Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of reserved keywords #2536

Closed
chinhodado opened this issue Mar 28, 2015 · 5 comments

Comments

@chinhodado
Copy link

commented Mar 28, 2015

Is there a list of reserved keywords for Typescript somewhere? I have looked around and couldn't find it, even in the language specification.

@DanielRosenwasser

This comment has been minimized.

Copy link
Member

commented Mar 28, 2015

While you could refer to the ES6 spec to figure out a partial list, it might be better to go directly to the code for the current list. Perhaps it would be better to keep a complete list as part of the TS spec (@ahejlsberg)

Based on the code, I ripped this out for you:

Reserved Words Strict Mode Reserved Words Contextual Keywords
break as any
case implements boolean
catch interface constructor
class let declare
const package get
continue private module
debugger protected require
default public number
delete static set
do yield string
else symbol
enum type
export from
extends of
false
finally
for
function
if
import
in
instanceof
new
null
return
super
switch
this
throw
true
try
typeof
var
void
while
with

And if you want to just copy more easily:

Reserved Words
break
case
catch
class
const
continue
debugger
default
delete
do
else
enum
export
extends
false
finally
for
function
if
import
in
instanceof
new
null
return
super
switch
this
throw
true
try
typeof
var
void
while
with
Strict Mode Reserved Words
as
implements
interface
let
package
private
protected
public
static
yield
Contextual Keywords
any
boolean
constructor
declare
get
module
require
number
set
string
symbol
type
from
of
@DanielRosenwasser

This comment has been minimized.

Copy link
Member

commented May 1, 2015

Also namespace, maybe async and await eventually.

@mhegazy

This comment has been minimized.

Copy link

commented May 1, 2015

@DanielRosenwasser looks like this should have a wiki page

@crissdev

This comment has been minimized.

Copy link

commented Nov 6, 2015

I tried a few of reserve words mentioned here on the Typescript Playground and didn't encounter any issues. IMO, the keywords should match at least those for ES6. For the later I have a list here https://github.com/crissdev/is-keyword-js/blob/master/index.js which is a list created from MDN site.

@zspitz

This comment has been minimized.

Copy link
Contributor

commented Aug 2, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants
You can’t perform that action at this time.