I am trying to convert an ASP.NET Core app to VS 2017. Unfortunately, I'm unable to compile the site since I continually receive TypeScript errors. I'd rather VS not even touch my TypeScript since I'm using Webpack to do the actual building and bundling.
The site has an Angular 2 app in it, including some tests. Here's a sample error:
Error TS2665 Build:Invalid module name in augmentation. Module 'angular-mocks/ngMock' resolves to an untyped module at 'D:/myapp/source/MySite/node_modules/angular-mocks/ngMock.js', which cannot be augmented. MySite D:\myapp\source\MySite\node_modules\@types\angularjs\angular-mocks.d.ts 8
My app/tsconfig.json file looks like this:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"experimentalDecorators": false,
"sourceMap": false,
"module": "commonjs",
"moduleResolution": "node",
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
},
"exclude": [
"../node_modules",
"../wwwroot"
],
"compileOnSave": false
}
Is there a way to tell VS to completely ignore my TypeScript when building? I don't know why it is even looking at these files.
If you do not want VS 2017 to compile your Typescript for you, please see the following documentation from TypeScript Handbook on how to disable compilation in MSBuild.
TypeScriptCompileBlocked
If you are using a different build tool to build your project (e.g. gulp, grunt , etc.) and VS for the development and debugging experience, set
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
in your project. This should give you all the editing support, but not the build when you hit F5.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加