Skip to content

Crash in "convert to default export" when using import(...) type and separate 'export default' #48591

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 6, 2022 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Apr 6, 2022

Apparently #48544 was separate.

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

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

// @filename: other.ts
class Other {}
export default Other;

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

Response received: getEditsForRefactor (71). Request took 26 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/typescript/lib/tsserver.js:157575:30)
    at node_modules/typescript/lib/tsserver.js:157530:21
    at Object.eachExportReference (node_modules/typescript/lib/tsserver.js:136347:29)
    at changeImports (node_modules/typescript/lib/tsserver.js:157527:39)
    at doChange (node_modules/typescript/lib/tsserver.js:157480:13)
    at node_modules/typescript/lib/tsserver.js:157415:94
    at Function.ChangeTracker.with (node_modules/typescript/lib/tsserver.js:147283:17)
    at Object.getRefactorEditsToConvertBetweenNamedAndDefaultExports [as getEditsForAction] (node_modules/typescript/lib/tsserver.js:157415:62)
    at Object.getEditsForRefactor (node_modules/typescript/lib/tsserver.js:148589:41)
    at Object.getEditsForRefactor (node_modules/typescript/lib/tsserver.js:164351:32)
    at IpcIOSession.Session.getEditsForRefactor (node_modules/typescript/lib/tsserver.js:175483:59)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (node_modules/typescript/lib/tsserver.js:174103:61)
    at node_modules/typescript/lib/tsserver.js:175866:88
    at IpcIOSession.Session.executeWithRequestId (node_modules/typescript/lib/tsserver.js:175857:28)
    at IpcIOSession.Session.executeCommand (node_modules/typescript/lib/tsserver.js:175866:33)
    at IpcIOSession.Session.onMessage (node_modules/typescript/lib/tsserver.js:175892:35)
    at process.<anonymous> (node_modules/typescript/lib/tsserver.js:178527: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 Duplicate An existing issue was already created and removed 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 6, 2022
@DanielRosenwasser
Copy link
Member Author

Wrong; needed to wait for the next nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

1 participant