File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change
1
+ // @strictNullChecks : true
2
+
1
3
// Repro from #9977
2
4
3
5
type IDLMemberTypes = OperationMemberType | ConstantMemberType ;
@@ -12,7 +14,7 @@ interface InterfaceType {
12
14
13
15
interface OperationMemberType {
14
16
type : "operation" ;
15
- idlType : IDLTypeDescription | null ;
17
+ idlType : IDLTypeDescription ;
16
18
}
17
19
18
20
interface ConstantMemberType {
@@ -47,4 +49,39 @@ function foo(memberType: IDLMemberTypes) {
47
49
else if ( memberType . type === "operation" ) {
48
50
memberType . idlType . origin ; // string
49
51
}
52
+ }
53
+
54
+ // Repro for issue similar to #8383
55
+
56
+ interface A {
57
+ kind : true ;
58
+ prop : { a : string ; } ;
59
+ }
60
+
61
+ interface B {
62
+ kind : false ;
63
+ prop : { b : string ; }
64
+ }
65
+
66
+ function f1 ( x : A | B ) {
67
+ while ( true ) {
68
+ x . prop ;
69
+ if ( x . kind === true ) {
70
+ x . prop . a ;
71
+ }
72
+ if ( x . kind === false ) {
73
+ x . prop . b ;
74
+ }
75
+ }
76
+ }
77
+
78
+ function f2 ( x : A | B ) {
79
+ while ( true ) {
80
+ if ( x . kind ) {
81
+ x . prop . a ;
82
+ }
83
+ if ( ! x . kind ) {
84
+ x . prop . b ;
85
+ }
86
+ }
50
87
}
You can’t perform that action at this time.
0 commit comments