Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: