A.1 Types
TypeParameters: <
TypeParameterList >
TypeParameterList: TypeParameter TypeParameterList ,
TypeParameter
TypeParameter: BindingIdentifier Constraintopt
Constraint: extends
Type
TypeArguments: <
TypeArgumentList >
TypeArgumentList: TypeArgument TypeArgumentList ,
TypeArgument
TypeArgument: Type
Type: UnionOrIntersectionOrPrimaryType FunctionType ConstructorType
UnionOrIntersectionOrPrimaryType: UnionType IntersectionOrPrimaryType
IntersectionOrPrimaryType: IntersectionType PrimaryType
PrimaryType: ParenthesizedType PredefinedType TypeReference ObjectType ArrayType TupleType TypeQuery ThisType
ParenthesizedType: (
Type )
PredefinedType: any
number
boolean
string
symbol
void
TypeReference: TypeName [no LineTerminator here] TypeArgumentsopt
TypeName: IdentifierReference NamespaceName .
IdentifierReference
NamespaceName: IdentifierReference NamespaceName .
IdentifierReference
ObjectType: {
TypeBodyopt }
TypeBody: TypeMemberList ;
opt TypeMemberList ,
opt
TypeMemberList: TypeMember TypeMemberList ;
TypeMember TypeMemberList ,
TypeMember
TypeMember: PropertySignature CallSignature ConstructSignature IndexSignature MethodSignature
ArrayType: PrimaryType [no LineTerminator here] [
]
TupleType: [
TupleElementTypes ]
TupleElementTypes: TupleElementType TupleElementTypes ,
TupleElementType
TupleElementType: Type
UnionType: UnionOrIntersectionOrPrimaryType |
IntersectionOrPrimaryType
IntersectionType: IntersectionOrPrimaryType &
PrimaryType
FunctionType: TypeParametersopt (
ParameterListopt )
=>
Type
ConstructorType: new
TypeParametersopt (
ParameterListopt )
=>
Type
TypeQuery: typeof
TypeQueryExpression
TypeQueryExpression: IdentifierReference TypeQueryExpression .
IdentifierName
ThisType: this
PropertySignature: PropertyName ?
opt TypeAnnotationopt
PropertyName: IdentifierName StringLiteral NumericLiteral
TypeAnnotation: :
Type
CallSignature: TypeParametersopt (
ParameterListopt )
TypeAnnotationopt
ParameterList: RequiredParameterList OptionalParameterList RestParameter RequiredParameterList ,
OptionalParameterList RequiredParameterList ,
RestParameter OptionalParameterList ,
RestParameter RequiredParameterList ,
OptionalParameterList ,
RestParameter
RequiredParameterList: RequiredParameter RequiredParameterList ,
RequiredParameter
RequiredParameter: AccessibilityModifieropt BindingIdentifierOrPattern TypeAnnotationopt BindingIdentifier :
StringLiteral
AccessibilityModifier: public
private
protected
BindingIdentifierOrPattern: BindingIdentifier BindingPattern
OptionalParameterList: OptionalParameter OptionalParameterList ,
OptionalParameter
OptionalParameter: AccessibilityModifieropt BindingIdentifierOrPattern ?
TypeAnnotationopt AccessibilityModifieropt BindingIdentifierOrPattern TypeAnnotationopt Initializer BindingIdentifier ?
:
StringLiteral
RestParameter: ...
BindingIdentifier TypeAnnotationopt
ConstructSignature: new
TypeParametersopt (
ParameterListopt )
TypeAnnotationopt
IndexSignature: [
BindingIdentifier :
string
]
TypeAnnotation [
BindingIdentifier :
number
]
TypeAnnotation
MethodSignature: PropertyName ?
opt CallSignature
TypeAliasDeclaration: type
BindingIdentifier TypeParametersopt =
Type ;