bitmovin-player-ui icon indicating copy to clipboard operation
bitmovin-player-ui copied to clipboard

TypeScript error

Open swaechterAS opened this issue 5 years ago • 6 comments

while running gulp i get a:

Error: TypeScript error: src/ts/components/tvnoisecanvas.ts(100,7): Error TS2322: Type 'Timeout' is not assignable to type 'number'.

VS code mark this line as well and says: [ts] Type 'Timeout' is not assignable to type 'number'. [2322] (property) TvNoiseCanvas.frameUpdateHandlerId: number

swaechterAS avatar May 29 '19 14:05 swaechterAS

On which branch does this happen?

Can you check the installed typescript version with npx tsc --version

stonko1994 avatar May 29 '19 14:05 stonko1994

This error usually happens in a Node environment (Node uses type Timeout while in browsers it is a number). Do you import the UI into such an environment?

This is usually fixed by setting the type to any (or maybe unknown in newer TS versions), and we might have to do that. It does not matter which type this is anyway because we never use the value directly.

protyposis avatar May 29 '19 15:05 protyposis

Typescript version is: Version 1.5.3

For now we use the assets included in the players package.

swaechterAS avatar May 31 '19 10:05 swaechterAS

Typescript version is: Version 1.5.3

Are you absolutely sure? The UI is on TS 3 and I am pretty sure it would not compile with TS 1.5 or be compatible with type definitions generated by v3.

For now we use the assets included in the players package.

What you you mean with "assets"?

protyposis avatar May 31 '19 10:05 protyposis

I am also having this issue. My tsc version is 3.6.3. I got past the issue by using your suggestion @protyposis. Since this is still in the master branch and still and issue and not getting more complaints I'm assuming I'm still doing something wrong. Is there a specific node version that I should be using?

beersbr avatar Sep 19 '19 00:09 beersbr

As mentioned by @protyposis, I changed private frameUpdateHandlerId: number; to private frameUpdateHandlerId: any; in tvnoisecanvas.ts, which resolved this issue. Note that I have the repo within my main application's repo – guessing that's the cause somehow, because if I clone the repo outside of my app repo and build, it works fine out of the box.

alexpcoleman avatar Dec 10 '19 23:12 alexpcoleman