I am currently working on the following code snippet...
@Component({
module: module.id,
selector: 'hero',
templateUrl:'hero.component.html',
styleUrls: ['hero.component.css'],
directives: [HeroDetailComponent, MD_CARD_DIRECTIVES, MD_BUTTON_DIRECTIVES, MD_LIST_DIRECTIVES, MD_ICON_DIRECTIVES, MdToolbar, MD_INPUT_DIRECTIVES],
providers: [HeroService],
viewProviders: [MdIconRegistry]
})
export class HeroComponent implements OnInit{
...
}
//tsconfig.js
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"rootDir": "src/ng2",
"moduleResolution": "node",
"sourceMap": false,
"inlineSources": true,
"inlineSourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"outDir": "public/ng2",
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
However, upon running the code, I encounter the following error...
src/ng2/components/hero/hero.component.ts(15,13): error TS2304: Cannot find name 'module'.
UPDATE
In an attempt to resolve this issue, I followed the steps outlined in this question
"globalDependencies": {
"node": "registry:dt/node#6.0.0+20160608110640"
}
Despite these efforts, the error persists...
Object literal may only specify known properties, and 'module' does not exist in type
UPDATE 2 after making adjustments to the bootstrap file as shown below...
import {bootstrap} from '@angular/platform-browser-dynamic';
import {HeroComponent} from './components/hero/hero.component';
import { HTTP_PROVIDERS } from '@angular/http';
declare var module:any;
bootstrap(HeroComponent, [ HTTP_PROVIDERS ]);
The error message still remains...
src/ng2/components/hero/hero.component.ts(15,5): error TS2345: Argument of type '{ module: string; selector: string; template: string; styleUrls: string[]; directives: (typeof He...' is not assignable to parameter of type '{ selector?: string; inputs?: string[]; outputs?: string[]; properties?: string[]; events?: strin...'. Object literal may only specify known properties, and 'module' does not exist in type '{ selector?: string; inputs?: string[]; outputs?: string[]; properties?: string[]; events?: strin...'.
For further reference, you can access the full project here