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

Why can a string of type any be assigned to type number? #31332

Closed
lujdong opened this issue May 10, 2019 · 1 comment
Closed

Why can a string of type any be assigned to type number? #31332

lujdong opened this issue May 10, 2019 · 1 comment
Labels
Question An issue which isn't directly actionable in code

Comments

@lujdong
Copy link

lujdong commented May 10, 2019

let str: any= 'str' let num: number = str //ok

@j-oliveras
Copy link
Contributor

Because this is the reason of the type any: be assignable from and to any other type. See it on basic types. Recommendation, read the FAQs.

Better ask questions to stackoverflow.

@ahejlsberg ahejlsberg added the Question An issue which isn't directly actionable in code label May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

4 participants