Skip to content

Commit cc460dc

Browse files
authored
Revert PR 56087 (#57849)
1 parent 8fa18b2 commit cc460dc

5 files changed

+34
-20
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5740,12 +5740,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
57405740
* Checks if two symbols, through aliasing and/or merging, refer to the same thing
57415741
*/
57425742
function getSymbolIfSameReference(s1: Symbol, s2: Symbol) {
5743-
if (s1.flags & SymbolFlags.TypeAlias && s2.declarations?.find(isTypeAlias)) {
5744-
s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2;
5745-
}
5746-
if (s2.flags & SymbolFlags.TypeAlias && s1.declarations?.find(isTypeAlias)) {
5747-
s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1;
5748-
}
57495743
if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
57505744
return s1;
57515745
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
src/index.ts(3,14): error TS2742: The inferred type of 'foo' cannot be named without a reference to '../node_modules/some-dep/dist/inner'. This is likely not portable. A type annotation is necessary.
2+
src/index.ts(7,14): error TS2742: The inferred type of 'bar' cannot be named without a reference to '../node_modules/some-dep/dist/inner'. This is likely not portable. A type annotation is necessary.
3+
4+
5+
==== node_modules/some-dep/dist/inner.d.ts (0 errors) ====
6+
export declare type Other = { other: string };
7+
export declare type SomeType = { arg: Other };
8+
9+
==== node_modules/some-dep/dist/index.d.ts (0 errors) ====
10+
export type OtherType = import('./inner').Other;
11+
export type SomeType = import('./inner').SomeType;
12+
13+
==== node_modules/some-dep/package.json (0 errors) ====
14+
{
15+
"name": "some-dep",
16+
"exports": {
17+
".": "./dist/index.js"
18+
}
19+
}
20+
21+
==== src/index.ts (2 errors) ====
22+
import { SomeType } from "some-dep";
23+
24+
export const foo = (thing: SomeType) => {
25+
~~~
26+
!!! error TS2742: The inferred type of 'foo' cannot be named without a reference to '../node_modules/some-dep/dist/inner'. This is likely not portable. A type annotation is necessary.
27+
return thing;
28+
};
29+
30+
export const bar = (thing: SomeType) => {
31+
~~~
32+
!!! error TS2742: The inferred type of 'bar' cannot be named without a reference to '../node_modules/some-dep/dist/inner'. This is likely not portable. A type annotation is necessary.
33+
return thing.arg;
34+
};

tests/baselines/reference/declarationEmitUsingTypeAlias1.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,3 @@ const bar = (thing) => {
3939
return thing.arg;
4040
};
4141
exports.bar = bar;
42-
43-
44-
//// [index.d.ts]
45-
import { SomeType } from "some-dep";
46-
export declare const foo: (thing: SomeType) => import("some-dep").SomeType;
47-
export declare const bar: (thing: SomeType) => import("some-dep").OtherType;

tests/baselines/reference/unusedTypeParametersCheckedByNoUnusedParameters.types

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
//// [tests/cases/compiler/unusedTypeParametersCheckedByNoUnusedParameters.ts] ////
22

3-
=== Performance Stats ===
4-
Type Count: 100 / 3,200 (nearest 100)
5-
Symbol count: 25,500 / 25,500 (nearest 500)
6-
73
=== unusedTypeParametersCheckedByNoUnusedParameters.ts ===
84
function f<T>() { }
95
>f : <T>() => void

tests/baselines/reference/unusedTypeParametersNotCheckedByNoUnusedLocals.types

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
//// [tests/cases/compiler/unusedTypeParametersNotCheckedByNoUnusedLocals.ts] ////
22

3-
=== Performance Stats ===
4-
Type Count: 100 / 3,200 (nearest 100)
5-
Symbol count: 25,500 / 25,500 (nearest 500)
6-
73
=== unusedTypeParametersNotCheckedByNoUnusedLocals.ts ===
84
function f<T>() { }
95
>f : <T>() => void

0 commit comments

Comments
 (0)