Skip to content

Duplicate identifier error for d.ts files in Visual Studio 2017 #14565

Closed
@odrozd

Description

@odrozd

TypeScript Language Version: 2.2
Visual Studio Typescript tooling Version 2.1.5

I am having trouble with typescript errors like TS2300: duplicate identifier 'export=' and TS2374: Duplicate string index signature. This errors appear in error window, but projects builds successful. This errors appear only with VS2017.

Env Details:

  1. Type definitions are installed via nuget to default folder: project root/scripts/typings/

  2. For build I use nuget package Microsoft.TypeScript.MSBuild" version="2.2.1

  3. tsconfig is NOT used**, instead here are setting from csproj:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
    <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
    <TypeScriptModuleKind>AMD</TypeScriptModuleKind>
    <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
    <TypeScriptOutFile>
    </TypeScriptOutFile>
    <TypeScriptOutDir />
    <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
    <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
    <TypeScriptSourceMap>True</TypeScriptSourceMap>
    <TypeScriptMapRoot />
    <TypeScriptSourceRoot />
    <TypeScriptStrictNullChecks>false</TypeScriptStrictNullChecks>
    <TypeScriptNoFallthroughCasesInSwitch>true</TypeScriptNoFallthroughCasesInSwitch>
    <TypeScriptLib>dom,es5,es2015.promise</TypeScriptLib>
  </PropertyGroup>

I assume I see this errors because VS2017 somehow downloaded @types to this folder: ~\AppData\Local\Microsoft\TypeScript\node_modules@types\ and there is conflict between this types definitions and those types installed via nuget, if this is the cause I am not sure how disable this feature in VS2017 and honor only nuget installed d.ts?

I would appreciate any help to this issue.

Here is screenshot:
vs2017_typescript_error

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions