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.
- Introduction — what the TypeScript target is, and how to read the rest of this section.
- Capabilities — which high-level features are possible, built in or through a library.
- Example — a full program using every keyword, and the TypeScript it renders to.
- Naming considerations — how Program's dotted names are carried into TypeScript.
- Entry point — starting a program and attaching it to a root element.
- Drivers — the native drivers that provide the interface, animation and network.
- Runtime — the Reactive and Context machinery the rendered code links against.
- Native modules — the hand-written JavaScript behind
NATIVEfunctions. - Keywords — how each of Program's keywords renders to TypeScript.
- Project setup — the files and commands to build and run the rendered program.
- Reserved words — the words TypeScript keeps for itself, and how a colliding name is escaped.
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 word | Rendered identifier |
|---|---|
await | await_ |
break | break_ |
case | case_ |
catch | catch_ |
class | class_ |
const | const_ |
continue | continue_ |
debugger | debugger_ |
default | default_ |
delete | delete_ |
do | do_ |
else | else_ |
enum | enum_ |
export | export_ |
extends | extends_ |
false | false_ |
finally | finally_ |
for | for_ |
function | function_ |
if | if_ |
import | import_ |
in | in_ |
instanceof | instanceof_ |
new | new_ |
null | null_ |
return | return_ |
super | super_ |
switch | switch_ |
this | this_ |
throw | throw_ |
true | true_ |
try | try_ |
typeof | typeof_ |
var | var_ |
void | void_ |
while | while_ |
with | with_ |
yield | yield_ |
let | let_ |
static | static_ |
implements | implements_ |
interface | interface_ |
package | package_ |
private | private_ |
protected | protected_ |
public | public_ |
abstract | abstract_ |
any | any_ |
as | as_ |
asserts | asserts_ |
async | async_ |
bigint | bigint_ |
boolean | boolean_ |
constructor | constructor_ |
declare | declare_ |
get | get_ |
infer | infer_ |
is | is_ |
keyof | keyof_ |
module | module_ |
namespace | namespace_ |
never | never_ |
number | number_ |
object | object_ |
of | of_ |
out | out_ |
override | override_ |
readonly | readonly_ |
require | require_ |
satisfies | satisfies_ |
set | set_ |
string | string_ |
symbol | symbol_ |
type | type_ |
undefined | undefined_ |
unique | unique_ |
unknown | unknown_ |