Skip to content

Certain types can produce implicit 'any' declaration output #21614

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

Closed
DanielRosenwasser opened this issue Feb 4, 2018 · 4 comments · Fixed by #21930
Closed

Certain types can produce implicit 'any' declaration output #21614

DanielRosenwasser opened this issue Feb 4, 2018 · 4 comments · Fixed by #21930
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

@DanielRosenwasser
Copy link
Member

Apparently this became a bug in TypeScript 1.4 and we never noticed.

export let x: (foo) => number;

Compile this with --declaration and module: esnext

Expected:

export let x: (foo: any) => number;

Actual:

export let x: (foo) => number;
@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files labels Feb 4, 2018
@DanielRosenwasser DanielRosenwasser changed the title Shorthand function types can produce implicit 'any' declaration output Certain types can produce implicit 'any' declaration output Feb 4, 2018
@DanielRosenwasser
Copy link
Member Author

DanielRosenwasser commented Feb 4, 2018

Actually, it's really

  • Function type parameters
  • Constructor type parameters
  • Property signatures
  • Any parameter whose grandparent is an anonymous object type literal.

Here's a decent test case:

export type A = (foo1, foo2) => number;
export type B = new (foo1, foo2) => string;
export type C = {
    foo;
    bar(barParam);
    baz(bazParam1, bazParam2);
}

@weswigham
Copy link
Member

I think I have this fixed, by chance, in the upcoming declaration transformer.

@DanielRosenwasser
Copy link
Member Author

DanielRosenwasser commented Feb 4, 2018

Awesome - what is the name of your branch?

@weswigham
Copy link
Member

weswigham commented Feb 5, 2018

declaration-emitter-refactor on my fork, I believe. Tests still aren't clean yet, though (hence why the pr isn't open).

@mhegazy mhegazy added this to the TypeScript 2.8 milestone Feb 5, 2018
@mhegazy mhegazy modified the milestones: TypeScript 2.8, TypeScript 2.9 Mar 9, 2018
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Mar 28, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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

Successfully merging a pull request may close this issue.

3 participants