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

Using @satisfies tag in JSDoc has strange effects on arrow function parameters #56900

Open
jespertheend opened this issue Dec 29, 2023 · 1 comment Β· May be fixed by #56907
Open

Using @satisfies tag in JSDoc has strange effects on arrow function parameters #56900

jespertheend opened this issue Dec 29, 2023 · 1 comment Β· May be fixed by #56907
Labels
Bug A bug in TypeScript
Milestone

Comments

@jespertheend
Copy link
Contributor

πŸ”Ž Search Terms

jsdoc satisfies

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about satisfies

⏯ Playground Link

https://www.typescriptlang.org/play?strictNullChecks=true&filetype=js#code/PQKhAIAEGcEMBcCW0BmiCm1wG8AUBXfRAEwC5xp4AnRAOwHMBKcAXgD5wA3AexIF9wIYACgAxt1qVwAWwCeAMXy1RSCa3CESrDtj7DhoCJHiyADumLoUOAAqwqsaenjoq0ADwnz3a3MXLVWjYBeW5uQRFgYHAY2Lj4hMSkxIA9NINo5Ky4gAluTldwfMKAA1DuEvBYWmIigCNoVwLweAALBHBEeE6sEtp0AqoS4SA

πŸ’» Code

/** @satisfies {(uuid: string) => void} */
const myFunction = uuid => {}

/** @typedef {Parameters<typeof myFunction>} Foo */
//                                           ^^^
//                        Hover over `Foo` and observe that it is `never`

πŸ™ Actual behavior

Type of Foo is never.

πŸ™‚ Expected behavior

Type of Foo should be [uuid: string]

Additional information about the issue

In the playground link above I have enabled strictNullChecks, but when you disable this, the parameter becomes optional. I.e. [uuid?: string], which is still incorrect. (playground link)

For reference, the same code in TypeScript works as expected: playground link.

@Andarist
Copy link
Contributor

The problem is in the getSignatureFromDeclaration and its isUntypedSignatureInJSFile check - it doesn't account for @satisfies. I'll put up a PR with a fix for this today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants