-
Notifications
You must be signed in to change notification settings - Fork 12.8k
v3.7.2 not compiling valid Javascript #35149
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
Comments
Your javascript is not exactly "valid". If you remove --checkJS param it will comile without errors |
What's not valid about it? It runs in node and chrome perfectly. I want to keep checkJS because I have some files with jsdocs I'd like to validate. I don't want to have to manually put each file I want to validate in |
|
So Typescript does not compile valid Javascript then? Why isn't it an implicit any? I thought the promise of Typescript is that it works out of the box with JS. |
It worked out of the box and told you there was something suspicious it sniffed from your code. |
there's nothing suspicious, |
@fatcerberus @kroleg answered your question above. Are you purposefully ignoring everyones answer here? |
@dave-dm there is something suspicious. By default TS treats all object properties as required, so in case of /**
* @param {object} param0
* @param {string} [param0.one]
*/
function something({one} = {}) {} Another is to add // @ts-ignore
function something({one} = {}) {} |
I doubt it strictly has to do with type checking via inferred types (if it was, I think you'd see
All equally suspicious/statically verifiable, with the same inferred types. In fact, checking the same file contents in a |
Maybe so, but the point remains: TS only promises it will compile JS out of the box (which it does—it even emits code in the presence of type errors!), it doesn’t promise it will typecheck. We’ll just have to wait to see what a TS team member has to say about this, but I still suspect this is by design. |
I think (maybe talking out of my ass?) there's also some stuff that TS only does syntactically, and not semantically for So, some constructs give errors because TS can identity the problem syntactically (someone specifically coded a check for it, that looks at the syntax only). While other constructs (that express the same thing) don't give errors because the check can't just be done syntactically (or no one coded the syntax-only check).
|
Well my use case is only to check jsdocs in all my .js files, and ignore all valid javascript. If that's not possible, that is unfortunate. @kroleg adding comments doesn't work for my use case. I have a huge codebase and only want jsdocs in a few places. It has to let valid javascript pass through without any addition. |
If you just want to validate that your JS Doc matches your parameter names, |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
The text was updated successfully, but these errors were encountered: