Skip to content

Commit 2531d35

Browse files
committed
fix: handle missing valueDeclaration as non-uniform case
1 parent dd1e258 commit 2531d35

5 files changed

Lines changed: 53 additions & 1 deletion

File tree

src/compiler/checker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15547,7 +15547,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1554715547
let firstValueDeclaration: Declaration | undefined;
1554815548
let hasNonUniformValueDeclaration = false;
1554915549
for (const prop of props) {
15550-
if (!firstValueDeclaration) {
15550+
if(!prop.valueDeclaration){
15551+
hasNonUniformValueDeclaration = true;
15552+
}
15553+
else if (!firstValueDeclaration) {
1555115554
firstValueDeclaration = prop.valueDeclaration;
1555215555
}
1555315556
else if (prop.valueDeclaration && prop.valueDeclaration !== firstValueDeclaration) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//// [tests/cases/compiler/intersectionWithConflictingPrivates2.ts] ////
2+
3+
//// [intersectionWithConflictingPrivates2.ts]
4+
declare class A {
5+
private a: number;
6+
7+
}
8+
type B = Pick<{ a: number }, 'a'> & A;
9+
10+
//// [intersectionWithConflictingPrivates2.js]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//// [tests/cases/compiler/intersectionWithConflictingPrivates2.ts] ////
2+
3+
=== intersectionWithConflictingPrivates2.ts ===
4+
declare class A {
5+
>A : Symbol(A, Decl(intersectionWithConflictingPrivates2.ts, 0, 0))
6+
7+
private a: number;
8+
>a : Symbol(A.a, Decl(intersectionWithConflictingPrivates2.ts, 0, 17))
9+
10+
}
11+
type B = Pick<{ a: number }, 'a'> & A;
12+
>B : Symbol(B, Decl(intersectionWithConflictingPrivates2.ts, 3, 1))
13+
>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --))
14+
>a : Symbol(a, Decl(intersectionWithConflictingPrivates2.ts, 4, 15))
15+
>A : Symbol(A, Decl(intersectionWithConflictingPrivates2.ts, 0, 0))
16+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//// [tests/cases/compiler/intersectionWithConflictingPrivates2.ts] ////
2+
3+
=== intersectionWithConflictingPrivates2.ts ===
4+
declare class A {
5+
>A : A
6+
> : ^
7+
8+
private a: number;
9+
>a : number
10+
> : ^^^^^^
11+
12+
}
13+
type B = Pick<{ a: number }, 'a'> & A;
14+
>B : never
15+
> : ^^^^^
16+
>a : number
17+
> : ^^^^^^
18+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare class A {
2+
private a: number;
3+
4+
}
5+
type B = Pick<{ a: number }, 'a'> & A;

0 commit comments

Comments
 (0)