Visual Studio Code cannot scan for type definition
imben1109 opened this issue · comments
I am using visual studio for TypeScript Application Development. Recently, I try to study Phaser.
I just install the phaser by yarn.
yarn add phaser-ce
I can find the folder phaser-ce in the folder of node_modules and the typescript folder in phaser-ce. However, I found that Visual Studio Code cannot scan the Type Definition. It throw errors when I tried to write a small Phaser Application.
How does it looks with Atom ?
The same
You might have to add a tsconfig file to your project.
Added . The below is my tsconfig
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"outDir": "target",
"jsx": "react",
"moduleResolution": "node",
"allowJs": true
},
"include": [
"src/**/*"
]
}
@samme. Thanks. But it still throws the below exception
[ts] Module '"phaser-ce"' has no exported member 'Phaser'.
import { Phaser } from 'phaser-ce';
export default class Test{
test: Phaser.Game;
}
Changed tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"outDir": "target",
"jsx": "react",
"moduleResolution": "node",
"allowJs": true
},
"files": [
"./node_modules/phaser-ce/typescript/phaser.d.ts"
],
"include": [
"src/**/*"
]
}
Try removing
import { Phaser } from 'phaser-ce';
Or import Phaser from 'phaser-ce';