Targets · TypeScript · Reserved words

Reserved words

TypeScript keeps a set of words for its own syntax, so a program cannot use them as names. When a Program name collides with one, the renderer appends a single underscore — class becomes class_ — so the program keeps the name it chose and the output still compiles. Because _ is illegal in a Program identifier, the escape can never collide with a name a program actually chose. TypeScript reserves everything JavaScript does, plus its own type-level words.

Contents

How a Program becomes TypeScript, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.

The full list

Every word TypeScript reserves, with the identifier a colliding Program name is escaped to. The rule is uniform — append a single _:

Reserved wordRendered identifier
awaitawait_
breakbreak_
casecase_
catchcatch_
classclass_
constconst_
continuecontinue_
debuggerdebugger_
defaultdefault_
deletedelete_
dodo_
elseelse_
enumenum_
exportexport_
extendsextends_
falsefalse_
finallyfinally_
forfor_
functionfunction_
ifif_
importimport_
inin_
instanceofinstanceof_
newnew_
nullnull_
returnreturn_
supersuper_
switchswitch_
thisthis_
throwthrow_
truetrue_
trytry_
typeoftypeof_
varvar_
voidvoid_
whilewhile_
withwith_
yieldyield_
letlet_
staticstatic_
implementsimplements_
interfaceinterface_
packagepackage_
privateprivate_
protectedprotected_
publicpublic_
abstractabstract_
anyany_
asas_
assertsasserts_
asyncasync_
bigintbigint_
booleanboolean_
constructorconstructor_
declaredeclare_
getget_
inferinfer_
isis_
keyofkeyof_
modulemodule_
namespacenamespace_
nevernever_
numbernumber_
objectobject_
ofof_
outout_
overrideoverride_
readonlyreadonly_
requirerequire_
satisfiessatisfies_
setset_
stringstring_
symbolsymbol_
typetype_
undefinedundefined_
uniqueunique_
unknownunknown_