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

tsc 2.9.x generating incorrect type definitions for import types #25278

Closed
jrf0110 opened this issue Jun 27, 2018 · 0 comments
Closed

tsc 2.9.x generating incorrect type definitions for import types #25278

jrf0110 opened this issue Jun 27, 2018 · 0 comments
Assignees
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Fixed A PR has been merged for this issue

Comments

@jrf0110
Copy link

jrf0110 commented Jun 27, 2018

tldr; when using the new import types feature of tsc 2.9, there are certain circumstances where the import( part is missing.

Version: 3.0.0-dev.20180626

Code

See https://github.com/jrf0110/tsc-declaration-bug/blob/master/workspaces/button-consumer/dist/index.d.ts#L2 for a full example

import { MyButton } from "@cloudflare/button-thing";
export const Something = MyButton;

Expected behavior:

/// <reference path="../../../types/component-button.d.ts" />
export declare const Something: typeof import('@cloudflare/component-button').Button;

Actual behavior:

/// <reference path="../../../types/component-button.d.ts" />
export declare const Something: typeof '@cloudflare/component-button'.Button;

Playground Link: https://github.com/jrf0110/tsc-declaration-bug

Additional Info

We saw this come up using yarn workspaces. I'm not exactly sure if using yarn workspaces is required to reproduce. Nonetheless, this definitely seems like a bug with tsc itself.

I suspect this has something to do with importing from .d.ts files that declare a module, as is the case in the linked example.

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 Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants