Skip to content

.d.ts generation error behaviour #31280

Closed
@shrinktofit

Description

@shrinktofit

TypeScript Version: 3.4.2

Search Terms:
.d.ts; import path

Suppose I have following project structure:

image

The codes are emplaced at https://github.com/shrinktofit/ts-issue .

The generated .d.ts will be:

declare module "nested/shared" {
    export class B {
    }
}
declare module "nested/base" {
    import { B } from "nested/shared";
    export function f(): B;
}
declare module "nested/derived" {
    export function g(): import("nested").B; // LINE 10
}
declare module "nested/index" {
    export * from "nested/base";
    export * from "nested/derived";
    export * from "nested/shared";
}
declare module "index" {
    export * from "nested/index";
}

In line 10, the import("nested").B is an error with message nested is not a module; If I change it to import("nested/index").B, it's fine,

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesFix AvailableA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions