-
Notifications
You must be signed in to change notification settings - Fork 767
Revise type-only alias logic to not depend on full type checks #2168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f1f4f51
21bce40
0577249
5d038d3
f1d6ee8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| --- old.importEquals3.errors.txt | ||
| +++ new.importEquals3.errors.txt | ||
| @@= skipped -0, +0 lines =@@ | ||
| b.ts(2,12): error TS1380: An import alias cannot reference a declaration that was imported using 'import type'. | ||
| b.ts(3,13): error TS1380: An import alias cannot reference a declaration that was imported using 'import type'. | ||
| c.ts(2,12): error TS1380: An import alias cannot reference a declaration that was imported using 'import type'. | ||
| -c.ts(3,13): error TS1380: An import alias cannot reference a declaration that was imported using 'import type'. | ||
|
|
||
|
|
||
| ==== a.ts (0 errors) ==== | ||
| @@= skipped -20, +19 lines =@@ | ||
| const x = 0; | ||
| export { a, A, x }; | ||
|
|
||
| -==== c.ts (2 errors) ==== | ||
| +==== c.ts (1 errors) ==== | ||
| import * as b from './b'; | ||
| import A = b.a.A; // Error | ||
| ~~~~~ | ||
| !!! error TS1380: An import alias cannot reference a declaration that was imported using 'import type'. | ||
| !!! related TS1376 b.ts:1:18: 'a' was imported here. | ||
| import AA = b.A; // Error | ||
| - ~~~ | ||
| -!!! error TS1380: An import alias cannot reference a declaration that was imported using 'import type'. | ||
| -!!! related TS1376 b.ts:1:18: 'a' was imported here. | ||
|
|
||
| import x = b.x; | ||
| console.log(x); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,4 @@ | ||
| b.ts(1,10): error TS2440: Import declaration conflicts with local declaration of 'A'. | ||
| c.ts(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| c.ts(3,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| c.ts(4,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| c.ts(4,1): error TS2349: This expression is not callable. | ||
| Type 'typeof A' has no call signatures. | ||
|
|
||
|
|
@@ -19,21 +16,12 @@ c.ts(4,1): error TS2349: This expression is not callable. | |
| } | ||
| export { A }; | ||
|
|
||
| ==== c.ts (4 errors) ==== | ||
| ==== c.ts (1 errors) ==== | ||
| import { A } from "./b"; | ||
| A; | ||
| ~ | ||
| !!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| !!! related TS1377 a.ts:2:15: 'A' was exported here. | ||
| A.displayName; | ||
| ~ | ||
| !!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| !!! related TS1377 a.ts:2:15: 'A' was exported here. | ||
| A(); | ||
| ~ | ||
| !!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| !!! related TS1377 a.ts:2:15: 'A' was exported here. | ||
| ~ | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These (previously inconsistently reported) errors are now no longer reported. |
||
| !!! error TS2349: This expression is not callable. | ||
| !!! error TS2349: Type 'typeof A' has no call signatures. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| --- old.typeOnlyMerge3.errors.txt | ||
| +++ new.typeOnlyMerge3.errors.txt | ||
| @@= skipped -0, +0 lines =@@ | ||
| b.ts(1,10): error TS2440: Import declaration conflicts with local declaration of 'A'. | ||
| -c.ts(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| -c.ts(3,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| -c.ts(4,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| c.ts(4,1): error TS2349: This expression is not callable. | ||
| Type 'typeof A' has no call signatures. | ||
|
|
||
| @@= skipped -18, +15 lines =@@ | ||
| } | ||
| export { A }; | ||
|
|
||
| -==== c.ts (4 errors) ==== | ||
| +==== c.ts (1 errors) ==== | ||
| import { A } from "./b"; | ||
| A; | ||
| - ~ | ||
| -!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| -!!! related TS1377 a.ts:2:15: 'A' was exported here. | ||
| A.displayName; | ||
| - ~ | ||
| -!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| -!!! related TS1377 a.ts:2:15: 'A' was exported here. | ||
| A(); | ||
| - ~ | ||
| -!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. | ||
| -!!! related TS1377 a.ts:2:15: 'A' was exported here. | ||
| ~ | ||
| !!! error TS2349: This expression is not callable. | ||
| !!! error TS2349: Type 'typeof A' has no call signatures. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ var t = p.x; | |
|
|
||
| === node_modules/math2d/index.d.ts === | ||
| export as namespace Math2d; | ||
| >Math2d : typeof import("node_modules/math2d/index.d.ts") | ||
| >Math2d : typeof import("node_modules/math2d/index") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Odd change; wonder where this is coming from...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't know, suspect it comes from something in emit. |
||
|
|
||
| export = M2D; | ||
| >M2D : typeof import("node_modules/math2d/index.d.ts") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An error was already reported on the declaration of
Aso this follow-on error isn't necessary.