2

I'm trying to build my Angular 2 TypeScript asp.net core project in Visual Studio 2015, but what I see is:

Severity Code Description Project File Line Suppression State Error TS1005 Build:'(' expected. MExplore C:\Users\Piotrek\documents\visual studio 2015\Projects\MProjects\MExplore\wwwroot\lib\@angular\core\esm\src\linker\query_list.d.ts 36
Error TS1005 Build:'(' expected. MExplore C:\Users\Piotrek\documents\visual studio 2015\Projects\MProjects\MExplore\wwwroot\lib\@angular\compiler\esm\src\output\output_interpreter.d.ts 7
Error TS1005 Build:'(' expected. MExplore C:\Users\Piotrek\documents\visual studio 2015\Projects\MProjects\MExplore\wwwroot\lib\@angular\compiler\esm\src\output\output_interpreter.d.ts 8
Error TS1005 Build:'(' expected. MExplore C:\Users\Piotrek\documents\visual studio 2015\Projects\MProjects\MExplore\wwwroot\lib\@angular\compiler\esm\src\output\output_interpreter.d.ts 9
Error TS1005 Build:'(' expected. MExplore C:\Users\Piotrek\documents\visual studio 2015\Projects\MProjects\MExplore\wwwroot\lib\@angular\common\esm\src\forms-deprecated\model.d.ts 53
Error TS1005 Build:'(' expected. MExplore C:\Users\Piotrek\documents\visual studio 2015\Projects\MProjects\MExplore\wwwroot\lib\@angular\common\esm\src\forms-deprecated\model.d.ts 98
Error TS1005 Build:'(' expected. MExplore C:\Users\Piotrek\documents\visual studio 2015\Projects\MProjects\MExplore\wwwroot\lib\@angular\common\esm\src\forms-deprecated\model.d.ts 52

and so on...

So, the basic pattern of what those 3743 errors look like is:

Build: '[something]' expected.

And files that problem happens always end with *.d.ts.

I thought that it was a problem with typings, but I have proper reference in my bootstraper (main.ts file)

///<reference path="./../../typings/globals/core-js/index.d.ts"/>

and those references inside:

/// <reference path="globals/core-js/index.d.ts" />
/// <reference path="globals/jasmine/index.d.ts" />
/// <reference path="globals/node/index.d.ts" />

I used it many times before and it worked...

I also use gulp ('gulp-typescript') to compile typescript to javascript and copy it to other place. It works well and no errors are shown. So maybe there are no problems with my code itself, but rather I configured something incorrectly in Visual Studio?

What do you think?

2 Answers 2

2

According to this GitHub issue, *.d.ts files should be excluded from compilation. So, basically, that's what you should do in tsconfig.json file:

{
  [...]
  [some stuff]
  [...]
  "exclude": [
    "folder_where_you_have_those_faulty_files"
  ]
}

Comment 1:

you should exclude some folders from tsc building to *avoid *to compile .d.ts files.

Comment 2:

the key point is not compiling *.d.ts no matter which typescript version you use. in your project, you should exclude all of the *.d.ts compilation to get rid of this issue.

Thank you, @danny8002!

Sign up to request clarification or add additional context in comments.

2 Comments

but tsconfig is mutually exclusive with CSProj, how do we exclude those files in a csproj!
I already have the node_modules folder inside the exclude array. But it includes it anyways.
1

I was getting this error TS110 Build Typescript expected core.d.ts only when building Visual Studio. When Visual Studio builds it uses the tsc -w. This causes it to build all files *.ts under the directory and it doesn't distinguish between *.d.ts and *.ts, so will try to compile them. The *.d.ts files are type define files and can not be compiled. So you have to just tell ts to ignore node_modules folder.

You do this by adding the following "exclude" : [ "node_modules","typings"] to the tsconfig.json. You should always ignore these two folders.

{
    "compilerOptions": {
        "module": "system",
        "noImplicitAny": true,
        "removeComments": true,
        "preserveConstEnums": true,
        "outFile": "../../built/local/tsc.js",
        "sourceMap": true
    },
    "include": [
        "src/**/*"
    ],
    "exclude": [
        "node_modules","typings"
      ]
}

1 Comment

this doesnt seem to have any effect. The error keeps occuring!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.