-
Notifications
You must be signed in to change notification settings - Fork 47
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
"Cannot find type definition file" using @types type definitions #145
Comments
Thanks for raising this, it is not implemented yet, I need to read up on this feature and figure out how it will work in plugin-typescript. |
I use typescript@beta and works tsconfig.json {
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": false,
"inlineSourceMap": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"types": [ "core-js", "jasmine" ]
},
"exclude": [
"node_modules"
]
} systemjs.config.js typescriptOptions: {
tsconfig: true,
types: []
} @frankwallis @types/ replace typings config,no more typings.json or typings install |
What version of the plugin and JSPM are you using? And where did you install the types; under jspm_packages or node_modules? |
"systemjs": "0.19.32" all installed in node_modules, not using jspm packages |
Interesting. I'm on systemjs@0.19.31, but that doesn't seem likely to be the issue. Latest version of the plugin though. Any chance you could update the plugin to verify if it still works at latest? If so, the only difference I see is that I'm using JSPM. @guybedford, do you have any insight as to why this might not work using JSPM? |
@fchiumeo Are you sure it is working? I think your types: [] is overriding the first one and nullifying the load of the type declarations. @frankwallis I took a look into this and the blocking point is that the compiler host in plugin-typescript doesn't provide the files that Typescript is looking for. Installing to jspm_packages does not seem possible because Typescript search for things like jspm_packages/@types/package_name without the added @version_number. When using node_modules the problem is that Typescript starts looking for http://localhost:xxx/node_modules/angular/package.json and index.d.ts in the Host files but on the first transpile call the host files only contain the main file. I wonder if the plugin could do a scan of all files under typeRoots, similar to what Typescript does in: I would love to help out with this but my knowledge is so far a couple of hours of debugging and reading the source code so I don't know what's the best way to address it. |
@dballesteros7 is right, it can't work with current implementation of plugin-typescript. At least it shouldn't.... Actually, most of the time, in tsc one does not need to provide explicit Looks like ts expose speciall method I'm not really familiar with typescript API, but that is what I found looking around. Also I've found few existing bugs related to type resolution, e.g: For more details see microsoft/TypeScript#9184 |
I have implemented some basic support for the Let me know if you find any issues, thanks |
This seems to look for the typings in the wrong place:
Note that |
I think this is caused by jspm@0.16 and the defaultJsExtensions behaviour. I am not able to recreate in the react example project using jspm@0.17-beta. I have added a patch in 5.0.19 which I hope will fix this. |
Using typescript@beta. My tsconfig.json has
"types": ["jquery"]
and I have installed @types/jquery under both node_modules and jspm_packages (as part of my debugging effort). When I build my project I get the following error:"Cannot find type definition file for 'jquery'. (TS2688)"
I have tried other packages as well, but none are found.
The text was updated successfully, but these errors were encountered: