Log in Sign up
1 Matching Annotations
  1. Aug 2021
  2. stackoverflow.com stackoverflow.com
    Typescript derive union type from tuple/array values
    1
    1. TylerRick 24 Aug 2021
      in Public
      const list = ['a', 'b', 'c'] as const; // TS3.4 syntax type NeededUnionType = typeof list[number]; // 'a'|'b'|'c';
      hard-coded list of literals TypeScript: tuple type TypeScript: union
    Visit annotations in context

    Tags

    • TypeScript: union
    • TypeScript: tuple type
    • hard-coded list of literals

    Annotators

    • TylerRick

    URL

    stackoverflow.com/questions/45251664/typescript-derive-union-type-from-tuple-array-values
Share:
Group. Only group members will be able to view this annotation.
Only me. No one else will be able to view this annotation.
Hypothes.is
  • About
  • Blog
  • Bioscience
  • Education
  • Jobs
  • Help
  • Contact
  • Terms of Service
  • Privacy Policy