-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Typescript = Javascript + Commented Types. noImplicitAny doesn't work with jsdoc types #10033
Comments
There is one way to write types in a .ts file, and that is type annotations. JSDoc comments are not relevant here. in a .js file it can be used, and it is. but |
So this means typescript cannot be used a pure type validator for js files.
Whey do I need to write a separate .ts file when type information can be
inferred from flow like comments.
A big usecase is just adding types to javascript function parameters.
…On Thu, Dec 15, 2016 at 12:54 PM, Mohamed Hegazy ***@***.***> wrote:
Closed #10033 <#10033>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#10033 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-JVF9jFgxfHuoOjsVQwrT0ZUXYVsvuks5rIakegaJpZM4JYUy1>
.
|
it can, and it does. the file extension needs to be
this works in VS Code / VS 2017 today. just open a All the type errors are suppressed in a .js file, but this is tracked by #6802 |
for posterity, it seems bit tough for js and ts to coexist with these options but oh well |
TypeScript Version: 1.8.0 / nightly (2.0.0-dev.201xxxxx)
Code
Expected behavior:
Type of cmd should be string
Actual behavior:
Type of cmd is any and compiler gives error.
Still gives no implicitError.
Weird thing is if my file is .js then tsc doesn't do any type checking or give me useful errors.
The user scenario is:
The text was updated successfully, but these errors were encountered: