Skip to content

Missing import qualification in declaration emit for generic parameters #27115

@Bobris

Description

@Bobris

TypeScript Version: Version 3.1.0-dev.20180914

Code

Let's have 3 TypeScript files:

bbb.ts:

export interface INode<T> {
  data: T;
}

export function create<T>(): () => INode<T> {
  return (undefined as any) as () => INode<T>;
}

lib.ts:

export type G<T extends string> = { [P in T]: string };

export enum E {
    A = "a"
}

export type T = G<E>;

index.ts:

import { T } from "./lib";
import { create } from "./bbb";

export const fun = create<T>();

Expected behavior:

when compiled with tsc index -d it generates valid index.d.ts:

export declare const fun: () => import("./bbb").INode<import("./lib").G<import("./lib").E>>;

or another valid would be:

export declare const fun: () => import("./bbb").INode<import("./lib").T>;

Actual behavior:

when compiled with tsc index -d it generates invalid index.d.ts:

export declare const fun: () => import("./bbb").INode<import("./lib").G<E>>;

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts files

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