-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Create Keywords.md #344
Create Keywords.md #344
Changes from 3 commits
31fff55
e8bcd2e
98e1033
1e4bb08
df1296a
bda7975
5900976
b628e33
bee295f
e111598
f258174
e3aaf09
3c23ce8
3110858
e11fa2f
67e33c8
ab67fa5
102a30f
0bb4aeb
3fa50b8
d87c35e
eb2b912
9f05002
10ddd2d
cbbd49f
d17b9cf
3bc3d30
6e4906e
345a6b1
35a0bc1
1e4b6e5
12788c7
632d8aa
35171f8
4826c50
d654783
6e834cd
8550e42
58a74c9
6f7766c
8eae732
eb5f8b4
b2ef743
6d4c103
7d50922
70f41dd
1241695
6d06909
99ab9ee
3bab206
8b54c8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Typescript Keywords | ||
|
||
The following keywords have the same meaning in Typescript as they do in Javascript: | ||
|
||
Keyword | Notes | ||
---|--- | ||
async, await | [ES draft](http://tc39.github.io/ecmascript-asyncawait/) | ||
break | | | ||
continue | | | ||
class, extends, constructor, super | `extends` can also be used with `interface` | | ||
const, let, var | `const`can also be used as a modifier for `enum`| | ||
debugger | | | ||
delete | | | ||
do, while | | | ||
export, import | | | ||
for, each, in, of | | | ||
function, return | | | ||
get, set | | | ||
if, else | | | ||
instanceof, typeof | | | ||
null, undefined | Can also refer to the `null` and `undefined` types| | ||
switch, case, default | | | ||
this | | | ||
true, false | | | ||
try, catch, finally | | | ||
void | Can also refer to the `void` type | | ||
yield | | | ||
|
||
Unless otherwise noted, more information can be found on the [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/JavaScript) or on [MSDN](https://msdn.microsoft.com/en-us/library/d1et7k7c%28v=vs.94%29.aspx) | ||
|
||
--- | ||
|
||
The following keywords are used for [basic type annotations](http://www.typescriptlang.org/docs/handbook/basic-types.html): | ||
|
||
Keyword | Description | ||
---|--- | ||
any | [Describes a type unknown at design time](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) | ||
boolean | [Boolean](http://www.typescriptlang.org/docs/handbook/basic-types.html#boolean) | ||
null | _Missing Handbook link_ ([Spec](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#326-the-null-type)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
number | [Number](http://www.typescriptlang.org/docs/handbook/basic-types.html#number) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make links relative to this one. the contents of the handbook should be navigatable as md files on github. the script the publishes them to the website takes care of fixing the links. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
string | [String](http://www.typescriptlang.org/docs/handbook/basic-types.html#string) | ||
symbol | [Symbol](http://www.typescriptlang.org/docs/handbook/symbols.html) | ||
undefined | _Missing Handbook link_ ([Spec](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#327-the-undefined-type)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
void | _Missing Handbook link_ ([Spec](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#325-the-void-type)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should also add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here is the link to void: https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Basic%20Types.md#void There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed
Does Typescript add more than the Javascript meaning of global context / call dependent context? |
||
|
||
Other basic type-related keywords: | ||
|
||
Keyword | Description | ||
---|--- | ||
as | [Type assertion](http://www.typescriptlang.org/docs/handbook/basic-types.html#type-assetions) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also used as a module import rename declaration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
is | _Missing link_ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
|
||
User-defined types: | ||
|
||
Keyword | Description | ||
---|--- | ||
enum | [Defines an enum - a set of named values](http://www.typescriptlang.org/docs/handbook/enums.html) | ||
type | [Type alias](http://www.typescriptlang.org/docs/handbook/advanced-types.html#type-aliases) | ||
interface | [Defines a type by its shape (structural typing)](http://www.typescriptlang.org/docs/handbook/interfaces.html) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not class too? |
||
|
||
Modifiers on user-defined type: | ||
|
||
Keyword | Description | Applies to | ||
---|---|--- | ||
abstract | [Abstract classes (cannot be instantiated; must be inherited)](http://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes) | class | ||
const | [Forces a const enum](http://www.typescriptlang.org/docs/handbook/enums.html) | enum | ||
implements | [Defines a class as implementing a given interface](http://www.typescriptlang.org/docs/handbook/interfaces.html#implementing-an-interface) | class | ||
|
||
Modifiers on **members** of class/interface definitions: | ||
|
||
Keyword | Description | ||
---|--- | ||
abstract | [Inheriting classes must implement this method](http://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes) | ||
static | [Defines a member on the class, and not on the instance](http://www.typescriptlang.org/docs/handbook/classes.html#static-properties) | ||
readonly | [Property's value can be read, but not written to](https://github.com/Microsoft/TypeScript/pull/6532) | ||
private | [Property can be used only from its containing class](https://www.typescriptlang.org/docs/handbook/classes.html#understanding-private) | ||
protected | [Property can only be used in its containing class, or by classes which inherit from the containing class](https://www.typescriptlang.org/docs/handbook/classes.html#understanding-protected) | ||
public | [Property can be used from outside its containing class](https://www.typescriptlang.org/docs/handbook/classes.html#public-by-default) | ||
|
||
Code organization and environment: | ||
|
||
Keyword | Description | ||
---|--- | ||
declare | [Ambient declarations -- elements created by the environment or other scripts](Missing link) | ||
module | [Define an ambient module](http://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules) | ||
namespace | [Associates the contained types with the specified namespace](http://www.typescriptlang.org/docs/handbook/namespaces.html) | ||
require | [Missing description](http://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require) | ||
|
||
--- | ||
|
||
Unknown: | ||
|
||
Keyword | | ||
---| | ||
from| | ||
of| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DanielRosenwasser fixed |
||
package| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use lower case type names, so as not to mix them with boxed types, Number, String, etc..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also add
never
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed lowercase and
never