tslab icon indicating copy to clipboard operation
tslab copied to clipboard

Any way to set tsconfig.json or other properties?

Open yatharth opened this issue 4 years ago • 4 comments

Steps to reproduce

  1. Start Jupyter Lab in /Users/yatharth/projectDir/
  2. Inside Jupyter Lab, create Typescript or Javascript notebook inside ``/Users/yatharth/projectDir/otherFolder`
  3. Inside notebook, try to do import myFile as '../myFolder/myFile'

Expected Result

The import works.

Actual Result

There’s an error.

3:33 - File '/Users/yatharth/projectDir/myFolder/myFile.ts' is not under 'rootDir' '/Users/yatharth/projectDir/myFolder'

Implications

Can you really not import modules outside the current notebook’s directory? This seems surprising.

Potential solutions

It seems like the rootDir Typescript uses is set to the notebook’s directory. Maybe it would be better set to the initial directory that Jupyter Lab was started in or is serving from.

yatharth avatar Dec 27 '21 08:12 yatharth

yo @yatharth have you had some workaround for this issue? apparently @yunabe will not work anymore in this repo.

wei3erHase avatar Jan 22 '22 18:01 wei3erHase

yo @yatharth have you had some workaround for this issue?

No, I just start tslab in a higher director to avoid this.

apparently @yunabe will not work anymore in this repo.

Really? Where did they say that?

yatharth avatar Jan 23 '22 06:01 yatharth

@yatharth i've found a cleaner workaround.

let's say you want to import from ./myFolder and you get the error you showed then you can do:

cd node_modules
ln -s ../myFolder @myFolder

and later import from @myFolder (as it were a node package)

the script above will create a system link inside your node_modules folder

i've made lot's of tests with the tsconfig.json and tslab is apparently wholly ignoring it

wei3erHase avatar Jan 25 '22 20:01 wei3erHase