winnekes / itypescript

ITypescript is a typescript kernel for the Jupyter notebook (A modified version of IJavascript)
Other
190 stars 29 forks source link

Dysfunctional #6

Open claudeduguay opened 6 years ago

claudeduguay commented 6 years ago

A simple test installing on Anaconda causes virtually every example to fail. It's not sufficient to simply copy files and rename a few things:

1) $TS command don't work 2) imports/modules don't appear to work 3) Writing a class works but only so long as it doesn't inherit from another class 4) Syntax highlighting appears broken 5) TypeScript 2.8 (which is what the Kernel is targeting) has numerous features that are apparently ignored.

This project seems questionable to me and really just a clone with little effort invested in a properly working implementation.

bgnkim commented 5 years ago

I'm very sorry for late responding. Since I'm not currently using typescript, I did not know that the issues had aroused before checking this repository. Thus, I think it is better to gather more people to maintain it or to transfer this project to other people.

Before discussing such things, I made an upgrade. (v.0.3.2)

  1. $TS now work.
  2. imports/modules now work correctly, if you have tsconfig.json at the project's root directory (regardless of your working directory)
  3. Now, typescript engine will compile inherited classes.
  4. Syntax highlighting now work.
  5. Updated reference to Typescript 3.3.3333.

Anyway, sorry for the inconvenience caused by the lazy update.

zya commented 5 years ago

@nearbydelta import statements do not seem to be working still. Not sure what the issue is. To replicate. Create ./test.ts in the same directory as your notebook.

export const test = 'test'

and in your notebook, if you try and import * as test from './test'; and then log outtest.test. You'll get an error sayingCan not find module './test'`.

bgnkim commented 5 years ago

@zya Could you paste your tsconfig.json file? And it'll be helpful to know which version of typescript & iTypescript that you're using currently.

zya commented 5 years ago
{
  "compilerOptions": {
    "target": "es2017",
    "module": "commonjs",
    "sourceMap": false,
    "moduleResolution": "node",
    "allowJs": false,
    "lib": [
      "es2017",
      "dom",
      "esnext.asynciterable"
    ],
    "noUnusedLocals": false,
    "esModuleInterop": true
  }
}
zya commented 5 years ago

itypescript version 0.3.5 tsc version 3.4.3

bgnkim commented 5 years ago

@zya I separated your issue since it posed another problem. And, the module fs is correctly loaded under specifying types option in the compilerOptions when I attempted to replicate the issue, as follow:

"compilerOptions":{
    "types": ["node"],
...

Without specifying the types option, its will throw errors since typescript compiler cannot check syntax/semantics of unknown fs module.

zya commented 5 years ago

@nearbydelta I'll give that a go, but I think this issue must be related to the working directory. In a normal TS project, if you have a local install of @types/node, you do not need to specify the types in compilerOptions. So this leads me to think that when compiling, its does not respect the locally installed packages. In the case of fs this is solvable by adding node to types in compilerOptions but if you have a installed package with types, I think it will not be picked up.