yunabe / tslab

Interactive JavaScript and TypeScript programming with Jupyter
Apache License 2.0
702 stars 44 forks source link

Missing built-in Javascript objects #42

Closed ThibTrip closed 1 year ago

ThibTrip commented 4 years ago

Hello,

this code works on Binder but not in my local Jupyter Lab (under Windows 10) with a TypeScript kernel:

let person = new Object();

I receive this error:

Cannot find name 'Object'.

Other objects like the functions parseInt, parseFloat etc. are also not available. Did you configure something to have this available in Binder? If so, maybe you could consider documenting it 😊 ? Thanks in advance!

bagley2014 commented 4 years ago

I wonder if this is the same issue brought up in #25 and/or #38.

I got the error Cannot find name 'Math'. in my local Jupyter notebook and after reading #25 I'm wondering if perhaps the issue is that I don't have Typescript installed or something.

I tried to run process.version and that failed so I ran npm i -g @types/node but that didn't fix it.

MrYutz commented 3 years ago

process.version = v14.15.3 let person = new Object() -> works Date() -> works

This doesn't work - but I think it is browser only? fetch() -> Cannot find name 'fetch'.

yunabe commented 1 year ago

Object

I added a unit test to check if Object is available and confirmed it passes with CI: link. Please let me know if it still does not work.

fetch

It should be available since I upgraded @types/node above v18: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

Thevetat commented 1 year ago

I am unable to use fetch, getting a cannot find name 'fetch'

Hello, tslab! Versions: { tslab: '1.0.21', typescript: '5.0.4', node: 'v18.15.0' }

Tried a few different methods, what is the preferred working way?