Skip to content

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

Closed
@jespertheend

Description

@jespertheend

πŸ”Ž 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions