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 82
82
83
83
## Current problems and limitations
84
84
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
+
85
98
``` javascript
86
99
interface Fun< N extends number, M extends number> {
87
100
(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>;
4
4
5
5
d = [ 'a' , 'b' ] ; // ok
6
6
d [ 0 ] = 'a2' ; // ok
7
+ d [ 1 ] = 'b2' ; // type error, but it is wrong!
7
8
d [ 2 ] = 'c2' ; // type error
8
9
d = [ 'a' ] ; // type error
9
10
d = [ 'a' , 'b' , 'c' ] ; // type error
You can’t perform that action at this time.
0 commit comments