File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
tests/cases/conformance/expressions/propertyAccess Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change
1
+ // @strict : true
2
+
3
+ // Repro from #31762
4
+
5
+ function g1 ( headerNames : any ) {
6
+ let t = [ { hasLineBreak : false , cells : [ ] } ] ;
7
+ const table = [ { cells : headerNames } ] . concat ( t ) ;
8
+ }
9
+
10
+ function g2 ( headerNames : any ) {
11
+ let t = [ { hasLineBreak : false , cells : [ ] } ] ;
12
+ const table = [ { cells : headerNames } ] [ "concat" ] ( t ) ;
13
+ }
14
+
15
+ // Object in property or element access is widened when target of assignment
16
+
17
+ function foo ( options ?: { a : string , b : number } ) {
18
+ let x1 = ( options || { } ) . a ; // Object type not widened
19
+ let x2 = ( options || { } ) [ "a" ] ; // Object type not widened
20
+ ( options || { } ) . a = 1 ; // Object type widened, error
21
+ ( options || { } ) [ "a" ] = 1 ; // Object type widened, error
22
+ }
You can’t perform that action at this time.
0 commit comments