Skip to content

<reference types="" /> is not emitted when dependency is in a namespace #15487

@azz

Description

@azz

TypeScript Version: 2.3.2

Code

// deps/dep/dep.d.ts
declare namespace NS {
    interface Dep {
    }
}
// deps/dep/package.json
{
  "typings": "dep.d.ts"
}

// src/index.ts
class Src implements NS.Dep {}

Compile with

// src/tsconfig.json
{
    "compilerOptions": {
        "declaration": true,
        "types": [
            "dep"
        ],
        "typeRoots": [
            "../deps"
        ]
    }
}

Expected behavior:

// src/index.d.ts
/// <reference types="dep" />
declare class Src implements NS.Dep {
}

Actual behavior:

// index.d.ts
declare class Src implements NS.Dep {
}

If the namespace is removed from dep.d.ts (with an interface at the top-level), the <reference> is (correctly) emitted.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions