File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -31,3 +31,20 @@ interface Indexed {
31
31
var b10 : Indexed = { 0 : { } , '1' : { } } ; // ok
32
32
33
33
var b11 : Indexed = { 0 : { colour : "blue" } } ; // nested object literal still errors
34
+
35
+ // Repros inspired by #28752
36
+
37
+ function test < T extends IFoo > ( ) {
38
+ // No excess property checks on generic types
39
+ const obj1 : T = { name : "test" } ;
40
+ // No excess property checks on intersections involving generics
41
+ const obj2 : T & { prop : boolean } = { name : "test" , prop : true } ;
42
+ // Excess property checks only on non-generic parts of unions
43
+ const obj3 : T | { prop : boolean } = { name : "test" , prop : true } ;
44
+ // Excess property checks only on non-generic parts of unions
45
+ const obj4 : T & { prop : boolean } | { name : string } = { name : "test" , prop : true } ;
46
+ // No excess property checks when union includes 'object' type
47
+ const obj5 : object | { x : string } = { z : 'abc' }
48
+ // The 'object' type has no effect on intersections
49
+ const obj6 : object & { x : string } = { z : 'abc' }
50
+ }
You can’t perform that action at this time.
0 commit comments