Info about system & node version
OpenSUSE Leap 42.1
angular-cli: 1.0.0-beta.1
node: 5.11.0
os: linux x64
Steps taken to produce error
ng new test-app
cd test-app
gvim
ng serve
Error is via typescript when I'm editing the file app/test-app.component.ts
I can get rid of the error by including
/// <reference path="../typings.d.ts" />
at the top of the file.
Using vim with https://github.com/leafgarland/typescript-vim and https://github.com/Valloric/YouCompleteMe
I can confirm this also is happening on windows in vim -- seems like a specific error to my setup.
I've seen live coding on last ng-conf where VSCode couldn't recognize the module
variable too.
module
is defined you can see that here
This is probably related to issue #684 you can track the progress there, closing this issue now in favor of the other.
try the following tsconfig filesGlob property :
"filesGlob": [
"main.ts",
"typings.d.ts",
"app/**/*.ts",
"!app/**/*.spec.ts"
],
for atom-typescript :
"files": [
"main.ts",
"typings.d.ts"
],
for ng build :
"filesGlob": [
"main.ts",
"typings.d.ts"
]
I put them together.
"files": [
"main.ts",
"typings.d.ts"
],
"filesGlob": [
"main.ts",
"typings.d.ts",
"app/**/*.ts"
]
That works for me.
@zetalei I followed your above example, but my atom-typescript still chokes on
moduleId: module.id
I have types installed via npm
I found that if I add a reference to my top-level .ts file it works
/// <reference path="../../node_modules/@types/node/index.d.ts" />
I've tortured myself over this for hours now. All the suggested fixes suggest typeRoots, but I figured that all these fancy tools were smart enough to find the correct directory for "@types". Does not turn out to be the case.
For those of you having this issue, make sure to include
"typeRoots": [
"../node_modules/@types/"
]
in your tsconfig.app.json file.
With a brand new project I created today, I had to remove "types": []
from src/tsconfig.app.json
to fix this.
Brand new project created today June 18th and @AnimaMundi's solution was still necessary for me
Spun up a new CLI project and had to remove "types":[] from both tsconfig.app.json and tsconfig.server.json after enabling hmr.
Update December 2018, this tsconfig.app.json
works:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": ["node"]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
With a brand new project I created today, I had to remove
"types": []
fromsrc/tsconfig.app.json
to fix this.