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
Closed

List of reserved keywords #2536

chinhodado opened this issue Mar 28, 2015 · 5 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@chinhodado
Copy link

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
Copy link
Member

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 DanielRosenwasser added the Question An issue which isn't directly actionable in code label Mar 28, 2015
@DanielRosenwasser
Copy link
Member

Also namespace, maybe async and await eventually.

@mhegazy
Copy link
Contributor

mhegazy commented May 1, 2015

@DanielRosenwasser looks like this should have a wiki page

@crissdev
Copy link

crissdev 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
Copy link
Contributor

zspitz commented Aug 2, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

6 participants