Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing import qualification in declaration emit for generic parameters #27115

Closed
Bobris opened this issue Sep 15, 2018 · 2 comments
Closed

Missing import qualification in declaration emit for generic parameters #27115

Bobris opened this issue Sep 15, 2018 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files

Comments

@Bobris
Copy link

Bobris commented Sep 15, 2018

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>>;
@mattmccutchen
Copy link
Contributor

Possible duplicate of #26969?

@Bobris
Copy link
Author

Bobris commented Sep 17, 2018

Could be duplicate, why type T is expanded is another question. Sorry that I didn't found your reported bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files
Projects
None yet
Development

No branches or pull requests

4 participants