Y
Published on

Complete List of TypeScript Keywords

Authors
  • avatar
    Name
    Yinhuan Yuan
    Twitter

Introduction

TypeScript includes all JavaScript keywords and adds several of its own. Here's a comprehensive list of keywords in TypeScript:

JavaScript Keywords (also used in TypeScript)

  1. break
  2. case
  3. catch
  4. class
  5. const
  6. continue
  7. debugger
  8. default
  9. delete
  10. do
  11. else
  12. enum
  13. export
  14. extends
  15. false
  16. finally
  17. for
  18. function
  19. if
  20. import
  21. in
  22. instanceof
  23. new
  24. null
  25. return
  26. super
  27. switch
  28. this
  29. throw
  30. true
  31. try
  32. typeof
  33. var
  34. void
  35. while
  36. with
  37. as
  38. implements
  39. interface
  40. let
  41. package
  42. private
  43. protected
  44. public
  45. static
  46. yield

TypeScript-Specific Keywords

  1. abstract
  2. any
  3. async
  4. await
  5. constructor
  6. declare
  7. from
  8. get
  9. is
  10. module
  11. namespace
  12. never
  13. require
  14. set
  15. type
  16. unknown
  17. readonly

Contextual Keywords

These words have special meaning in certain contexts but are not reserved words:

  1. of (used in for...of loops)
  2. asserts (used in type assertions)
  3. infer (used in conditional types)
  4. keyof (used to get the union of keys from a type)

Types

While not strictly keywords, these are built-in types in TypeScript:

  1. boolean
  2. number
  3. string
  4. symbol
  5. object
  6. undefined
  7. bigint

Note: Some keywords like any, unknown, never, etc., are both types and keywords in TypeScript