Skip to content

Commit 879f69e

Browse files
committed
accept baseline
1 parent 487dff7 commit 879f69e

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20315,7 +20315,7 @@ namespace ts {
2031520315
return resultType;
2031620316
}
2031720317
return narrowTypeByInKeywordWithExistedPropName(type, propName);
20318-
}
20318+
}
2031920319
return type;
2032020320
}
2032120321

tests/baselines/reference/inKeywordTypeguard.errors.txt

+8-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ tests/cases/compiler/inKeywordTypeguard.ts(16,11): error TS2339: Property 'a' do
55
tests/cases/compiler/inKeywordTypeguard.ts(27,11): error TS2339: Property 'b' does not exist on type 'AWithOptionalProp | BWithOptionalProp'.
66
Property 'b' does not exist on type 'AWithOptionalProp'.
77
tests/cases/compiler/inKeywordTypeguard.ts(42,11): error TS2339: Property 'b' does not exist on type 'AWithMethod'.
8-
tests/cases/compiler/inKeywordTypeguard.ts(49,11): error TS2339: Property 'a' does not exist on type 'never'.
9-
tests/cases/compiler/inKeywordTypeguard.ts(50,11): error TS2339: Property 'b' does not exist on type 'never'.
8+
tests/cases/compiler/inKeywordTypeguard.ts(49,11): error TS2339: Property 'a' does not exist on type '(AWithMethod & { c: unknown; }) | (BWithMethod & { c: unknown; })'.
9+
Property 'a' does not exist on type 'BWithMethod & { c: unknown; }'.
10+
tests/cases/compiler/inKeywordTypeguard.ts(50,11): error TS2339: Property 'b' does not exist on type '(AWithMethod & { c: unknown; }) | (BWithMethod & { c: unknown; })'.
11+
Property 'b' does not exist on type 'AWithMethod & { c: unknown; }'.
1012
tests/cases/compiler/inKeywordTypeguard.ts(52,11): error TS2339: Property 'a' does not exist on type 'AWithMethod | BWithMethod'.
1113
Property 'a' does not exist on type 'BWithMethod'.
1214
tests/cases/compiler/inKeywordTypeguard.ts(53,11): error TS2339: Property 'b' does not exist on type 'AWithMethod | BWithMethod'.
@@ -85,10 +87,12 @@ tests/cases/compiler/inKeywordTypeguard.ts(94,26): error TS2339: Property 'a' do
8587
if ("c" in x) {
8688
x.a();
8789
~
88-
!!! error TS2339: Property 'a' does not exist on type 'never'.
90+
!!! error TS2339: Property 'a' does not exist on type '(AWithMethod & { c: unknown; }) | (BWithMethod & { c: unknown; })'.
91+
!!! error TS2339: Property 'a' does not exist on type 'BWithMethod & { c: unknown; }'.
8992
x.b();
9093
~
91-
!!! error TS2339: Property 'b' does not exist on type 'never'.
94+
!!! error TS2339: Property 'b' does not exist on type '(AWithMethod & { c: unknown; }) | (BWithMethod & { c: unknown; })'.
95+
!!! error TS2339: Property 'b' does not exist on type 'AWithMethod & { c: unknown; }'.
9296
} else {
9397
x.a();
9498
~

tests/baselines/reference/inKeywordTypeguard.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ function negativeTestClassesWithMemberMissingInBothClasses(x: AWithMethod | BWit
146146
x.a();
147147
>x.a() : any
148148
>x.a : any
149-
>x : never
149+
>x : (AWithMethod & { c: unknown; }) | (BWithMethod & { c: unknown; })
150150
>a : any
151151

152152
x.b();
153153
>x.b() : any
154154
>x.b : any
155-
>x : never
155+
>x : (AWithMethod & { c: unknown; }) | (BWithMethod & { c: unknown; })
156156
>b : any
157157

158158
} else {

0 commit comments

Comments
 (0)