Typescript errors on initial build, fine on rebuild after editing `.ts` file

I just checked out an older Ionic v3 project (Ionic Framework : ionic-angular 3.5.3, @ionic/app-scripts : 3.2.0) and noticed something strange:

The first build via ionic serve failed with error messages like this:

λ ionic serve                                                                                                                                         
> ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser                                   
[app-scripts] [19:02:47]  ionic-app-scripts 3.2.0                                                                                                     
[app-scripts] [19:02:47]  watch started ...                                                                                                           
[app-scripts] [19:02:47]  build dev started ...                                                                                                       
[app-scripts] [19:02:47]  clean started ...                                                                                                           
[app-scripts] [19:02:47]  clean finished in 20 ms                                                                                                     
[app-scripts] [19:02:47]  copy started ...                                                                                                            
[app-scripts] [19:02:48]  deeplinks started ...                                                                                                       
[app-scripts] [19:02:48]  deeplinks finished in 383 ms                                                                                                
[app-scripts] [19:02:48]  transpile started ...                                                                                                       
[app-scripts] [19:03:02]  typescript: E:/Projects/.../src/pages/analysis/analysis.ts, line: 85                                  
[app-scripts]             Property 'padStart' does not exist on type 'string'.                                                                        
[app-scripts]       L84:  let _month = getMonth(day.datetime);                                                                                        
[app-scripts] [19:03:02]  typescript: E:/Projects/.../src/pages/analysis/analysis.ts, line: 132                                 
[app-scripts] [19:03:02]  typescript: E:/Projects/.../src/pages/analysis/analysis.ts, line: 133                                 
[app-scripts]       L85:  let month = (_month+1).toString().padStart(2, "0");                                                                         
[app-scripts]       L86:  let year_month = year + '-' + month ;                                                                                       
[app-scripts]             Property 'values' does not exist on type 'ObjectConstructor'.                                                               
[app-scripts]      L131:  // Graphs                                                                                                                   
[app-scripts]      L132:  this.barChart = this._createChart(this.barCanvas, 'bar', Object.keys(years), Object.values(years));                         
[app-scripts]      L133:  this.barCharta = this._createChart(this.barCanvasa, 'bar', Object.keys(anbieter_years), Object.values(anbieter_years));     
[app-scripts]             Property 'values' does not exist on type 'ObjectConstructor'.                                                               
[app-scripts]      L132:  this.barChart = this._createChart(this.barCanvas, 'bar', Object.keys(years), Object.values(years));                         
[app-scripts]      L133:  ta = this._createChart(this.barCanvasa, 'bar', Object.keys(anbieter_years), Object.values(anbieter_years));                 
[app-scripts]      L134:  this.barChart2 = this._createChart(this.barCanvas2, 'bar', Object.keys(year_months), Object.values(year_months));           
[app-scripts]             Property 'values' does not exist on type 'ObjectConstructor'.                                                               
[app-scripts]      L133:      this.barCharta = this._createChart(this.barCanvasa, 'bar', Object.keys(anbieter_years), Object.values(anbieter_years)); 
[app-scripts]      L134:  arChart2 = this._createChart(this.barCanvas2, 'bar', Object.keys(year_months), Object.values(year_months));                 
[app-scripts] [19:03:02]  typescript: E:/Projects/.../src/pages/analysis/analysis.ts, line: 134                                 
[app-scripts] [19:03:02]  typescript: E:/Projects/.../src/pages/analysis/analysis.ts, line: 167                                 
[app-scripts]             Property 'xAxes' does not exist on type '{ yAxes: { ticks: { beginAtZero: boolean; }; }[]; }'.                              
[app-scripts]      L166:  config.type = 'line';                                                                                                       
[app-scripts]      L167:  config.options.scales.xAxes = [{                                                                                            
[app-scripts]      L168:    type: 'time',   

[INFO] Development server running!

       Local: http://localhost:8100
       External: http://192.168.178.34:8100
       DevApp: stromzaehler@8100 on Lenovo-X1

       Use Ctrl+C to quit this process

[INFO] Browser window opened to http://localhost:8100!

[app-scripts] [19:03:02]  copy finished in 14.57 s
[app-scripts] [19:03:02]  watch ready in 14.84 s                                                                                                         

The app opened in the browser, but only showed a nicer view of the same error mesage.

But after I edited a .ts file of the project (just added a few spaces, no real changes), this happened:

[app-scripts] [19:07:31]  copy update started ...
[app-scripts] [19:07:31]  copy update finished in 129 ms
[app-scripts] [19:07:46]  build started ...
[app-scripts] [19:07:46]  deeplinks update started ...
[app-scripts] [19:07:46]  deeplinks update finished in 242 ms
[app-scripts] [19:07:46]  transpile update started ...
[app-scripts] [19:07:46]  transpile update finished in 149 ms
[app-scripts] [19:07:46]  webpack started ...
[app-scripts] [19:08:09]  webpack finished in 22.43 s
[app-scripts] [19:08:09]  sass started ...
[app-scripts] [19:08:16]  sass finished in 6.94 s
[app-scripts] [19:08:16]  build finished in 29.90 s

And now the app works perfectly fine!

Any idea what is going on here and how I can fix this?

Hey, everything ok?
I have a similar error when using ‘Object.values’ in a ionic app v3. Any solution for that?

Hello @Audrey84, welcome back!
Hi @SenhorVerne02 welcome to the community!
I think the error is related to the analysis.ts file.
It seems me the code needed a date to start, and after the browser reload it the date time was updated automatically. So, it’s why you didn’t get any error anymore.
Try to check the sequence of the lifecycle of this code.
Also check for empty not initialized variables.
Hope it may helps.

I don’t think your issue is related to OP’s. Somebody else can come along and delineate exactly which versions of what engines and ESwhatever standards do and don’t support Object.values and how reliable they are, but I don’t have the time or inclination to bother about JavaScript language lawyering. I just do my best to avoid all the heaps of flaming garbage in the JS ecosystem, and in my book, Object.values is definitely one of those. I would suggest just pretending it doesn’t exist.