Skip to content

Accepted subset ​

Generated

Everything the compiler accepts, listed from the compiler's own tables by scripts/gen-subset.ts (the page is docs/SUBSET.md). A test fails if this list and the compiler disagree, so it cannot go stale. Anything not listed is rejected with a clear error; each error code is explained in the error reference.

Next: Error codes · CLI.

Accepted syntax (AST node kinds) ​

  • ArrayLiteralExpression
  • ArrayType
  • ArrowFunction
  • AsyncKeyword
  • AwaitExpression
  • BinaryExpression
  • BindingElement
  • Block
  • BooleanKeyword
  • BreakStatement
  • CallExpression
  • CaseBlock
  • CaseClause
  • CatchClause
  • ClassDeclaration
  • ConditionalExpression
  • Constructor
  • ContinueStatement
  • DefaultClause
  • DefaultKeyword
  • ElementAccessExpression
  • EndOfFileToken
  • ExportAssignment
  • ExportDeclaration
  • ExportKeyword
  • ExportSpecifier
  • ExpressionStatement
  • ExpressionWithTypeArguments
  • FalseKeyword
  • FirstLiteralToken
  • FirstNode
  • FirstStatement
  • FirstTemplateToken
  • ForOfStatement
  • ForStatement
  • FunctionDeclaration
  • FunctionExpression
  • FunctionType
  • HeritageClause
  • Identifier
  • IfStatement
  • ImportClause
  • ImportDeclaration
  • ImportSpecifier
  • InstanceOfKeyword
  • InterfaceDeclaration
  • LiteralType
  • MethodDeclaration
  • MethodSignature
  • NamedExports
  • NamedImports
  • NamespaceImport
  • NewExpression
  • NonNullExpression
  • NullKeyword
  • NumberKeyword
  • ObjectBindingPattern
  • ObjectLiteralExpression
  • OverrideKeyword
  • Parameter
  • ParenthesizedExpression
  • ParenthesizedType
  • PostfixUnaryExpression
  • PrefixUnaryExpression
  • PropertyAccessExpression
  • PropertyAssignment
  • PropertyDeclaration
  • PropertySignature
  • ReturnStatement
  • ShorthandPropertyAssignment
  • SourceFile
  • SpreadAssignment
  • SpreadElement
  • StringKeyword
  • StringLiteral
  • SuperKeyword
  • SwitchStatement
  • TemplateExpression
  • TemplateSpan
  • ThisKeyword
  • ThrowStatement
  • TrueKeyword
  • TryStatement
  • TypeAliasDeclaration
  • TypeLiteral
  • TypeOfExpression
  • TypeParameter
  • TypeReference
  • UndefinedKeyword
  • UnionType
  • VariableDeclaration
  • VariableDeclarationList
  • VoidKeyword
  • WhileStatement

Supported binary operators ​

  • !==
  • %
  • %=
  • &
  • &&
  • *
  • *=
  • +
  • +=
  • -
  • -=
  • /
  • /=
  • <
  • <<
  • <=
  • =
  • ===
  • >
  • >=
  • >>
  • >>>
  • ??
  • ^
  • instanceof
  • |
  • ||

Supported unary operators ​

  • !
  • +
  • ++
  • -
  • --
  • ~

Supported string methods ​

  • at
  • charAt
  • charCodeAt
  • concat
  • endsWith
  • includes
  • indexOf
  • lastIndexOf
  • padEnd
  • padStart
  • repeat
  • replace
  • replaceAll
  • slice
  • split
  • startsWith
  • substr
  • substring
  • toLowerCase
  • toUpperCase
  • trim
  • trimEnd
  • trimStart

Supported array methods ​

  • at
  • concat
  • every
  • filter
  • find
  • findIndex
  • flat
  • flatMap
  • forEach
  • includes
  • indexOf
  • join
  • map
  • pop
  • push
  • reduce
  • reverse
  • shift
  • slice
  • some
  • sort

Supported Map methods ​

  • clear
  • delete
  • forEach
  • get
  • has
  • keys
  • set
  • values

Supported Set methods ​

  • add
  • clear
  • delete
  • forEach
  • has
  • keys
  • values

Supported namespace statics ​

  • Array: isArray
  • Date: now
  • Math: abs, ceil, clz32, floor, fround, hypot, imul, max, min, pow, round, sign, sqrt, trunc
  • Number: isFinite, isInteger, isNaN
  • Object: keys, values
  • Promise: all, resolve

Rejection codes ​

CodeRule
CS1000NOT_IN_SUBSET
CS1201ANY_TYPE
CS1202ENUM
CS1203EQEQ
CS1204NON_NULL_ASSERTION
CS1205AS_ANY
CS1206DELETE
CS1207INDEX_SIGNATURE
CS1208DECORATOR
CS1209NAMESPACE
CS1210WITH
CS1211EVAL_OR_FUNCTION_CTOR
CS1212VAR
CS1213REGEX
CS1214JSON_API
CS1215DATE_API
CS1216STRING_UNICODE_OP
CS1217PARAM_FORM
CS1218UNINIT_VAR
CS1220STDLIB_STATIC
CS1221NUMBER_METHOD
CS1222COLLECTION_METHOD
CS1223STRING_METHOD
CS1224ARRAY_METHOD
CS1225OBJECT_METHOD
CS1226MODULE_FORM
CS1227DUPLICATE_CLASS
CS1228TDZ_MODULE_VAR
CS1229ARGV_FORM
CS1230RECURSIVE_TYPE
CS1231TIMER_ASYNC_CALLBACK
CS1232FN_DECL_AS_VALUE
CS1233UNREPRESENTABLE_TYPE
CS1234OPAQUE_HANDLE_USE
CS1235PROPERTY_ADD
CS1236LAYOUT_LIMIT
CS1237METHOD_REPRESENTATION
CS1238UNRENDERABLE_VALUE
CS1239VALUE_OPERATION
CS1240REPRESENTATION_MISMATCH
CS1241STALE_NARROWING
CS1242GENERIC_TYPE_ARGUMENT
CS1243TYPE_COMPUTATION
CS1244CONSTRUCTOR_TYPE
CS1246BUILTIN_AS_VALUE
CS1247THROWN_VALUE
CS1248CAUGHT_VALUE_USE
CS1249HOST_CALL_FORM
CS1250SELF_INIT_CAPTURE