TypeScript Language Specification v1.5
TypeScript Language Specification v1.5
TypeScript Language Specification v1.5
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
BindingProperty:<br />
Identifier Initialiser opt<br />
PropertyName : Identifier Initialiser opt<br />
PropertyName : BindingPattern Initialiser opt<br />
ArrayBindingPattern:<br />
[ Elision opt BindingRestElement opt ]<br />
[ BindingElementList ]<br />
[ BindingElementList , Elision opt BindingRestElement opt ]<br />
BindingElementList:<br />
Elision opt BindingElement<br />
BindingElementList , Elision opt BindingElement<br />
BindingElement:<br />
Identifier Initialiser opt<br />
BindingPattern Initialiser opt<br />
BindingRestElement:<br />
... Identifier<br />
Each binding property or element that specifies an identifier introduces a variable by that name. The type<br />
of the variable is the widened form (section 3.11) of the type associated with the binding property or<br />
element, as defined in the following.<br />
The type T associated with a destructuring variable declaration is determined as follows:<br />
<br />
<br />
<br />
If the declaration includes a type annotation, T is that type.<br />
Otherwise, if the declaration includes an initializer expression, T is the type of that initializer<br />
expression.<br />
Otherwise, T is the Any type.<br />
The type T associated with a binding property is determined as follows:<br />
<br />
<br />
<br />
<br />
<br />
<br />
Let S be the type associated with the immediately containing destructuring variable declaration,<br />
binding property, or binding element.<br />
If S is the Any type:<br />
o If the binding property specifies an initializer expression, T is the type of that initializer<br />
expression.<br />
o Otherwise, T is the Any type.<br />
Let P be the property name specified in the binding property.<br />
If S has an apparent property with the name P, T is the type of that property.<br />
Otherwise, if S has a numeric index signature and P is a numerical name, T is the type of the<br />
numeric index signature.<br />
Otherwise, if S has a string index signature, T is the type of the string index signature.<br />
89