Skip to content

Handle @typedef with type on wrong side #16946

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
ghost opened this issue Jul 5, 2017 · 2 comments
Closed

Handle @typedef with type on wrong side #16946

ghost opened this issue Jul 5, 2017 · 2 comments
Labels
Fixed A PR has been merged for this issue

Comments

@ghost
Copy link

ghost commented Jul 5, 2017

TypeScript Version: nightly (2.5.0-dev.20170629)

Code

// @ts-check

/** @typedef Foo {number} */

/** @type {Foo} */
const x = "";

Expected behavior:

Either a syntax error, or correctly set Foo = number and have a type error.

Actual behavior:

No error.

@ghost
Copy link

ghost commented Jul 5, 2017

I'd rather have the syntax error. If we start accepting the wrong syntax, people will start using the wrong syntax.

@sandersn sandersn changed the title Handle @typedef with type on wrong wide Handle @typedef with type on wrong side Jul 6, 2017
@ghost
Copy link
Author

ghost commented Sep 26, 2017

Fixed by #18662

@ghost ghost closed this as completed Sep 26, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Nov 20, 2017
@mhegazy mhegazy added this to the TypeScript 2.7 milestone Nov 20, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

1 participant