logoalt Hacker News

culiyesterday at 12:55 AM0 repliesview on HN

Yes, all of these are supported in JSDoc because they are supported in TypeScript. Because JSDoc is TypeScript. You can either define your types in JSDoc comments or in .ts files.

I really mean it. You can even use the @satisfies operator like so

  /** @satisfies {Type} */
Discriminated unions, conditional types, mapped types, template literal types, etc work exactly the same way if you define them in a JSDoc comment as if you define them in a .ts file