low*_*ler 8 typescript tsconfig atom-editor
使用带有打字稿插件的Atom编辑器我收到以下错误:
错误文件"D:/foo/app/classes/event.class.ts"未包含在TypeScript编译上下文中.如果不是这样,请检查tsconfig.json file.at第1行col 1的"files"或"filesGlob"部分.
我的tsconfig.json文件的内容是:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
Run Code Online (Sandbox Code Playgroud)
我看过其他一些有这个问题的人.这个:https://github.com/lathonez/clicker/issues/4让我尝试在tsconfig.json数组中构建一个"files"数组.这与其他线程中的人非常相似,没有帮助.请注意,该线程谈了很多关于测试...这不适用于我.
我也尝试通过这个线程解析:https://github.com/TypeStrong/atom-typescript/issues/558然而,这基本上最终成为关于纯度与实用主义的争论.我确实认为如果缺少files和filesGlob数组,则会使用隐式的"everything"glob.如果是这种情况,为什么我得到错误,因为我没有文件和filesGlob条目.
顺便说一句,命令行TSC正在生成已编译的js和映射文件....但我仍然需要看到Atom中的大红色错误.
对于它的价值,event.class.ts文件看起来像这样(我不认为这是问题的根源,但我想包括它是为了完整性):
import {Utilities} from '../utilities';
export class Event {
eventData:JSON;
eventID:string;
constructor(_eventData:JSON, _eventID?:string) {
if(_eventID==null) {
_eventID=Utilities.newGuidPlus();
}
this.eventID = _eventID;
this.eventData = _eventData;
}
getEventData():JSON { // returns the full event
return this.eventData;
}
getEventID():string {
return this.eventID;
}
}
Run Code Online (Sandbox Code Playgroud)
对于我来说,准确的问题,我包括"**/*.ts"在"filesGlob"物业tsconfig.json来解决.整个tsconfig.json看起来像这样.
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "/",
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../dist/",
"rootDir": ".",
"sourceMap": true,
"target": "es5",
"inlineSources": true
},
"filesGlob": [
"**/*.ts"
],
"atom": {
"rewriteTsconfig": false
}
}
Run Code Online (Sandbox Code Playgroud)
就我而言,解决方案是不同的:
如果此bug出现其他问题,我会更新.
| 归档时间: |
|
| 查看次数: |
2915 次 |
| 最近记录: |