File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 8282
8383## Current problems and limitations
8484
85+ Access to array elements through their indexes will result in a type error.
86+
87+ ``` javascript
88+ let d: FixedSizeArray< 2 , string> ;
89+
90+ d = [' a' , ' b' ]; // ok
91+ d[0 ] = ' a2' ; // ok
92+ d[1 ] = ' b2' ; // type error, but it is wrong!
93+ d[2 ] = ' c2' ; // type error
94+ ```
95+
96+ Other more complex cases.
97+
8598``` javascript
8699interface Fun< N extends number, M extends number> {
87100 (a: FixedSizeArray< N , number> ): FixedSizeArray< M , number> ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ let d: FixedSizeArray<2, string>;
44
55d = [ 'a' , 'b' ] ; // ok
66d [ 0 ] = 'a2' ; // ok
7+ d [ 1 ] = 'b2' ; // type error, but it is wrong!
78d [ 2 ] = 'c2' ; // type error
89d = [ 'a' ] ; // type error
910d = [ 'a' , 'b' , 'c' ] ; // type error
You can’t perform that action at this time.
0 commit comments