-
Notifications
You must be signed in to change notification settings - Fork 46
Question: How to get the types
array to load using System.js.
#170
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
Comments
If I use typescriptOptions: {
....
files: [ "vendor/node_modules/@types/node/index.d.ts" ],
....
} |
What does the rest of your |
@aluanhaddad this is what I have at the moment for my in-browser demos: (function( global ) {
System.config({
paths: {
"vendor/*": "../../vendor/angular2/2.1.1/*",
"~/*": "./app/*"
},
map: {
"@angular": "vendor/node_modules/@angular",
"plugin-typescript": "vendor/node_modules/plugin-typescript/lib/plugin.js",
"rxjs": "vendor/node_modules/rxjs",
"ts": "vendor/node_modules/plugin-typescript",
"typescript": "vendor/node_modules/typescript"
},
packages: {
"@angular/common": {
main: "bundles/common.umd.js",
meta: {
"bundles/common.umd.js": {
typings: "index.d.ts"
}
}
},
"@angular/compiler": {
main: "bundles/compiler.umd.js",
meta: {
"bundles/compiler.umd.js": {
typings: "index.d.ts"
}
}
},
"@angular/core": {
main: "bundles/core.umd.js",
meta: {
"bundles/core.umd.js": {
typings: "index.d.ts"
}
}
},
"@angular/forms": {
main: "bundles/forms.umd.js",
meta: {
"bundles/forms.umd.js": {
typings: "index.d.ts"
}
}
},
"@angular/http": {
main: "bundles/http.umd.js",
meta: {
"bundles/http.umd.js": {
typings: "index.d.ts"
}
}
},
"@angular/platform-browser": {
main: "bundles/platform-browser.umd.js",
meta: {
"bundles/platform-browser.umd.js": {
typings: "index.d.ts"
}
}
},
"@angular/platform-browser-dynamic": {
main: "bundles/platform-browser-dynamic.umd.js",
meta: {
"bundles/platform-browser-dynamic.umd.js": {
typings: "index.d.ts"
}
}
},
"@angular/router": {
main: "bundles/router.umd.js",
meta: {
"bundles/router.umd.js": {
typings: "index.d.ts"
}
}
},
"app": {
main: "main.ts",
defaultExtension: "ts",
meta: {
"*.ts": {
loader: "ts"
}
}
},
"vendor/node_modules": {
defaultExtension: "js"
},
"rxjs": {
meta: {
"*.js": {
typings: true
}
}
},
"ts": {
main: "lib/plugin.js"
},
"typescript": {
main: "lib/typescript.js",
meta: {
"lib/typescript.js": {
exports: "ts"
}
}
}
},
transpiler: "plugin-typescript",
transpiler: "ts",
typescriptOptions: {
emitDecoratorMetadata: true,
experimentalDecorators: true,
files: [ "vendor/node_modules/@types/node/index.d.ts" ],
module: "commonjs",
moduleResolution: "node",
noImplicitAny: true,
removeComments: false,
sourceMap: true,
suppressImplicitAnyIndexErrors: true,
target: "es5",
typeCheck: true
}
});
// Load "./app/main.ts" (gets full path from package configuration above).
global.bootstrapping = System
.import( "app" )
.then(
function handleResolve() {
console.info( "System.js successfully bootstrapped app." );
},
function handleReject( error ) {
console.warn( "System.js could not bootstrap the app." );
console.error( error );
return( Promise.reject( error ) );
}
)
;
})( window ); |
So I think the issue here is that plugin-typescript is treating the The reason for this is that tsc is able to automatically find and include typings from @aluanhaddad - does this sound correct to you with regard to the tsc handling of the There are a few ways to solve this
(1) is probably the easiest, but may mean that types are available in files which are not importing the module. (2) is a breaking change, but probably more correct. Probably I should implement (2) as a major change, although first I will find out what the impact of doing (1) will be. |
@frankwallis thanks for the insight. I "mostly" understand what you're saying. For the time being, I'll just stick with using the |
@frankwallis Yes, I believe your understanding of how For example if the I think it is an open question how this should behave, but my preference is for explicitness. This is one of the reasons I prefer jspm to npm.
I think this behavior is actually good but it does conflict with the behavior of |
type-checking is no longer supported in 7.0.0 so this is no longer an issue |
I am currently using the
plugin-typescript
to do in-browser compiling of an Angular 2 application, but I can't seem to get thetypes
to be loaded. Here are the typescript options I have in my system.js config:... notice the
types: [ "node" ]
. However, when I load the app, I do not see any network requests tonode_modules/@types/node
. Is there something that I have to do to tell the typescript plugin to actually load the types?Because it's not loading, my references to
moduleId: module.id
are throwing the error:Everything else is working, in so much as the
.ts
files are being loading and transpiled toes5
and my Angular 2 app loads. I just can't figure out how to get rid of that compiler error. Thanks!Also, my dependencies in
package.json
:The text was updated successfully, but these errors were encountered: