DonJayamanne / typescript-notebook

Run JavaScript and TypeScript in node.js within VS Code notebooks with excellent support for debugging, tensorflowjs visulizations, plotly, danfojs, etc
https://marketplace.visualstudio.com/items?itemName=donjayamanne.typescript-notebook
MIT License
905 stars 40 forks source link

Type inference issues #9

Closed luchsamapparat closed 3 years ago

luchsamapparat commented 3 years ago

I ran into some weird type inference issues when using this extension:

image

VS Code infers the type correctly as number, not unknown or 1 as the error suggests:

image

The code itself compiles correctly when running it through the TS compiler directly. So at first, I thought that this may be an tslab issue. However, when executing the same script it in Jupyter, it runs without issues:

image

Any idea what might cause this? 🤔

luchsamapparat commented 3 years ago

Nevermind... the error now also appears in Jupyter. Maybe I accidentally ran the code with the JS kernel 😞