Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript not working #2452

Closed
guybedford opened this issue Apr 28, 2019 · 5 comments
Closed

TypeScript not working #2452

guybedford opened this issue Apr 28, 2019 · 5 comments

Comments

@guybedford
Copy link
Member

jspm install -g typescript

when run gives the following errors:

error TS2318: Cannot find global type 'Array'.

error TS2318: Cannot find global type 'Boolean'.

error TS2318: Cannot find global type 'Function'.

error TS2318: Cannot find global type 'IArguments'.

error TS2318: Cannot find global type 'Number'.

error TS2318: Cannot find global type 'Object'.

error TS2318: Cannot find global type 'RegExp'.

error TS2318: Cannot find global type 'String'.


Found 8 errors.
@guybedford
Copy link
Member Author

guybedford commented Apr 28, 2019

@irustm sorry I misunderstood your comment previously, if you want to investigate this that would be amazing.

The first step would be to work out what TypeScript code path is trying to load the global types, and to see why that codepath isn't working in the jspm conversion.

This sounds like a typical conversion bug though, since it's likely a dynamic require scenario, where ideally we want to convert dynamic requires into dynamic imports for the conversion.

The hard part about that though is that it likely isn't an async function. This is also related to https://jspm.org/docs/integrations#one-weird-trick-to-support-jspm-in-tools.

The static analysis does support wildcards like require('./asdf/' + unknown) so this will likely be fixed by ensuring we can handle this wildcard case in the dew conversion statically as opposed to trying to treat it as a dynamic import (https://github.com/jspm/babel-plugin-transform-cjs-dew).

@irustm
Copy link
Contributor

irustm commented May 19, 2019

omg,

> jspm install -g typescript

err  TypeError: Cannot read property 'warn' of undefined
    at Project.checkGlobalBin (/Users/irustm/.nvm/versions/node/v11.14.0/lib/node_modules/jspm/lib/project.js:138:22)

@guybedford
Copy link
Member Author

Woah, thanks. Fixed in dbf8fde.

@guybedford
Copy link
Member Author

I also went ahead and fixed the support for TypeScript in cdf7144. So jspm install -g typescript && tsc now works!

@guybedford
Copy link
Member Author

Released in 2.0.0-beta.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants