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

"{0} only refers to a type but is used as a value" doesn't work for primitive types #15565

Closed
sandersn opened this issue May 3, 2017 · 0 comments · Fixed by #15507
Closed
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@sandersn
Copy link
Member

sandersn commented May 3, 2017

interface Foo { a }
let x = Foo // "'Foo' only refers to a type but it used as a value"
let y = any // 'any' is not found

Expected: error messages are the same.
Actual: let y = any has the generic 'any'-not-found message.

I'm not sure how often people say new string[], but our tests definitely say it a lot!

@sandersn sandersn changed the title "{0} only refers to a type but is used a value" doesn't work for primitive types "{0} only refers to a type but is used as a value" doesn't work for primitive types May 3, 2017
sandersn added a commit that referenced this issue May 3, 2017
Previously, you would get the generic message when writing incorrect
code like `let y = number`. "Cannot find name 'number'". Now the message
says "'number' is a type but is used a value here."

Fixes #15565
@mhegazy mhegazy added the Bug A bug in TypeScript label May 3, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label May 9, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants