-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationFixedA PR has been merged for this issueA PR has been merged for this issueVS Code TrackedThere is a VS Code equivalent to this issueThere is a VS Code equivalent to this issue
Milestone
Description
TypeScript Version: 2.3.4
Code
This works:
{
/**
* @typedef {{
type: string,
color?: string
}} Props
* @param {Props} props
*/
const foo = (props) => {
console.log(props.type); // type of type is string
};
foo({ type: 1 }); // error
// However, if I destructure the param, it breaks:
/**
* @typedef {{
type: string,
color?: string
}} Props2
* @param {Props2} props
*/
const foo2 = ({ type }) => {
console.log(type); // type of type is any, expected string
};
foo2({ type: 1 }); // expected error but got none
}
Reading through the docs on JSDoc support, I couldn't find anything to suggest why this shouldn't work.
briandipalma, bfricka, aweber1, blackandcode, opiation and 1 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationFixedA PR has been merged for this issueA PR has been merged for this issueVS Code TrackedThere is a VS Code equivalent to this issueThere is a VS Code equivalent to this issue