TypeScript error in Angular2 code: Cannot find name 'module'

前端 未结 11 1420
梦毁少年i
梦毁少年i 2020-11-30 03:13

I have defined the following Angular2 component:

import {Component} from \'angular2/core\';

@Component({
  selector: \'my-app\',
  moduleId: module.id,
  te         


        
11条回答
  •  北海茫月
    2020-11-30 03:30

    For me, I had a tsconfig.app.json that extended tsconfig.json. So when I added "types": ["node"] in tsconfig.json, it was being overridden by the "types" property in tsconfig.app.json. Adding "node" to the existing "types" property in tsconfig.app.config fixed it.

提交回复
热议问题