-
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
Non-Nullable Objects in params don't have properties parsed #32783
Comments
The parser only supports the following markers for nested type construction: |
@sandersn i know the parser doesn't support it that's why the issue is there. what do you mean error-prone? you can't add |
New code should use multiple typedefs, Typescript's own object literal types, or just declare types in a separate d.ts file. |
@sandersn thanks for the reply mate. i understand this post is in typescript repo but it's not about typescript but vscode, as all issues like that are moved in here. |
This is the right place for JS-in-VSCode bugs, since TS handles those too. I tried an example program on the Closure Compiler Service and it gave me this warning:
If I changed the actual properties to something else, like Did I do something wrong? Does that version of Closure not support nested object types? I pasted the full program below in case the link doesn't work. // ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name default.js
// ==/ClosureCompiler==
/**
* @param {!Object} [name]
* @param {boolean} [name.narrow]
*/
function hello(name) {
if (name)
alert(name.narrow);
}
hello({ narrow: true }); |
yeah i don't know which version they are running on their gcc apps but there's no warning on the current standalone ( |
I ran into a similar issue when working on #52370. The issue I found is that using destructuring in /**
*
* @param {Object} param0 description
* @param {*} [param0.a=1] some desc
*/
function foo({ a = 1 }) { } // This works, we understand "some desc" is a description for `a`
/**
*
* @param param0 description
* @param [param0.a=1] some desc
*/
function bar({ a = 1 }) { } // This doesn't work, we don't understand "some desc" is a description for `a` Looking at the parser code with Nathan, this seems to be because we only speculatively try to parse the following |
TypeScript Version: 3.5.2
Search Terms: object param
Code
Expected behavior:
Actual behavior:
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: