Skip to content

Crash in "convert to default export" when using an import(...) type #48544

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

Closed
DanielRosenwasser opened this issue Apr 3, 2022 · 1 comment · Fixed by #48550
Closed

Crash in "convert to default export" when using an import(...) type #48544

DanielRosenwasser opened this issue Apr 3, 2022 · 1 comment · Fixed by #48550
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: Refactorings e.g. extract to constant or function, rename symbol Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this

Comments

@DanielRosenwasser
Copy link
Member

// @filename: element.ts
export default class /*$*/Element {}

// @filename: consumer.ts
import Element from "./element";
export type Uhoh = typeof import("./element").default;

Apply the "Convert default export to named export" refactoring at /*$*/.

Response received: getEditsForRefactor (1456). Request took 2 ms. Success: false . Message: Error processing request. Debug Failure. Unexpected node.
Node ImportType was unexpected.
Error: Debug Failure. Unexpected node.
Node ImportType was unexpected.
    at changeDefaultToNamedImport ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:157539:30)
    at [NODE_MODULES_DIR]/typescript/lib/tsserver.js:157494:21
    at Object.eachExportReference ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:136321:29)
    at changeImports ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:157491:39)
    at doChange ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:157444:13)
    at [NODE_MODULES_DIR]/typescript/lib/tsserver.js:157379:94
    at Function.ChangeTracker.with ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:147251:17)
    at Object.getRefactorEditsToConvertBetweenNamedAndDefaultExports [as getEditsForAction] ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:157379:62)
    at Object.getEditsForRefactor ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:148557:41)
    at Object.getEditsForRefactor ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:164314:32)
    at IpcIOSession.Session.getEditsForRefactor ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:175446:59)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:174066:61)
    at [NODE_MODULES_DIR]/typescript/lib/tsserver.js:175829:88
    at IpcIOSession.Session.executeWithRequestId ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:175820:28)
    at IpcIOSession.Session.executeCommand ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:175829:33)
    at IpcIOSession.Session.onMessage ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:175855:35)
    at process.<anonymous> ([NODE_MODULES_DIR]/typescript/lib/tsserver.js:178490:31)
    at process.emit (node:events:390:28)
    at emit (node:internal/child_process:917:12)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)
@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Help Wanted You can do this Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Domain: Refactorings e.g. extract to constant or function, rename symbol Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output labels Apr 3, 2022
@DanielRosenwasser
Copy link
Member Author

Thank you @a-tarasyuk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: Refactorings e.g. extract to constant or function, rename symbol Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this
Projects
None yet
1 participant