snapweb icon indicating copy to clipboard operation
snapweb copied to clipboard

'Property outputLatency does not exist' - when compiling with TypeScript 4.4+

Open Saiyato opened this issue 2 years ago • 0 comments

When compiling (doesn't really seem to matter which version of NodeJS/NPM) against the latest version of TypeScript I'm getting the below error:

/ # make -C snapweb/
make: Entering directory '/snapweb'
tsc --build page/tsconfig.json
page/snapstream.ts:912:112 - error TS2339: Property 'outputLatency' does not exist on type 'AudioContext'.

912                     this.latency = (this.ctx.baseLatency !== undefined ? this.ctx.baseLatency : 0) + (this.ctx.outputLatency !== undefined ? this.ctx.outputLatency : 0)
                                                                                                                   ~~~~~~~~~~~~~

page/snapstream.ts:912:151 - error TS2339: Property 'outputLatency' does not exist on type 'AudioContext'.

912                     this.latency = (this.ctx.baseLatency !== undefined ? this.ctx.baseLatency : 0) + (this.ctx.outputLatency !== undefined ? this.ctx.outputLatency : 0)
                                                                                                                                                          ~~~~~~~~~~~~~

page/snapstream.ts:913:107 - error TS2339: Property 'outputLatency' does not exist on type 'AudioContext'.

913                     console.log("Base latency: " + this.ctx.baseLatency + ", output latency: " + this.ctx.outputLatency + ", latency: " + this.latency);
                                                                                                              ~~~~~~~~~~~~~


Found 3 errors.

make: *** [Makefile:6: tsc] Error 1
make: Leaving directory '/snapweb'

I can solve this by using TypeScript 4.3 or lower, instead of latest.

Not sure if it's something that can be fixed in code (or references), since I'm not familiar with TS (or C++ for that matter :wink:) In any case, I hope this helps people trying to compile with containers (Docker).

Saiyato avatar Oct 02 '21 14:10 Saiyato