-
Couldn't load subscription status.
- Fork 724
Actually transform KindCommonJSExport in declaration emit #1962
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
8d69c76
7523927
fe13452
7bf4926
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //// [tests/cases/compiler/jsDeclarationExportDefaultAssignmentCrash.ts] //// | ||
|
|
||
| //// [index.js] | ||
| exports.default = () => { | ||
| return 1234; | ||
| } | ||
|
|
||
|
|
||
| //// [index.js] | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| export var default = () => { | ||
| return 1234; | ||
| }; | ||
| exports.default = () => { | ||
| return 1234; | ||
| }; | ||
|
|
||
|
|
||
| //// [index.d.ts] | ||
| declare const _default: () => number; | ||
| export default _default; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| //// [tests/cases/compiler/jsDeclarationExportDefaultAssignmentCrash.ts] //// | ||
|
|
||
| === index.js === | ||
| exports.default = () => { | ||
| >exports.default : Symbol(default, Decl(index.js, 0, 0)) | ||
| >exports : Symbol("index", Decl(index.js, 0, 0)) | ||
| >default : Symbol(default, Decl(index.js, 0, 0)) | ||
|
|
||
| return 1234; | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| //// [tests/cases/compiler/jsDeclarationExportDefaultAssignmentCrash.ts] //// | ||
|
|
||
| === index.js === | ||
| exports.default = () => { | ||
| >exports.default = () => { return 1234;} : () => number | ||
| >exports.default : () => number | ||
| >exports : typeof import("index") | ||
| >default : () => number | ||
| >() => { return 1234;} : () => number | ||
|
|
||
| return 1234; | ||
| >1234 : 1234 | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ | |
| //// [assignmentToVoidZero1.d.ts] | ||
| -export const x: 1; | ||
| -export const y: 2; | ||
| +export var y = exports.x = void 0; | ||
| +export var x = 1; | ||
| +export var y = 2; | ||
| +export {}; | ||
| +export declare var y: undefined; | ||
| +export declare var x: number; | ||
| +export declare var y: undefined; | ||
|
Comment on lines
+22
to
+24
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. Weird, we're taking the initial assignment for the type of these? 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.
|
||
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.
I saw this when trying to fix this crash too; definitely some weird widening interplay here
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.
Well, the old output was because the
KindCommonJSExportdeclaration was just being emitted as-is. :S That's why we had things likeexport var x = { x: "x" }in the output which just...isn't actually something we should ever have in a declaration file? And is an error?