Open elpddev opened 8 years ago
@elpddev Is it ok, when you're trying to compile project with tsc
?
Did someone ever solve this? It is really so annoying, especially for Promise
s.
What does your tsconfig.json look like?
@nickspoons Sure, thanks for the quick response. Here you go:
$ cat tsconfig.json
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react",
"pretty": true,
"noUnusedParameters": true,
"experimentalDecorators": true,
"noUnusedLocals": true,
"lib": ["dom", "es2017"]
},
"include": [
"src/**/*.ts?",
"config.ts",
"typings/*"
]
}
It compiles fine btw.
Here are some of the dependencies I use which might be relevant:
$ cat package.json| grep type
"lint:src": "tslint --format stylish --type-check --project tsconfig.json",
"type": "git",
"typescript",
"@types/bytes": "^2.4.33",
"@types/gravatar": "^1.4.28",
"@types/history": "^4.5.0",
"@types/http-status-codes": "^1.0.29",
"@types/lowlight": "0.0.0",
"@types/material-ui": "^0.16.44",
"@types/node": "^7.0.5",
"@types/ramda": "^0.0.3",
"@types/random-seed": "^0.3.1",
"@types/react": "^15.0.11",
"@types/react-dom": "^0.14.19",
"@types/react-intl": "^2.2.0",
"@types/react-redux": "^4.4.35",
"@types/react-router": "^3.0.4",
"@types/react-syntax-highlighter": "0.0.1",
"@types/react-tap-event-plugin": "0.0.30",
"@types/reselect": "^2.0.27",
"@types/uuid": "^2.0.29",
"@types/whatwg-fetch": "0.0.33",
"array.prototype.find": "^2.0.1",
"@types/enzyme": "^2.5.39",
"@types/fetch-mock": "^5.8.1",
"@types/jest": "^20.0.4",
"@types/jquery": "=2.0.45",
"@types/jsdom": "=2.0.30",
"@types/redux-mock-store": "0.0.7",
"@types/sinon": "^1.16.34",
"awesome-typescript-loader": "=3.0.8",
"typescript": "=2.2.0",
What happens if you remove your "include" section from tsconfig.json, and add an "exclude" instead:
"exclude": [ "**/node_modules/*" ]
That helped. But why? After changing back to using include
I can no longer reproduce it. Weird.
I have a similar case for which I asked a question on stackexchange. I have the messages Cannot find name 'JQuery' and Cannot find name 'crossfilter'* respectively. What does this message mean exactly? How does syntactic index keywords?
My package.json and tsconfig.json files are respectively:
{
"compilerOptions": {
"target": "es5",
"sourceMap": false,
"outDir": "./built",
"rootDir": "src"
},
"include": [
"**/*"
],
"exclude": [
"node_modules"
],
"compileOnSave": true
}
and
{
"name": "Foo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/crossfilter": "0.0.30",
"@types/d3": "^4.7.0",
"@types/dc": "0.0.23",
"@types/jquery": "^2.0.41"
},
"dependencies": {
"@types/dc": "0.0.23",
"@types/jquery": "^2.0.41"
}
}
You should try install the types needed for your project by yarn install
or npm install
and tsserver should resolve the dependencies.
I get this error with angular cli latest project on every ts file.
Versions:
Is there some configuration I'm missing ? On other editors like Atom it is not an issue.