--// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
--// TypeScript Version: 2.8
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.default = spected;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/spreadExpressionContextualTypeWithNamespace.js b/testdata/baselines/reference/submodule/compiler/spreadExpressionContextualTypeWithNamespace.js
index 132ae598ca..58620e049f 100644
--- a/testdata/baselines/reference/submodule/compiler/spreadExpressionContextualTypeWithNamespace.js
+++ b/testdata/baselines/reference/submodule/compiler/spreadExpressionContextualTypeWithNamespace.js
@@ -36,11 +36,11 @@ getStuff().exportedDirectly;
//// [spreadExpressionContextualTypeWithNamespace_0.js]
"use strict";
+// Repro from #44179 with some modification
Object.defineProperty(exports, "__esModule", { value: true });
exports.obj = exports.klass = void 0;
exports.func = func;
exports.exportedDirectly = exportedDirectly;
-// Repro from #44179 with some modification
function func() { }
class klass {
}
diff --git a/testdata/baselines/reference/submodule/compiler/spreadExpressionContextualTypeWithNamespace.js.diff b/testdata/baselines/reference/submodule/compiler/spreadExpressionContextualTypeWithNamespace.js.diff
index e22623ce91..c8f0893e6d 100644
--- a/testdata/baselines/reference/submodule/compiler/spreadExpressionContextualTypeWithNamespace.js.diff
+++ b/testdata/baselines/reference/submodule/compiler/spreadExpressionContextualTypeWithNamespace.js.diff
@@ -1,19 +1,6 @@
--- old.spreadExpressionContextualTypeWithNamespace.js
+++ new.spreadExpressionContextualTypeWithNamespace.js
-@@= skipped -35, +35 lines =@@
-
- //// [spreadExpressionContextualTypeWithNamespace_0.js]
- "use strict";
--// Repro from #44179 with some modification
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.obj = exports.klass = void 0;
- exports.func = func;
- exports.exportedDirectly = exportedDirectly;
-+// Repro from #44179 with some modification
- function func() { }
- class klass {
- }
-@@= skipped -26, +26 lines =@@
+@@= skipped -61, +61 lines =@@
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js
index 6d734ae2ed..7c518b3b9d 100644
--- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js
+++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js
@@ -15,6 +15,6 @@ const a: GlobalThing = { a: 0 };
//// [usage.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
///
+Object.defineProperty(exports, "__esModule", { value: true });
const a = { a: 0 };
diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js.diff b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js.diff
deleted file mode 100644
index 050a3b1053..0000000000
--- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js.diff
+++ /dev/null
@@ -1,10 +0,0 @@
---- old.tripleSlashTypesReferenceWithMissingExports(module=node16).js
-+++ new.tripleSlashTypesReferenceWithMissingExports(module=node16).js
-@@= skipped -14, +14 lines =@@
-
- //// [usage.js]
- "use strict";
--///
- Object.defineProperty(exports, "__esModule", { value: true });
-+///
- const a = { a: 0 };
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js
index 6d734ae2ed..7c518b3b9d 100644
--- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js
+++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js
@@ -15,6 +15,6 @@ const a: GlobalThing = { a: 0 };
//// [usage.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
///
+Object.defineProperty(exports, "__esModule", { value: true });
const a = { a: 0 };
diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js.diff b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js.diff
deleted file mode 100644
index 18ceeaf53b..0000000000
--- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js.diff
+++ /dev/null
@@ -1,10 +0,0 @@
---- old.tripleSlashTypesReferenceWithMissingExports(module=node20).js
-+++ new.tripleSlashTypesReferenceWithMissingExports(module=node20).js
-@@= skipped -14, +14 lines =@@
-
- //// [usage.js]
- "use strict";
--///
- Object.defineProperty(exports, "__esModule", { value: true });
-+///
- const a = { a: 0 };
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js
index 6d734ae2ed..7c518b3b9d 100644
--- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js
+++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js
@@ -15,6 +15,6 @@ const a: GlobalThing = { a: 0 };
//// [usage.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
///
+Object.defineProperty(exports, "__esModule", { value: true });
const a = { a: 0 };
diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js.diff
deleted file mode 100644
index 02147f9a60..0000000000
--- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js.diff
+++ /dev/null
@@ -1,10 +0,0 @@
---- old.tripleSlashTypesReferenceWithMissingExports(module=nodenext).js
-+++ new.tripleSlashTypesReferenceWithMissingExports(module=nodenext).js
-@@= skipped -14, +14 lines =@@
-
- //// [usage.js]
- "use strict";
--///
- Object.defineProperty(exports, "__esModule", { value: true });
-+///
- const a = { a: 0 };
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/tsxNotUsingApparentTypeOfSFC.js b/testdata/baselines/reference/submodule/compiler/tsxNotUsingApparentTypeOfSFC.js
index 37e3dbd216..86f61ddfe3 100644
--- a/testdata/baselines/reference/submodule/compiler/tsxNotUsingApparentTypeOfSFC.js
+++ b/testdata/baselines/reference/submodule/compiler/tsxNotUsingApparentTypeOfSFC.js
@@ -23,6 +23,7 @@ function test(wrappedProps: P) {
//// [tsxNotUsingApparentTypeOfSFC.js]
"use strict";
+///
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -38,7 +39,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-///
const react_1 = __importDefault(require("react"));
function test(wrappedProps) {
let MySFC = function (props) {
diff --git a/testdata/baselines/reference/submodule/compiler/tsxNotUsingApparentTypeOfSFC.js.diff b/testdata/baselines/reference/submodule/compiler/tsxNotUsingApparentTypeOfSFC.js.diff
index adaeb0ae16..46768e7061 100644
--- a/testdata/baselines/reference/submodule/compiler/tsxNotUsingApparentTypeOfSFC.js.diff
+++ b/testdata/baselines/reference/submodule/compiler/tsxNotUsingApparentTypeOfSFC.js.diff
@@ -1,19 +1,10 @@
--- old.tsxNotUsingApparentTypeOfSFC.js
+++ new.tsxNotUsingApparentTypeOfSFC.js
-@@= skipped -22, +22 lines =@@
-
- //// [tsxNotUsingApparentTypeOfSFC.js]
- "use strict";
--///
- var __assign = (this && this.__assign) || function () {
- __assign = Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
-@@= skipped -16, +15 lines =@@
+@@= skipped -38, +38 lines =@@
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-var react_1 = __importDefault(require("react"));
-+///
+const react_1 = __importDefault(require("react"));
function test(wrappedProps) {
let MySFC = function (props) {
diff --git a/testdata/baselines/reference/submodule/compiler/tsxReactPropsInferenceSucceedsOnIntersections.js b/testdata/baselines/reference/submodule/compiler/tsxReactPropsInferenceSucceedsOnIntersections.js
index 6a231bf839..238668914a 100644
--- a/testdata/baselines/reference/submodule/compiler/tsxReactPropsInferenceSucceedsOnIntersections.js
+++ b/testdata/baselines/reference/submodule/compiler/tsxReactPropsInferenceSucceedsOnIntersections.js
@@ -20,6 +20,7 @@ const CustomButton: React.SFC = props =>
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -35,6 +36,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-///
const react_1 = __importDefault(require("react"));
const CustomButton = props => react_1.default.createElement(Button, __assign({}, props));
diff --git a/testdata/baselines/reference/submodule/compiler/tsxReactPropsInferenceSucceedsOnIntersections.js.diff b/testdata/baselines/reference/submodule/compiler/tsxReactPropsInferenceSucceedsOnIntersections.js.diff
index 2ebcb90370..21a2dfd386 100644
--- a/testdata/baselines/reference/submodule/compiler/tsxReactPropsInferenceSucceedsOnIntersections.js.diff
+++ b/testdata/baselines/reference/submodule/compiler/tsxReactPropsInferenceSucceedsOnIntersections.js.diff
@@ -1,18 +1,9 @@
--- old.tsxReactPropsInferenceSucceedsOnIntersections.js
+++ new.tsxReactPropsInferenceSucceedsOnIntersections.js
-@@= skipped -19, +19 lines =@@
-
- //// [tsxReactPropsInferenceSucceedsOnIntersections.js]
- "use strict";
--///
- var __assign = (this && this.__assign) || function () {
- __assign = Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
-@@= skipped -16, +15 lines =@@
+@@= skipped -35, +35 lines =@@
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-var react_1 = __importDefault(require("react"));
-+///
+const react_1 = __importDefault(require("react"));
const CustomButton = props => react_1.default.createElement(Button, __assign({}, props));
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/tsxSpreadDoesNotReportExcessProps.js b/testdata/baselines/reference/submodule/compiler/tsxSpreadDoesNotReportExcessProps.js
index 586677a793..7f7e219d8c 100644
--- a/testdata/baselines/reference/submodule/compiler/tsxSpreadDoesNotReportExcessProps.js
+++ b/testdata/baselines/reference/submodule/compiler/tsxSpreadDoesNotReportExcessProps.js
@@ -14,6 +14,7 @@ class MyComponent extends React.Component<{dataSource: number[], onClick?: any},
//// [tsxSpreadDoesNotReportExcessProps.js]
"use strict";
+///
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -29,7 +30,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-///
const react_1 = __importDefault(require("react"));
class MyComponent extends react_1.default.Component {
render() {
diff --git a/testdata/baselines/reference/submodule/compiler/tsxSpreadDoesNotReportExcessProps.js.diff b/testdata/baselines/reference/submodule/compiler/tsxSpreadDoesNotReportExcessProps.js.diff
index 816cc15597..b3ceb982de 100644
--- a/testdata/baselines/reference/submodule/compiler/tsxSpreadDoesNotReportExcessProps.js.diff
+++ b/testdata/baselines/reference/submodule/compiler/tsxSpreadDoesNotReportExcessProps.js.diff
@@ -1,19 +1,10 @@
--- old.tsxSpreadDoesNotReportExcessProps.js
+++ new.tsxSpreadDoesNotReportExcessProps.js
-@@= skipped -13, +13 lines =@@
-
- //// [tsxSpreadDoesNotReportExcessProps.js]
- "use strict";
--///
- var __assign = (this && this.__assign) || function () {
- __assign = Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
-@@= skipped -16, +15 lines =@@
+@@= skipped -29, +29 lines =@@
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-var react_1 = __importDefault(require("react"));
-+///
+const react_1 = __importDefault(require("react"));
class MyComponent extends react_1.default.Component {
render() {
diff --git a/testdata/baselines/reference/submodule/compiler/tsxStatelessComponentDefaultProps.js b/testdata/baselines/reference/submodule/compiler/tsxStatelessComponentDefaultProps.js
index 98878f4580..ba0e2963cc 100644
--- a/testdata/baselines/reference/submodule/compiler/tsxStatelessComponentDefaultProps.js
+++ b/testdata/baselines/reference/submodule/compiler/tsxStatelessComponentDefaultProps.js
@@ -19,11 +19,11 @@ let a =
//// [tsxStatelessComponentDefaultProps.js]
"use strict";
+///
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-///
const react_1 = __importDefault(require("react"));
function BackButton(_props) {
return react_1.default.createElement("div", null);
diff --git a/testdata/baselines/reference/submodule/compiler/tsxStatelessComponentDefaultProps.js.diff b/testdata/baselines/reference/submodule/compiler/tsxStatelessComponentDefaultProps.js.diff
index d76b3ff591..6f9b23d252 100644
--- a/testdata/baselines/reference/submodule/compiler/tsxStatelessComponentDefaultProps.js.diff
+++ b/testdata/baselines/reference/submodule/compiler/tsxStatelessComponentDefaultProps.js.diff
@@ -1,16 +1,10 @@
--- old.tsxStatelessComponentDefaultProps.js
+++ new.tsxStatelessComponentDefaultProps.js
-@@= skipped -18, +18 lines =@@
-
- //// [tsxStatelessComponentDefaultProps.js]
- "use strict";
--///
- var __importDefault = (this && this.__importDefault) || function (mod) {
+@@= skipped -23, +23 lines =@@
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-var react_1 = __importDefault(require("react"));
-+///
+const react_1 = __importDefault(require("react"));
function BackButton(_props) {
return react_1.default.createElement("div", null);
diff --git a/testdata/baselines/reference/submodule/compiler/typePredicateInLoop.js b/testdata/baselines/reference/submodule/compiler/typePredicateInLoop.js
index d657daa82a..ef7caba8a4 100644
--- a/testdata/baselines/reference/submodule/compiler/typePredicateInLoop.js
+++ b/testdata/baselines/reference/submodule/compiler/typePredicateInLoop.js
@@ -25,6 +25,7 @@ export function y(arg: Type): void {
//// [typePredicateInLoop.js]
"use strict";
+// Repro from #12101
Object.defineProperty(exports, "__esModule", { value: true });
exports.y = y;
const guard = (arg) => arg.type === 1;
diff --git a/testdata/baselines/reference/submodule/compiler/typePredicateInLoop.js.diff b/testdata/baselines/reference/submodule/compiler/typePredicateInLoop.js.diff
deleted file mode 100644
index 2e27873425..0000000000
--- a/testdata/baselines/reference/submodule/compiler/typePredicateInLoop.js.diff
+++ /dev/null
@@ -1,10 +0,0 @@
---- old.typePredicateInLoop.js
-+++ new.typePredicateInLoop.js
-@@= skipped -24, +24 lines =@@
-
- //// [typePredicateInLoop.js]
- "use strict";
--// Repro from #12101
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.y = y;
- const guard = (arg) => arg.type === 1;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives7.js b/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives7.js
index cefc57834a..6bedc1b86e 100644
--- a/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives7.js
+++ b/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives7.js
@@ -14,9 +14,9 @@ export let y = () => x
//// [app.js]
"use strict";
+///
Object.defineProperty(exports, "__esModule", { value: true });
exports.y = exports.x = exports.$ = void 0;
-///
exports.$ = 1;
let y = () => exports.x;
exports.y = y;
diff --git a/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives7.js.diff b/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives7.js.diff
deleted file mode 100644
index 94902b00dd..0000000000
--- a/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives7.js.diff
+++ /dev/null
@@ -1,13 +0,0 @@
---- old.typeReferenceDirectives7.js
-+++ new.typeReferenceDirectives7.js
-@@= skipped -13, +13 lines =@@
-
- //// [app.js]
- "use strict";
--///
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.y = exports.x = exports.$ = void 0;
-+///
- exports.$ = 1;
- let y = () => exports.x;
- exports.y = y;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives9.js b/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives9.js
index 4329c39e2b..50d48c587a 100644
--- a/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives9.js
+++ b/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives9.js
@@ -41,8 +41,8 @@ class Cls {
exports.Cls = Cls;
//// [mod1.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
///
+Object.defineProperty(exports, "__esModule", { value: true });
const main_1 = require("./main");
main_1.Cls.prototype.foo = function () { return undefined; };
//// [mod2.js]
diff --git a/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives9.js.diff b/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives9.js.diff
index 3e3de03b42..c1ee095aab 100644
--- a/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives9.js.diff
+++ b/testdata/baselines/reference/submodule/compiler/typeReferenceDirectives9.js.diff
@@ -9,9 +9,8 @@
exports.Cls = Cls;
//// [mod1.js]
"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
///
--Object.defineProperty(exports, "__esModule", { value: true });
+ Object.defineProperty(exports, "__esModule", { value: true });
-var main_1 = require("./main");
+const main_1 = require("./main");
main_1.Cls.prototype.foo = function () { return undefined; };
diff --git a/testdata/baselines/reference/submodule/compiler/unwitnessedTypeParameterVariance.js b/testdata/baselines/reference/submodule/compiler/unwitnessedTypeParameterVariance.js
index 046a97e286..156765d6ff 100644
--- a/testdata/baselines/reference/submodule/compiler/unwitnessedTypeParameterVariance.js
+++ b/testdata/baselines/reference/submodule/compiler/unwitnessedTypeParameterVariance.js
@@ -28,6 +28,7 @@ b = a;
//// [unwitnessedTypeParameterVariance.js]
"use strict";
+// Repros from #33872
Object.defineProperty(exports, "__esModule", { value: true });
function foo() {
const unk = { read: (origin) => unk };
diff --git a/testdata/baselines/reference/submodule/compiler/unwitnessedTypeParameterVariance.js.diff b/testdata/baselines/reference/submodule/compiler/unwitnessedTypeParameterVariance.js.diff
deleted file mode 100644
index 4f2ad7bc64..0000000000
--- a/testdata/baselines/reference/submodule/compiler/unwitnessedTypeParameterVariance.js.diff
+++ /dev/null
@@ -1,10 +0,0 @@
---- old.unwitnessedTypeParameterVariance.js
-+++ new.unwitnessedTypeParameterVariance.js
-@@= skipped -27, +27 lines =@@
-
- //// [unwitnessedTypeParameterVariance.js]
- "use strict";
--// Repros from #33872
- Object.defineProperty(exports, "__esModule", { value: true });
- function foo() {
- const unk = { read: (origin) => unk };
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js b/testdata/baselines/reference/submodule/conformance/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js
index 1f1316eea5..8066fd7de6 100644
--- a/testdata/baselines/reference/submodule/conformance/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js
+++ b/testdata/baselines/reference/submodule/conformance/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js
@@ -16,6 +16,7 @@ declare module debugger {} // still an error
//// [ambientModuleDeclarationWithReservedIdentifierInDottedPath.js]
"use strict";
+// https://github.com/microsoft/TypeScript/issues/7840
Object.defineProperty(exports, "__esModule", { value: true });
exports.tabId = void 0;
exports.tabId = chrome.debugger.tabId;
diff --git a/testdata/baselines/reference/submodule/conformance/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js.diff b/testdata/baselines/reference/submodule/conformance/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js.diff
deleted file mode 100644
index e240c699c5..0000000000
--- a/testdata/baselines/reference/submodule/conformance/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js.diff
+++ /dev/null
@@ -1,10 +0,0 @@
---- old.ambientModuleDeclarationWithReservedIdentifierInDottedPath.js
-+++ new.ambientModuleDeclarationWithReservedIdentifierInDottedPath.js
-@@= skipped -15, +15 lines =@@
-
- //// [ambientModuleDeclarationWithReservedIdentifierInDottedPath.js]
- "use strict";
--// https://github.com/microsoft/TypeScript/issues/7840
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.tabId = void 0;
- exports.tabId = chrome.debugger.tabId;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.js b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.js
index b0320bf6dd..4f234c9ea6 100644
--- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.js
+++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.js
@@ -27,11 +27,11 @@ export const main = () => {
//// [assertionTypePredicates2.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.main = void 0;
/**
* @typedef {{ x: number }} A
*/
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.main = void 0;
/**
* @typedef { A & { y: number } } B
*/
diff --git a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.js.diff b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.js.diff
index ae9f8f494d..f1321522e7 100644
--- a/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/assertionTypePredicates2.js.diff
@@ -1,22 +1,6 @@
--- old.assertionTypePredicates2.js
+++ new.assertionTypePredicates2.js
-@@= skipped -26, +26 lines =@@
-
- //// [assertionTypePredicates2.js]
- "use strict";
--/**
-- * @typedef {{ x: number }} A
-- */
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.main = void 0;
- /**
-+ * @typedef {{ x: number }} A
-+ */
-+/**
- * @typedef { A & { y: number } } B
- */
- /**
-@@= skipped -13, +13 lines =@@
+@@= skipped -39, +39 lines =@@
* @returns { asserts a is B }
*/
const foo = (a) => {
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.js b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.js
index 51d60d049b..1924b560a8 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.js
+++ b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.js
@@ -14,13 +14,13 @@ var res = x('a', 'b')
//// [callbackTagVariadicType.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.x = void 0;
/**
* @callback Foo
* @param {...string} args
* @returns {number}
*/
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.x = void 0;
/** @type {Foo} */
const x = () => 1;
exports.x = x;
diff --git a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.js.diff b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.js.diff
index ffc9fed256..49e5de167f 100644
--- a/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/callbackTagVariadicType.js.diff
@@ -1,25 +1,6 @@
--- old.callbackTagVariadicType.js
+++ new.callbackTagVariadicType.js
-@@= skipped -13, +13 lines =@@
-
- //// [callbackTagVariadicType.js]
- "use strict";
--/**
-- * @callback Foo
-- * @param {...string} args
-- * @returns {number}
-- */
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.x = void 0;
-+/**
-+ * @callback Foo
-+ * @param {...string} args
-+ * @returns {number}
-+ */
- /** @type {Foo} */
- const x = () => 1;
- exports.x = x;
-@@= skipped -14, +14 lines =@@
+@@= skipped -27, +27 lines =@@
//// [callbackTagVariadicType.d.ts]
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.js b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.js
index 89a04a9d59..f57ff9964e 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.js
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.js
@@ -16,8 +16,8 @@ const myString = 'str';
//// [0.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
// @ts-check
+Object.defineProperty(exports, "__esModule", { value: true });
var exports = {};
/**
* @typedef {string}
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.js.diff b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.js.diff
index c8f32fd793..204fcaef6a 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.js.diff
@@ -5,7 +5,8 @@
//// [0.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
// @ts-check
++Object.defineProperty(exports, "__esModule", { value: true });
var exports = {};
- /**
\ No newline at end of file
+ /**
+ * @typedef {string}
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js
index 71b865abce..a8e9ea62af 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js
+++ b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js
@@ -25,11 +25,11 @@ const testErr =
//// [checkJsxChildrenCanBeTupleType.js]
"use strict";
+///
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-///
const react_1 = __importDefault(require("react"));
class ResizablePanel extends react_1.default.Component {
}
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff
index 50f0de8e3c..4692b199e4 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff
@@ -1,16 +1,10 @@
--- old.checkJsxChildrenCanBeTupleType.js
+++ new.checkJsxChildrenCanBeTupleType.js
-@@= skipped -24, +24 lines =@@
-
- //// [checkJsxChildrenCanBeTupleType.js]
- "use strict";
--///
- var __importDefault = (this && this.__importDefault) || function (mod) {
+@@= skipped -29, +29 lines =@@
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-var react_1 = __importDefault(require("react"));
-+///
+const react_1 = __importDefault(require("react"));
class ResizablePanel extends react_1.default.Component {
}
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsxUnionSFXContextualTypeInferredCorrectly.js b/testdata/baselines/reference/submodule/conformance/checkJsxUnionSFXContextualTypeInferredCorrectly.js
index 7942e3828e..2e0af15548 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsxUnionSFXContextualTypeInferredCorrectly.js
+++ b/testdata/baselines/reference/submodule/conformance/checkJsxUnionSFXContextualTypeInferredCorrectly.js
@@ -42,13 +42,13 @@ ComponentWithUnion({
//// [checkJsxUnionSFXContextualTypeInferredCorrectly.js]
"use strict";
+///
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComponentWithUnion = ComponentWithUnion;
exports.HereIsTheError = HereIsTheError;
-///
const react_1 = __importDefault(require("react"));
function ComponentWithUnion(props) {
return react_1.default.createElement("h1", null);
diff --git a/testdata/baselines/reference/submodule/conformance/checkJsxUnionSFXContextualTypeInferredCorrectly.js.diff b/testdata/baselines/reference/submodule/conformance/checkJsxUnionSFXContextualTypeInferredCorrectly.js.diff
index 7a90de352c..337f068694 100644
--- a/testdata/baselines/reference/submodule/conformance/checkJsxUnionSFXContextualTypeInferredCorrectly.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/checkJsxUnionSFXContextualTypeInferredCorrectly.js.diff
@@ -1,18 +1,10 @@
--- old.checkJsxUnionSFXContextualTypeInferredCorrectly.js
+++ new.checkJsxUnionSFXContextualTypeInferredCorrectly.js
-@@= skipped -41, +41 lines =@@
-
- //// [checkJsxUnionSFXContextualTypeInferredCorrectly.js]
- "use strict";
--///
- var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
- };
+@@= skipped -48, +48 lines =@@
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComponentWithUnion = ComponentWithUnion;
exports.HereIsTheError = HereIsTheError;
-var react_1 = __importDefault(require("react"));
-+///
+const react_1 = __importDefault(require("react"));
function ComponentWithUnion(props) {
return react_1.default.createElement("h1", null);
diff --git a/testdata/baselines/reference/submodule/conformance/exportNonInitializedVariablesInIfThenStatementNoCrash1(module=commonjs).js b/testdata/baselines/reference/submodule/conformance/exportNonInitializedVariablesInIfThenStatementNoCrash1(module=commonjs).js
index d8e44f30fb..548cee9657 100644
--- a/testdata/baselines/reference/submodule/conformance/exportNonInitializedVariablesInIfThenStatementNoCrash1(module=commonjs).js
+++ b/testdata/baselines/reference/submodule/conformance/exportNonInitializedVariablesInIfThenStatementNoCrash1(module=commonjs).js
@@ -10,8 +10,8 @@ export default cssExports;
//// [exportNonInitializedVariablesInIfThenStatementNoCrash1.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
// https://github.com/microsoft/TypeScript/issues/59373
+Object.defineProperty(exports, "__esModule", { value: true });
if (true)
export const cssExports;
exports.default = exports.cssExports;
diff --git a/testdata/baselines/reference/submodule/conformance/exportNonInitializedVariablesInIfThenStatementNoCrash1(module=commonjs).js.diff b/testdata/baselines/reference/submodule/conformance/exportNonInitializedVariablesInIfThenStatementNoCrash1(module=commonjs).js.diff
index b126feb050..1027ff3f41 100644
--- a/testdata/baselines/reference/submodule/conformance/exportNonInitializedVariablesInIfThenStatementNoCrash1(module=commonjs).js.diff
+++ b/testdata/baselines/reference/submodule/conformance/exportNonInitializedVariablesInIfThenStatementNoCrash1(module=commonjs).js.diff
@@ -1,13 +1,10 @@
--- old.exportNonInitializedVariablesInIfThenStatementNoCrash1(module=commonjs).js
+++ new.exportNonInitializedVariablesInIfThenStatementNoCrash1(module=commonjs).js
-@@= skipped -9, +9 lines =@@
-
- //// [exportNonInitializedVariablesInIfThenStatementNoCrash1.js]
+@@= skipped -11, +11 lines =@@
"use strict";
--// https://github.com/microsoft/TypeScript/issues/59373
+ // https://github.com/microsoft/TypeScript/issues/59373
Object.defineProperty(exports, "__esModule", { value: true });
-if (true) { }
-+// https://github.com/microsoft/TypeScript/issues/59373
+if (true)
+ export const cssExports;
exports.default = exports.cssExports;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/inferTypes2.js b/testdata/baselines/reference/submodule/conformance/inferTypes2.js
index 97a645fed3..92a0c0a9d9 100644
--- a/testdata/baselines/reference/submodule/conformance/inferTypes2.js
+++ b/testdata/baselines/reference/submodule/conformance/inferTypes2.js
@@ -26,6 +26,7 @@ const b: string = a;
//// [inferTypes2.js]
"use strict";
+// Repros from #22755
Object.defineProperty(exports, "__esModule", { value: true });
exports.bar = bar;
exports.bar2 = bar2;
diff --git a/testdata/baselines/reference/submodule/conformance/inferTypes2.js.diff b/testdata/baselines/reference/submodule/conformance/inferTypes2.js.diff
deleted file mode 100644
index 5b8076441a..0000000000
--- a/testdata/baselines/reference/submodule/conformance/inferTypes2.js.diff
+++ /dev/null
@@ -1,10 +0,0 @@
---- old.inferTypes2.js
-+++ new.inferTypes2.js
-@@= skipped -25, +25 lines =@@
-
- //// [inferTypes2.js]
- "use strict";
--// Repros from #22755
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.bar = bar;
- exports.bar2 = bar2;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassesErr.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassesErr.js
index c46d6df296..5f71b46f20 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassesErr.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassesErr.js
@@ -74,10 +74,10 @@ export class CC extends Y {
//// [index.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.CC = exports.BB = exports.AA = exports.Z = exports.Y = exports.X = exports.W = exports.V = exports.U = exports.T = exports.S = exports.R = exports.Q = exports.P = exports.O = exports.N = exports.M = void 0;
// Pretty much all of this should be an error, (since index signatures and generics are forbidden in js),
// but we should be able to synthesize declarations from the symbols regardless
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.CC = exports.BB = exports.AA = exports.Z = exports.Y = exports.X = exports.W = exports.V = exports.U = exports.T = exports.S = exports.R = exports.Q = exports.P = exports.O = exports.N = exports.M = void 0;
class M {
field;
}
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassesErr.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassesErr.js.diff
index 3aedd4a7cd..a1e02ba0e2 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassesErr.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassesErr.js.diff
@@ -1,15 +1,8 @@
--- old.jsDeclarationsClassesErr.js
+++ new.jsDeclarationsClassesErr.js
-@@= skipped -73, +73 lines =@@
-
- //// [index.js]
- "use strict";
--// Pretty much all of this should be an error, (since index signatures and generics are forbidden in js),
--// but we should be able to synthesize declarations from the symbols regardless
+@@= skipped -78, +78 lines =@@
Object.defineProperty(exports, "__esModule", { value: true });
exports.CC = exports.BB = exports.AA = exports.Z = exports.Y = exports.X = exports.W = exports.V = exports.U = exports.T = exports.S = exports.R = exports.Q = exports.P = exports.O = exports.N = exports.M = void 0;
-+// Pretty much all of this should be an error, (since index signatures and generics are forbidden in js),
-+// but we should be able to synthesize declarations from the symbols regardless
class M {
+ field;
}
@@ -19,7 +12,7 @@
}
exports.N = N;
class O {
-@@= skipped -58, +60 lines =@@
+@@= skipped -53, +55 lines =@@
//// [index.d.ts]
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js
index c74cd87722..dbea11647a 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js
@@ -66,10 +66,10 @@ export const enum L {
//// [index.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.K = exports.I = exports.H = exports.G = exports.F = exports.FF = exports.EE = exports.E = exports.D = exports.C = exports.B = exports.A = void 0;
// Pretty much all of this should be an error, (since enums are forbidden in js),
// but we should be able to synthesize declarations from the symbols regardless
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.K = exports.I = exports.H = exports.G = exports.F = exports.FF = exports.EE = exports.E = exports.D = exports.C = exports.B = exports.A = void 0;
var A;
(function (A) {
})(A || (exports.A = A = {}));
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js.diff
index d4d5c20022..2eb52d8400 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsEnums.js.diff
@@ -1,19 +1,6 @@
--- old.jsDeclarationsEnums.js
+++ new.jsDeclarationsEnums.js
-@@= skipped -65, +65 lines =@@
-
- //// [index.js]
- "use strict";
--// Pretty much all of this should be an error, (since enums are forbidden in js),
--// but we should be able to synthesize declarations from the symbols regardless
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.K = exports.I = exports.H = exports.G = exports.F = exports.FF = exports.EE = exports.E = exports.D = exports.C = exports.B = exports.A = void 0;
-+// Pretty much all of this should be an error, (since enums are forbidden in js),
-+// but we should be able to synthesize declarations from the symbols regardless
- var A;
- (function (A) {
- })(A || (exports.A = A = {}));
-@@= skipped -51, +51 lines =@@
+@@= skipped -116, +116 lines =@@
//// [index.d.ts]
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js
index 479a6ab822..5071fd6ee4 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js
@@ -82,7 +82,6 @@ export = Timer;
module.exports = Timer;
//// [context.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/**
* Imports
*
@@ -90,6 +89,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
* @typedef {import("./hook")} Hook
* @typedef {import("./hook").HookHandler} HookHandler
*/
+Object.defineProperty(exports, "__esModule", { value: true });
/**
* Input type definition
*
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff
index f4d945f527..aa963d9301 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff
@@ -8,11 +8,18 @@
module.exports = Timer;
//// [context.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/**
* Imports
*
-@@= skipped -45, +48 lines =@@
+@@= skipped -9, +11 lines =@@
+ * @typedef {import("./hook")} Hook
+ * @typedef {import("./hook").HookHandler} HookHandler
+ */
++Object.defineProperty(exports, "__esModule", { value: true });
+ /**
+ * Input type definition
+ *
+@@= skipped -36, +37 lines =@@
return input;
}
};
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsInterfaces.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsInterfaces.js
index 8bb2c92af5..b609fac5ca 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsInterfaces.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsInterfaces.js
@@ -123,6 +123,8 @@ export interface CC extends Y {
//// [index.js]
"use strict";
+// Pretty much all of this should be an error, (since interfaces are forbidden in js),
+// but we should be able to synthesize declarations from the symbols regardless
Object.defineProperty(exports, "__esModule", { value: true });
exports.JJ = exports.II = exports.H = exports.G = void 0;
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsInterfaces.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsInterfaces.js.diff
index d8c960d73e..fbb4794d4c 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsInterfaces.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsInterfaces.js.diff
@@ -1,17 +1,14 @@
--- old.jsDeclarationsInterfaces.js
+++ new.jsDeclarationsInterfaces.js
-@@= skipped -122, +122 lines =@@
-
- //// [index.js]
- "use strict";
--// Pretty much all of this should be an error, (since interfaces are forbidden in js),
--// but we should be able to synthesize declarations from the symbols regardless
+@@= skipped -125, +125 lines =@@
+ // Pretty much all of this should be an error, (since interfaces are forbidden in js),
+ // but we should be able to synthesize declarations from the symbols regardless
Object.defineProperty(exports, "__esModule", { value: true });
+exports.JJ = exports.II = exports.H = exports.G = void 0;
//// [index.d.ts]
-@@= skipped -12, +11 lines =@@
+@@= skipped -9, +10 lines =@@
cat: string;
}
export interface C {
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.js
index 1dca157bd6..c92bd9bc18 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.js
@@ -16,8 +16,8 @@ module.exports.A.B = {
//// [index.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
///
+Object.defineProperty(exports, "__esModule", { value: true });
const Something = require("fs").Something;
export var A = {};
module.exports.A = {};
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.js.diff
index bfcbf6de4d..2a594e8114 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences3.js.diff
@@ -5,8 +5,8 @@
//// [index.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
///
++Object.defineProperty(exports, "__esModule", { value: true });
const Something = require("fs").Something;
+export var A = {};
module.exports.A = {};
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js
index 4d67274d17..941ec07389 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js
@@ -36,10 +36,10 @@ module.exports = {
//// [conn.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/**
* @typedef {string | number} Whatever
*/
+Object.defineProperty(exports, "__esModule", { value: true });
class Conn {
constructor() { }
item = 3;
@@ -49,10 +49,10 @@ export = Conn;
module.exports = Conn;
//// [usage.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/**
* @typedef {import("./conn")} Conn
*/
+Object.defineProperty(exports, "__esModule", { value: true });
class Wrap {
/**
* @param {Conn} c
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff
index e597ed2ed7..ffecfbc9fc 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff
@@ -5,10 +5,10 @@
//// [conn.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/**
* @typedef {string | number} Whatever
*/
++Object.defineProperty(exports, "__esModule", { value: true });
class Conn {
- constructor() {
- this.item = 3;
@@ -21,10 +21,13 @@
module.exports = Conn;
//// [usage.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/**
* @typedef {import("./conn")} Conn
*/
++Object.defineProperty(exports, "__esModule", { value: true });
+ class Wrap {
+ /**
+ * @param {Conn} c
@@= skipped -30, +34 lines =@@
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefDescriptionsPreserved.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefDescriptionsPreserved.js
index 581befda80..da2885f04b 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefDescriptionsPreserved.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefDescriptionsPreserved.js
@@ -20,13 +20,13 @@
//// [index.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/**
* Options for Foo <------------
* @typedef {Object} FooOptions
* @property {boolean} bar - Marvin K Mooney
* @property {string} baz - Sylvester McMonkey McBean
*/
+Object.defineProperty(exports, "__esModule", { value: true });
/**
* Multiline
* Options
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefDescriptionsPreserved.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefDescriptionsPreserved.js.diff
index 006d84c0c1..7f87515e4a 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefDescriptionsPreserved.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefDescriptionsPreserved.js.diff
@@ -5,10 +5,16 @@
//// [index.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/**
* Options for Foo <------------
* @typedef {Object} FooOptions
+ * @property {boolean} bar - Marvin K Mooney
+ * @property {string} baz - Sylvester McMonkey McBean
+ */
++Object.defineProperty(exports, "__esModule", { value: true });
+ /**
+ * Multiline
+ * Options
@@= skipped -17, +19 lines =@@
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js
index 3bef7dea8d..f4b0ef085b 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js
@@ -56,8 +56,8 @@ module.exports = MainThreadTasks;
//// [module.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */
+Object.defineProperty(exports, "__esModule", { value: true });
/**
* @typedef TaskGroup
* @property {TaskGroupIds} id
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js.diff
index 014dd8fd76..b59c4ac50f 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js.diff
@@ -5,10 +5,11 @@
//// [module.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */
++Object.defineProperty(exports, "__esModule", { value: true });
/**
* @typedef TaskGroup
+ * @property {TaskGroupIds} id
@@= skipped -27, +29 lines =@@
taskNameToGroup,
};
diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.js b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.js
index c7b444b44c..8990c7b84e 100644
--- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.js
+++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.js
@@ -70,11 +70,11 @@ function f3(a, b) {}
//// [file.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/**
* @template {string | number} [T=string] - ok: defaults are permitted
* @typedef {[T]} A
*/
+Object.defineProperty(exports, "__esModule", { value: true });
/** @type {A} */ // ok, default for `T` in `A` is `string`
const aDefault1 = [""];
/** @type {A} */ // error: `number` is not assignable to string`
diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.js.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.js.diff
index 7fe14aa992..1e29dc647c 100644
--- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.js.diff
@@ -5,10 +5,14 @@
//// [file.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/**
* @template {string | number} [T=string] - ok: defaults are permitted
* @typedef {[T]} A
+ */
++Object.defineProperty(exports, "__esModule", { value: true });
+ /** @type {A} */ // ok, default for `T` in `A` is `string`
+ const aDefault1 = [""];
+ /** @type {A} */ // error: `number` is not assignable to string`
@@= skipped -59, +61 lines =@@
diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.js b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.js
index f607f63de7..b1ec65bfd4 100644
--- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.js
+++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.js
@@ -14,12 +14,12 @@ const y = "a";
//// [file.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/**
* @template T
* @template {keyof T} K
* @typedef {T[K]} Foo
*/
+Object.defineProperty(exports, "__esModule", { value: true });
const x = { a: 1 };
/** @type {Foo} */
const y = "a";
diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.js.diff b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.js.diff
index 5b6477fc9e..2c21894ea1 100644
--- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagNameResolution.js.diff
@@ -5,11 +5,15 @@
//// [file.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/**
* @template T
* @template {keyof T} K
-@@= skipped -11, +13 lines =@@
+ * @typedef {T[K]} Foo
+ */
++Object.defineProperty(exports, "__esModule", { value: true });
+ const x = { a: 1 };
+ /** @type {Foo} */
+ const y = "a";
//// [file.d.ts]
diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.js b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.js
index 0fd26701c0..b11f60405c 100644
--- a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.js
+++ b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.js
@@ -26,9 +26,9 @@ export class ParseThemeData {
//// [labeledStatementDeclarationListInLoopNoCrash3.js]
"use strict";
+// https://github.com/microsoft/TypeScript/issues/59345
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParseThemeData = void 0;
-// https://github.com/microsoft/TypeScript/issues/59345
class ParseThemeData {
parseButton(button) {
const { type, size } = button;
diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.js.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.js.diff
deleted file mode 100644
index af5a1af0b9..0000000000
--- a/testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.js.diff
+++ /dev/null
@@ -1,13 +0,0 @@
---- old.labeledStatementDeclarationListInLoopNoCrash3.js
-+++ new.labeledStatementDeclarationListInLoopNoCrash3.js
-@@= skipped -25, +25 lines =@@
-
- //// [labeledStatementDeclarationListInLoopNoCrash3.js]
- "use strict";
--// https://github.com/microsoft/TypeScript/issues/59345
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.ParseThemeData = void 0;
-+// https://github.com/microsoft/TypeScript/issues/59345
- class ParseThemeData {
- parseButton(button) {
- const { type, size } = button;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).js b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).js
index c5f2c973c7..64070959f9 100644
--- a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).js
+++ b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).js
@@ -10,6 +10,7 @@ export const title: string
//// [labeledStatementExportDeclarationNoCrash1.js]
"use strict";
+// https://github.com/microsoft/TypeScript/issues/59372
Object.defineProperty(exports, "__esModule", { value: true });
exports.box = void 0;
subTitle: export const title;
diff --git a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).js.diff b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).js.diff
index 732d020a88..43fc150a8f 100644
--- a/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).js.diff
+++ b/testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).js.diff
@@ -1,10 +1,7 @@
--- old.labeledStatementExportDeclarationNoCrash1(module=commonjs).js
+++ new.labeledStatementExportDeclarationNoCrash1(module=commonjs).js
-@@= skipped -9, +9 lines =@@
-
- //// [labeledStatementExportDeclarationNoCrash1.js]
- "use strict";
--// https://github.com/microsoft/TypeScript/issues/59372
+@@= skipped -12, +12 lines =@@
+ // https://github.com/microsoft/TypeScript/issues/59372
Object.defineProperty(exports, "__esModule", { value: true });
exports.box = void 0;
-subTitle: ;
diff --git a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.js b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.js
index 7a000f6c35..418c3c99bb 100644
--- a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.js
+++ b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.js
@@ -29,13 +29,13 @@ var see3 = true
//// [linkTagEmit1.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/** @typedef {number} N */
/**
* @typedef {Object} D1
* @property {1} e Just link to {@link NS.R} this time
* @property {1} m Wyatt Earp loved {@link N integers} I bet.
*/
+Object.defineProperty(exports, "__esModule", { value: true });
/** @typedef {number} Z @see N {@link N} */
/**
* @param {number} integer {@link Z}
diff --git a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.js.diff b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.js.diff
index 3b0ca7cf6a..1c7f6a73da 100644
--- a/testdata/baselines/reference/submodule/conformance/linkTagEmit1.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/linkTagEmit1.js.diff
@@ -5,10 +5,16 @@
//// [linkTagEmit1.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/** @typedef {number} N */
/**
* @typedef {Object} D1
+ * @property {1} e Just link to {@link NS.R} this time
+ * @property {1} m Wyatt Earp loved {@link N integers} I bet.
+ */
++Object.defineProperty(exports, "__esModule", { value: true });
+ /** @typedef {number} Z @see N {@link N} */
+ /**
+ * @param {number} integer {@link Z}
@@= skipped -19, +21 lines =@@
diff --git a/testdata/baselines/reference/submodule/conformance/literalTypeWidening.js b/testdata/baselines/reference/submodule/conformance/literalTypeWidening.js
index 4946011c78..461b4b0efe 100644
--- a/testdata/baselines/reference/submodule/conformance/literalTypeWidening.js
+++ b/testdata/baselines/reference/submodule/conformance/literalTypeWidening.js
@@ -148,6 +148,7 @@ const b: E.A = a;
//// [literalTypeWidening.js]
"use strict";
+// Widening vs. non-widening literal types
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -174,7 +175,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.langCodes = void 0;
exports.Set = Set;
exports.keys = keys;
-// Widening vs. non-widening literal types
function f1() {
const c1 = "hello"; // Widening type "hello"
let v1 = c1; // Type string
diff --git a/testdata/baselines/reference/submodule/conformance/literalTypeWidening.js.diff b/testdata/baselines/reference/submodule/conformance/literalTypeWidening.js.diff
deleted file mode 100644
index 3a211fb855..0000000000
--- a/testdata/baselines/reference/submodule/conformance/literalTypeWidening.js.diff
+++ /dev/null
@@ -1,18 +0,0 @@
---- old.literalTypeWidening.js
-+++ new.literalTypeWidening.js
-@@= skipped -147, +147 lines =@@
-
- //// [literalTypeWidening.js]
- "use strict";
--// Widening vs. non-widening literal types
- var __assign = (this && this.__assign) || function () {
- __assign = Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
-@@= skipped -27, +26 lines =@@
- exports.langCodes = void 0;
- exports.Set = Set;
- exports.keys = keys;
-+// Widening vs. non-widening literal types
- function f1() {
- const c1 = "hello"; // Widening type "hello"
- let v1 = c1; // Type string
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/nonPrimitiveAndEmptyObject.js b/testdata/baselines/reference/submodule/conformance/nonPrimitiveAndEmptyObject.js
index 9fc3f29fb3..9abdc835d0 100644
--- a/testdata/baselines/reference/submodule/conformance/nonPrimitiveAndEmptyObject.js
+++ b/testdata/baselines/reference/submodule/conformance/nonPrimitiveAndEmptyObject.js
@@ -19,6 +19,7 @@ fooProps.barProp;
//// [nonPrimitiveAndEmptyObject.js]
"use strict";
+// Repro from #49480
Object.defineProperty(exports, "__esModule", { value: true });
const { fooProps = {} } = foo;
fooProps.barProp;
diff --git a/testdata/baselines/reference/submodule/conformance/nonPrimitiveAndEmptyObject.js.diff b/testdata/baselines/reference/submodule/conformance/nonPrimitiveAndEmptyObject.js.diff
deleted file mode 100644
index 37c126bde1..0000000000
--- a/testdata/baselines/reference/submodule/conformance/nonPrimitiveAndEmptyObject.js.diff
+++ /dev/null
@@ -1,10 +0,0 @@
---- old.nonPrimitiveAndEmptyObject.js
-+++ new.nonPrimitiveAndEmptyObject.js
-@@= skipped -18, +18 lines =@@
-
- //// [nonPrimitiveAndEmptyObject.js]
- "use strict";
--// Repro from #49480
- Object.defineProperty(exports, "__esModule", { value: true });
- const { fooProps = {} } = foo;
- fooProps.barProp;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/recursiveMappedTypes.js b/testdata/baselines/reference/submodule/conformance/recursiveMappedTypes.js
index 11ab3176df..c4bc8600c4 100644
--- a/testdata/baselines/reference/submodule/conformance/recursiveMappedTypes.js
+++ b/testdata/baselines/reference/submodule/conformance/recursiveMappedTypes.js
@@ -96,6 +96,7 @@ export type Foo = T extends { [P in infer E]: any } ? E : never;
//// [recursiveMappedTypes.js]
"use strict";
+// Recursive mapped types simply appear empty
Object.defineProperty(exports, "__esModule", { value: true });
function foo(arg) {
return arg;
diff --git a/testdata/baselines/reference/submodule/conformance/recursiveMappedTypes.js.diff b/testdata/baselines/reference/submodule/conformance/recursiveMappedTypes.js.diff
deleted file mode 100644
index 31d84e94fc..0000000000
--- a/testdata/baselines/reference/submodule/conformance/recursiveMappedTypes.js.diff
+++ /dev/null
@@ -1,10 +0,0 @@
---- old.recursiveMappedTypes.js
-+++ new.recursiveMappedTypes.js
-@@= skipped -95, +95 lines =@@
-
- //// [recursiveMappedTypes.js]
- "use strict";
--// Recursive mapped types simply appear empty
- Object.defineProperty(exports, "__esModule", { value: true });
- function foo(arg) {
- return arg;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.js b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.js
index c2658b7dd0..1392fe1384 100644
--- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.js
+++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.js
@@ -30,10 +30,10 @@ const p = {};
//// [bug39372.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/** @typedef {ReadonlyArray} JsonArray */
/** @typedef {{ readonly [key: string]: Json }} JsonRecord */
/** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */
+Object.defineProperty(exports, "__esModule", { value: true });
/**
* @template T
* @typedef {{
diff --git a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.js.diff b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.js.diff
index 6bb913f83a..5d0a68e739 100644
--- a/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/recursiveTypeReferences2.js.diff
@@ -5,10 +5,13 @@
//// [bug39372.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/** @typedef {ReadonlyArray} JsonArray */
/** @typedef {{ readonly [key: string]: Json }} JsonRecord */
/** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */
++Object.defineProperty(exports, "__esModule", { value: true });
+ /**
+ * @template T
+ * @typedef {{
@@= skipped -26, +28 lines =@@
diff --git a/testdata/baselines/reference/submodule/conformance/seeTag4.js b/testdata/baselines/reference/submodule/conformance/seeTag4.js
index 612845bfd1..e53677805e 100644
--- a/testdata/baselines/reference/submodule/conformance/seeTag4.js
+++ b/testdata/baselines/reference/submodule/conformance/seeTag4.js
@@ -15,10 +15,10 @@ let foo;
//// [seeTag4.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/**
* @typedef {any} A
*/
+Object.defineProperty(exports, "__esModule", { value: true });
/**
* @see {@link A}
* @see {@linkcode A}
diff --git a/testdata/baselines/reference/submodule/conformance/seeTag4.js.diff b/testdata/baselines/reference/submodule/conformance/seeTag4.js.diff
index e1e02ca84b..f9f736b961 100644
--- a/testdata/baselines/reference/submodule/conformance/seeTag4.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/seeTag4.js.diff
@@ -5,7 +5,10 @@
//// [seeTag4.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/**
* @typedef {any} A
- */
\ No newline at end of file
+ */
++Object.defineProperty(exports, "__esModule", { value: true });
+ /**
+ * @see {@link A}
+ * @see {@linkcode A}
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes1.js b/testdata/baselines/reference/submodule/conformance/templateLiteralTypes1.js
index f3c59f192d..3185943d3a 100644
--- a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes1.js
+++ b/testdata/baselines/reference/submodule/conformance/templateLiteralTypes1.js
@@ -259,8 +259,8 @@ const test1: SpacingShorthand = "0 0 0";
//// [templateLiteralTypes1.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
// Template types example from #12754
+Object.defineProperty(exports, "__esModule", { value: true });
const createScopedActionType = (scope) => (type) => `${scope}/${type}`;
const createActionInMyScope = createScopedActionType("MyScope"); // (type: T) => `MyScope/${T}`
const MY_ACTION = createActionInMyScope("MY_ACTION"); // 'MyScope/MY_ACTION'
diff --git a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes1.js.diff b/testdata/baselines/reference/submodule/conformance/templateLiteralTypes1.js.diff
deleted file mode 100644
index b058b3edad..0000000000
--- a/testdata/baselines/reference/submodule/conformance/templateLiteralTypes1.js.diff
+++ /dev/null
@@ -1,12 +0,0 @@
---- old.templateLiteralTypes1.js
-+++ new.templateLiteralTypes1.js
-@@= skipped -258, +258 lines =@@
-
- //// [templateLiteralTypes1.js]
- "use strict";
--// Template types example from #12754
- Object.defineProperty(exports, "__esModule", { value: true });
-+// Template types example from #12754
- const createScopedActionType = (scope) => (type) => `${scope}/${type}`;
- const createActionInMyScope = createScopedActionType("MyScope"); // (type: T) => `MyScope/${T}`
- const MY_ACTION = createActionInMyScope("MY_ACTION"); // 'MyScope/MY_ACTION'
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescript.js b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescript.js
index 7f4c10b98e..5ddf2aa3c7 100644
--- a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescript.js
+++ b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescript.js
@@ -16,9 +16,9 @@ export class Bet implements Aleph {
//// [file.js]
"use strict";
+// @ts-nocheck
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bet = exports.a = void 0;
-// @ts-nocheck
exports.a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment
class Bet {
q = "lol"; // And so will this implements error
diff --git a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescript.js.diff b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescript.js.diff
index 5d67fbc164..64df3c68a5 100644
--- a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescript.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescript.js.diff
@@ -1,13 +1,7 @@
--- old.tsNoCheckForTypescript.js
+++ new.tsNoCheckForTypescript.js
-@@= skipped -15, +15 lines =@@
-
- //// [file.js]
- "use strict";
--// @ts-nocheck
- Object.defineProperty(exports, "__esModule", { value: true });
+@@= skipped -20, +20 lines =@@
exports.Bet = exports.a = void 0;
-+// @ts-nocheck
exports.a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment
class Bet {
- constructor() {
diff --git a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments1.js b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments1.js
index 248fb75544..a3e223edaf 100644
--- a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments1.js
+++ b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments1.js
@@ -16,9 +16,9 @@ export class Bet implements Aleph {
//// [file.js]
"use strict";
+// @ts-nocheck additional comments
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bet = exports.a = void 0;
-// @ts-nocheck additional comments
exports.a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment
class Bet {
q = 'lol'; // And so will this implements error
diff --git a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments1.js.diff b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments1.js.diff
index d859c333f5..0dc5d4fb2b 100644
--- a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments1.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments1.js.diff
@@ -1,13 +1,7 @@
--- old.tsNoCheckForTypescriptComments1.js
+++ new.tsNoCheckForTypescriptComments1.js
-@@= skipped -15, +15 lines =@@
-
- //// [file.js]
- "use strict";
--// @ts-nocheck additional comments
- Object.defineProperty(exports, "__esModule", { value: true });
+@@= skipped -20, +20 lines =@@
exports.Bet = exports.a = void 0;
-+// @ts-nocheck additional comments
exports.a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment
class Bet {
- constructor() {
diff --git a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments2.js b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments2.js
index 73ef57b95c..c7b173e0be 100644
--- a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments2.js
+++ b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments2.js
@@ -16,9 +16,9 @@ export class Bet implements Aleph {
//// [file.js]
"use strict";
+// @ts-nocheck: additional comments
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bet = exports.a = void 0;
-// @ts-nocheck: additional comments
exports.a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment
class Bet {
q = "lol"; // And so will this implements error
diff --git a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments2.js.diff b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments2.js.diff
index 2d2b27a026..e8e46482d2 100644
--- a/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments2.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/tsNoCheckForTypescriptComments2.js.diff
@@ -1,13 +1,7 @@
--- old.tsNoCheckForTypescriptComments2.js
+++ new.tsNoCheckForTypescriptComments2.js
-@@= skipped -15, +15 lines =@@
-
- //// [file.js]
- "use strict";
--// @ts-nocheck: additional comments
- Object.defineProperty(exports, "__esModule", { value: true });
+@@= skipped -20, +20 lines =@@
exports.Bet = exports.a = void 0;
-+// @ts-nocheck: additional comments
exports.a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment
class Bet {
- constructor() {
diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentWithExport.js b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentWithExport.js
index 8364e13a35..0d66eab407 100644
--- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentWithExport.js
+++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentWithExport.js
@@ -12,9 +12,9 @@ Adapter.asyncMethod = function() {}
//// [a.js]
"use strict";
+// this is a javascript file...
Object.defineProperty(exports, "__esModule", { value: true });
exports.Adapter = void 0;
-// this is a javascript file...
exports.Adapter = {};
exports.Adapter.prop = {};
// comment this out, and it works
diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentWithExport.js.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentWithExport.js.diff
deleted file mode 100644
index e8b296c70c..0000000000
--- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignmentWithExport.js.diff
+++ /dev/null
@@ -1,13 +0,0 @@
---- old.typeFromPropertyAssignmentWithExport.js
-+++ new.typeFromPropertyAssignmentWithExport.js
-@@= skipped -11, +11 lines =@@
-
- //// [a.js]
- "use strict";
--// this is a javascript file...
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.Adapter = void 0;
-+// this is a javascript file...
- exports.Adapter = {};
- exports.Adapter.prop = {};
- // comment this out, and it works
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/typeGuardsAsAssertions.js b/testdata/baselines/reference/submodule/conformance/typeGuardsAsAssertions.js
index 4d73aad492..7c74eb86f2 100644
--- a/testdata/baselines/reference/submodule/conformance/typeGuardsAsAssertions.js
+++ b/testdata/baselines/reference/submodule/conformance/typeGuardsAsAssertions.js
@@ -130,11 +130,11 @@ function f7() {
//// [typeGuardsAsAssertions.js]
"use strict";
+// Repro from #8513
Object.defineProperty(exports, "__esModule", { value: true });
exports.none = void 0;
exports.isSome = isSome;
exports.fn = fn;
-// Repro from #8513
let cond;
exports.none = { none: '' };
function isSome(value) {
diff --git a/testdata/baselines/reference/submodule/conformance/typeGuardsAsAssertions.js.diff b/testdata/baselines/reference/submodule/conformance/typeGuardsAsAssertions.js.diff
deleted file mode 100644
index 40d59b71ec..0000000000
--- a/testdata/baselines/reference/submodule/conformance/typeGuardsAsAssertions.js.diff
+++ /dev/null
@@ -1,15 +0,0 @@
---- old.typeGuardsAsAssertions.js
-+++ new.typeGuardsAsAssertions.js
-@@= skipped -129, +129 lines =@@
-
- //// [typeGuardsAsAssertions.js]
- "use strict";
--// Repro from #8513
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.none = void 0;
- exports.isSome = isSome;
- exports.fn = fn;
-+// Repro from #8513
- let cond;
- exports.none = { none: '' };
- function isSome(value) {
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/typeGuardsInExternalModule.js b/testdata/baselines/reference/submodule/conformance/typeGuardsInExternalModule.js
index f632c56dfd..e8875c957b 100644
--- a/testdata/baselines/reference/submodule/conformance/typeGuardsInExternalModule.js
+++ b/testdata/baselines/reference/submodule/conformance/typeGuardsInExternalModule.js
@@ -27,10 +27,10 @@ else {
//// [typeGuardsInExternalModule.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.var2 = void 0;
// Note that type guards affect types of variables and parameters only and
// have no effect on members of objects such as properties.
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.var2 = void 0;
// local variable in external module
var num;
var var1;
diff --git a/testdata/baselines/reference/submodule/conformance/typeGuardsInExternalModule.js.diff b/testdata/baselines/reference/submodule/conformance/typeGuardsInExternalModule.js.diff
deleted file mode 100644
index efa2fe3e31..0000000000
--- a/testdata/baselines/reference/submodule/conformance/typeGuardsInExternalModule.js.diff
+++ /dev/null
@@ -1,15 +0,0 @@
---- old.typeGuardsInExternalModule.js
-+++ new.typeGuardsInExternalModule.js
-@@= skipped -26, +26 lines =@@
-
- //// [typeGuardsInExternalModule.js]
- "use strict";
--// Note that type guards affect types of variables and parameters only and
--// have no effect on members of objects such as properties.
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.var2 = void 0;
-+// Note that type guards affect types of variables and parameters only and
-+// have no effect on members of objects such as properties.
- // local variable in external module
- var num;
- var var1;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.js b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.js
index 4f5bbb3bb4..54abdad8a9 100644
--- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.js
+++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.js
@@ -12,8 +12,8 @@ test('hi') // error, T=number
//// [typeTagNoErasure.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
/** @template T @typedef {(data: T1) => T1} Test */
+Object.defineProperty(exports, "__esModule", { value: true });
/** @type {Test} */
const test = dibbity => dibbity;
test(1); // ok, T=1
diff --git a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.js.diff b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.js.diff
index faf23d49b9..0d9a94426b 100644
--- a/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/typeTagNoErasure.js.diff
@@ -5,10 +5,11 @@
//// [typeTagNoErasure.js]
+"use strict";
-+Object.defineProperty(exports, "__esModule", { value: true });
/** @template T @typedef {(data: T1) => T1} Test */
++Object.defineProperty(exports, "__esModule", { value: true });
/** @type {Test} */
const test = dibbity => dibbity;
+ test(1); // ok, T=1
@@= skipped -8, +10 lines =@@
diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.js b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.js
index de1d469b27..fd8e870126 100644
--- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.js
+++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.js
@@ -20,11 +20,11 @@ inJsArrow(2); // no error gets linted as expected
//// [typeTagOnFunctionReferencesGeneric.js]
"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.inJs = inJs;
/**
* @typedef {(m : T) => T} IFn
*/
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.inJs = inJs;
/**@type {IFn}*/
function inJs(l) {
return l;
diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.js.diff b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.js.diff
index 4c7d4f17b7..7c29bf21aa 100644
--- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.js.diff
@@ -1,21 +1,6 @@
--- old.typeTagOnFunctionReferencesGeneric.js
+++ new.typeTagOnFunctionReferencesGeneric.js
-@@= skipped -19, +19 lines =@@
-
- //// [typeTagOnFunctionReferencesGeneric.js]
- "use strict";
--/**
-- * @typedef {(m : T) => T} IFn
-- */
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.inJs = inJs;
-+/**
-+ * @typedef {(m : T) => T} IFn
-+ */
- /**@type {IFn}*/
- function inJs(l) {
- return l;
-@@= skipped -18, +18 lines =@@
+@@= skipped -37, +37 lines =@@
//// [typeTagOnFunctionReferencesGeneric.d.ts]
From 0ab9a4f29f0c5e776025051f8e3798e388027697 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 23 Oct 2025 00:09:18 +0000
Subject: [PATCH 4/7] Address review comments: improve comment clarity and
reduce code duplication
- Updated misleading comment at line 4387 to better reflect the actual logic
- Extracted duplicated prologue emission logic into helper function
emitPrologueDirectivesAndDetachedComments to improve code clarity
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
---
internal/printer/printer.go | 56 ++++++++++++++++++++++---------------
1 file changed, 33 insertions(+), 23 deletions(-)
diff --git a/internal/printer/printer.go b/internal/printer/printer.go
index 3d0f69d073..b68b060dba 100644
--- a/internal/printer/printer.go
+++ b/internal/printer/printer.go
@@ -4377,6 +4377,36 @@ func (p *Printer) emitHelpers(node *ast.Node) bool {
return helpersEmitted
}
+func (p *Printer) emitPrologueDirectivesAndDetachedComments(node *ast.SourceFile, shouldEmitDetached bool) (index int, state *commentState) {
+ index = 0
+ state = nil
+
+ // When there are prologue directives and the first is synthesized, emit them first,
+ // then emit detached comments, then emit helpers. This matches TypeScript's behavior
+ // where writeFile calls emitPrologueDirectivesIfNeeded before emitSourceFile.
+ if shouldEmitDetached && len(node.Statements.Nodes) > 0 && ast.IsPrologueDirective(node.Statements.Nodes[0]) {
+ // Emit synthesized prologue directives first (without their comments since they're synthesized)
+ index = p.emitPrologueDirectives(node.Statements)
+ // Add a newline after prologue directives before detached comments
+ if !p.writer.IsAtStartOfLine() {
+ p.writeLine()
+ }
+ // Then emit detached comments (copyright headers) that come after prologues but before other code
+ // We need to save the state for emitting trailing comments later
+ emitFlags := p.emitContext.EmitFlags(node.AsNode())
+ containerPos := p.containerPos
+ containerEnd := p.containerEnd
+ declarationListContainerEnd := p.declarationListContainerEnd
+ p.emitDetachedCommentsAndUpdateCommentsInfo(node.Statements.Loc)
+ state = &commentState{emitFlags, node.Statements.Loc, containerPos, containerEnd, declarationListContainerEnd}
+ } else if shouldEmitDetached {
+ // No prologue directives, just emit detached comments normally
+ state = p.emitDetachedCommentsBeforeStatementList(node.AsNode(), node.Statements.Loc)
+ }
+
+ return index, state
+}
+
func (p *Printer) emitSourceFile(node *ast.SourceFile) {
savedCurrentSourceFile := p.currentSourceFile
savedCommentsDisabled := p.commentsDisabled
@@ -4384,7 +4414,7 @@ func (p *Printer) emitSourceFile(node *ast.SourceFile) {
p.writeLine()
- // Emit detached comments only if there are no prologue directives or the first node is synthesized
+ // Determine if detached comments should be emitted before helpers
shouldEmitDetached := p.shouldEmitDetachedComments(node.AsNode())
p.pushNameGenerationScope(node.AsNode())
@@ -4395,28 +4425,8 @@ func (p *Printer) emitSourceFile(node *ast.SourceFile) {
if node.ScriptKind != core.ScriptKindJSON {
p.emitShebangIfNeeded(node)
- // When there are prologue directives and the first is synthesized, emit them first,
- // then emit detached comments, then emit helpers. This matches TypeScript's behavior
- // where writeFile calls emitPrologueDirectivesIfNeeded before emitSourceFile.
- if shouldEmitDetached && len(node.Statements.Nodes) > 0 && ast.IsPrologueDirective(node.Statements.Nodes[0]) {
- // Emit synthesized prologue directives first (without their comments since they're synthesized)
- index = p.emitPrologueDirectives(node.Statements)
- // Add a newline after prologue directives before detached comments
- if !p.writer.IsAtStartOfLine() {
- p.writeLine()
- }
- // Then emit detached comments (copyright headers) that come after prologues but before other code
- // We need to save the state for emitting trailing comments later
- emitFlags := p.emitContext.EmitFlags(node.AsNode())
- containerPos := p.containerPos
- containerEnd := p.containerEnd
- declarationListContainerEnd := p.declarationListContainerEnd
- p.emitDetachedCommentsAndUpdateCommentsInfo(node.Statements.Loc)
- state = &commentState{emitFlags, node.Statements.Loc, containerPos, containerEnd, declarationListContainerEnd}
- } else if shouldEmitDetached {
- // No prologue directives, just emit detached comments normally
- state = p.emitDetachedCommentsBeforeStatementList(node.AsNode(), node.Statements.Loc)
- }
+ // Emit prologue directives and detached comments in the correct order
+ index, state = p.emitPrologueDirectivesAndDetachedComments(node, shouldEmitDetached)
// Emit helpers after prologues and detached comments
p.emitHelpers(node.AsNode())
From 4d2ece11e6f343e65377252c9b8b9ca309830420 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 23 Oct 2025 00:22:14 +0000
Subject: [PATCH 5/7] Remove redundant comments in emitSourceFile
Removed comments that simply described what the code does, making
the code cleaner and more maintainable.
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
---
internal/printer/printer.go | 4 ----
1 file changed, 4 deletions(-)
diff --git a/internal/printer/printer.go b/internal/printer/printer.go
index b68b060dba..9a8e509cc8 100644
--- a/internal/printer/printer.go
+++ b/internal/printer/printer.go
@@ -4425,13 +4425,9 @@ func (p *Printer) emitSourceFile(node *ast.SourceFile) {
if node.ScriptKind != core.ScriptKindJSON {
p.emitShebangIfNeeded(node)
- // Emit prologue directives and detached comments in the correct order
index, state = p.emitPrologueDirectivesAndDetachedComments(node, shouldEmitDetached)
-
- // Emit helpers after prologues and detached comments
p.emitHelpers(node.AsNode())
- // If we didn't emit prologue directives yet (non-synthesized case), emit them after helpers
if !shouldEmitDetached {
index = p.emitPrologueDirectives(node.Statements)
}
From 4fbefe6a61cfff0d0dcda36d498932f4efe7b918 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 23 Oct 2025 02:21:31 +0000
Subject: [PATCH 6/7] Remove remaining redundant comment and format code
Removed the comment at line 4417 that was just describing what the
code does. Also ran formatter to clean up whitespace issues.
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
---
internal/printer/printer.go | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/internal/printer/printer.go b/internal/printer/printer.go
index 9a8e509cc8..e8d4ceb5a3 100644
--- a/internal/printer/printer.go
+++ b/internal/printer/printer.go
@@ -4380,7 +4380,7 @@ func (p *Printer) emitHelpers(node *ast.Node) bool {
func (p *Printer) emitPrologueDirectivesAndDetachedComments(node *ast.SourceFile, shouldEmitDetached bool) (index int, state *commentState) {
index = 0
state = nil
-
+
// When there are prologue directives and the first is synthesized, emit them first,
// then emit detached comments, then emit helpers. This matches TypeScript's behavior
// where writeFile calls emitPrologueDirectivesIfNeeded before emitSourceFile.
@@ -4403,7 +4403,7 @@ func (p *Printer) emitPrologueDirectivesAndDetachedComments(node *ast.SourceFile
// No prologue directives, just emit detached comments normally
state = p.emitDetachedCommentsBeforeStatementList(node.AsNode(), node.Statements.Loc)
}
-
+
return index, state
}
@@ -4414,7 +4414,6 @@ func (p *Printer) emitSourceFile(node *ast.SourceFile) {
p.writeLine()
- // Determine if detached comments should be emitted before helpers
shouldEmitDetached := p.shouldEmitDetachedComments(node.AsNode())
p.pushNameGenerationScope(node.AsNode())
@@ -4424,14 +4423,14 @@ func (p *Printer) emitSourceFile(node *ast.SourceFile) {
var state *commentState
if node.ScriptKind != core.ScriptKindJSON {
p.emitShebangIfNeeded(node)
-
+
index, state = p.emitPrologueDirectivesAndDetachedComments(node, shouldEmitDetached)
p.emitHelpers(node.AsNode())
-
+
if !shouldEmitDetached {
index = p.emitPrologueDirectives(node.Statements)
}
-
+
if node.IsDeclarationFile {
p.emitTripleSlashDirectives(node)
}
From 3a53c98077d9822ccfe00c6f926d585d2bb511b4 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 23 Oct 2025 21:51:57 +0000
Subject: [PATCH 7/7] Reimplement copyright comment fix with simpler approach
Following @weswigham's feedback, removed the complex helper function
and instead simply reordered the emit calls to match TypeScript:
1. emitShebangIfNeeded
2. emitPrologueDirectives
3. emitDetachedComments (for copyright headers)
4. emitHelpers
5. emitTripleSlashDirectives
This is much simpler, less duplicative, and directly matches the
strada/TypeScript emit order.
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
---
internal/printer/printer.go | 51 +++++++------------------------------
1 file changed, 9 insertions(+), 42 deletions(-)
diff --git a/internal/printer/printer.go b/internal/printer/printer.go
index e8d4ceb5a3..d599f8afe1 100644
--- a/internal/printer/printer.go
+++ b/internal/printer/printer.go
@@ -4377,36 +4377,6 @@ func (p *Printer) emitHelpers(node *ast.Node) bool {
return helpersEmitted
}
-func (p *Printer) emitPrologueDirectivesAndDetachedComments(node *ast.SourceFile, shouldEmitDetached bool) (index int, state *commentState) {
- index = 0
- state = nil
-
- // When there are prologue directives and the first is synthesized, emit them first,
- // then emit detached comments, then emit helpers. This matches TypeScript's behavior
- // where writeFile calls emitPrologueDirectivesIfNeeded before emitSourceFile.
- if shouldEmitDetached && len(node.Statements.Nodes) > 0 && ast.IsPrologueDirective(node.Statements.Nodes[0]) {
- // Emit synthesized prologue directives first (without their comments since they're synthesized)
- index = p.emitPrologueDirectives(node.Statements)
- // Add a newline after prologue directives before detached comments
- if !p.writer.IsAtStartOfLine() {
- p.writeLine()
- }
- // Then emit detached comments (copyright headers) that come after prologues but before other code
- // We need to save the state for emitting trailing comments later
- emitFlags := p.emitContext.EmitFlags(node.AsNode())
- containerPos := p.containerPos
- containerEnd := p.containerEnd
- declarationListContainerEnd := p.declarationListContainerEnd
- p.emitDetachedCommentsAndUpdateCommentsInfo(node.Statements.Loc)
- state = &commentState{emitFlags, node.Statements.Loc, containerPos, containerEnd, declarationListContainerEnd}
- } else if shouldEmitDetached {
- // No prologue directives, just emit detached comments normally
- state = p.emitDetachedCommentsBeforeStatementList(node.AsNode(), node.Statements.Loc)
- }
-
- return index, state
-}
-
func (p *Printer) emitSourceFile(node *ast.SourceFile) {
savedCurrentSourceFile := p.currentSourceFile
savedCommentsDisabled := p.commentsDisabled
@@ -4414,8 +4384,6 @@ func (p *Printer) emitSourceFile(node *ast.SourceFile) {
p.writeLine()
- shouldEmitDetached := p.shouldEmitDetachedComments(node.AsNode())
-
p.pushNameGenerationScope(node.AsNode())
p.generateAllNames(node.Statements)
@@ -4423,14 +4391,15 @@ func (p *Printer) emitSourceFile(node *ast.SourceFile) {
var state *commentState
if node.ScriptKind != core.ScriptKindJSON {
p.emitShebangIfNeeded(node)
-
- index, state = p.emitPrologueDirectivesAndDetachedComments(node, shouldEmitDetached)
- p.emitHelpers(node.AsNode())
-
- if !shouldEmitDetached {
- index = p.emitPrologueDirectives(node.Statements)
+ index = p.emitPrologueDirectives(node.Statements)
+ // Emit detached comments after prologue directives but before helpers
+ if !p.writer.IsAtStartOfLine() {
+ p.writeLine()
}
-
+ p.emitDetachedCommentsAndUpdateCommentsInfo(node.Statements.Loc)
+ emitFlags := p.emitContext.EmitFlags(node.AsNode())
+ state = &commentState{emitFlags, node.Statements.Loc, p.containerPos, p.containerEnd, p.declarationListContainerEnd}
+ p.emitHelpers(node.AsNode())
if node.IsDeclarationFile {
p.emitTripleSlashDirectives(node)
}
@@ -4446,9 +4415,7 @@ func (p *Printer) emitSourceFile(node *ast.SourceFile) {
-1, /*count*/
)
p.popNameGenerationScope(node.AsNode())
- if shouldEmitDetached {
- p.emitDetachedCommentsAfterStatementList(node.AsNode(), node.Statements.Loc, state)
- }
+ p.emitDetachedCommentsAfterStatementList(node.AsNode(), node.Statements.Loc, state)
p.currentSourceFile = savedCurrentSourceFile
p.commentsDisabled = savedCommentsDisabled
}