program
comment "// @target: es2015"
comment "// Each element expression in a non-empty array literal is p"...
comment "// - If the array literal contains no spread elements, an"...
comment "// by a type T and T has a property with the numeric na"...
comment "// the element expression is contextually typed by the "...
comment "// The resulting type an array literal expression is determi"...
comment "// - If the array literal contains no spread elements an"...
comment "// the resulting type is a tuple type constructed from"...
variable_declaration (+22 nodes collapsed)
comment "// Error"
variable_declaration (+30 nodes collapsed)
comment "// Error"
comment "// The resulting type an array literal expression is determi"...
comment "// - If the array literal contains no spread elements an"...
comment "// the resulting type is a tuple type constructed from"...
variable_declaration (+34 nodes collapsed)
comment "// The resulting type an array literal expression is determi"...
comment "// - the resulting type is an array type with an elemen"...
comment "// non - spread element expressions and the numeric i"...
variable_declaration (+23 nodes collapsed)
variable_declaration
var "var"
variable_declarator
identifier "temp1"
= "="
array
[ "["
number "1"
, ","
number "2"
, ","
number "3"
] "]"
; ";"
variable_declaration (+46 nodes collapsed)
interface_declaration (+40 nodes collapsed)
interface_declaration
interface "interface"
type_identifier "myArray"
extends_type_clause
extends "extends"
generic_type
type_identifier "Array"
type_arguments
< "<"
type_identifier "Number"
> ">"
interface_body
{ "{"
} "}"
interface_declaration
interface "interface"
type_identifier "myArray2"
extends_type_clause
extends "extends"
generic_type
type_identifier "Array"
type_arguments
< "<"
union_type
type_identifier "Number"
| "|"
type_identifier "String"
> ">"
interface_body
{ "{"
} "}"
variable_declaration
var "var"
variable_declarator
identifier "c0"
type_annotation
: ":"
type_identifier "tup"
= "="
array
[ "["
spread_element
... "..."
identifier "temp2"
] "]"
; ";"
comment "// Error"
variable_declaration (+25 nodes collapsed)
comment "// Error cannot assign number[] to [number, number, number]"
variable_declaration
var "var"
variable_declarator
identifier "c2"
type_annotation
: ":"
type_identifier "myArray"
= "="
array
[ "["
spread_element
... "..."
identifier "temp1"
, ","
spread_element
... "..."
identifier "temp"
] "]"
; ";"
comment "// Error cannot assign (number|string)[] to number[]"