From 6183abfe4fe92c94748aaf97fe09467b4ac1220f Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 15 Oct 2025 11:25:35 -0700 Subject: [PATCH 001/152] Port 'go to type definition' tests (#1883) --- .../fourslash/_scripts/convertFourslash.mts | 48 +++- internal/fourslash/_scripts/failingTests.txt | 1 + internal/fourslash/fourslash.go | 49 ++++ .../tests/gen/goToTypeDefinition2_test.go | 27 +++ .../tests/gen/goToTypeDefinition3_test.go | 18 ++ .../tests/gen/goToTypeDefinition4_test.go | 23 ++ .../tests/gen/goToTypeDefinition5_test.go | 20 ++ .../gen/goToTypeDefinitionAliases_test.go | 28 +++ .../gen/goToTypeDefinitionEnumMembers_test.go | 23 ++ .../gen/goToTypeDefinitionImportMeta_test.go | 24 ++ .../gen/goToTypeDefinitionModifiers_test.go | 33 +++ .../gen/goToTypeDefinitionModule_test.go | 24 ++ .../gen/goToTypeDefinitionPrimitives_test.go | 26 ++ .../gen/goToTypeDefinitionUnionType_test.go | 33 +++ .../tests/gen/goToTypeDefinition_Pick_test.go | 23 ++ .../gen/goToTypeDefinition_arrayType_test.go | 27 +++ .../goToTypeDefinition_promiseType_test.go | 22 ++ .../gen/goToTypeDefinition_returnType_test.go | 49 ++++ .../tests/gen/goToTypeDefinition_test.go | 23 ++ .../goToTypeDefinition_typeReference_test.go | 20 ++ .../gen/goToTypeDefinition_typedef_test.go | 25 ++ .../fourslash/tests/gen/jsDocServices_test.go | 30 +++ .../tests/gen/typedefinition01_test.go | 21 ++ .../goToTypeDefinition4.baseline.jsonc | 8 + .../goToTypeDefinition.baseline.jsonc | 9 + .../goToTypeDefinition2.baseline.jsonc | 11 + .../goToTypeDefinition3.baseline.jsonc | 4 + .../goToTypeDefinition4.baseline.jsonc | 4 + .../goToTypeDefinition5.baseline.jsonc | 5 + .../goToTypeDefinitionAliases.baseline.jsonc | 23 ++ ...ToTypeDefinitionEnumMembers.baseline.jsonc | 9 + ...oToTypeDefinitionImportMeta.baseline.jsonc | 9 + ...goToTypeDefinitionModifiers.baseline.jsonc | 227 ++++++++++++++++++ .../goToTypeDefinitionModule.baseline.jsonc | 23 ++ ...oToTypeDefinitionPrimitives.baseline.jsonc | 33 +++ ...goToTypeDefinitionUnionType.baseline.jsonc | 19 ++ .../goToTypeDefinition_Pick.baseline.jsonc | 19 ++ ...oToTypeDefinition_arrayType.baseline.jsonc | 37 +++ ...oTypeDefinition_promiseType.baseline.jsonc | 19 ++ ...ToTypeDefinition_returnType.baseline.jsonc | 179 ++++++++++++++ ...ypeDefinition_typeReference.baseline.jsonc | 6 + .../goToTypeDefinition_typedef.baseline.jsonc | 9 + .../goToType/typedefinition01.baseline.jsonc | 7 + 43 files changed, 1266 insertions(+), 11 deletions(-) create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition2_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition3_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition4_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition5_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinitionAliases_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinitionEnumMembers_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinitionImportMeta_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinitionModifiers_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinitionModule_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinitionPrimitives_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinitionUnionType_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition_Pick_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition_arrayType_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition_promiseType_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition_returnType_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition_typeReference_test.go create mode 100644 internal/fourslash/tests/gen/goToTypeDefinition_typedef_test.go create mode 100644 internal/fourslash/tests/gen/jsDocServices_test.go create mode 100644 internal/fourslash/tests/gen/typedefinition01_test.go create mode 100644 testdata/baselines/reference/fourslash/goToDefinition/goToTypeDefinition4.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition2.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition3.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition4.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition5.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionAliases.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionEnumMembers.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionImportMeta.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionModifiers.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionModule.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionPrimitives.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionUnionType.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_Pick.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_arrayType.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_promiseType.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_returnType.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_typeReference.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_typedef.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/goToType/typedefinition01.baseline.jsonc diff --git a/internal/fourslash/_scripts/convertFourslash.mts b/internal/fourslash/_scripts/convertFourslash.mts index 0b461efff6..534b7d69c7 100644 --- a/internal/fourslash/_scripts/convertFourslash.mts +++ b/internal/fourslash/_scripts/convertFourslash.mts @@ -186,11 +186,14 @@ function parseFourslashStatement(statement: ts.Statement): Cmd[] | undefined { return [parseBaselineSignatureHelp(callExpression.arguments)]; case "baselineGoToDefinition": case "baselineGetDefinitionAtPosition": - // Both of these take the same arguments, but differ in that... + case "baselineGoToType": + // Both `baselineGoToDefinition` and `baselineGetDefinitionAtPosition` take the same + // arguments, but differ in that... // - `verify.baselineGoToDefinition(...)` called getDefinitionAndBoundSpan // - `verify.baselineGetDefinitionAtPosition(...)` called getDefinitionAtPosition - // LSP doesn't have two separate commands though. It's unclear how we would model bound spans though. - return parseBaselineGoToDefinitionArgs(callExpression.arguments); + // LSP doesn't have two separate commands though. + // It's unclear how we would model bound spans though. + return parseBaselineGoToDefinitionArgs(func.text, callExpression.arguments); case "baselineRename": case "baselineRenameAtRangesWithText": // `verify.baselineRename...(...)` @@ -817,7 +820,20 @@ function parseBaselineDocumentHighlightsArgs(args: readonly ts.Expression[]): [V }]; } -function parseBaselineGoToDefinitionArgs(args: readonly ts.Expression[]): [VerifyBaselineGoToDefinitionCmd] | undefined { +function parseBaselineGoToDefinitionArgs( + funcName: "baselineGoToDefinition" | "baselineGoToType" | "baselineGetDefinitionAtPosition", + args: readonly ts.Expression[], +): [VerifyBaselineGoToDefinitionCmd] | undefined { + let kind: "verifyBaselineGoToDefinition" | "verifyBaselineGoToType"; + switch (funcName) { + case "baselineGoToDefinition": + case "baselineGetDefinitionAtPosition": + kind = "verifyBaselineGoToDefinition"; + break; + case "baselineGoToType": + kind = "verifyBaselineGoToType"; + break; + } const newArgs = []; for (const arg of args) { let strArg; @@ -829,19 +845,19 @@ function parseBaselineGoToDefinitionArgs(args: readonly ts.Expression[]): [Verif } else if (arg.getText() === "...test.ranges()") { return [{ - kind: "verifyBaselineGoToDefinition", + kind, markers: [], ranges: true, }]; } else { - console.error(`Unrecognized argument in verify.baselineGoToDefinition: ${arg.getText()}`); + console.error(`Unrecognized argument in verify.${funcName}: ${arg.getText()}`); return undefined; } } return [{ - kind: "verifyBaselineGoToDefinition", + kind, markers: newArgs, }]; } @@ -1293,7 +1309,7 @@ interface VerifyBaselineFindAllReferencesCmd { } interface VerifyBaselineGoToDefinitionCmd { - kind: "verifyBaselineGoToDefinition"; + kind: "verifyBaselineGoToDefinition" | "verifyBaselineGoToType"; markers: string[]; ranges?: boolean; } @@ -1393,11 +1409,20 @@ function generateBaselineDocumentHighlights({ args, preferences }: VerifyBaselin return `f.VerifyBaselineDocumentHighlights(t, ${preferences}, ${args.join(", ")})`; } -function generateBaselineGoToDefinition({ markers, ranges }: VerifyBaselineGoToDefinitionCmd): string { +function generateBaselineGoToDefinition({ markers, ranges, kind }: VerifyBaselineGoToDefinitionCmd): string { + let goFunc; + switch (kind) { + case "verifyBaselineGoToDefinition": + goFunc = "VerifyBaselineGoToDefinition"; + break; + case "verifyBaselineGoToType": + goFunc = "VerifyBaselineGoToTypeDefinition"; + break; + } if (ranges || markers.length === 0) { - return `f.VerifyBaselineGoToDefinition(t)`; + return `f.${goFunc}(t)`; } - return `f.VerifyBaselineGoToDefinition(t, ${markers.join(", ")})`; + return `f.${goFunc}(t, ${markers.join(", ")})`; } function generateGoToCommand({ funcName, args }: GoToCmd): string { @@ -1436,6 +1461,7 @@ function generateCmd(cmd: Cmd): string { case "verifyBaselineDocumentHighlights": return generateBaselineDocumentHighlights(cmd); case "verifyBaselineGoToDefinition": + case "verifyBaselineGoToType": return generateBaselineGoToDefinition(cmd); case "verifyBaselineQuickInfo": // Quick Info -> Hover diff --git a/internal/fourslash/_scripts/failingTests.txt b/internal/fourslash/_scripts/failingTests.txt index a3851e759e..3aef9a7a9f 100644 --- a/internal/fourslash/_scripts/failingTests.txt +++ b/internal/fourslash/_scripts/failingTests.txt @@ -245,6 +245,7 @@ TestJsDocPropertyDescription6 TestJsDocPropertyDescription7 TestJsDocPropertyDescription8 TestJsDocPropertyDescription9 +TestJsDocServices TestJsDocTagsWithHyphen TestJsQuickInfoGenerallyAcceptableSize TestJsRequireQuickInfo diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index a488f7d2c5..8c64ea2f90 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -852,6 +852,55 @@ func (f *FourslashTest) VerifyBaselineGoToDefinition( } } +func (f *FourslashTest) VerifyBaselineGoToTypeDefinition( + t *testing.T, + markers ...string, +) { + referenceLocations := f.lookupMarkersOrGetRanges(t, markers) + + for _, markerOrRange := range referenceLocations { + // worker in `baselineEachMarkerOrRange` + f.GoToMarkerOrRange(t, markerOrRange) + + params := &lsproto.TypeDefinitionParams{ + TextDocument: lsproto.TextDocumentIdentifier{ + Uri: ls.FileNameToDocumentURI(f.activeFilename), + }, + Position: f.currentCaretPosition, + } + + resMsg, result, resultOk := sendRequest(t, f, lsproto.TextDocumentTypeDefinitionInfo, params) + if resMsg == nil { + if f.lastKnownMarkerName == nil { + t.Fatalf("Nil response received for type definition request at pos %v", f.currentCaretPosition) + } else { + t.Fatalf("Nil response received for type definition request at marker '%s'", *f.lastKnownMarkerName) + } + } + if !resultOk { + if f.lastKnownMarkerName == nil { + t.Fatalf("Unexpected type definition response type at pos %v: %T", f.currentCaretPosition, resMsg.AsResponse().Result) + } else { + t.Fatalf("Unexpected type definition response type at marker '%s': %T", *f.lastKnownMarkerName, resMsg.AsResponse().Result) + } + } + + var resultAsLocations []lsproto.Location + if result.Locations != nil { + resultAsLocations = *result.Locations + } else if result.Location != nil { + resultAsLocations = []lsproto.Location{*result.Location} + } else if result.DefinitionLinks != nil { + t.Fatalf("Unexpected type definition response type at marker '%s': %T", *f.lastKnownMarkerName, result.DefinitionLinks) + } + + f.addResultToBaseline(t, "goToType", f.getBaselineForLocationsWithFileContents(resultAsLocations, baselineFourslashLocationsOptions{ + marker: markerOrRange, + markerName: "/*GOTO TYPE*/", + })) + } +} + func (f *FourslashTest) VerifyBaselineHover(t *testing.T) { markersAndItems := core.MapFiltered(f.Markers(), func(marker *Marker) (markerAndItem[*lsproto.Hover], bool) { if marker.Name == nil { diff --git a/internal/fourslash/tests/gen/goToTypeDefinition2_test.go b/internal/fourslash/tests/gen/goToTypeDefinition2_test.go new file mode 100644 index 0000000000..ebcbd8ab16 --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition2_test.go @@ -0,0 +1,27 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: goToTypeDefinition2_Definition.ts +interface /*definition*/I1 { + p; +} +type propertyType = I1; +interface I2 { + property: propertyType; +} +// @Filename: goToTypeDefinition2_Consumption.ts +var i2: I2; +i2.prop/*reference*/erty;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinition3_test.go b/internal/fourslash/tests/gen/goToTypeDefinition3_test.go new file mode 100644 index 0000000000..959731d36c --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition3_test.go @@ -0,0 +1,18 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition3(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `type /*definition*/T = string; +const x: /*reference*/T;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinition4_test.go b/internal/fourslash/tests/gen/goToTypeDefinition4_test.go new file mode 100644 index 0000000000..b37d04f884 --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition4_test.go @@ -0,0 +1,23 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition4(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: foo.ts +export type /*def0*/T = string; +export const /*def1*/T = ""; +// @Filename: bar.ts +import { T } from "./foo"; +let x: [|/*reference*/T|];` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference") + f.VerifyBaselineGoToDefinition(t, "reference") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinition5_test.go b/internal/fourslash/tests/gen/goToTypeDefinition5_test.go new file mode 100644 index 0000000000..a6e495eddd --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition5_test.go @@ -0,0 +1,20 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition5(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: foo.ts +let Foo: /*definition*/unresolved; +type Foo = { x: string }; +/*reference*/Foo;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinitionAliases_test.go b/internal/fourslash/tests/gen/goToTypeDefinitionAliases_test.go new file mode 100644 index 0000000000..cf70f8b7e6 --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinitionAliases_test.go @@ -0,0 +1,28 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinitionAliases(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: goToTypeDefinitioAliases_module1.ts +interface /*definition*/I { + p; +} +export {I as I2}; +// @Filename: goToTypeDefinitioAliases_module2.ts +import {I2 as I3} from "./goToTypeDefinitioAliases_module1"; +var v1: I3; +export {v1 as v2}; +// @Filename: goToTypeDefinitioAliases_module3.ts +import {/*reference1*/v2 as v3} from "./goToTypeDefinitioAliases_module2"; +/*reference2*/v3;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference1", "reference2") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinitionEnumMembers_test.go b/internal/fourslash/tests/gen/goToTypeDefinitionEnumMembers_test.go new file mode 100644 index 0000000000..6a248e3e46 --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinitionEnumMembers_test.go @@ -0,0 +1,23 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinitionEnumMembers(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `enum E { + value1, + /*definition*/value2 +} +var x = E.value2; + +/*reference*/x;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinitionImportMeta_test.go b/internal/fourslash/tests/gen/goToTypeDefinitionImportMeta_test.go new file mode 100644 index 0000000000..9cda20577e --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinitionImportMeta_test.go @@ -0,0 +1,24 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinitionImportMeta(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @Filename: foo.ts +/// +/// +import.me/*reference*/ta; +//@Filename: bar.d.ts +interface /*definition*/ImportMeta { +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinitionModifiers_test.go b/internal/fourslash/tests/gen/goToTypeDefinitionModifiers_test.go new file mode 100644 index 0000000000..957d3ff39e --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinitionModifiers_test.go @@ -0,0 +1,33 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinitionModifiers(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +/*export*/export class A/*A*/ { + + /*private*/private z/*z*/: string; + + /*private2*/private y/*y*/: A; + + /*readonly*/readonly x/*x*/: string; + + /*async*/async a/*a*/() { } + + /*override*/override b/*b*/() {} + + /*public1*/public/*public2*/ as/*multipleModifiers*/ync c/*c*/() { } +} + +exp/*exportFunction*/ort function foo/*foo*/() { }` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "export", "A", "private", "z", "private2", "y", "readonly", "x", "async", "a", "override", "b", "public1", "public2", "multipleModifiers", "c", "exportFunction", "foo") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinitionModule_test.go b/internal/fourslash/tests/gen/goToTypeDefinitionModule_test.go new file mode 100644 index 0000000000..988f92ddd2 --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinitionModule_test.go @@ -0,0 +1,24 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinitionModule(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: module1.ts +module /*definition*/M { + export var p; +} +var m: typeof M; +// @Filename: module3.ts +/*reference1*/M; +/*reference2*/m;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference1", "reference2") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinitionPrimitives_test.go b/internal/fourslash/tests/gen/goToTypeDefinitionPrimitives_test.go new file mode 100644 index 0000000000..18e9fe06ef --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinitionPrimitives_test.go @@ -0,0 +1,26 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinitionPrimitives(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: module1.ts +var w: {a: number}; +var x = "string"; +var y: number | string; +var z; // any +// @Filename: module2.ts +w./*reference1*/a; +/*reference2*/x; +/*reference3*/y; +/*reference4*/y;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference1", "reference2", "reference3", "reference4") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinitionUnionType_test.go b/internal/fourslash/tests/gen/goToTypeDefinitionUnionType_test.go new file mode 100644 index 0000000000..76e52a123e --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinitionUnionType_test.go @@ -0,0 +1,33 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinitionUnionType(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class /*definition0*/C { + p; +} + +interface /*definition1*/I { + x; +} + +module M { + export interface /*definition2*/I { + y; + } +} + +var x: C | I | M.I; + +/*reference*/x;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinition_Pick_test.go b/internal/fourslash/tests/gen/goToTypeDefinition_Pick_test.go new file mode 100644 index 0000000000..ed7dae6496 --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition_Pick_test.go @@ -0,0 +1,23 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition_Pick(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `type User = { id: number; name: string; }; +declare const user: Pick +/*reference*/user + +type PickedUser = Pick +declare const user2: PickedUser +/*reference2*/user2` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference", "reference2") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinition_arrayType_test.go b/internal/fourslash/tests/gen/goToTypeDefinition_arrayType_test.go new file mode 100644 index 0000000000..8d3803c3bb --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition_arrayType_test.go @@ -0,0 +1,27 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition_arrayType(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `type User = { name: string }; +declare const users: User[] +/*reference*/users + +type UsersArr = Array +declare const users2: UsersArr +/*reference2*/users2 + +class CustomArray extends Array { immutableReverse() { return [...this].reverse() } } +declare const users3: CustomArray +/*reference3*/users3` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference", "reference2", "reference3") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinition_promiseType_test.go b/internal/fourslash/tests/gen/goToTypeDefinition_promiseType_test.go new file mode 100644 index 0000000000..c13cbf198d --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition_promiseType_test.go @@ -0,0 +1,22 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition_promiseType(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `type User = { name: string }; +async function /*reference*/getUser() { return { name: "Bob" } satisfies User as User } + +const /*reference2*/promisedBob = getUser() + +export {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference", "reference2") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinition_returnType_test.go b/internal/fourslash/tests/gen/goToTypeDefinition_returnType_test.go new file mode 100644 index 0000000000..930b658c60 --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition_returnType_test.go @@ -0,0 +1,49 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition_returnType(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `interface /*I*/I { x: number; } +interface /*J*/J { y: number; } + +function f0(): I { return { x: 0 }; } + +type T = /*T*/(i: I) => I; +const f1: T = i => ({ x: i.x + 1 }); + +const f2 = (i: I): I => ({ x: i.x + 1 }); + +const f3 = (i: I) => (/*f3Def*/{ x: i.x + 1 }); + +const f4 = (i: I) => i; + +const f5 = /*f5Def*/(i: I): I | J => ({ x: i.x + 1 }); + +const f6 = (i: I, j: J, b: boolean) => b ? i : j; + +const /*f7Def*/f7 = (i: I) => {}; + +function f8(i: I): I; +function f8(j: J): J; +function /*f8Def*/f8(ij: any): any { return ij; } + +/*f0*/f0(); +/*f1*/f1(); +/*f2*/f2(); +/*f3*/f3(); +/*f4*/f4(); +/*f5*/f5(); +/*f6*/f6(); +/*f7*/f7(); +/*f8*/f8();` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinition_test.go b/internal/fourslash/tests/gen/goToTypeDefinition_test.go new file mode 100644 index 0000000000..2b9a7ca2a1 --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition_test.go @@ -0,0 +1,23 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: goToTypeDefinition_Definition.ts +class /*definition*/C { + p; +} +var c: C; +// @Filename: goToTypeDefinition_Consumption.ts +/*reference*/c = undefined;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinition_typeReference_test.go b/internal/fourslash/tests/gen/goToTypeDefinition_typeReference_test.go new file mode 100644 index 0000000000..e7e8ae6ee9 --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition_typeReference_test.go @@ -0,0 +1,20 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition_typeReference(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `type User = { name: string }; +type Box = { value: T }; +declare const boxedUser: Box +/*reference*/boxedUser` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "reference") +} diff --git a/internal/fourslash/tests/gen/goToTypeDefinition_typedef_test.go b/internal/fourslash/tests/gen/goToTypeDefinition_typedef_test.go new file mode 100644 index 0000000000..8f8c1868cb --- /dev/null +++ b/internal/fourslash/tests/gen/goToTypeDefinition_typedef_test.go @@ -0,0 +1,25 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestGoToTypeDefinition_typedef(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: /a.js +/** + * /*def*/@typedef {object} I + * @property {number} x + */ + +/** @type {I} */ +const /*ref*/i = { x: 0 };` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "ref") +} diff --git a/internal/fourslash/tests/gen/jsDocServices_test.go b/internal/fourslash/tests/gen/jsDocServices_test.go new file mode 100644 index 0000000000..e25cdc74ce --- /dev/null +++ b/internal/fourslash/tests/gen/jsDocServices_test.go @@ -0,0 +1,30 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestJsDocServices(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `interface /*I*/I {} + +/** + * @param /*use*/[|foo|] I pity the foo + */ +function f([|[|/*def*/{| "contextRangeIndex": 1 |}foo|]: I|]) { + return /*use2*/[|foo|]; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "use") + f.VerifyQuickInfoIs(t, "(parameter) foo: I", "I pity the foo") + f.VerifyBaselineFindAllReferences(t, "use", "def", "use2") + f.VerifyBaselineRename(t, nil /*preferences*/, f.Ranges()[0], f.Ranges()[2], f.Ranges()[3]) + f.VerifyBaselineDocumentHighlights(t, nil /*preferences*/, f.Ranges()[0], f.Ranges()[2], f.Ranges()[3]) + f.VerifyBaselineGoToTypeDefinition(t, "use") + f.VerifyBaselineGoToDefinition(t, "use") +} diff --git a/internal/fourslash/tests/gen/typedefinition01_test.go b/internal/fourslash/tests/gen/typedefinition01_test.go new file mode 100644 index 0000000000..dc025b79ad --- /dev/null +++ b/internal/fourslash/tests/gen/typedefinition01_test.go @@ -0,0 +1,21 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestTypedefinition01(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: b.ts +import n = require('./a'); +var x/*1*/ = new n.Foo(); +// @Filename: a.ts +export class /*2*/Foo {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineGoToTypeDefinition(t, "1") +} diff --git a/testdata/baselines/reference/fourslash/goToDefinition/goToTypeDefinition4.baseline.jsonc b/testdata/baselines/reference/fourslash/goToDefinition/goToTypeDefinition4.baseline.jsonc new file mode 100644 index 0000000000..a639362681 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToDefinition/goToTypeDefinition4.baseline.jsonc @@ -0,0 +1,8 @@ +// === goToDefinition === +// === /foo.ts === +// export type [|T|] = string; +// export const [|T|] = ""; + +// === /bar.ts === +// import { T } from "./foo"; +// let x: /*GOTO DEF*/T; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition.baseline.jsonc new file mode 100644 index 0000000000..1ff73db085 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition.baseline.jsonc @@ -0,0 +1,9 @@ +// === goToType === +// === /goToTypeDefinition_Definition.ts === +// class [|C|] { +// p; +// } +// var c: C; + +// === /goToTypeDefinition_Consumption.ts === +// /*GOTO TYPE*/c = undefined; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition2.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition2.baseline.jsonc new file mode 100644 index 0000000000..beaf380dc5 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition2.baseline.jsonc @@ -0,0 +1,11 @@ +// === goToType === +// === /goToTypeDefinition2_Definition.ts === +// interface [|I1|] { +// p; +// } +// type propertyType = I1; +// // --- (line: 5) skipped --- + +// === /goToTypeDefinition2_Consumption.ts === +// var i2: I2; +// i2.prop/*GOTO TYPE*/erty; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition3.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition3.baseline.jsonc new file mode 100644 index 0000000000..6067823559 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition3.baseline.jsonc @@ -0,0 +1,4 @@ +// === goToType === +// === /goToTypeDefinition3.ts === +// type [|T|] = string; +// const x: /*GOTO TYPE*/T; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition4.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition4.baseline.jsonc new file mode 100644 index 0000000000..61504f639c --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition4.baseline.jsonc @@ -0,0 +1,4 @@ +// === goToType === +// === /bar.ts === +// import { T } from "./foo"; +// let x: /*GOTO TYPE*/T; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition5.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition5.baseline.jsonc new file mode 100644 index 0000000000..4f3d334efb --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition5.baseline.jsonc @@ -0,0 +1,5 @@ +// === goToType === +// === /foo.ts === +// let Foo: unresolved; +// type Foo = { x: string }; +// /*GOTO TYPE*/Foo; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionAliases.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionAliases.baseline.jsonc new file mode 100644 index 0000000000..dd9f252f4b --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionAliases.baseline.jsonc @@ -0,0 +1,23 @@ +// === goToType === +// === /goToTypeDefinitioAliases_module1.ts === +// interface [|I|] { +// p; +// } +// export {I as I2}; + +// === /goToTypeDefinitioAliases_module3.ts === +// import {/*GOTO TYPE*/v2 as v3} from "./goToTypeDefinitioAliases_module2"; +// v3; + + + +// === goToType === +// === /goToTypeDefinitioAliases_module1.ts === +// interface [|I|] { +// p; +// } +// export {I as I2}; + +// === /goToTypeDefinitioAliases_module3.ts === +// import {v2 as v3} from "./goToTypeDefinitioAliases_module2"; +// /*GOTO TYPE*/v3; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionEnumMembers.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionEnumMembers.baseline.jsonc new file mode 100644 index 0000000000..7e09546c95 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionEnumMembers.baseline.jsonc @@ -0,0 +1,9 @@ +// === goToType === +// === /goToTypeDefinitionEnumMembers.ts === +// enum E { +// value1, +// [|value2|] +// } +// var x = E.value2; +// +// /*GOTO TYPE*/x; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionImportMeta.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionImportMeta.baseline.jsonc new file mode 100644 index 0000000000..11fd9f4d3d --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionImportMeta.baseline.jsonc @@ -0,0 +1,9 @@ +// === goToType === +// === /bar.d.ts === +// interface [|ImportMeta|] { +// } + +// === /foo.ts === +// /// +// /// +// import.me/*GOTO TYPE*/ta; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionModifiers.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionModifiers.baseline.jsonc new file mode 100644 index 0000000000..c6416aa695 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionModifiers.baseline.jsonc @@ -0,0 +1,227 @@ +// === goToType === +// === /a.ts === +// /*GOTO TYPE*/export class [|A|] { +// +// private z: string; +// +// // --- (line: 5) skipped --- + + + +// === goToType === +// === /a.ts === +// export class [|A|]/*GOTO TYPE*/ { +// +// private z: string; +// +// // --- (line: 5) skipped --- + + + +// === goToType === +// === /a.ts === +// export class A { +// +// /*GOTO TYPE*/private z: string; +// +// private y: A; +// +// // --- (line: 7) skipped --- + + + +// === goToType === +// === /a.ts === +// export class A { +// +// private z/*GOTO TYPE*/: string; +// +// private y: A; +// +// // --- (line: 7) skipped --- + + + +// === goToType === +// === /a.ts === +// export class [|A|] { +// +// private z: string; +// +// /*GOTO TYPE*/private y: A; +// +// readonly x: string; +// +// // --- (line: 9) skipped --- + + + +// === goToType === +// === /a.ts === +// export class [|A|] { +// +// private z: string; +// +// private y/*GOTO TYPE*/: A; +// +// readonly x: string; +// +// // --- (line: 9) skipped --- + + + +// === goToType === +// === /a.ts === +// --- (line: 3) skipped --- +// +// private y: A; +// +// /*GOTO TYPE*/readonly x: string; +// +// async a() { } +// +// // --- (line: 11) skipped --- + + + +// === goToType === +// === /a.ts === +// --- (line: 3) skipped --- +// +// private y: A; +// +// readonly x/*GOTO TYPE*/: string; +// +// async a() { } +// +// // --- (line: 11) skipped --- + + + +// === goToType === +// === /a.ts === +// --- (line: 5) skipped --- +// +// readonly x: string; +// +// /*GOTO TYPE*/async a() { } +// +// override b() {} +// +// // --- (line: 13) skipped --- + + + +// === goToType === +// === /a.ts === +// --- (line: 5) skipped --- +// +// readonly x: string; +// +// async a/*GOTO TYPE*/() { } +// +// override b() {} +// +// // --- (line: 13) skipped --- + + + +// === goToType === +// === /a.ts === +// --- (line: 7) skipped --- +// +// async a() { } +// +// /*GOTO TYPE*/override b() {} +// +// public async c() { } +// } +// +// export function foo() { } + + + +// === goToType === +// === /a.ts === +// --- (line: 7) skipped --- +// +// async a() { } +// +// override b/*GOTO TYPE*/() {} +// +// public async c() { } +// } +// +// export function foo() { } + + + +// === goToType === +// === /a.ts === +// --- (line: 9) skipped --- +// +// override b() {} +// +// /*GOTO TYPE*/public async c() { } +// } +// +// export function foo() { } + + + +// === goToType === +// === /a.ts === +// --- (line: 9) skipped --- +// +// override b() {} +// +// public/*GOTO TYPE*/ async c() { } +// } +// +// export function foo() { } + + + +// === goToType === +// === /a.ts === +// --- (line: 9) skipped --- +// +// override b() {} +// +// public as/*GOTO TYPE*/ync c() { } +// } +// +// export function foo() { } + + + +// === goToType === +// === /a.ts === +// --- (line: 9) skipped --- +// +// override b() {} +// +// public async c/*GOTO TYPE*/() { } +// } +// +// export function foo() { } + + + +// === goToType === +// === /a.ts === +// --- (line: 12) skipped --- +// public async c() { } +// } +// +// exp/*GOTO TYPE*/ort function foo() { } + + + +// === goToType === +// === /a.ts === +// --- (line: 12) skipped --- +// public async c() { } +// } +// +// export function foo/*GOTO TYPE*/() { } \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionModule.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionModule.baseline.jsonc new file mode 100644 index 0000000000..e4615be10b --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionModule.baseline.jsonc @@ -0,0 +1,23 @@ +// === goToType === +// === /module1.ts === +// module [|M|] { +// export var p; +// } +// var m: typeof M; + +// === /module3.ts === +// /*GOTO TYPE*/M; +// m; + + + +// === goToType === +// === /module1.ts === +// module [|M|] { +// export var p; +// } +// var m: typeof M; + +// === /module3.ts === +// M; +// /*GOTO TYPE*/m; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionPrimitives.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionPrimitives.baseline.jsonc new file mode 100644 index 0000000000..04785ee8ff --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionPrimitives.baseline.jsonc @@ -0,0 +1,33 @@ +// === goToType === +// === /module2.ts === +// w./*GOTO TYPE*/a; +// x; +// y; +// y; + + + +// === goToType === +// === /module2.ts === +// w.a; +// /*GOTO TYPE*/x; +// y; +// y; + + + +// === goToType === +// === /module2.ts === +// w.a; +// x; +// /*GOTO TYPE*/y; +// y; + + + +// === goToType === +// === /module2.ts === +// w.a; +// x; +// y; +// /*GOTO TYPE*/y; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionUnionType.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionUnionType.baseline.jsonc new file mode 100644 index 0000000000..b29b559356 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinitionUnionType.baseline.jsonc @@ -0,0 +1,19 @@ +// === goToType === +// === /goToTypeDefinitionUnionType.ts === +// class [|C|] { +// p; +// } +// +// interface [|I|] { +// x; +// } +// +// module M { +// export interface [|I|] { +// y; +// } +// } +// +// var x: C | I | M.I; +// +// /*GOTO TYPE*/x; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_Pick.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_Pick.baseline.jsonc new file mode 100644 index 0000000000..e15dcddec0 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_Pick.baseline.jsonc @@ -0,0 +1,19 @@ +// === goToType === +// === /goToTypeDefinition_Pick.ts === +// type User = [|{ id: number; name: string; }|]; +// declare const user: Pick +// /*GOTO TYPE*/user +// +// type PickedUser = Pick +// declare const user2: PickedUser +// user2 + + + +// === goToType === +// === /goToTypeDefinition_Pick.ts === +// --- (line: 3) skipped --- +// +// type PickedUser = Pick +// declare const user2: PickedUser +// /*GOTO TYPE*/user2 \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_arrayType.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_arrayType.baseline.jsonc new file mode 100644 index 0000000000..e984cc5804 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_arrayType.baseline.jsonc @@ -0,0 +1,37 @@ +// === goToType === +// === /goToTypeDefinition_arrayType.ts === +// type User = [|{ name: string }|]; +// declare const users: User[] +// /*GOTO TYPE*/users +// +// type UsersArr = Array +// declare const users2: UsersArr +// // --- (line: 7) skipped --- + + + +// === goToType === +// === /goToTypeDefinition_arrayType.ts === +// type User = [|{ name: string }|]; +// declare const users: User[] +// users +// +// type UsersArr = Array +// declare const users2: UsersArr +// /*GOTO TYPE*/users2 +// +// class CustomArray extends Array { immutableReverse() { return [...this].reverse() } } +// declare const users3: CustomArray +// users3 + + + +// === goToType === +// === /goToTypeDefinition_arrayType.ts === +// --- (line: 5) skipped --- +// declare const users2: UsersArr +// users2 +// +// class [|CustomArray|] extends Array { immutableReverse() { return [...this].reverse() } } +// declare const users3: CustomArray +// /*GOTO TYPE*/users3 \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_promiseType.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_promiseType.baseline.jsonc new file mode 100644 index 0000000000..18eae436c2 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_promiseType.baseline.jsonc @@ -0,0 +1,19 @@ +// === goToType === +// === /goToTypeDefinition_promiseType.ts === +// type User = [|{ name: string }|]; +// async function /*GOTO TYPE*/getUser() { return { name: "Bob" } satisfies User as User } +// +// const promisedBob = getUser() +// +// export {} + + + +// === goToType === +// === /goToTypeDefinition_promiseType.ts === +// type User = [|{ name: string }|]; +// async function getUser() { return { name: "Bob" } satisfies User as User } +// +// const /*GOTO TYPE*/promisedBob = getUser() +// +// export {} \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_returnType.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_returnType.baseline.jsonc new file mode 100644 index 0000000000..33d20e328a --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_returnType.baseline.jsonc @@ -0,0 +1,179 @@ +// === goToType === +// === /goToTypeDefinition_returnType.ts === +// interface [|I|] { x: number; } +// interface J { y: number; } +// +// function f0(): I { return { x: 0 }; } +// // --- (line: 5) skipped --- + +// --- (line: 21) skipped --- +// function f8(j: J): J; +// function f8(ij: any): any { return ij; } +// +// /*GOTO TYPE*/f0(); +// f1(); +// f2(); +// f3(); +// // --- (line: 29) skipped --- + + + +// === goToType === +// === /goToTypeDefinition_returnType.ts === +// interface I { x: number; } +// interface J { y: number; } +// +// function f0(): I { return { x: 0 }; } +// +// type T = [|(i: I) => I|]; +// const f1: T = i => ({ x: i.x + 1 }); +// +// const f2 = (i: I): I => ({ x: i.x + 1 }); +// // --- (line: 10) skipped --- + +// --- (line: 22) skipped --- +// function f8(ij: any): any { return ij; } +// +// f0(); +// /*GOTO TYPE*/f1(); +// f2(); +// f3(); +// f4(); +// // --- (line: 30) skipped --- + + + +// === goToType === +// === /goToTypeDefinition_returnType.ts === +// interface [|I|] { x: number; } +// interface J { y: number; } +// +// function f0(): I { return { x: 0 }; } +// // --- (line: 5) skipped --- + +// --- (line: 23) skipped --- +// +// f0(); +// f1(); +// /*GOTO TYPE*/f2(); +// f3(); +// f4(); +// f5(); +// // --- (line: 31) skipped --- + + + +// === goToType === +// === /goToTypeDefinition_returnType.ts === +// --- (line: 7) skipped --- +// +// const f2 = (i: I): I => ({ x: i.x + 1 }); +// +// const f3 = (i: I) => ([|{ x: i.x + 1 }|]); +// +// const f4 = (i: I) => i; +// +// // --- (line: 15) skipped --- + +// --- (line: 24) skipped --- +// f0(); +// f1(); +// f2(); +// /*GOTO TYPE*/f3(); +// f4(); +// f5(); +// f6(); +// f7(); +// f8(); + + + +// === goToType === +// === /goToTypeDefinition_returnType.ts === +// interface [|I|] { x: number; } +// interface J { y: number; } +// +// function f0(): I { return { x: 0 }; } +// // --- (line: 5) skipped --- + +// --- (line: 25) skipped --- +// f1(); +// f2(); +// f3(); +// /*GOTO TYPE*/f4(); +// f5(); +// f6(); +// f7(); +// f8(); + + + +// === goToType === +// === /goToTypeDefinition_returnType.ts === +// interface [|I|] { x: number; } +// interface [|J|] { y: number; } +// +// function f0(): I { return { x: 0 }; } +// +// // --- (line: 6) skipped --- + +// --- (line: 26) skipped --- +// f2(); +// f3(); +// f4(); +// /*GOTO TYPE*/f5(); +// f6(); +// f7(); +// f8(); + + + +// === goToType === +// === /goToTypeDefinition_returnType.ts === +// interface [|I|] { x: number; } +// interface [|J|] { y: number; } +// +// function f0(): I { return { x: 0 }; } +// +// // --- (line: 6) skipped --- + +// --- (line: 27) skipped --- +// f3(); +// f4(); +// f5(); +// /*GOTO TYPE*/f6(); +// f7(); +// f8(); + + + +// === goToType === +// === /goToTypeDefinition_returnType.ts === +// --- (line: 28) skipped --- +// f4(); +// f5(); +// f6(); +// /*GOTO TYPE*/f7(); +// f8(); + + + +// === goToType === +// === /goToTypeDefinition_returnType.ts === +// --- (line: 17) skipped --- +// +// const f7 = (i: I) => {}; +// +// function [|f8|](i: I): I; +// function [|f8|](j: J): J; +// function [|f8|](ij: any): any { return ij; } +// +// f0(); +// f1(); +// f2(); +// f3(); +// f4(); +// f5(); +// f6(); +// f7(); +// /*GOTO TYPE*/f8(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_typeReference.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_typeReference.baseline.jsonc new file mode 100644 index 0000000000..b5a668654f --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_typeReference.baseline.jsonc @@ -0,0 +1,6 @@ +// === goToType === +// === /goToTypeDefinition_typeReference.ts === +// type User = { name: string }; +// type Box = [|{ value: T }|]; +// declare const boxedUser: Box +// /*GOTO TYPE*/boxedUser \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_typedef.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_typedef.baseline.jsonc new file mode 100644 index 0000000000..beeae33cc7 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/goToTypeDefinition_typedef.baseline.jsonc @@ -0,0 +1,9 @@ +// === goToType === +// === /a.js === +// /** +// * @typedef {object} I +// * [|@property {number} x +// |]*/ +// +// /** @type {I} */ +// const /*GOTO TYPE*/i = { x: 0 }; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/goToType/typedefinition01.baseline.jsonc b/testdata/baselines/reference/fourslash/goToType/typedefinition01.baseline.jsonc new file mode 100644 index 0000000000..5803b2d492 --- /dev/null +++ b/testdata/baselines/reference/fourslash/goToType/typedefinition01.baseline.jsonc @@ -0,0 +1,7 @@ +// === goToType === +// === /a.ts === +// export class [|Foo|] {} + +// === /b.ts === +// import n = require('./a'); +// var x/*GOTO TYPE*/ = new n.Foo(); \ No newline at end of file From 2ad9453a78179115066aa8301b7f82f1e9890b3c Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Oct 2025 17:22:41 -0700 Subject: [PATCH 002/152] Fix panic in `getTokenAtPosition` for JSDoc type assertions (#1846) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Co-authored-by: Andrew Branch --- internal/astnav/tokens.go | 45 ++++++++++++++++++++++++--------- internal/astnav/tokens_test.go | 46 ++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 12 deletions(-) diff --git a/internal/astnav/tokens.go b/internal/astnav/tokens.go index a7b4750034..27ad1ebdf6 100644 --- a/internal/astnav/tokens.go +++ b/internal/astnav/tokens.go @@ -65,6 +65,10 @@ func getTokenAtPosition( // `left` tracks the lower boundary of the node/token that could be returned, // and is eventually the scanner's start position, if the scanner is used. left := 0 + // `allowReparsed` is set when we're navigating inside an AsExpression or + // SatisfiesExpression, which allows visiting their reparsed children to reach + // the actual identifier from JSDoc type assertions. + allowReparsed := false testNode := func(node *ast.Node) int { if node.Kind != ast.KindEndOfFile && node.End() == position && includePrecedingTokenAtEndPosition != nil { @@ -74,7 +78,8 @@ func getTokenAtPosition( if node.End() < position || node.Kind != ast.KindEndOfFile && node.End() == position { return -1 } - if getPosition(node, sourceFile, allowPositionInLeadingTrivia) > position { + nodePos := getPosition(node, sourceFile, allowPositionInLeadingTrivia) + if nodePos > position { return 1 } return 0 @@ -86,18 +91,29 @@ func getTokenAtPosition( visitNode := func(node *ast.Node, _ *ast.NodeVisitor) *ast.Node { // We can't abort visiting children, so once a match is found, we set `next` // and do nothing on subsequent visits. - if node != nil && node.Flags&ast.NodeFlagsReparsed == 0 && next == nil { - switch testNode(node) { - case -1: - if !ast.IsJSDocKind(node.Kind) { - // We can't move the left boundary into or beyond JSDoc, - // because we may end up returning the token after this JSDoc, - // constructing it with the scanner, and we need to include - // all its leading trivia in its position. - left = node.End() + if node != nil && next == nil { + // Skip reparsed nodes unless: + // 1. The node itself is AsExpression or SatisfiesExpression, OR + // 2. We're already inside an AsExpression or SatisfiesExpression (allowReparsed=true) + // These are special cases where reparsed nodes from JSDoc type assertions + // should still be navigable to reach identifiers. + isSpecialReparsed := node.Flags&ast.NodeFlagsReparsed != 0 && + (node.Kind == ast.KindAsExpression || node.Kind == ast.KindSatisfiesExpression) + + if node.Flags&ast.NodeFlagsReparsed == 0 || isSpecialReparsed || allowReparsed { + result := testNode(node) + switch result { + case -1: + if !ast.IsJSDocKind(node.Kind) { + // We can't move the left boundary into or beyond JSDoc, + // because we may end up returning the token after this JSDoc, + // constructing it with the scanner, and we need to include + // all its leading trivia in its position. + left = node.End() + } + case 0: + next = node } - case 0: - next = node } } return node @@ -194,6 +210,11 @@ func getTokenAtPosition( current = next left = current.Pos() next = nil + // When navigating into AsExpression or SatisfiesExpression, allow visiting + // their reparsed children to reach identifiers from JSDoc type assertions. + if current.Kind == ast.KindAsExpression || current.Kind == ast.KindSatisfiesExpression { + allowReparsed = true + } } } diff --git a/internal/astnav/tokens_test.go b/internal/astnav/tokens_test.go index b5eb7ba39f..0a0d180646 100644 --- a/internal/astnav/tokens_test.go +++ b/internal/astnav/tokens_test.go @@ -43,6 +43,52 @@ func TestGetTokenAtPosition(t *testing.T) { ) }) + t.Run("JSDoc type assertion", func(t *testing.T) { + t.Parallel() + fileText := `function foo(x) { + const s = /**@type {string}*/(x) +}` + file := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/test.js", + Path: "/test.js", + }, fileText, core.ScriptKindJS) + + // Position of 'x' inside the parenthesized expression (position 52) + position := 52 + + // This should not panic - it previously panicked with: + // "did not expect KindParenthesizedExpression to have KindIdentifier in its trivia" + token := astnav.GetTouchingPropertyName(file, position) + if token == nil { + t.Fatal("Expected to get a token, got nil") + } + + // The function may return either the identifier itself or the containing + // parenthesized expression, depending on how the AST is structured + if token.Kind != ast.KindIdentifier && token.Kind != ast.KindParenthesizedExpression { + t.Errorf("Expected identifier or parenthesized expression, got %s", token.Kind) + } + }) + + t.Run("JSDoc type assertion with comment", func(t *testing.T) { + t.Parallel() + // Exact code from the issue report + fileText := `function foo(x) { + const s = /**@type {string}*/(x) // Go-to-definition on x causes panic +}` + file := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/test.js", + Path: "/test.js", + }, fileText, core.ScriptKindJS) + + // Find position of 'x' in the type assertion + xPos := 52 // Position of 'x' in (x) + + // This should not panic + token := astnav.GetTouchingPropertyName(file, xPos) + assert.Assert(t, token != nil, "Expected to get a token") + }) + t.Run("pointer equality", func(t *testing.T) { t.Parallel() fileText := ` From 0f6b0a779b8dc059a8ae7bc2168b3e40234105e0 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 16 Oct 2025 11:05:49 -0700 Subject: [PATCH 003/152] =?UTF-8?q?Don=E2=80=99t=20look=20in=20JSExportAss?= =?UTF-8?q?ignment=20and=20CommonJSExport=20for=20nodes=20(#1886)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/ast/utilities.go | 2 +- .../tests/cases/compiler/nestedJSDocImportType.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 testdata/tests/cases/compiler/nestedJSDocImportType.ts diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 1793bc63ef..f491127d22 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -2641,7 +2641,7 @@ func GetNodeAtPosition(file *SourceFile, position int, includeJSDoc bool) *Node } if child == nil { current.ForEachChild(func(node *Node) bool { - if nodeContainsPosition(node, position) { + if nodeContainsPosition(node, position) && node.Kind != KindJSExportAssignment && node.Kind != KindCommonJSExport { child = node return true } diff --git a/testdata/tests/cases/compiler/nestedJSDocImportType.ts b/testdata/tests/cases/compiler/nestedJSDocImportType.ts new file mode 100644 index 0000000000..8569089738 --- /dev/null +++ b/testdata/tests/cases/compiler/nestedJSDocImportType.ts @@ -0,0 +1,15 @@ +// @checkJs: true +// @noEmit: true +// @noTypesAndSymbols: true + +// @Filename: a.js +/** @typedef {string} A */ + +// @Filename: b.js +module.exports = { + create() { + /** @param {import("./a").A} x */ + function f(x) {} + return f("hi"); + } +} \ No newline at end of file From 49e5285c336c2212d568b504e578a461cb726ab3 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 16 Oct 2025 17:04:16 -0700 Subject: [PATCH 004/152] Fix link in native preview platform packages (#1838) --- Herebyfile.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Herebyfile.mjs b/Herebyfile.mjs index 81109df321..b43a2b0115 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -1127,7 +1127,7 @@ export const buildNativePreviewPackages = task({ const readme = [ `# \`${npmPackageName}\``, "", - `This package provides ${nodeOs}-${nodeArch} support for [${packageJson.name}](https://www.npmjs.com/package/${packageJson.name}).`, + `This package provides ${nodeOs}-${nodeArch} support for [${mainNativePreviewPackage.npmPackageName}](https://www.npmjs.com/package/${mainNativePreviewPackage.npmPackageName}).`, ]; fs.promises.writeFile(path.join(npmDir, "README.md"), readme.join("\n") + "\n"); From 20b1482ea8b55d51fc21c60718dc934d763c918b Mon Sep 17 00:00:00 2001 From: "Oleksandr T." Date: Fri, 17 Oct 2025 15:59:03 +0300 Subject: [PATCH 005/152] fix(1880): No error message for JSDoc type parsing (#1881) --- internal/compiler/program.go | 6 ++ .../compiler/invalidJsdocType.errors.txt | 8 +++ .../compiler/invalidJsdocType.symbols | 7 +++ .../reference/compiler/invalidJsdocType.types | 7 +++ .../compiler/jsEnumCrossFileExport.errors.txt | 6 +- .../jsdocFunctionTypeFalsePositive.errors.txt | 5 +- ...docParameterParsingInfiniteLoop.errors.txt | 5 +- .../compiler/uniqueSymbolJs.errors.txt | 5 +- .../asyncArrowFunction_allowJs.errors.txt | 17 +++++- .../checkJsdocSatisfiesTag14.errors.txt | 20 +++++++ .../conformance/checkJsdocTypeTag1.errors.txt | 11 +++- .../conformance/checkJsdocTypeTag2.errors.txt | 14 ++++- ...ckJsdocTypeTagOnObjectProperty1.errors.txt | 8 ++- ...ckJsdocTypeTagOnObjectProperty2.errors.txt | 11 +++- ...checkJsdocTypedefOnlySourceFile.errors.txt | 6 +- .../conformance/importDeferJsdoc.errors.txt | 5 +- .../conformance/importTag10.errors.txt | 11 ++++ .../conformance/importTag11.errors.txt | 10 ++++ .../conformance/importTag12.errors.txt | 10 ++++ .../conformance/importTag13.errors.txt | 5 +- .../conformance/importTag14.errors.txt | 5 +- ...larationsModuleReferenceHasEmit.errors.txt | 5 +- ...ArgsWithThisTypeInJSDocFunction.errors.txt | 13 +++++ ...sExistingNodesMappingJSDocTypes.errors.txt | 11 +++- .../jsdocAugmentsMissingType.errors.txt | 5 +- .../conformance/jsdocFunctionType.errors.txt | 20 ++++++- .../jsdocFunction_missingReturn.errors.txt | 5 +- .../jsdocImplements_missingType.errors.txt | 11 ++++ .../jsdocImplements_missingType.js | 18 ------ .../jsdocImplements_missingType.js.diff | 20 +------ .../jsdocOuterTypeParameters1.errors.txt | 5 +- .../jsdocOuterTypeParameters3.errors.txt | 5 +- ...ocParseDotDotDotInJSDocFunction.errors.txt | 8 ++- .../jsdocParseHigherOrderFunction.errors.txt | 5 +- ...arseParenthesizedJSDocParameter.errors.txt | 5 +- .../jsdocParseStarEquals.errors.txt | 5 +- .../jsdocPrefixPostfixParsing.errors.txt | 11 +++- .../conformance/jsdocPrivateName2.errors.txt | 14 +++++ .../conformance/jsdocTemplateTag.errors.txt | 5 +- .../conformance/jsdocTemplateTag3.errors.txt | 5 +- .../jsdocTemplateTagDefault.errors.txt | 8 ++- .../conformance/jsdocThisType.errors.txt | 8 ++- .../jsdocTypeTagParameterType.errors.txt | 5 +- .../jsdocTypeTagRequiredParameters.errors.txt | 5 +- .../conformance/jsdocVariadicType.errors.txt | 5 +- .../noAssertForUnparseableTypedefs.errors.txt | 5 +- .../conformance/paramTagWrapping.errors.txt | 11 +++- .../templateInsideCallback.errors.txt | 14 ++++- ...typedefDuplicateTypeDeclaration.errors.txt | 13 +++++ .../typedefInnerNamepaths.errors.txt | 19 +++++++ .../conformance/typedefTagWrapping.errors.txt | 23 ++++++-- .../jsEnumCrossFileExport.errors.txt.diff | 6 +- ...cFunctionTypeFalsePositive.errors.txt.diff | 18 ------ ...rameterParsingInfiniteLoop.errors.txt.diff | 5 +- .../compiler/uniqueSymbolJs.errors.txt.diff | 13 +++-- ...asyncArrowFunction_allowJs.errors.txt.diff | 17 +++++- .../checkJsdocSatisfiesTag14.errors.txt.diff | 35 ++++++------ .../checkJsdocTypeTag1.errors.txt.diff | 22 +++++++- .../checkJsdocTypeTag2.errors.txt.diff | 16 +++++- ...ocTypeTagOnObjectProperty1.errors.txt.diff | 8 ++- ...ocTypeTagOnObjectProperty2.errors.txt.diff | 23 ++++---- ...JsdocTypedefOnlySourceFile.errors.txt.diff | 6 +- .../importDeferJsdoc.errors.txt.diff | 13 +++-- .../conformance/importTag10.errors.txt.diff | 15 ----- .../conformance/importTag11.errors.txt.diff | 19 +++---- .../conformance/importTag12.errors.txt.diff | 18 +++--- .../conformance/importTag13.errors.txt.diff | 15 +++-- .../conformance/importTag14.errors.txt.diff | 11 ++-- ...ionsModuleReferenceHasEmit.errors.txt.diff | 5 +- ...ithThisTypeInJSDocFunction.errors.txt.diff | 17 ++++++ ...tingNodesMappingJSDocTypes.errors.txt.diff | 11 +++- .../jsdocAugmentsMissingType.errors.txt.diff | 5 +- .../jsdocFunctionType.errors.txt.diff | 27 +++++++-- ...sdocFunction_missingReturn.errors.txt.diff | 5 +- ...sdocImplements_missingType.errors.txt.diff | 20 +++---- .../jsdocOuterTypeParameters1.errors.txt.diff | 12 ++-- .../jsdocOuterTypeParameters3.errors.txt.diff | 12 ++-- ...seDotDotDotInJSDocFunction.errors.txt.diff | 8 ++- ...ocParseHigherOrderFunction.errors.txt.diff | 5 +- ...arenthesizedJSDocParameter.errors.txt.diff | 5 +- .../jsdocParseStarEquals.errors.txt.diff | 5 +- .../jsdocPrefixPostfixParsing.errors.txt.diff | 24 ++++---- .../jsdocPrivateName2.errors.txt.diff | 23 +++----- .../jsdocTemplateTag.errors.txt.diff | 9 ++- .../jsdocTemplateTag3.errors.txt.diff | 21 +++---- .../jsdocTemplateTagDefault.errors.txt.diff | 33 ----------- .../conformance/jsdocThisType.errors.txt.diff | 10 +++- .../jsdocTypeTagParameterType.errors.txt.diff | 5 +- ...cTypeTagRequiredParameters.errors.txt.diff | 7 ++- .../jsdocVariadicType.errors.txt.diff | 5 +- ...sertForUnparseableTypedefs.errors.txt.diff | 5 +- .../paramTagWrapping.errors.txt.diff | 19 ++++--- .../templateInsideCallback.errors.txt.diff | 51 +++++++---------- ...efDuplicateTypeDeclaration.errors.txt.diff | 17 ------ .../typedefInnerNamepaths.errors.txt.diff | 35 ++++++------ .../typedefTagWrapping.errors.txt.diff | 55 +++++++------------ .../tests/cases/compiler/invalidJsdocType.ts | 6 ++ 97 files changed, 777 insertions(+), 419 deletions(-) create mode 100644 testdata/baselines/reference/compiler/invalidJsdocType.errors.txt create mode 100644 testdata/baselines/reference/compiler/invalidJsdocType.symbols create mode 100644 testdata/baselines/reference/compiler/invalidJsdocType.types create mode 100644 testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag10.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag11.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/importTag12.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocPrivateName2.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefDuplicateTypeDeclaration.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.errors.txt delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/importTag10.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefDuplicateTypeDeclaration.errors.txt.diff create mode 100644 testdata/tests/cases/compiler/invalidJsdocType.ts diff --git a/internal/compiler/program.go b/internal/compiler/program.go index b70a00197f..7238991f97 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -1056,6 +1056,12 @@ func (p *Program) getSemanticDiagnosticsForFileNotFilter(ctx context.Context, so }) } + isJS := sourceFile.ScriptKind == core.ScriptKindJS || sourceFile.ScriptKind == core.ScriptKindJSX + isCheckJS := isJS && ast.IsCheckJSEnabledForFile(sourceFile, compilerOptions) + if isCheckJS { + diags = append(diags, sourceFile.JSDocDiagnostics()...) + } + filtered, directivesByLine := p.getDiagnosticsWithPrecedingDirectives(sourceFile, diags) for _, directive := range directivesByLine { // Above we changed all used directive kinds to @ts-ignore, so any @ts-expect-error directives that diff --git a/testdata/baselines/reference/compiler/invalidJsdocType.errors.txt b/testdata/baselines/reference/compiler/invalidJsdocType.errors.txt new file mode 100644 index 0000000000..e122d03076 --- /dev/null +++ b/testdata/baselines/reference/compiler/invalidJsdocType.errors.txt @@ -0,0 +1,8 @@ +a.js(1,12): error TS1110: Type expected. + + +==== a.js (1 errors) ==== + /** @type {@import("a").Type} */ + ~ +!!! error TS1110: Type expected. + let x; \ No newline at end of file diff --git a/testdata/baselines/reference/compiler/invalidJsdocType.symbols b/testdata/baselines/reference/compiler/invalidJsdocType.symbols new file mode 100644 index 0000000000..0f8b4e2b0a --- /dev/null +++ b/testdata/baselines/reference/compiler/invalidJsdocType.symbols @@ -0,0 +1,7 @@ +//// [tests/cases/compiler/invalidJsdocType.ts] //// + +=== a.js === +/** @type {@import("a").Type} */ +let x; +>x : Symbol(x, Decl(a.js, 1, 3)) + diff --git a/testdata/baselines/reference/compiler/invalidJsdocType.types b/testdata/baselines/reference/compiler/invalidJsdocType.types new file mode 100644 index 0000000000..50b41486a2 --- /dev/null +++ b/testdata/baselines/reference/compiler/invalidJsdocType.types @@ -0,0 +1,7 @@ +//// [tests/cases/compiler/invalidJsdocType.ts] //// + +=== a.js === +/** @type {@import("a").Type} */ +let x; +>x : any + diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt index 3be4b9a200..8636c15447 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsEnumCrossFileExport.errors.txt @@ -1,3 +1,4 @@ +enumDef.js(14,21): error TS1003: Identifier expected. enumDef.js(16,18): error TS2339: Property 'Blah' does not exist on type '{ Action: { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; }; }'. index.js(4,17): error TS2503: Cannot find namespace 'Host'. index.js(8,21): error TS2304: Cannot find name 'Host'. @@ -5,7 +6,7 @@ index.js(13,11): error TS2503: Cannot find namespace 'Host'. index.js(18,11): error TS2503: Cannot find namespace 'Host'. -==== enumDef.js (1 errors) ==== +==== enumDef.js (2 errors) ==== var Host = {}; Host.UserMetrics = {}; /** @enum {number} */ @@ -20,7 +21,10 @@ index.js(18,11): error TS2503: Cannot find namespace 'Host'. */ /** * @typedef {string} + */ + +!!! error TS1003: Identifier expected. Host.UserMetrics.Blah = { ~~~~ !!! error TS2339: Property 'Blah' does not exist on type '{ Action: { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; }; }'. diff --git a/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt index 4147bce1d5..f3bf77a415 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocFunctionTypeFalsePositive.errors.txt @@ -1,9 +1,12 @@ /a.js(1,13): error TS1098: Type parameter list cannot be empty. +/a.js(1,14): error TS1139: Type parameter declaration expected. -==== /a.js (1 errors) ==== +==== /a.js (2 errors) ==== /** @param {<} x */ ~~ !!! error TS1098: Type parameter list cannot be empty. + ~ +!!! error TS1139: Type parameter declaration expected. function f(x) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt index 1b0b2a8cd2..e7e5e429a5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocParameterParsingInfiniteLoop.errors.txt @@ -1,12 +1,15 @@ example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +example.js(3,19): error TS1005: '}' expected. -==== example.js (1 errors) ==== +==== example.js (2 errors) ==== // @ts-check /** * @type {function(@foo)} ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. */ let x; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/uniqueSymbolJs.errors.txt b/testdata/baselines/reference/submodule/compiler/uniqueSymbolJs.errors.txt index 162596d71b..9b3d5518d5 100644 --- a/testdata/baselines/reference/submodule/compiler/uniqueSymbolJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/uniqueSymbolJs.errors.txt @@ -1,8 +1,9 @@ a.js(5,18): error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type. a.js(5,23): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? +a.js(5,28): error TS1005: ';' expected. -==== a.js (2 errors) ==== +==== a.js (3 errors) ==== /** @type {unique symbol} */ const foo = Symbol(); @@ -12,4 +13,6 @@ a.js(5,23): error TS2749: 'foo' refers to a value, but is being used as a type h !!! error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type. ~~~ !!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? + ~~~~~~~ +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt index 6dc5427f14..fcda802241 100644 --- a/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/asyncArrowFunction_allowJs.errors.txt @@ -1,16 +1,23 @@ file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(2,20): error TS1005: '}' expected. file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(6,20): error TS1005: '}' expected. file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(10,20): error TS1005: '}' expected. file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(16,20): error TS1005: '}' expected. file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +file.js(21,20): error TS1005: '}' expected. -==== file.js (5 errors) ==== +==== file.js (10 errors) ==== // Error (good) /** @type {function(): string} */ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const a = () => 0 // Error (good) @@ -18,6 +25,8 @@ file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Functio ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const b = async () => 0 // No error (bad) @@ -25,6 +34,8 @@ file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Functio ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const c = async () => { return 0 } @@ -34,6 +45,8 @@ file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Functio ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const d = async () => { return "" } @@ -42,6 +55,8 @@ file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Functio ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const f = (p) => {} // Error (good) diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.errors.txt new file mode 100644 index 0000000000..81ef184a80 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocSatisfiesTag14.errors.txt @@ -0,0 +1,20 @@ +/a.js(7,15): error TS1005: '{' expected. +/a.js(10,27): error TS1005: '{' expected. + + +==== /a.js (2 errors) ==== + /** + * @typedef {Object} T1 + * @property {number} a + */ + + /** + * @satisfies T1 + ~~ +!!! error TS1005: '{' expected. + */ + const t1 = { a: 1 }; + const t2 = /** @satisfies T1 */ ({ a: 1 }); + ~~ +!!! error TS1005: '{' expected. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt index beeb1723a4..e65ef651bc 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag1.errors.txt @@ -1,10 +1,13 @@ +0.js(12,13): error TS1110: Type expected. 0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? 0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(24,21): error TS1005: '}' expected. 0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(28,21): error TS1005: '}' expected. 0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'object', but here has type 'Object'. -==== 0.js (4 errors) ==== +==== 0.js (7 errors) ==== // @ts-check /** @type {String} */ var S = "hello world"; @@ -17,6 +20,8 @@ anyT = "hello"; /** @type {?} */ + ~ +!!! error TS1110: Type expected. var anyT1 = 2; anyT1 = "hi"; @@ -35,6 +40,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x1 = (a) => a + 1; x1(0); @@ -42,6 +49,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x2 = (a) => a + 1; x2(0); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt index 76933dc06a..3fa558ce7e 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag2.errors.txt @@ -1,12 +1,16 @@ 0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'String'. 0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. 0.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(8,21): error TS1005: '}' expected. 0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(12,21): error TS1005: '}' expected. 0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(19,21): error TS1005: '}' expected. 0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(23,21): error TS1005: '}' expected. -==== 0.js (6 errors) ==== +==== 0.js (10 errors) ==== // @ts-check /** @type {String} */ var S = true; @@ -22,6 +26,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x1 = (a) => a + 1; x1("string"); @@ -29,6 +35,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x2 = (a) => a + 1; /** @type {string} */ @@ -39,6 +47,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x3 = (a) => a.concat("hi"); x3(0); @@ -46,5 +56,7 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const x4 = (a) => a + 1; x4(0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt index 0de428dba4..fdc2f09b11 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt @@ -1,9 +1,11 @@ 0.js(8,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? 0.js(8,14): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. +0.js(8,22): error TS1005: '}' expected. 0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(16,22): error TS1005: '}' expected. -==== 0.js (3 errors) ==== +==== 0.js (5 errors) ==== // @ts-check var lol = "hello Lol" const obj = { @@ -17,6 +19,8 @@ !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ~~~~~~~~ !!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. + ~ +!!! error TS1005: '}' expected. method1(n1) { return n1 + 42; }, @@ -28,6 +32,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. arrowFunc: (num) => num + 42 } obj.foo = 'string' diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt index 42e3fc5e74..a57a956ce1 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt @@ -1,11 +1,14 @@ 0.js(5,3): error TS2322: Type 'number' is not assignable to type 'string'. 0.js(6,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? 0.js(6,14): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. +0.js(6,22): error TS1005: '}' expected. 0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(10,22): error TS1005: '}' expected. 0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(12,22): error TS1005: '}' expected. -==== 0.js (5 errors) ==== +==== 0.js (8 errors) ==== // @ts-check var lol; const obj = { @@ -19,6 +22,8 @@ !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ~~~~~~~~ !!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. + ~ +!!! error TS1005: '}' expected. method1(n1) { return "42"; }, @@ -26,11 +31,15 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. method2: (n1) => "lol", /** @type {function(number): number} */ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. arrowFunc: (num="0") => num + 42, /** @type {string} */ lol diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt index 7cb22b9170..02b45beef8 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypedefOnlySourceFile.errors.txt @@ -1,9 +1,10 @@ 0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. +0.js(6,21): error TS1003: Identifier expected. 0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'. 0.js(10,12): error TS2503: Cannot find namespace 'exports'. -==== 0.js (3 errors) ==== +==== 0.js (4 errors) ==== // @ts-check var exports = {}; @@ -12,7 +13,10 @@ /** * @typedef {string} + */ + +!!! error TS1003: Identifier expected. exports.SomeName; ~~~~~~~~ !!! error TS2339: Property 'SomeName' does not exist on type '{}'. diff --git a/testdata/baselines/reference/submodule/conformance/importDeferJsdoc.errors.txt b/testdata/baselines/reference/submodule/conformance/importDeferJsdoc.errors.txt index ddbf644aaa..857db340b4 100644 --- a/testdata/baselines/reference/submodule/conformance/importDeferJsdoc.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importDeferJsdoc.errors.txt @@ -1,3 +1,4 @@ +/foo.js(2,18): error TS1005: 'from' expected. /foo.js(2,18): error TS1141: String literal expected. /foo.js(6,12): error TS2503: Cannot find namespace 'ns'. @@ -5,9 +6,11 @@ ==== /types.ts (0 errors) ==== export type X = 1; -==== /foo.js (2 errors) ==== +==== /foo.js (3 errors) ==== /** * @import defer * as ns from "./types" + ~ +!!! error TS1005: 'from' expected. ~~~~ !!! error TS1141: String literal expected. */ diff --git a/testdata/baselines/reference/submodule/conformance/importTag10.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag10.errors.txt new file mode 100644 index 0000000000..496ce7f502 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag10.errors.txt @@ -0,0 +1,11 @@ +/foo.js(2,11): error TS1109: Expression expected. + + +==== /foo.js (1 errors) ==== + /** + * @import + + */ + +!!! error TS1109: Expression expected. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag11.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag11.errors.txt new file mode 100644 index 0000000000..6071e9e709 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag11.errors.txt @@ -0,0 +1,10 @@ +/foo.js(3,2): error TS1005: 'from' expected. + + +==== /foo.js (1 errors) ==== + /** + * @import foo + */ + +!!! error TS1005: 'from' expected. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag12.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag12.errors.txt new file mode 100644 index 0000000000..dc3d88ac50 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag12.errors.txt @@ -0,0 +1,10 @@ +/foo.js(3,2): error TS1109: Expression expected. + + +==== /foo.js (1 errors) ==== + /** + * @import foo from + */ + +!!! error TS1109: Expression expected. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importTag13.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag13.errors.txt index 958d6225ec..3427c0e358 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag13.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importTag13.errors.txt @@ -1,8 +1,11 @@ +/foo.js(1,15): error TS1005: 'from' expected. /foo.js(1,15): error TS1141: String literal expected. -==== /foo.js (1 errors) ==== +==== /foo.js (2 errors) ==== /** @import x = require("types") */ + ~ +!!! error TS1005: 'from' expected. ~~~~~~~~~~~~~~~~~~ !!! error TS1141: String literal expected. diff --git a/testdata/baselines/reference/submodule/conformance/importTag14.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag14.errors.txt index d5fdf908c6..6109dd03ca 100644 --- a/testdata/baselines/reference/submodule/conformance/importTag14.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importTag14.errors.txt @@ -1,9 +1,10 @@ /foo.js(1,25): error TS2306: File '/foo.js' is not a module. /foo.js(1,33): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /foo.js(1,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +/foo.js(1,38): error TS1005: '{' expected. -==== /foo.js (3 errors) ==== +==== /foo.js (4 errors) ==== /** @import * as f from "./foo" with */ ~~~~~~~ !!! error TS2306: File '/foo.js' is not a module. @@ -11,4 +12,6 @@ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. ~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + +!!! error TS1005: '{' expected. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt index 30a9f935a7..03ef528a8c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt @@ -1,7 +1,8 @@ index.js(9,11): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +index.js(9,17): error TS1005: '}' expected. -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== /** * @module A */ @@ -13,6 +14,8 @@ index.js(9,11): error TS2580: Cannot find name 'module'. Do you need to install * @type {module:A} ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + ~ +!!! error TS1005: '}' expected. */ export let el = null; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt new file mode 100644 index 0000000000..9e85c38599 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt @@ -0,0 +1,13 @@ +bug38550.js(3,22): error TS1005: '}' expected. + + +==== bug38550.js (1 errors) ==== + export class Clazz { + /** + * @param {function(this:Object, ...*):*} functionDeclaration + ~ +!!! error TS1005: '}' expected. + */ + method(functionDeclaration) {} + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt index e15b2747c9..e6ea3ee553 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt @@ -1,10 +1,15 @@ +index.js(1,13): error TS1110: Type expected. index.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +index.js(16,20): error TS1005: '}' expected. index.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +index.js(19,20): error TS1005: '}' expected. index.js(22,12): error TS2315: Type 'Object' is not generic. -==== index.js (3 errors) ==== +==== index.js (6 errors) ==== /** @type {?} */ + ~ +!!! error TS1110: Type expected. export const a = null; /** @type {*} */ @@ -23,12 +28,16 @@ index.js(22,12): error TS2315: Type 'Object' is not generic. ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. export const f = null; /** @type {function(new: object, string, number)} */ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. export const g = null; /** @type {Object.} */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocAugmentsMissingType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocAugmentsMissingType.errors.txt index f3a1da2292..64751af466 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocAugmentsMissingType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocAugmentsMissingType.errors.txt @@ -1,11 +1,14 @@ /a.js(2,14): error TS8023: JSDoc '@augments ' does not match the 'extends A' clause. +/a.js(2,14): error TS1003: Identifier expected. -==== /a.js (1 errors) ==== +==== /a.js (2 errors) ==== class A { constructor() { this.x = 0; } } /** @augments */ !!! error TS8023: JSDoc '@augments ' does not match the 'extends A' clause. + ~ +!!! error TS1003: Identifier expected. class B extends A { m() { this.x diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt index b1407448a2..bb3a047fb1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunctionType.errors.txt @@ -1,22 +1,32 @@ +functions.js(2,20): error TS1005: '}' expected. functions.js(3,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(3,21): error TS1005: '}' expected. functions.js(5,14): error TS7006: Parameter 'c' implicitly has an 'any' type. functions.js(9,23): error TS7006: Parameter 'n' implicitly has an 'any' type. +functions.js(12,20): error TS1005: '}' expected. functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(13,21): error TS1005: '}' expected. functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +functions.js(30,21): error TS1005: '}' expected. functions.js(31,19): error TS7006: Parameter 'ab' implicitly has an 'any' type. functions.js(31,23): error TS7006: Parameter 'onetwo' implicitly has an 'any' type. +functions.js(48,20): error TS1005: '}' expected. functions.js(49,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type. -==== functions.js (10 errors) ==== +==== functions.js (16 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through + ~ +!!! error TS1005: '}' expected. * @return {function(this: string, number): number} ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. */ function id1(c) { ~ @@ -30,10 +40,14 @@ functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type /** * @param {function(new: { length: number }, number): number} c is just passing on through + ~ +!!! error TS1005: '}' expected. * @return {function(new: { length: number }, number): number} ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. */ function id2(c) { ~ @@ -56,6 +70,8 @@ functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } ~~ !!! error TS7006: Parameter 'ab' implicitly has an 'any' type. @@ -78,6 +94,8 @@ functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type /** * @param {function(new: D, number)} dref + ~ +!!! error TS1005: '}' expected. * @return {D} ~ !!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? diff --git a/testdata/baselines/reference/submodule/conformance/jsdocFunction_missingReturn.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocFunction_missingReturn.errors.txt index cf99dc4aac..f245054c91 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocFunction_missingReturn.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocFunction_missingReturn.errors.txt @@ -1,13 +1,16 @@ /a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? /a.js(1,12): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. +/a.js(1,20): error TS1005: '}' expected. -==== /a.js (2 errors) ==== +==== /a.js (3 errors) ==== /** @type {function(): number} */ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ~~~~~~~~ !!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. + ~ +!!! error TS1005: '}' expected. function f() {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.errors.txt new file mode 100644 index 0000000000..1b22f60035 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.errors.txt @@ -0,0 +1,11 @@ +/a.js(2,16): error TS1003: Identifier expected. + + +==== /a.js (1 errors) ==== + class A { constructor() { this.x = 0; } } + /** @implements */ + ~ +!!! error TS1003: Identifier expected. + class B { + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js index 0d5243e60c..222dea0291 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js @@ -16,21 +16,3 @@ declare class A { /** @implements */ declare class B implements { } - - -//// [DtsFileErrors] - - -out/a.d.ts(5,27): error TS1097: 'implements' list cannot be empty. - - -==== out/a.d.ts (1 errors) ==== - declare class A { - constructor(); - } - /** @implements */ - declare class B implements { - -!!! error TS1097: 'implements' list cannot be empty. - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js.diff b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js.diff index 643e190e6e..0f948ec122 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_missingType.js.diff @@ -10,22 +10,4 @@ /** @implements */ -declare class B { +declare class B implements { - } -+ -+ -+//// [DtsFileErrors] -+ -+ -+out/a.d.ts(5,27): error TS1097: 'implements' list cannot be empty. -+ -+ -+==== out/a.d.ts (1 errors) ==== -+ declare class A { -+ constructor(); -+ } -+ /** @implements */ -+ declare class B implements { -+ -+!!! error TS1097: 'implements' list cannot be empty. -+ } -+ \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt index ab250f778b..7d683ab15b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters1.errors.txt @@ -1,18 +1,21 @@ error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. +jsdocOuterTypeParameters1.js(4,19): error TS1069: Unexpected token. A type parameter name was expected without curly braces. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. !!! error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. !!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -==== jsdocOuterTypeParameters1.js (2 errors) ==== +==== jsdocOuterTypeParameters1.js (3 errors) ==== /** @return {T} */ ~ !!! error TS2304: Cannot find name 'T'. const dedupingMixin = function(mixin) {}; /** @template {T} */ + ~ +!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. const PropertyAccessors = dedupingMixin(() => { class Bar { static bar() { this.prototype.foo(); } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters3.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters3.errors.txt index dbb9a05d5f..dec5ad00d7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOuterTypeParameters3.errors.txt @@ -1,12 +1,15 @@ error TS5055: Cannot write file 'jsdocOuterTypeParameters3.js' because it would overwrite input file. Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. +jsdocOuterTypeParameters3.js(1,18): error TS1069: Unexpected token. A type parameter name was expected without curly braces. jsdocOuterTypeParameters3.js(5,43): error TS2339: Property 'foo' does not exist on type 'Bar'. !!! error TS5055: Cannot write file 'jsdocOuterTypeParameters3.js' because it would overwrite input file. !!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -==== jsdocOuterTypeParameters3.js (1 errors) ==== +==== jsdocOuterTypeParameters3.js (2 errors) ==== /** @template {T} */ + ~ +!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. class Baz { m() { class Bar { diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt index 4d4beab51f..eae095f502 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt @@ -1,10 +1,14 @@ +a.js(2,21): error TS1005: '}' expected. a.js(3,12): error TS7006: Parameter 'callback' implicitly has an 'any' type. a.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(8,20): error TS1005: '}' expected. -==== a.js (2 errors) ==== +==== a.js (4 errors) ==== // from bcryptjs /** @param {function(...[*])} callback */ + ~ +!!! error TS1005: '}' expected. function g(callback) { ~~~~~~~~ !!! error TS7006: Parameter 'callback' implicitly has an 'any' type. @@ -16,6 +20,8 @@ a.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. * @inner */ var stringFromCharCode = String.fromCharCode; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt index ff420a46d1..a5d5360268 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseHigherOrderFunction.errors.txt @@ -1,13 +1,16 @@ paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +paren.js(1,20): error TS1005: '}' expected. paren.js(2,10): error TS7006: Parameter 's' implicitly has an 'any' type. paren.js(2,13): error TS7006: Parameter 'id' implicitly has an 'any' type. -==== paren.js (3 errors) ==== +==== paren.js (4 errors) ==== /** @type {function((string), function((string)): string): string} */ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. var x = (s, id) => id(s) ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt index 89b948713c..ebc7f44032 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt @@ -1,12 +1,15 @@ paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +paren.js(1,20): error TS1005: '}' expected. paren.js(2,9): error TS7006: Parameter 's' implicitly has an 'any' type. -==== paren.js (2 errors) ==== +==== paren.js (3 errors) ==== /** @type {function((string)): string} */ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. var x = s => s.toString() ~ !!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt index b4c0510f9b..a6b4acf204 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocParseStarEquals.errors.txt @@ -1,9 +1,10 @@ a.js(1,5): error TS1047: A rest parameter cannot be optional. a.js(3,12): error TS2370: A rest parameter must be of an array type. +a.js(11,21): error TS1005: '}' expected. a.js(12,14): error TS7006: Parameter 'f' implicitly has an 'any' type. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== /** @param {...*=} args ~~~~~~~~~~~~~~~~~~~ @return {*=} */ @@ -20,6 +21,8 @@ a.js(12,14): error TS7006: Parameter 'f' implicitly has an 'any' type. /** @param {function():*=} f */ + ~ +!!! error TS1005: '}' expected. function cbf(f) { ~ !!! error TS7006: Parameter 'f' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt index f6d00af955..4318cb0357 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrefixPostfixParsing.errors.txt @@ -1,23 +1,32 @@ +prefixPostfix.js(5,18): error TS1005: '}' expected. +prefixPostfix.js(11,21): error TS1005: '}' expected. +prefixPostfix.js(14,21): error TS1005: '}' expected. prefixPostfix.js(18,21): error TS7006: Parameter 'a' implicitly has an 'any' type. prefixPostfix.js(18,39): error TS7006: Parameter 'h' implicitly has an 'any' type. prefixPostfix.js(18,48): error TS7006: Parameter 'k' implicitly has an 'any' type. -==== prefixPostfix.js (3 errors) ==== +==== prefixPostfix.js (6 errors) ==== /** * @param {number![]} x - number[] * @param {!number[]} y - number[] * @param {(number[])!} z - number[] * @param {number?[]} a - parse error without parentheses + ~ +!!! error TS1005: '}' expected. * @param {?number[]} b - number[] | null * @param {(number[])?} c - number[] | null * @param {...?number} e - (number | null)[] * @param {...number?} f - number[] | null * @param {...number!?} g - number[] | null * @param {...number?!} h - parse error without parentheses (also nonsensical) + ~ +!!! error TS1005: '}' expected. * @param {...number[]} i - number[][] * @param {...number![]?} j - number[][] | null * @param {...number?[]!} k - parse error without parentheses + ~ +!!! error TS1005: '}' expected. * @param {number extends number ? true : false} l - conditional types work * @param {[number, number?]} m - [number, (number | undefined)?] */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocPrivateName2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName2.errors.txt new file mode 100644 index 0000000000..259a1dcf2f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocPrivateName2.errors.txt @@ -0,0 +1,14 @@ +jsdocPrivateName1.js(6,23): error TS1003: Identifier expected. + + +==== jsdocPrivateName1.js (1 errors) ==== + // Expecting parse error for private field + + /** + * @typedef A + * @type {object} + * @property {string} #id + ~ +!!! error TS1003: Identifier expected. + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt index b60487ba5b..c2c29e32e4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag.errors.txt @@ -1,9 +1,10 @@ forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +forgot.js(13,22): error TS1005: '}' expected. forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. Type 'void' is not assignable to type 'Animation'. -==== forgot.js (2 errors) ==== +==== forgot.js (3 errors) ==== /** * @param {T} a * @template T @@ -20,6 +21,8 @@ forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKey ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. */ function g(a) { return () => a diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt index acd63b1e17..13884500ea 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTag3.errors.txt @@ -1,9 +1,10 @@ a.js(14,29): error TS2339: Property 'a' does not exist on type 'U'. a.js(14,35): error TS2339: Property 'b' does not exist on type 'U'. a.js(21,3): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. +a.js(25,2): error TS1069: Unexpected token. A type parameter name was expected without curly braces. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? @@ -36,6 +37,8 @@ a.js(21,3): error TS2741: Property 'b' is missing in type '{ a: number; }' but r /** * @template {NoLongerAllowed} * @template T preceding line's syntax is no longer allowed + ~ +!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. * @param {T} x */ function g(x) { } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt index 6ad768a099..ef3db758ce 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTemplateTagDefault.errors.txt @@ -1,11 +1,13 @@ file.js(9,20): error TS2322: Type 'number' is not assignable to type 'string'. +file.js(22,34): error TS1005: '=' expected. +file.js(27,35): error TS1110: Type expected. file.js(33,14): error TS2706: Required type parameters may not follow optional type parameters. file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. -==== file.js (5 errors) ==== +==== file.js (7 errors) ==== /** * @template {string | number} [T=string] - ok: defaults are permitted * @typedef {[T]} A @@ -30,11 +32,15 @@ file.js(60,17): error TS2744: Type parameter defaults can only reference previou /** * @template {string | number} [T] - error: default requires an `=type` + ~ +!!! error TS1005: '=' expected. * @typedef {[T]} C */ /** * @template {string | number} [T=] - error: default requires a `type` + ~ +!!! error TS1110: Type expected. * @typedef {[T]} D */ diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt index 1d0065669f..138dbe00f1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.errors.txt @@ -3,8 +3,10 @@ /a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'. /a.js(18,10): error TS2339: Property 'test' does not exist on type 'Foo'. /a.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +/a.js(21,20): error TS1005: '}' expected. /a.js(26,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? /a.js(26,12): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. +/a.js(26,20): error TS1005: '}' expected. ==== /types.d.ts (0 errors) ==== @@ -14,7 +16,7 @@ export type M = (this: Foo) => void; -==== /a.js (7 errors) ==== +==== /a.js (9 errors) ==== /** @type {import('./types').M} */ export const f1 = function() { this.test(); @@ -47,6 +49,8 @@ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. export const f5 = function() { this.test(); } @@ -57,6 +61,8 @@ !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ~~~~~~~~ !!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. + ~ +!!! error TS1005: '}' expected. export function f6() { this.test(); } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt index c7dad2e526..0aab334433 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagParameterType.errors.txt @@ -1,13 +1,16 @@ a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(1,20): error TS1005: '}' expected. a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(7,5): error TS2322: Type 'number' is not assignable to type 'string'. -==== a.js (3 errors) ==== +==== a.js (4 errors) ==== /** @type {function(string): void} */ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const f = (value) => { ~~~~~ !!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt index 5b78db63ce..39e940dd64 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt @@ -1,14 +1,17 @@ a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(1,20): error TS1005: '}' expected. a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(12,1): error TS2554: Expected 1 arguments, but got 0. a.js(13,1): error TS2554: Expected 1 arguments, but got 0. -==== a.js (4 errors) ==== +==== a.js (5 errors) ==== /** @type {function(string): void} */ ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. const f = (value) => { ~~~~~ !!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt index 908bca4dda..45177af772 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocVariadicType.errors.txt @@ -1,12 +1,15 @@ a.js(2,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +a.js(2,19): error TS1005: '}' expected. -==== a.js (1 errors) ==== +==== a.js (2 errors) ==== /** * @type {function(boolean, string, ...*):void} ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. */ const foo = function (a, b, ...r) { }; diff --git a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt index e71c8f9b2d..072f764cfa 100644 --- a/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/noAssertForUnparseableTypedefs.errors.txt @@ -1,11 +1,14 @@ bug26693.js(1,15): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +bug26693.js(1,21): error TS1005: '}' expected. bug26693.js(2,22): error TS2307: Cannot find module 'nope' or its corresponding type declarations. -==== bug26693.js (2 errors) ==== +==== bug26693.js (3 errors) ==== /** @typedef {module:locale} hi */ ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + ~ +!!! error TS1005: '}' expected. import { nope } from 'nope'; ~~~~~~ !!! error TS2307: Cannot find module 'nope' or its corresponding type declarations. diff --git a/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt b/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt index bc43cc7750..c0d8d0c963 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/paramTagWrapping.errors.txt @@ -1,3 +1,6 @@ +bad.js(2,11): error TS1003: Identifier expected. +bad.js(5,4): error TS1003: Identifier expected. +bad.js(6,20): error TS1003: Identifier expected. bad.js(9,14): error TS7006: Parameter 'x' implicitly has an 'any' type. bad.js(9,17): error TS7006: Parameter 'y' implicitly has an 'any' type. bad.js(9,20): error TS7006: Parameter 'z' implicitly has an 'any' type. @@ -18,13 +21,19 @@ bad.js(9,20): error TS7006: Parameter 'z' implicitly has an 'any' type. good(1, 2, 3) -==== bad.js (3 errors) ==== +==== bad.js (6 errors) ==== /** * @param * + ~ +!!! error TS1003: Identifier expected. * {number} x Arg x. * @param {number} * * y Arg y. + ~ +!!! error TS1003: Identifier expected. * @param {number} * z + ~ +!!! error TS1003: Identifier expected. * Arg z. */ function bad(x, y, z) { diff --git a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt index 48940af384..7d0367dab1 100644 --- a/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/templateInsideCallback.errors.txt @@ -1,11 +1,15 @@ +templateInsideCallback.js(9,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag templateInsideCallback.js(15,11): error TS2315: Type 'Call' is not generic. templateInsideCallback.js(15,16): error TS2304: Cannot find name 'T'. templateInsideCallback.js(17,18): error TS7006: Parameter 'x' implicitly has an 'any' type. +templateInsideCallback.js(23,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag templateInsideCallback.js(29,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. +templateInsideCallback.js(30,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. +templateInsideCallback.js(38,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -==== templateInsideCallback.js (5 errors) ==== +==== templateInsideCallback.js (9 errors) ==== /** * @typedef Oops * @template T @@ -15,6 +19,8 @@ templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns /** * @callback Call * @template T + ~~~~~~~~ +!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @param {T} x * @returns {T} */ @@ -35,6 +41,8 @@ templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns * @property {Object} oh * @property {number} oh.no * @template T + ~~~~~~~~ +!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @property {string} oh.noooooo */ @@ -44,6 +52,8 @@ templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns ~~~~~~~~ !!! error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. * @template T + ~~~~~~~~ +!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @template U * @param {T[]} array * @param {(x: T) => U[]} iterable @@ -54,6 +64,8 @@ templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns ~~~~~~~~ !!! error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. * @template T + ~~~~~~~~ +!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @param {T[][]} array * @returns {T[]} */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefDuplicateTypeDeclaration.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefDuplicateTypeDeclaration.errors.txt new file mode 100644 index 0000000000..9dd2576068 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefDuplicateTypeDeclaration.errors.txt @@ -0,0 +1,13 @@ +typedefDuplicateTypeDeclaration.js(4,16): error TS8033: A JSDoc '@typedef' comment may not contain multiple '@type' tags. + + +==== typedefDuplicateTypeDeclaration.js (1 errors) ==== + /** + * @typedef Name + * @type {string} + * @type {Oops} + + */ + +!!! error TS8033: A JSDoc '@typedef' comment may not contain multiple '@type' tags. +!!! related TS8034 typedefDuplicateTypeDeclaration.js:1:1: The tag was first specified here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.errors.txt new file mode 100644 index 0000000000..2aa319ce1c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefInnerNamepaths.errors.txt @@ -0,0 +1,19 @@ +bug25104.js(3,19): error TS1005: '}' expected. +bug25104.js(6,18): error TS1005: '}' expected. + + +==== bug25104.js (2 errors) ==== + class C { + /** + * @typedef {C~A} C~B + ~ +!!! error TS1005: '}' expected. + * @typedef {object} C~A + */ + /** @param {C~A} o */ + ~ +!!! error TS1005: '}' expected. + constructor(o) { + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt index 6b2506e05c..80e1108585 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefTagWrapping.errors.txt @@ -1,17 +1,24 @@ mod1.js(2,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +mod1.js(2,22): error TS1005: '}' expected. mod1.js(9,12): error TS2304: Cannot find name 'Type1'. mod3.js(4,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +mod3.js(4,22): error TS1005: '}' expected. mod3.js(10,12): error TS2304: Cannot find name 'StringOrNumber1'. mod4.js(4,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +mod4.js(4,22): error TS1005: '}' expected. mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. +mod7.js(5,7): error TS1110: Type expected. +mod7.js(8,4): error TS1110: Type expected. -==== mod1.js (2 errors) ==== +==== mod1.js (3 errors) ==== /** * @typedef {function(string): boolean} ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. * Type1 */ @@ -46,7 +53,7 @@ mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. return obj.boo ? obj.num : obj.str; } -==== mod3.js (2 errors) ==== +==== mod3.js (3 errors) ==== /** * A function whose signature is very long. * @@ -54,6 +61,8 @@ mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. * (string|number)} StringOrNumber1 */ @@ -71,7 +80,7 @@ mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. return func(bool, str, num) } -==== mod4.js (2 errors) ==== +==== mod4.js (3 errors) ==== /** * A function whose signature is very long. * @@ -79,6 +88,8 @@ mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? !!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~ +!!! error TS1005: '}' expected. * number): * (string|number)} StringOrNumber2 */ @@ -138,14 +149,18 @@ mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. } -==== mod7.js (0 errors) ==== +==== mod7.js (2 errors) ==== /** Multiline type expressions in comments without leading * are not supported. @typedef {{ foo: *, + ~ +!!! error TS1110: Type expected. bar: * }} Type7 + ~ +!!! error TS1110: Type expected. */ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff index aa131e44ee..8c877aa4f3 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumCrossFileExport.errors.txt.diff @@ -2,6 +2,7 @@ +++ new.jsEnumCrossFileExport.errors.txt @@= skipped -0, +0 lines =@@ - ++enumDef.js(14,21): error TS1003: Identifier expected. +enumDef.js(16,18): error TS2339: Property 'Blah' does not exist on type '{ Action: { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; }; }'. +index.js(4,17): error TS2503: Cannot find namespace 'Host'. +index.js(8,21): error TS2304: Cannot find name 'Host'. @@ -9,7 +10,7 @@ +index.js(18,11): error TS2503: Cannot find namespace 'Host'. + + -+==== enumDef.js (1 errors) ==== ++==== enumDef.js (2 errors) ==== + var Host = {}; + Host.UserMetrics = {}; + /** @enum {number} */ @@ -24,7 +25,10 @@ + */ + /** + * @typedef {string} ++ + */ ++ ++!!! error TS1003: Identifier expected. + Host.UserMetrics.Blah = { + ~~~~ +!!! error TS2339: Property 'Blah' does not exist on type '{ Action: { WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; TimelineStarted: number; }; }'. diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff deleted file mode 100644 index 240506dd0b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocFunctionTypeFalsePositive.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.jsdocFunctionTypeFalsePositive.errors.txt -+++ new.jsdocFunctionTypeFalsePositive.errors.txt -@@= skipped -0, +0 lines =@@ - /a.js(1,13): error TS1098: Type parameter list cannot be empty. --/a.js(1,14): error TS1139: Type parameter declaration expected. -- -- --==== /a.js (2 errors) ==== -+ -+ -+==== /a.js (1 errors) ==== - /** @param {<} x */ - ~~ - !!! error TS1098: Type parameter list cannot be empty. -- ~ --!!! error TS1139: Type parameter declaration expected. - function f(x) {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff index d1fab64b56..fbc195cf2e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocParameterParsingInfiniteLoop.errors.txt.diff @@ -8,9 +8,10 @@ - -==== example.js (3 errors) ==== +example.js(3,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++example.js(3,19): error TS1005: '}' expected. + + -+==== example.js (1 errors) ==== ++==== example.js (2 errors) ==== // @ts-check /** * @type {function(@foo)} @@ -23,5 +24,7 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. */ let x; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/uniqueSymbolJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/uniqueSymbolJs.errors.txt.diff index e97c2ce80f..9372405a69 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/uniqueSymbolJs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/uniqueSymbolJs.errors.txt.diff @@ -2,20 +2,23 @@ +++ new.uniqueSymbolJs.errors.txt @@= skipped -0, +0 lines =@@ -a.js(5,18): error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead. --a.js(5,28): error TS1005: ';' expected. +a.js(5,18): error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type. +a.js(5,23): error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? + a.js(5,28): error TS1005: ';' expected. - ==== a.js (2 errors) ==== -@@= skipped -8, +8 lines =@@ +-==== a.js (2 errors) ==== ++==== a.js (3 errors) ==== + /** @type {unique symbol} */ + const foo = Symbol(); + /** @typedef {{ [foo]: boolean }} A */ /** @typedef {{ [key: foo] boolean }} B */ ~~~ -!!! error TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead. -- ~~~~~~~ --!!! error TS1005: ';' expected. +!!! error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type. + ~~~ +!!! error TS2749: 'foo' refers to a value, but is being used as a type here. Did you mean 'typeof foo'? + ~~~~~~~ + !!! error TS1005: ';' expected. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.errors.txt.diff index ec3ffa5a3a..49320a3a4a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/asyncArrowFunction_allowJs.errors.txt.diff @@ -13,18 +13,25 @@ - -==== file.js (7 errors) ==== +file.js(2,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(2,20): error TS1005: '}' expected. +file.js(6,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(6,20): error TS1005: '}' expected. +file.js(10,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(10,20): error TS1005: '}' expected. +file.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(16,20): error TS1005: '}' expected. +file.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++file.js(21,20): error TS1005: '}' expected. + + -+==== file.js (5 errors) ==== ++==== file.js (10 errors) ==== // Error (good) /** @type {function(): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const a = () => 0 - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. @@ -36,6 +43,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const b = async () => 0 - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. @@ -47,6 +56,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const c = async () => { return 0 - ~~~~~~ @@ -60,6 +71,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const d = async () => { return "" } @@ -68,6 +81,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const f = (p) => {} // Error (good) diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.errors.txt.diff index 85c8c13099..5bf5bbfd0b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocSatisfiesTag14.errors.txt.diff @@ -1,30 +1,29 @@ --- old.checkJsdocSatisfiesTag14.errors.txt +++ new.checkJsdocSatisfiesTag14.errors.txt @@= skipped -0, +0 lines =@@ --/a.js(7,15): error TS1005: '{' expected. + /a.js(7,15): error TS1005: '{' expected. -/a.js(8,2): error TS1005: '}' expected. --/a.js(10,27): error TS1005: '{' expected. + /a.js(10,27): error TS1005: '{' expected. -/a.js(10,30): error TS1005: '}' expected. - - -==== /a.js (4 errors) ==== -- /** -- * @typedef {Object} T1 -- * @property {number} a -- */ -- -- /** -- * @satisfies T1 -- ~~ --!!! error TS1005: '{' expected. -- */ ++ ++ ++==== /a.js (2 errors) ==== + /** + * @typedef {Object} T1 + * @property {number} a +@@= skipped -14, +12 lines =@@ + ~~ + !!! error TS1005: '{' expected. + */ - -!!! error TS1005: '}' expected. -- const t1 = { a: 1 }; -- const t2 = /** @satisfies T1 */ ({ a: 1 }); -- ~~ --!!! error TS1005: '{' expected. + const t1 = { a: 1 }; + const t2 = /** @satisfies T1 */ ({ a: 1 }); + ~~ + !!! error TS1005: '{' expected. - -!!! error TS1005: '}' expected. -- -+ \ No newline at end of file + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff index 886d602488..684c5b6009 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag1.errors.txt.diff @@ -5,17 +5,29 @@ - - -==== 0.js (1 errors) ==== ++0.js(12,13): error TS1110: Type expected. +0.js(20,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(24,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(24,21): error TS1005: '}' expected. +0.js(28,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(28,21): error TS1005: '}' expected. +0.js(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'props' must be of type 'object', but here has type 'Object'. + + -+==== 0.js (4 errors) ==== ++==== 0.js (7 errors) ==== // @ts-check /** @type {String} */ var S = "hello world"; -@@= skipped -21, +24 lines =@@ +@@= skipped -13, +19 lines =@@ + anyT = "hello"; + + /** @type {?} */ ++ ~ ++!!! error TS1110: Type expected. + var anyT1 = 2; + anyT1 = "hi"; + +@@= skipped -8, +10 lines =@@ x(1); /** @type {function} */ @@ -31,6 +43,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x1 = (a) => a + 1; x1(0); @@ -38,10 +52,12 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x2 = (a) => a + 1; x2(0); -@@= skipped -22, +29 lines =@@ +@@= skipped -22, +33 lines =@@ * @type {Object} */ var props = {}; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff index 6b72170b6d..6665582b86 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag2.errors.txt.diff @@ -13,12 +13,16 @@ - -==== 0.js (7 errors) ==== +0.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(8,21): error TS1005: '}' expected. +0.js(12,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(12,21): error TS1005: '}' expected. +0.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(19,21): error TS1005: '}' expected. +0.js(23,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(23,21): error TS1005: '}' expected. + + -+==== 0.js (6 errors) ==== ++==== 0.js (10 errors) ==== // @ts-check /** @type {String} */ var S = true; @@ -28,7 +32,7 @@ /** @type {number} */ var n = "hello"; -@@= skipped -19, +18 lines =@@ +@@= skipped -19, +22 lines =@@ !!! error TS2322: Type 'string' is not assignable to type 'number'. /** @type {function (number)} */ @@ -37,6 +41,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x1 = (a) => a + 1; x1("string"); - ~~~~~~~~ @@ -46,6 +52,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x2 = (a) => a + 1; /** @type {string} */ @@ -58,6 +66,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x3 = (a) => a.concat("hi"); - ~~~~~~ -!!! error TS2339: Property 'concat' does not exist on type 'number'. @@ -67,6 +77,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const x4 = (a) => a + 1; - ~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff index 4df7dcb221..763732c109 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty1.errors.txt.diff @@ -4,10 +4,12 @@ - +0.js(8,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(8,14): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++0.js(8,22): error TS1005: '}' expected. +0.js(16,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(16,22): error TS1005: '}' expected. + + -+==== 0.js (3 errors) ==== ++==== 0.js (5 errors) ==== + // @ts-check + var lol = "hello Lol" + const obj = { @@ -21,6 +23,8 @@ +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~~~~~~~~ +!!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++ ~ ++!!! error TS1005: '}' expected. + method1(n1) { + return n1 + 42; + }, @@ -32,6 +36,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. + arrowFunc: (num) => num + 42 + } + obj.foo = 'string' diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff index e6472b5cf2..65a1df20cd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTagOnObjectProperty2.errors.txt.diff @@ -9,20 +9,17 @@ -0.js(19,5): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(22,5): error TS2322: Type 'number' is not assignable to type 'string'. -0.js(22,22): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -- --==== 0.js (8 errors) ==== +0.js(6,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +0.js(6,14): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++0.js(6,22): error TS1005: '}' expected. +0.js(10,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++0.js(10,22): error TS1005: '}' expected. +0.js(12,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? -+ -+ -+==== 0.js (5 errors) ==== - // @ts-check - var lol; - const obj = { -@@= skipped -16, +13 lines =@@ ++0.js(12,22): error TS1005: '}' expected. + + + ==== 0.js (8 errors) ==== +@@= skipped -16, +16 lines =@@ ~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. /** @type {function(number): number} */ @@ -31,6 +28,8 @@ +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~~~~~~~~ +!!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++ ~ ++!!! error TS1005: '}' expected. method1(n1) { return "42"; - ~~~~~~ @@ -40,6 +39,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. method2: (n1) => "lol", - ~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. @@ -47,6 +48,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. arrowFunc: (num="0") => num + 42, - ~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff index cfb3d23d1b..60fa860711 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypedefOnlySourceFile.errors.txt.diff @@ -6,11 +6,12 @@ - -==== 0.js (1 errors) ==== +0.js(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. ++0.js(6,21): error TS1003: Identifier expected. +0.js(8,9): error TS2339: Property 'SomeName' does not exist on type '{}'. +0.js(10,12): error TS2503: Cannot find namespace 'exports'. + + -+==== 0.js (3 errors) ==== ++==== 0.js (4 errors) ==== // @ts-check var exports = {}; @@ -19,7 +20,10 @@ /** * @typedef {string} ++ */ ++ ++!!! error TS1003: Identifier expected. exports.SomeName; + ~~~~~~~~ +!!! error TS2339: Property 'SomeName' does not exist on type '{}'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importDeferJsdoc.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importDeferJsdoc.errors.txt.diff index 36ba74556a..07493724d2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importDeferJsdoc.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importDeferJsdoc.errors.txt.diff @@ -1,17 +1,20 @@ --- old.importDeferJsdoc.errors.txt +++ new.importDeferJsdoc.errors.txt @@= skipped -0, +0 lines =@@ --/foo.js(2,18): error TS1005: 'from' expected. + /foo.js(2,18): error TS1005: 'from' expected. +/foo.js(2,18): error TS1141: String literal expected. /foo.js(6,12): error TS2503: Cannot find namespace 'ns'. -@@= skipped -7, +7 lines =@@ - ==== /foo.js (2 errors) ==== + ==== /types.ts (0 errors) ==== + export type X = 1; + +-==== /foo.js (2 errors) ==== ++==== /foo.js (3 errors) ==== /** * @import defer * as ns from "./types" -- ~ --!!! error TS1005: 'from' expected. + ~ + !!! error TS1005: 'from' expected. + ~~~~ +!!! error TS1141: String literal expected. */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag10.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag10.errors.txt.diff deleted file mode 100644 index c90b25d031..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag10.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.importTag10.errors.txt -+++ new.importTag10.errors.txt -@@= skipped -0, +0 lines =@@ --/foo.js(2,11): error TS1109: Expression expected. -- -- --==== /foo.js (1 errors) ==== -- /** -- * @import -- -- */ -- --!!! error TS1109: Expression expected. -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag11.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag11.errors.txt.diff index 1d60c189e9..545f442e45 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag11.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag11.errors.txt.diff @@ -2,16 +2,15 @@ +++ new.importTag11.errors.txt @@= skipped -0, +0 lines =@@ -/foo.js(2,15): error TS1109: Expression expected. --/foo.js(3,2): error TS1005: 'from' expected. -- -- + /foo.js(3,2): error TS1005: 'from' expected. + + -==== /foo.js (2 errors) ==== -- /** -- * @import foo ++==== /foo.js (1 errors) ==== + /** + * @import foo - -!!! error TS1109: Expression expected. -- */ -- --!!! error TS1005: 'from' expected. -- -+ \ No newline at end of file + */ + + !!! error TS1005: 'from' expected. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag12.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag12.errors.txt.diff index 3bcbbcf079..afbde6e8d6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag12.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag12.errors.txt.diff @@ -2,13 +2,15 @@ +++ new.importTag12.errors.txt @@= skipped -0, +0 lines =@@ -/foo.js(2,20): error TS1109: Expression expected. -- -- --==== /foo.js (1 errors) ==== -- /** -- * @import foo from ++/foo.js(3,2): error TS1109: Expression expected. + + + ==== /foo.js (1 errors) ==== + /** + * @import foo from - -!!! error TS1109: Expression expected. -- */ -- -+ \ No newline at end of file + */ ++ ++!!! error TS1109: Expression expected. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag13.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag13.errors.txt.diff index a55a49f933..55cd457a99 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag13.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag13.errors.txt.diff @@ -1,14 +1,17 @@ --- old.importTag13.errors.txt +++ new.importTag13.errors.txt @@= skipped -0, +0 lines =@@ --/foo.js(1,15): error TS1005: 'from' expected. + /foo.js(1,15): error TS1005: 'from' expected. +- +- +-==== /foo.js (1 errors) ==== +/foo.js(1,15): error TS1141: String literal expected. - - - ==== /foo.js (1 errors) ==== ++ ++ ++==== /foo.js (2 errors) ==== /** @import x = require("types") */ -- ~ --!!! error TS1005: 'from' expected. + ~ + !!! error TS1005: 'from' expected. + ~~~~~~~~~~~~~~~~~~ +!!! error TS1141: String literal expected. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag14.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag14.errors.txt.diff index 06e93a4fb5..7f62149103 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag14.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag14.errors.txt.diff @@ -4,17 +4,14 @@ +/foo.js(1,25): error TS2306: File '/foo.js' is not a module. /foo.js(1,33): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /foo.js(1,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. --/foo.js(1,38): error TS1005: '{' expected. + /foo.js(1,38): error TS1005: '{' expected. - ==== /foo.js (3 errors) ==== +-==== /foo.js (3 errors) ==== ++==== /foo.js (4 errors) ==== /** @import * as f from "./foo" with */ + ~~~~~~~ +!!! error TS2306: File '/foo.js' is not a module. ~~~~ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - ~~~~ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -- --!!! error TS1005: '{' expected. - \ No newline at end of file + ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff index 6344763693..44818fe741 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsModuleReferenceHasEmit.errors.txt.diff @@ -3,9 +3,10 @@ @@= skipped -0, +0 lines =@@ - +index.js(9,11): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++index.js(9,17): error TS1005: '}' expected. + + -+==== index.js (1 errors) ==== ++==== index.js (2 errors) ==== + /** + * @module A + */ @@ -17,6 +18,8 @@ + * @type {module:A} + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ ~ ++!!! error TS1005: '}' expected. + */ + export let el = null; + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt.diff new file mode 100644 index 0000000000..77f79eb7c4 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt.diff @@ -0,0 +1,17 @@ +--- old.jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt ++++ new.jsDeclarationsRestArgsWithThisTypeInJSDocFunction.errors.txt +@@= skipped -0, +0 lines =@@ +- ++bug38550.js(3,22): error TS1005: '}' expected. ++ ++ ++==== bug38550.js (1 errors) ==== ++ export class Clazz { ++ /** ++ * @param {function(this:Object, ...*):*} functionDeclaration ++ ~ ++!!! error TS1005: '}' expected. ++ */ ++ method(functionDeclaration) {} ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff index 23875f11d5..b84e9f3807 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt.diff @@ -2,13 +2,18 @@ +++ new.jsDeclarationsReusesExistingNodesMappingJSDocTypes.errors.txt @@= skipped -0, +0 lines =@@ - ++index.js(1,13): error TS1110: Type expected. +index.js(16,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++index.js(16,20): error TS1005: '}' expected. +index.js(19,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++index.js(19,20): error TS1005: '}' expected. +index.js(22,12): error TS2315: Type 'Object' is not generic. + + -+==== index.js (3 errors) ==== ++==== index.js (6 errors) ==== + /** @type {?} */ ++ ~ ++!!! error TS1110: Type expected. + export const a = null; + + /** @type {*} */ @@ -27,12 +32,16 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. + export const f = null; + + /** @type {function(new: object, string, number)} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. + export const g = null; + + /** @type {Object.} */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugmentsMissingType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugmentsMissingType.errors.txt.diff index 0d8dfe2f9e..bc605dfad5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugmentsMissingType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugmentsMissingType.errors.txt.diff @@ -7,15 +7,18 @@ - - -==== /a.js (3 errors) ==== ++/a.js(2,14): error TS1003: Identifier expected. + + -+==== /a.js (1 errors) ==== ++==== /a.js (2 errors) ==== class A { constructor() { this.x = 0; } } /** @augments */ -!!! error TS1003: Identifier expected. - !!! error TS8023: JSDoc '@augments ' does not match the 'extends A' clause. ++ ~ ++!!! error TS1003: Identifier expected. class B extends A { m() { this.x diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff index 899510ffa9..aa905126e8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunctionType.errors.txt.diff @@ -6,25 +6,35 @@ - - -==== functions.js (1 errors) ==== ++functions.js(2,20): error TS1005: '}' expected. +functions.js(3,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++functions.js(3,21): error TS1005: '}' expected. +functions.js(5,14): error TS7006: Parameter 'c' implicitly has an 'any' type. +functions.js(9,23): error TS7006: Parameter 'n' implicitly has an 'any' type. ++functions.js(12,20): error TS1005: '}' expected. +functions.js(13,13): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++functions.js(13,21): error TS1005: '}' expected. +functions.js(15,14): error TS7006: Parameter 'c' implicitly has an 'any' type. +functions.js(30,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++functions.js(30,21): error TS1005: '}' expected. +functions.js(31,19): error TS7006: Parameter 'ab' implicitly has an 'any' type. +functions.js(31,23): error TS7006: Parameter 'onetwo' implicitly has an 'any' type. ++functions.js(48,20): error TS1005: '}' expected. +functions.js(49,13): error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? +functions.js(51,26): error TS7006: Parameter 'dref' implicitly has an 'any' type. + + -+==== functions.js (10 errors) ==== ++==== functions.js (16 errors) ==== /** * @param {function(this: string, number): number} c is just passing on through ++ ~ ++!!! error TS1005: '}' expected. * @return {function(this: string, number): number} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. */ function id1(c) { + ~ @@ -38,10 +48,14 @@ /** * @param {function(new: { length: number }, number): number} c is just passing on through ++ ~ ++!!! error TS1005: '}' expected. * @return {function(new: { length: number }, number): number} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. */ function id2(c) { + ~ @@ -49,13 +63,15 @@ return c } -@@= skipped -32, +52 lines =@@ +@@= skipped -32, +66 lines =@@ z.length; /** @type {function ("a" | "b", 1 | 2): 3 | 4} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. var f = function (ab, onetwo) { return ab === "a" ? 3 : 4; } + ~~ +!!! error TS7006: Parameter 'ab' implicitly has an 'any' type. @@ -64,9 +80,12 @@ /** -@@= skipped -19, +26 lines =@@ +@@= skipped -18, +27 lines =@@ + /** * @param {function(new: D, number)} dref ++ ~ ++!!! error TS1005: '}' expected. * @return {D} + ~ +!!! error TS2749: 'D' refers to a value, but is being used as a type here. Did you mean 'typeof D'? @@ -77,7 +96,7 @@ var z3 = construct(D); z3.length; -@@= skipped -16, +20 lines =@@ +@@= skipped -17, +23 lines =@@ var y3 = id2(E); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunction_missingReturn.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunction_missingReturn.errors.txt.diff index 2a4513ad36..4f926c210b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunction_missingReturn.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocFunction_missingReturn.errors.txt.diff @@ -7,9 +7,10 @@ -==== /a.js (1 errors) ==== +/a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +/a.js(1,12): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++/a.js(1,20): error TS1005: '}' expected. + + -+==== /a.js (2 errors) ==== ++==== /a.js (3 errors) ==== /** @type {function(): number} */ - ~~~~~~ -!!! error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. @@ -18,5 +19,7 @@ +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~~~~~~~~ +!!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++ ~ ++!!! error TS1005: '}' expected. function f() {} \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_missingType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_missingType.errors.txt.diff index 7a27f9d761..9ba145f7a0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_missingType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_missingType.errors.txt.diff @@ -1,15 +1,11 @@ --- old.jsdocImplements_missingType.errors.txt +++ new.jsdocImplements_missingType.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(2,16): error TS1003: Identifier expected. -- -- --==== /a.js (1 errors) ==== -- class A { constructor() { this.x = 0; } } -- /** @implements */ +@@= skipped -3, +3 lines =@@ + ==== /a.js (1 errors) ==== + class A { constructor() { this.x = 0; } } + /** @implements */ - --!!! error TS1003: Identifier expected. -- class B { -- } -- -+ \ No newline at end of file ++ ~ + !!! error TS1003: Identifier expected. + class B { + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff index 241ccbd587..3469144058 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters1.errors.txt.diff @@ -5,14 +5,14 @@ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. jsdocOuterTypeParameters1.js(1,14): error TS2304: Cannot find name 'T'. -jsdocOuterTypeParameters1.js(4,17): error TS2304: Cannot find name 'T'. --jsdocOuterTypeParameters1.js(4,19): error TS1069: Unexpected token. A type parameter name was expected without curly braces. + jsdocOuterTypeParameters1.js(4,19): error TS1069: Unexpected token. A type parameter name was expected without curly braces. jsdocOuterTypeParameters1.js(7,35): error TS2339: Property 'foo' does not exist on type 'Bar'. !!! error TS5055: Cannot write file 'jsdocOuterTypeParameters1.js' because it would overwrite input file. !!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -==== jsdocOuterTypeParameters1.js (4 errors) ==== -+==== jsdocOuterTypeParameters1.js (2 errors) ==== ++==== jsdocOuterTypeParameters1.js (3 errors) ==== /** @return {T} */ ~ !!! error TS2304: Cannot find name 'T'. @@ -21,8 +21,6 @@ /** @template {T} */ - ~ -!!! error TS2304: Cannot find name 'T'. -- ~ --!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. - const PropertyAccessors = dedupingMixin(() => { - class Bar { - static bar() { this.prototype.foo(); } \ No newline at end of file + ~ + !!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. + const PropertyAccessors = dedupingMixin(() => { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters3.errors.txt.diff index 4622725904..7832110098 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOuterTypeParameters3.errors.txt.diff @@ -4,19 +4,17 @@ error TS5055: Cannot write file 'jsdocOuterTypeParameters3.js' because it would overwrite input file. Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -jsdocOuterTypeParameters3.js(1,16): error TS2304: Cannot find name 'T'. --jsdocOuterTypeParameters3.js(1,18): error TS1069: Unexpected token. A type parameter name was expected without curly braces. + jsdocOuterTypeParameters3.js(1,18): error TS1069: Unexpected token. A type parameter name was expected without curly braces. jsdocOuterTypeParameters3.js(5,43): error TS2339: Property 'foo' does not exist on type 'Bar'. !!! error TS5055: Cannot write file 'jsdocOuterTypeParameters3.js' because it would overwrite input file. !!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -==== jsdocOuterTypeParameters3.js (3 errors) ==== -+==== jsdocOuterTypeParameters3.js (1 errors) ==== ++==== jsdocOuterTypeParameters3.js (2 errors) ==== /** @template {T} */ - ~ -!!! error TS2304: Cannot find name 'T'. -- ~ --!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. - class Baz { - m() { - class Bar { \ No newline at end of file + ~ + !!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. + class Baz { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff index 0bed525624..2f955bae63 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseDotDotDotInJSDocFunction.errors.txt.diff @@ -5,15 +5,19 @@ - - -==== a.js (1 errors) ==== ++a.js(2,21): error TS1005: '}' expected. +a.js(3,12): error TS7006: Parameter 'callback' implicitly has an 'any' type. +a.js(8,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++a.js(8,20): error TS1005: '}' expected. + + -+==== a.js (2 errors) ==== ++==== a.js (4 errors) ==== // from bcryptjs /** @param {function(...[*])} callback */ - ~~~~~~~~~~~~~~~~ -!!! error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. ++ ~ ++!!! error TS1005: '}' expected. function g(callback) { + ~~~~~~~~ +!!! error TS7006: Parameter 'callback' implicitly has an 'any' type. @@ -25,6 +29,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. * @inner */ var stringFromCharCode = String.fromCharCode; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff index 0b43e0d1a6..4017c73d0a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseHigherOrderFunction.errors.txt.diff @@ -3,15 +3,18 @@ @@= skipped -0, +0 lines =@@ - +paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++paren.js(1,20): error TS1005: '}' expected. +paren.js(2,10): error TS7006: Parameter 's' implicitly has an 'any' type. +paren.js(2,13): error TS7006: Parameter 'id' implicitly has an 'any' type. + + -+==== paren.js (3 errors) ==== ++==== paren.js (4 errors) ==== + /** @type {function((string), function((string)): string): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. + var x = (s, id) => id(s) + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff index a6dd8192ea..51c92a19c6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseParenthesizedJSDocParameter.errors.txt.diff @@ -3,14 +3,17 @@ @@= skipped -0, +0 lines =@@ - +paren.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++paren.js(1,20): error TS1005: '}' expected. +paren.js(2,9): error TS7006: Parameter 's' implicitly has an 'any' type. + + -+==== paren.js (2 errors) ==== ++==== paren.js (3 errors) ==== + /** @type {function((string)): string} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. + var x = s => s.toString() + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff index 76fc71ede2..8f3df4dfb4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocParseStarEquals.errors.txt.diff @@ -4,10 +4,11 @@ - +a.js(1,5): error TS1047: A rest parameter cannot be optional. +a.js(3,12): error TS2370: A rest parameter must be of an array type. ++a.js(11,21): error TS1005: '}' expected. +a.js(12,14): error TS7006: Parameter 'f' implicitly has an 'any' type. + + -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== + /** @param {...*=} args + ~~~~~~~~~~~~~~~~~~~ + @return {*=} */ @@ -24,6 +25,8 @@ + + + /** @param {function():*=} f */ ++ ~ ++!!! error TS1005: '}' expected. + function cbf(f) { + ~ +!!! error TS7006: Parameter 'f' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.errors.txt.diff index cd4ecc1839..309d3d89d4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrefixPostfixParsing.errors.txt.diff @@ -2,23 +2,23 @@ +++ new.jsdocPrefixPostfixParsing.errors.txt @@= skipped -0, +0 lines =@@ -prefixPostfix.js(5,18): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. --prefixPostfix.js(5,18): error TS1005: '}' expected. + prefixPostfix.js(5,18): error TS1005: '}' expected. -prefixPostfix.js(8,12): error TS1014: A rest parameter must be last in a parameter list. -prefixPostfix.js(9,12): error TS1014: A rest parameter must be last in a parameter list. -prefixPostfix.js(10,12): error TS1014: A rest parameter must be last in a parameter list. -prefixPostfix.js(11,21): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. --prefixPostfix.js(11,21): error TS1005: '}' expected. + prefixPostfix.js(11,21): error TS1005: '}' expected. -prefixPostfix.js(12,12): error TS1014: A rest parameter must be last in a parameter list. -prefixPostfix.js(13,12): error TS1014: A rest parameter must be last in a parameter list. -prefixPostfix.js(14,21): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. --prefixPostfix.js(14,21): error TS1005: '}' expected. + prefixPostfix.js(14,21): error TS1005: '}' expected. prefixPostfix.js(18,21): error TS7006: Parameter 'a' implicitly has an 'any' type. prefixPostfix.js(18,39): error TS7006: Parameter 'h' implicitly has an 'any' type. prefixPostfix.js(18,48): error TS7006: Parameter 'k' implicitly has an 'any' type. -==== prefixPostfix.js (14 errors) ==== -+==== prefixPostfix.js (3 errors) ==== ++==== prefixPostfix.js (6 errors) ==== /** * @param {number![]} x - number[] * @param {!number[]} y - number[] @@ -26,8 +26,8 @@ * @param {number?[]} a - parse error without parentheses - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -- ~ --!!! error TS1005: '}' expected. + ~ + !!! error TS1005: '}' expected. * @param {?number[]} b - number[] | null * @param {(number[])?} c - number[] | null * @param {...?number} e - (number | null)[] @@ -42,8 +42,8 @@ * @param {...number?!} h - parse error without parentheses (also nonsensical) - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -- ~ --!!! error TS1005: '}' expected. + ~ + !!! error TS1005: '}' expected. * @param {...number[]} i - number[][] - ~~~~~~~~~~~ -!!! error TS1014: A rest parameter must be last in a parameter list. @@ -53,8 +53,6 @@ * @param {...number?[]!} k - parse error without parentheses - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -- ~ --!!! error TS1005: '}' expected. - * @param {number extends number ? true : false} l - conditional types work - * @param {[number, number?]} m - [number, (number | undefined)?] - */ \ No newline at end of file + ~ + !!! error TS1005: '}' expected. + * @param {number extends number ? true : false} l - conditional types work \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName2.errors.txt.diff index 01d7e10957..feb3c736b8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocPrivateName2.errors.txt.diff @@ -1,18 +1,11 @@ --- old.jsdocPrivateName2.errors.txt +++ new.jsdocPrivateName2.errors.txt -@@= skipped -0, +0 lines =@@ --jsdocPrivateName1.js(6,23): error TS1003: Identifier expected. -- -- --==== jsdocPrivateName1.js (1 errors) ==== -- // Expecting parse error for private field -- -- /** -- * @typedef A -- * @type {object} -- * @property {string} #id +@@= skipped -7, +7 lines =@@ + * @typedef A + * @type {object} + * @property {string} #id - --!!! error TS1003: Identifier expected. -- */ -- -+ \ No newline at end of file ++ ~ + !!! error TS1003: Identifier expected. + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff index 716047469c..bd9d4ecccb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag.errors.txt.diff @@ -3,26 +3,29 @@ @@= skipped -0, +0 lines =@@ -forgot.js(23,1): error TS2322: Type '(keyframes: any[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. +forgot.js(13,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++forgot.js(13,22): error TS1005: '}' expected. +forgot.js(23,1): error TS2322: Type '(keyframes: Keyframe[] | PropertyIndexedKeyframes) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'. Type 'void' is not assignable to type 'Animation'. -==== forgot.js (1 errors) ==== -+==== forgot.js (2 errors) ==== ++==== forgot.js (3 errors) ==== /** * @param {T} a * @template T -@@= skipped -15, +16 lines =@@ +@@= skipped -15, +17 lines =@@ * @param {T} a * @template T * @returns {function(): T} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. */ function g(a) { return () => a -@@= skipped -11, +14 lines =@@ +@@= skipped -11, +16 lines =@@ */ Element.prototype.animate = function(keyframes) {}; ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff index a30dd9f14c..d7bb83cb38 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTag3.errors.txt.diff @@ -6,18 +6,16 @@ -a.js(21,3): error TS2345: Argument of type '{ a: number; }' is not assignable to parameter of type '{ a: number; b: string; }'. - Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -a.js(24,15): error TS2304: Cannot find name 'NoLongerAllowed'. --a.js(25,2): error TS1069: Unexpected token. A type parameter name was expected without curly braces. -- -- --==== a.js (5 errors) ==== +a.js(21,3): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. -+ -+ -+==== a.js (3 errors) ==== + a.js(25,2): error TS1069: Unexpected token. A type parameter name was expected without curly braces. + + +-==== a.js (5 errors) ==== ++==== a.js (4 errors) ==== /** * @template {{ a: number, b: string }} T,U A Comment * @template {{ c: boolean }} V uh ... are comments even supported?? -@@= skipped -32, +29 lines =@@ +@@= skipped -32, +30 lines =@@ f({ a: 12, b: 'hi', c: null }, undefined, { c: false, d: 12, b: undefined }, 101, 'nope'); f({ a: 12 }, undefined, undefined, 101, 'nope'); ~~~~~~~~~~ @@ -31,8 +29,5 @@ - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'NoLongerAllowed'. * @template T preceding line's syntax is no longer allowed -- ~ --!!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. - * @param {T} x - */ - function g(x) { } \ No newline at end of file + ~ + !!! error TS1069: Unexpected token. A type parameter name was expected without curly braces. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff deleted file mode 100644 index 31ea3f1da6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTemplateTagDefault.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.jsdocTemplateTagDefault.errors.txt -+++ new.jsdocTemplateTagDefault.errors.txt -@@= skipped -0, +0 lines =@@ - file.js(9,20): error TS2322: Type 'number' is not assignable to type 'string'. --file.js(22,34): error TS1005: '=' expected. --file.js(27,35): error TS1110: Type expected. - file.js(33,14): error TS2706: Required type parameters may not follow optional type parameters. - file.js(38,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. - file.js(53,14): error TS2706: Required type parameters may not follow optional type parameters. - file.js(60,17): error TS2744: Type parameter defaults can only reference previously declared type parameters. - - --==== file.js (7 errors) ==== -+==== file.js (5 errors) ==== - /** - * @template {string | number} [T=string] - ok: defaults are permitted - * @typedef {[T]} A -@@= skipped -31, +29 lines =@@ - - /** - * @template {string | number} [T] - error: default requires an `=type` -- ~ --!!! error TS1005: '=' expected. - * @typedef {[T]} C - */ - - /** - * @template {string | number} [T=] - error: default requires a `type` -- ~ --!!! error TS1110: Type expected. - * @typedef {[T]} D - */ - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff index 9c0639589d..2543da1a5c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.errors.txt.diff @@ -7,17 +7,19 @@ -/a.js(23,10): error TS2339: Property 'test' does not exist on type 'Foo'. -/a.js(28,10): error TS2339: Property 'test' does not exist on type 'Foo'. +/a.js(21,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++/a.js(21,20): error TS1005: '}' expected. +/a.js(26,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? +/a.js(26,12): error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++/a.js(26,20): error TS1005: '}' expected. ==== /types.d.ts (0 errors) ==== -@@= skipped -11, +12 lines =@@ +@@= skipped -11, +14 lines =@@ export type M = (this: Foo) => void; -==== /a.js (6 errors) ==== -+==== /a.js (7 errors) ==== ++==== /a.js (9 errors) ==== /** @type {import('./types').M} */ export const f1 = function() { this.test(); @@ -28,6 +30,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. export const f5 = function() { this.test(); - ~~~~ @@ -40,6 +44,8 @@ +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. + ~~~~~~~~ +!!! error TS8030: A JSDoc '@type' tag on a function must have a signature with the correct number of arguments. ++ ~ ++!!! error TS1005: '}' expected. export function f6() { this.test(); - ~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff index d787b3e33e..5af503e217 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagParameterType.errors.txt.diff @@ -3,16 +3,19 @@ @@= skipped -0, +0 lines =@@ -a.js(3,5): error TS2322: Type 'number' is not assignable to type 'string'. +a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++a.js(1,20): error TS1005: '}' expected. +a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(7,5): error TS2322: Type 'number' is not assignable to type 'string'. -==== a.js (2 errors) ==== -+==== a.js (3 errors) ==== ++==== a.js (4 errors) ==== /** @type {function(string): void} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const f = (value) => { + ~~~~~ +!!! error TS7006: Parameter 'value' implicitly has an 'any' type. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff index 75b452f94e..efc34c532f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff @@ -3,24 +3,27 @@ @@= skipped -0, +0 lines =@@ -a.js(11,1): error TS2554: Expected 1 arguments, but got 0. +a.js(1,12): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++a.js(1,20): error TS1005: '}' expected. +a.js(2,12): error TS7006: Parameter 'value' implicitly has an 'any' type. a.js(12,1): error TS2554: Expected 1 arguments, but got 0. a.js(13,1): error TS2554: Expected 1 arguments, but got 0. -==== a.js (3 errors) ==== -+==== a.js (4 errors) ==== ++==== a.js (5 errors) ==== /** @type {function(string): void} */ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. const f = (value) => { + ~~~~~ +!!! error TS7006: Parameter 'value' implicitly has an 'any' type. }; /** @type {(s: string) => void} */ function g(s) { -@@= skipped -14, +20 lines =@@ +@@= skipped -14, +23 lines =@@ } f() // should error diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff index a79f41e4ea..6ce480620b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocVariadicType.errors.txt.diff @@ -3,14 +3,17 @@ @@= skipped -0, +0 lines =@@ - +a.js(2,11): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++a.js(2,19): error TS1005: '}' expected. + + -+==== a.js (1 errors) ==== ++==== a.js (2 errors) ==== + /** + * @type {function(boolean, string, ...*):void} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. + */ + const foo = function (a, b, ...r) { }; + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff index 5e9e331de6..b9fb76f3f4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/noAssertForUnparseableTypedefs.errors.txt.diff @@ -2,14 +2,17 @@ +++ new.noAssertForUnparseableTypedefs.errors.txt @@= skipped -0, +0 lines =@@ +bug26693.js(1,15): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++bug26693.js(1,21): error TS1005: '}' expected. bug26693.js(2,22): error TS2307: Cannot find module 'nope' or its corresponding type declarations. -==== bug26693.js (1 errors) ==== -+==== bug26693.js (2 errors) ==== ++==== bug26693.js (3 errors) ==== /** @typedef {module:locale} hi */ + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ ~ ++!!! error TS1005: '}' expected. import { nope } from 'nope'; ~~~~~~ !!! error TS2307: Cannot find module 'nope' or its corresponding type declarations. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.errors.txt.diff index c7b1b74daa..0e7b04a15c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagWrapping.errors.txt.diff @@ -1,34 +1,37 @@ --- old.paramTagWrapping.errors.txt +++ new.paramTagWrapping.errors.txt @@= skipped -0, +0 lines =@@ --bad.js(2,11): error TS1003: Identifier expected. --bad.js(5,4): error TS1003: Identifier expected. + bad.js(2,11): error TS1003: Identifier expected. + bad.js(5,4): error TS1003: Identifier expected. -bad.js(5,4): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. --bad.js(6,20): error TS1003: Identifier expected. + bad.js(6,20): error TS1003: Identifier expected. -bad.js(6,20): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. bad.js(9,14): error TS7006: Parameter 'x' implicitly has an 'any' type. bad.js(9,17): error TS7006: Parameter 'y' implicitly has an 'any' type. bad.js(9,20): error TS7006: Parameter 'z' implicitly has an 'any' type. -@@= skipped -22, +17 lines =@@ +@@= skipped -22, +20 lines =@@ good(1, 2, 3) -==== bad.js (8 errors) ==== -+==== bad.js (3 errors) ==== ++==== bad.js (6 errors) ==== /** * @param * - --!!! error TS1003: Identifier expected. ++ ~ + !!! error TS1003: Identifier expected. * {number} x Arg x. * @param {number} * * y Arg y. - --!!! error TS1003: Identifier expected. ++ ~ + !!! error TS1003: Identifier expected. - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. * @param {number} * z - --!!! error TS1003: Identifier expected. ++ ~ + !!! error TS1003: Identifier expected. - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. * Arg z. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff index 2164c25069..c8db475455 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/templateInsideCallback.errors.txt.diff @@ -3,16 +3,18 @@ @@= skipped -0, +0 lines =@@ -error TS-1: Pre-emit (11) and post-emit (13) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here! -templateInsideCallback.js(2,13): error TS8021: JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags. --templateInsideCallback.js(9,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag + templateInsideCallback.js(9,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(10,12): error TS2304: Cannot find name 'T'. templateInsideCallback.js(15,11): error TS2315: Type 'Call' is not generic. +templateInsideCallback.js(15,16): error TS2304: Cannot find name 'T'. templateInsideCallback.js(17,18): error TS7006: Parameter 'x' implicitly has an 'any' type. --templateInsideCallback.js(23,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag --templateInsideCallback.js(30,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag + templateInsideCallback.js(23,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag ++templateInsideCallback.js(29,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. + templateInsideCallback.js(30,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(32,12): error TS2304: Cannot find name 'T'. -templateInsideCallback.js(33,16): error TS2304: Cannot find name 'T'. --templateInsideCallback.js(38,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag ++templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. + templateInsideCallback.js(38,5): error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag -templateInsideCallback.js(39,12): error TS2304: Cannot find name 'T'. - - @@ -21,11 +23,9 @@ -!!! related TS7012 templateInsideCallback.js:29:5: This overload implicitly returns the type 'any' because it lacks a return type annotation. -!!! related TS7012 templateInsideCallback.js:37:5: This overload implicitly returns the type 'any' because it lacks a return type annotation. -==== templateInsideCallback.js (11 errors) ==== -+templateInsideCallback.js(29,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. -+templateInsideCallback.js(37,5): error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. + + -+==== templateInsideCallback.js (5 errors) ==== ++==== templateInsideCallback.js (9 errors) ==== /** * @typedef Oops - ~~~~ @@ -33,19 +33,16 @@ * @template T * @property {T} a * @property {T} b -@@= skipped -27, +14 lines =@@ - /** - * @callback Call - * @template T -- ~~~~~~~~ --!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag +@@= skipped -30, +21 lines =@@ + ~~~~~~~~ + !!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @param {T} x - ~ -!!! error TS2304: Cannot find name 'T'. * @returns {T} */ /** -@@= skipped -12, +8 lines =@@ +@@= skipped -9, +7 lines =@@ * @type {Call} ~~~~~~~ !!! error TS2315: Type 'Call' is not generic. @@ -54,23 +51,15 @@ */ const identity = x => x; ~ -@@= skipped -10, +12 lines =@@ - * @property {Object} oh - * @property {number} oh.no - * @template T -- ~~~~~~~~ --!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag - * @property {string} oh.noooooo - */ - +@@= skipped -18, +20 lines =@@ /** * @overload -- * @template T - ~~~~~~~~ --!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag ++ ~~~~~~~~ +!!! error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. -+ * @template T + * @template T + ~~~~~~~~ + !!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @template U * @param {T[]} array - ~ @@ -82,11 +71,11 @@ */ /** * @overload -- * @template T - ~~~~~~~~ --!!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag ++ ~~~~~~~~ +!!! error TS7012: This overload implicitly returns the type 'any' because it lacks a return type annotation. -+ * @template T + * @template T + ~~~~~~~~ + !!! error TS8039: A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag * @param {T[][]} array - ~ -!!! error TS2304: Cannot find name 'T'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefDuplicateTypeDeclaration.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefDuplicateTypeDeclaration.errors.txt.diff deleted file mode 100644 index eb4c54bdd8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefDuplicateTypeDeclaration.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.typedefDuplicateTypeDeclaration.errors.txt -+++ new.typedefDuplicateTypeDeclaration.errors.txt -@@= skipped -0, +0 lines =@@ --typedefDuplicateTypeDeclaration.js(4,16): error TS8033: A JSDoc '@typedef' comment may not contain multiple '@type' tags. -- -- --==== typedefDuplicateTypeDeclaration.js (1 errors) ==== -- /** -- * @typedef Name -- * @type {string} -- * @type {Oops} -- -- */ -- --!!! error TS8033: A JSDoc '@typedef' comment may not contain multiple '@type' tags. --!!! related TS8034 typedefDuplicateTypeDeclaration.js:1:1: The tag was first specified here. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.errors.txt.diff index 0cbf38e973..668a3e4dd1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefInnerNamepaths.errors.txt.diff @@ -2,31 +2,28 @@ +++ new.typedefInnerNamepaths.errors.txt @@= skipped -0, +0 lines =@@ -bug25104.js(1,7): error TS2300: Duplicate identifier 'C'. --bug25104.js(3,19): error TS1005: '}' expected. + bug25104.js(3,19): error TS1005: '}' expected. -bug25104.js(4,26): error TS2300: Duplicate identifier 'C'. -bug25104.js(6,18): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. --bug25104.js(6,18): error TS1005: '}' expected. -- -- + bug25104.js(6,18): error TS1005: '}' expected. + + -==== bug25104.js (5 errors) ==== -- class C { ++==== bug25104.js (2 errors) ==== + class C { - ~ -!!! error TS2300: Duplicate identifier 'C'. -- /** -- * @typedef {C~A} C~B -- ~ --!!! error TS1005: '}' expected. -- * @typedef {object} C~A + /** + * @typedef {C~A} C~B + ~ + !!! error TS1005: '}' expected. + * @typedef {object} C~A - ~ -!!! error TS2300: Duplicate identifier 'C'. -- */ -- /** @param {C~A} o */ + */ + /** @param {C~A} o */ - -!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -- ~ --!!! error TS1005: '}' expected. -- constructor(o) { -- } -- } -- -+ \ No newline at end of file + ~ + !!! error TS1005: '}' expected. + constructor(o) { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff index eaa71cd329..42766d987e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefTagWrapping.errors.txt.diff @@ -1,29 +1,32 @@ --- old.typedefTagWrapping.errors.txt +++ new.typedefTagWrapping.errors.txt @@= skipped -0, +0 lines =@@ --mod7.js(5,7): error TS1110: Type expected. --mod7.js(8,4): error TS1110: Type expected. -- -- --==== mod1.js (0 errors) ==== +mod1.js(2,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++mod1.js(2,22): error TS1005: '}' expected. +mod1.js(9,12): error TS2304: Cannot find name 'Type1'. +mod3.js(4,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++mod3.js(4,22): error TS1005: '}' expected. +mod3.js(10,12): error TS2304: Cannot find name 'StringOrNumber1'. +mod4.js(4,14): error TS2552: Cannot find name 'function'. Did you mean 'Function'? ++mod4.js(4,22): error TS1005: '}' expected. +mod4.js(11,12): error TS2304: Cannot find name 'StringOrNumber2'. -+ -+ -+==== mod1.js (2 errors) ==== + mod7.js(5,7): error TS1110: Type expected. + mod7.js(8,4): error TS1110: Type expected. + + +-==== mod1.js (0 errors) ==== ++==== mod1.js (3 errors) ==== /** * @typedef {function(string): boolean} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. * Type1 */ -@@= skipped -11, +18 lines =@@ +@@= skipped -11, +25 lines =@@ * Tries to use a type whose name is on a different * line than the typedef tag. * @param {Type1} func The function to call. @@ -37,7 +40,7 @@ } -==== mod3.js (0 errors) ==== -+==== mod3.js (2 errors) ==== ++==== mod3.js (3 errors) ==== /** * A function whose signature is very long. * @@ -45,6 +48,8 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. * (string|number)} StringOrNumber1 */ @@ -56,12 +61,12 @@ * @param {boolean} bool The condition. * @param {string} str The string. * @param {number} num The number. -@@= skipped -20, +25 lines =@@ +@@= skipped -20, +27 lines =@@ return func(bool, str, num) } -==== mod4.js (0 errors) ==== -+==== mod4.js (2 errors) ==== ++==== mod4.js (3 errors) ==== /** * A function whose signature is very long. * @@ -69,10 +74,12 @@ + ~~~~~~~~ +!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? +!!! related TS2728 lib.es5.d.ts:--:--: 'Function' is declared here. ++ ~ ++!!! error TS1005: '}' expected. * number): * (string|number)} StringOrNumber2 */ -@@= skipped -12, +15 lines =@@ +@@= skipped -12, +17 lines =@@ /** * Makes use of a function type with a long signature. * @param {StringOrNumber2} func The function. @@ -80,24 +87,4 @@ +!!! error TS2304: Cannot find name 'StringOrNumber2'. * @param {boolean} bool The condition. * @param {string} str The string. - * @param {number} num The number. -@@= skipped -50, +52 lines =@@ - } - - --==== mod7.js (2 errors) ==== -+==== mod7.js (0 errors) ==== - /** - Multiline type expressions in comments without leading * are not supported. - @typedef {{ - foo: - *, -- ~ --!!! error TS1110: Type expected. - bar: - * - }} Type7 -- ~ --!!! error TS1110: Type expected. - */ - \ No newline at end of file + * @param {number} num The number. \ No newline at end of file diff --git a/testdata/tests/cases/compiler/invalidJsdocType.ts b/testdata/tests/cases/compiler/invalidJsdocType.ts new file mode 100644 index 0000000000..9697abdb1b --- /dev/null +++ b/testdata/tests/cases/compiler/invalidJsdocType.ts @@ -0,0 +1,6 @@ +// @allowJs: true +// @checkJs: true +// @noEmit: true +// @filename: a.js +/** @type {@import("a").Type} */ +let x; \ No newline at end of file From 7a4a79f8e6b278e7d8cf805d219f2579b14b4fb5 Mon Sep 17 00:00:00 2001 From: Matt Bierner <12821956+mjbvz@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:08:24 -0700 Subject: [PATCH 006/152] Add vscode editor issue template (#1893) Co-authored-by: Ryan Cavanaugh --- .../ISSUE_TEMPLATE/03-vscode-editor-issue.yml | 49 +++++++++++++++++++ .../{03-other.md => 04-other.md} | 0 ...pr-porting.md => 05-copilot-pr-porting.md} | 0 3 files changed, 49 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/03-vscode-editor-issue.yml rename .github/ISSUE_TEMPLATE/{03-other.md => 04-other.md} (100%) rename .github/ISSUE_TEMPLATE/{04-copilot-pr-porting.md => 05-copilot-pr-porting.md} (100%) diff --git a/.github/ISSUE_TEMPLATE/03-vscode-editor-issue.yml b/.github/ISSUE_TEMPLATE/03-vscode-editor-issue.yml new file mode 100644 index 0000000000..d50d09f0c6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/03-vscode-editor-issue.yml @@ -0,0 +1,49 @@ +name: 'VS Code Editor Issue' +about: 'Issue using tsgo in VS Code' +title: '' +labels: 'Domain: Editor' +assignees: '' +body: + - type: input + id: extension_version + attributes: + label: Extension Version + description: The version of the TypeScript (native preview) extension + placeholder: '0.20251016.x' + validations: + required: true + - type: input + id: vscode_version + attributes: + label: VS Code Version + description: The version of the VS Code you are using + placeholder: '1.105.x' + validations: + required: true + - type: input + id: os_version + attributes: + label: Operating system Version + description: Your operating system and version + validations: + required: true + - type: textarea + id: steps + attributes: + label: 'Steps to reproduce' + description: | + Information about how to reproduce the issue and expected behavior + value: | + 1. + 2. + 3. + validations: + required: true + - type: textarea + id: bug_info + attributes: + label: 'Issue' + description: | + Information about the bug, such as expected vs actual behavior + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/03-other.md b/.github/ISSUE_TEMPLATE/04-other.md similarity index 100% rename from .github/ISSUE_TEMPLATE/03-other.md rename to .github/ISSUE_TEMPLATE/04-other.md diff --git a/.github/ISSUE_TEMPLATE/04-copilot-pr-porting.md b/.github/ISSUE_TEMPLATE/05-copilot-pr-porting.md similarity index 100% rename from .github/ISSUE_TEMPLATE/04-copilot-pr-porting.md rename to .github/ISSUE_TEMPLATE/05-copilot-pr-porting.md From 5207eb8f8022fccc8d5c1806c712fbd502581ba1 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:15:14 -0700 Subject: [PATCH 007/152] Add "Report Issue" button to TSGO status bar commands (#1889) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> Co-authored-by: Daniel Rosenwasser --- _extension/package.json | 6 ++++++ _extension/src/commands.ts | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/_extension/package.json b/_extension/package.json index 6fd7113d63..b218b3496a 100644 --- a/_extension/package.json +++ b/_extension/package.json @@ -85,6 +85,12 @@ "title": "Show LSP Trace", "enablement": "typescript.native-preview.serverRunning", "category": "TypeScript Native Preview" + }, + { + "command": "typescript.native-preview.reportIssue", + "title": "Report Issue", + "enablement": "typescript.native-preview.serverRunning", + "category": "TypeScript Native Preview" } ] }, diff --git a/_extension/src/commands.ts b/_extension/src/commands.ts index 18da6a3ca1..a2e0a58065 100644 --- a/_extension/src/commands.ts +++ b/_extension/src/commands.ts @@ -34,6 +34,12 @@ export function registerLanguageCommands(context: vscode.ExtensionContext, clien disposables.push(vscode.commands.registerCommand("typescript.native-preview.showMenu", showCommands)); + disposables.push(vscode.commands.registerCommand("typescript.native-preview.reportIssue", () => { + vscode.commands.executeCommand("workbench.action.openIssueReporter", { + extensionId: "TypeScriptTeam.native-preview", + }); + })); + return disposables; } @@ -74,6 +80,11 @@ async function showCommands(): Promise { description: "Show the LSP communication trace", command: "typescript.native-preview.lsp-trace.focus", }, + { + label: "$(report) Report Issue", + description: "Report an issue with TypeScript Native Preview", + command: "typescript.native-preview.reportIssue", + }, { label: "$(stop-circle) Disable TypeScript Native Preview", description: "Switch back to the built-in TypeScript extension", From 80e287b8e3670718a0d427efd44a8e0633aee765 Mon Sep 17 00:00:00 2001 From: "Oleksandr T." Date: Sat, 18 Oct 2025 22:10:24 +0300 Subject: [PATCH 008/152] fix(1898): adjust location handling in find-refs (#1901) --- internal/ls/documenthighlights.go | 2 +- internal/ls/findallreferences.go | 4 + internal/ls/utilities.go | 2 +- ...nstructorFindAllReferences1.baseline.jsonc | 4 +- ...nstructorFindAllReferences2.baseline.jsonc | 4 +- ...nstructorFindAllReferences4.baseline.jsonc | 4 +- ...AllReferencesDynamicImport1.baseline.jsonc | 2 +- ...ndAllReferencesOfJsonModule.baseline.jsonc | 4 +- .../findAllRefsDeclareClass.baseline.jsonc | 2 +- .../findAllRefsEnumAsNamespace.baseline.jsonc | 4 +- .../findAllRefsExportEquals.baseline.jsonc | 4 +- ...ndAllRefsForDefaultExport01.baseline.jsonc | 6 +- ...ndAllRefsForDefaultExport02.baseline.jsonc | 13 +- ...orVariableInExtendsClause01.baseline.jsonc | 4 +- ...orVariableInExtendsClause02.baseline.jsonc | 4 +- .../findAllRefsImportType.baseline.jsonc | 5 +- ...findAllRefsInsideTemplates1.baseline.jsonc | 4 +- ...findAllRefsInsideTemplates2.baseline.jsonc | 4 +- .../findAllRefsInsideWithBlock.baseline.jsonc | 7 +- .../findAllRefsOnDecorators.baseline.jsonc | 11 +- .../findAllRefsOnDefinition.baseline.jsonc | 9 +- .../findAllRefsOnDefinition2.baseline.jsonc | 8 +- ...OnPrivateParameterProperty1.baseline.jsonc | 6 +- ...AllRefsPrivateNameAccessors.baseline.jsonc | 36 ++-- ...WithLeadingUnderscoreNames1.baseline.jsonc | 4 +- ...WithLeadingUnderscoreNames2.baseline.jsonc | 4 +- ...WithLeadingUnderscoreNames3.baseline.jsonc | 4 +- ...WithLeadingUnderscoreNames4.baseline.jsonc | 4 +- ...WithLeadingUnderscoreNames5.baseline.jsonc | 8 +- ...WithLeadingUnderscoreNames6.baseline.jsonc | 9 +- ...WithLeadingUnderscoreNames7.baseline.jsonc | 4 +- ...mportType_meaningAtLocation.baseline.jsonc | 6 +- ...indAllRefs_importType_named.baseline.jsonc | 12 +- ...efs_importType_typeofImport.baseline.jsonc | 4 +- .../findAllRefs_jsEnum.baseline.jsonc | 6 +- ...encesAcrossMultipleProjects.baseline.jsonc | 10 +- .../findReferencesJSXTagName2.baseline.jsonc | 4 +- ...IsDefinitionOfArrowFunction.baseline.jsonc | 4 +- ...urrencesIsDefinitionOfClass.baseline.jsonc | 6 +- ...currencesIsDefinitionOfEnum.baseline.jsonc | 4 +- ...encesIsDefinitionOfFunction.baseline.jsonc | 4 +- ...ncesIsDefinitionOfInterface.baseline.jsonc | 4 +- ...nitionOfInterfaceClassMerge.baseline.jsonc | 39 ++-- ...ncesIsDefinitionOfNamespace.baseline.jsonc | 4 +- ...ncesIsDefinitionOfTypeAlias.baseline.jsonc | 4 +- ...encesIsDefinitionOfVariable.baseline.jsonc | 20 +- ...cTypedefTagSemanticMeaning0.baseline.jsonc | 4 +- ...cTypedefTagSemanticMeaning1.baseline.jsonc | 4 +- .../localGetReferences.baseline.jsonc | 181 +++++++++++++++++- .../referencesForAmbients.baseline.jsonc | 39 ++-- .../referencesForClassLocal.baseline.jsonc | 13 +- ...referencesForClassParameter.baseline.jsonc | 10 +- ...encesForDeclarationKeywords.baseline.jsonc | 51 ++--- ...rencesForExpressionKeywords.baseline.jsonc | 134 ++++++++----- ...encesForExternalModuleNames.baseline.jsonc | 7 +- ...erencesForFunctionOverloads.baseline.jsonc | 12 +- .../referencesForGlobals.baseline.jsonc | 20 +- .../referencesForGlobals2.baseline.jsonc | 5 +- .../referencesForGlobals3.baseline.jsonc | 5 +- .../referencesForGlobals4.baseline.jsonc | 5 +- .../referencesForGlobals5.baseline.jsonc | 5 +- ...sForGlobalsInExternalModule.baseline.jsonc | 25 +-- .../referencesForImports.baseline.jsonc | 6 +- ...rencesForMergedDeclarations.baseline.jsonc | 22 ++- ...encesForMergedDeclarations2.baseline.jsonc | 6 +- ...encesForMergedDeclarations4.baseline.jsonc | 33 +++- ...encesForMergedDeclarations6.baseline.jsonc | 7 +- ...encesForMergedDeclarations8.baseline.jsonc | 4 +- .../referencesForModifiers.baseline.jsonc | 20 +- .../referencesForStatic.baseline.jsonc | 24 ++- ...ticsAndMembersWithSameNames.baseline.jsonc | 35 +++- ...StringLiteralPropertyNames3.baseline.jsonc | 12 +- .../referencesForTypeKeywords.baseline.jsonc | 16 +- .../remoteGetReferences.baseline.jsonc | 175 ++++++++++++++++- .../tsxFindAllReferences4.baseline.jsonc | 7 +- .../tsxFindAllReferences5.baseline.jsonc | 12 +- .../tsxFindAllReferences8.baseline.jsonc | 52 +++-- ...ReferencesUnionElementType1.baseline.jsonc | 4 +- ...ReferencesUnionElementType2.baseline.jsonc | 4 +- 79 files changed, 960 insertions(+), 320 deletions(-) diff --git a/internal/ls/documenthighlights.go b/internal/ls/documenthighlights.go index f0ed4ce0e0..bab0f63b61 100644 --- a/internal/ls/documenthighlights.go +++ b/internal/ls/documenthighlights.go @@ -51,7 +51,7 @@ func (l *LanguageService) ProvideDocumentHighlights(ctx context.Context, documen } func (l *LanguageService) getSemanticDocumentHighlights(ctx context.Context, position int, node *ast.Node, program *compiler.Program, sourceFile *ast.SourceFile) []*lsproto.DocumentHighlight { - options := refOptions{use: referenceUseReferences} + options := refOptions{use: referenceUseNone} referenceEntries := l.getReferencedSymbolsForNode(ctx, position, node, program, []*ast.SourceFile{sourceFile}, options, &collections.Set[string]{}) if referenceEntries == nil { return nil diff --git a/internal/ls/findallreferences.go b/internal/ls/findallreferences.go index 5dc45a5702..4b937d094e 100644 --- a/internal/ls/findallreferences.go +++ b/internal/ls/findallreferences.go @@ -611,6 +611,10 @@ func (l *LanguageService) getReferencedSymbolsForNode(ctx context.Context, posit } } + if options.use == referenceUseReferences || options.use == referenceUseRename { + node = getAdjustedLocation(node, options.use == referenceUseRename, ast.GetSourceFileOfNode(node)) + } + checker, done := program.GetTypeChecker(ctx) defer done() diff --git a/internal/ls/utilities.go b/internal/ls/utilities.go index 86e27a9fb7..a51d0a2fe1 100644 --- a/internal/ls/utilities.go +++ b/internal/ls/utilities.go @@ -917,7 +917,7 @@ func getAdjustedLocation(node *ast.Node, forRename bool, sourceFile *ast.SourceF // specially by `getSymbolAtLocation`. isModifier := func(node *ast.Node) bool { if ast.IsModifier(node) && (forRename || node.Kind != ast.KindDefaultKeyword) { - return ast.CanHaveModifiers(parent) && slices.Contains(parent.Modifiers().NodeList.Nodes, node) + return ast.CanHaveModifiers(parent) && parent.Modifiers() != nil && slices.Contains(parent.Modifiers().NodeList.Nodes, node) } switch node.Kind { case ast.KindClassKeyword: diff --git a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences1.baseline.jsonc index 360000f99d..ee50558949 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences1.baseline.jsonc @@ -1,8 +1,8 @@ // === findAllReferences === // === /constructorFindAllReferences1.ts === // export class C { -// /*FIND ALL REFS*/public constructor() { } +// /*FIND ALL REFS*/public [|constructor|]() { } // public foo() { } // } // -// new C().foo(); \ No newline at end of file +// new [|C|]().foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences2.baseline.jsonc index ebe82fac1e..a6c3c02e0f 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences2.baseline.jsonc @@ -1,8 +1,8 @@ // === findAllReferences === // === /constructorFindAllReferences2.ts === // export class C { -// /*FIND ALL REFS*/private constructor() { } +// /*FIND ALL REFS*/private [|constructor|]() { } // public foo() { } // } // -// new C().foo(); \ No newline at end of file +// new [|C|]().foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences4.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences4.baseline.jsonc index a9c98eaea2..cf4ebb836b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences4.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/constructorFindAllReferences4.baseline.jsonc @@ -1,8 +1,8 @@ // === findAllReferences === // === /constructorFindAllReferences4.ts === // export class C { -// /*FIND ALL REFS*/protected constructor() { } +// /*FIND ALL REFS*/protected [|constructor|]() { } // public foo() { } // } // -// new C().foo(); \ No newline at end of file +// new [|C|]().foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesDynamicImport1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesDynamicImport1.baseline.jsonc index cf2a41e027..af501fac1d 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesDynamicImport1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesDynamicImport1.baseline.jsonc @@ -18,7 +18,7 @@ // === /foo.ts === // export function foo() { return "foo"; } // import("./foo") -// /*FIND ALL REFS*/var x = import("./foo") +// /*FIND ALL REFS*/var [|x|] = import("./foo") diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesOfJsonModule.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesOfJsonModule.baseline.jsonc index b573d0da76..2560521003 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesOfJsonModule.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllReferencesOfJsonModule.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /foo.ts === -// /*FIND ALL REFS*/import settings from "./settings.json"; -// settings; +// /*FIND ALL REFS*/import [|settings|] from "./settings.json"; +// [|settings|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsDeclareClass.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsDeclareClass.baseline.jsonc index a0e7b903e9..4b37e613d9 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsDeclareClass.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsDeclareClass.baseline.jsonc @@ -1,6 +1,6 @@ // === findAllReferences === // === /findAllRefsDeclareClass.ts === -// /*FIND ALL REFS*/declare class C { +// /*FIND ALL REFS*/declare class [|C|] { // static m(): void; // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsEnumAsNamespace.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsEnumAsNamespace.baseline.jsonc index 459666328e..4bd7d96f89 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsEnumAsNamespace.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsEnumAsNamespace.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /findAllRefsEnumAsNamespace.ts === -// /*FIND ALL REFS*/enum E { A } -// let e: E.A; +// /*FIND ALL REFS*/enum [|E|] { A } +// let e: [|E|].A; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc index 3734653d91..bc114597e4 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsExportEquals.baseline.jsonc @@ -8,10 +8,10 @@ // === findAllReferences === // === /a.ts === // type T = number; -// /*FIND ALL REFS*/[|export|] = T; +// /*FIND ALL REFS*/export = [|T|]; // === /b.ts === -// import T = require("[|./a|]"); +// import [|T|] = require("./a"); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport01.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport01.baseline.jsonc index a7e3cdedf6..f936ce1ea0 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport01.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport01.baseline.jsonc @@ -1,11 +1,11 @@ // === findAllReferences === // === /findAllRefsForDefaultExport01.ts === -// /*FIND ALL REFS*/export default class DefaultExportedClass { +// /*FIND ALL REFS*/export default class [|DefaultExportedClass|] { // } // -// var x: DefaultExportedClass; +// var x: [|DefaultExportedClass|]; // -// var y = new DefaultExportedClass; +// var y = new [|DefaultExportedClass|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport02.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport02.baseline.jsonc index 00007d570f..6f553cd654 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport02.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport02.baseline.jsonc @@ -1,10 +1,15 @@ // === findAllReferences === // === /findAllRefsForDefaultExport02.ts === -// /*FIND ALL REFS*/export default function DefaultExportedFunction() { -// return DefaultExportedFunction; +// /*FIND ALL REFS*/export default function [|DefaultExportedFunction|]() { +// return [|DefaultExportedFunction|]; // } // -// // --- (line: 5) skipped --- +// var x: typeof [|DefaultExportedFunction|]; +// +// var y = [|DefaultExportedFunction|](); +// +// namespace DefaultExportedFunction { +// } @@ -74,7 +79,7 @@ // // var y = DefaultExportedFunction(); // -// /*FIND ALL REFS*/namespace DefaultExportedFunction { +// /*FIND ALL REFS*/namespace [|DefaultExportedFunction|] { // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause01.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause01.baseline.jsonc index e63980b63d..4064c53b01 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause01.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause01.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /findAllRefsForVariableInExtendsClause01.ts === -// /*FIND ALL REFS*/var Base = class { }; -// class C extends Base { } +// /*FIND ALL REFS*/var [|Base|] = class { }; +// class C extends [|Base|] { } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause02.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause02.baseline.jsonc index 635f9d38cb..692886f089 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause02.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForVariableInExtendsClause02.baseline.jsonc @@ -1,9 +1,9 @@ // === findAllReferences === // === /findAllRefsForVariableInExtendsClause02.ts === -// /*FIND ALL REFS*/interface Base { } +// /*FIND ALL REFS*/interface [|Base|] { } // namespace n { // var Base = class { }; -// interface I extends Base { } +// interface I extends [|Base|] { } // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc index d7491ce03c..479db50506 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc @@ -1,7 +1,10 @@ // === findAllReferences === // === /a.js === // module.exports = 0; -// /*FIND ALL REFS*/export type N = number; +// /*FIND ALL REFS*/export type [|N|] = number; + +// === /b.js === +// type T = import("./a").[|N|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates1.baseline.jsonc index d70f81e56a..b433189590 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates1.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /findAllRefsInsideTemplates1.ts === -// /*FIND ALL REFS*/var x = 10; -// var y = `${ x } ${ x }` +// /*FIND ALL REFS*/var [|x|] = 10; +// var y = `${ [|x|] } ${ [|x|] }` diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates2.baseline.jsonc index 9d2e0aa91d..8ca4acea24 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideTemplates2.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /findAllRefsInsideTemplates2.ts === -// /*FIND ALL REFS*/function f(...rest: any[]) { } -// f `${ f } ${ f }` +// /*FIND ALL REFS*/function [|f|](...rest: any[]) { } +// [|f|] `${ [|f|] } ${ [|f|] }` diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideWithBlock.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideWithBlock.baseline.jsonc index 118d6ab98c..19b1d2ba3d 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideWithBlock.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsInsideWithBlock.baseline.jsonc @@ -1,10 +1,13 @@ // === findAllReferences === // === /findAllRefsInsideWithBlock.ts === -// /*FIND ALL REFS*/var x = 0; +// /*FIND ALL REFS*/var [|x|] = 0; // // with ({}) { // var y = x; // Reference of x here should not be picked -// // --- (line: 5) skipped --- +// y++; // also reference for y should be ignored +// } +// +// [|x|] = [|x|] + 1; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDecorators.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDecorators.baseline.jsonc index 8cef99ffaa..a362eb779e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDecorators.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDecorators.baseline.jsonc @@ -1,9 +1,16 @@ // === findAllReferences === // === /a.ts === -// /*FIND ALL REFS*/function decorator(target) { +// /*FIND ALL REFS*/function [|decorator|](target) { // return target; // } -// decorator(); +// [|decorator|](); + +// === /b.ts === +// @[|decorator|] @[|decorator|]("again") +// class C { +// @[|decorator|] +// method() {} +// } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition.baseline.jsonc index c27ee5460e..1ce9c15254 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition.baseline.jsonc @@ -4,12 +4,19 @@ // // } // -// /*FIND ALL REFS*/public start(){ +// /*FIND ALL REFS*/public [|start|](){ // return this; // } // // // --- (line: 11) skipped --- +// === /findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second.[|start|](); +// second.stop(); + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition2.baseline.jsonc index 97030d14d0..948c4ea942 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnDefinition2.baseline.jsonc @@ -2,11 +2,17 @@ // === /findAllRefsOnDefinition2-import.ts === // export module Test{ // -// /*FIND ALL REFS*/export interface start { } +// /*FIND ALL REFS*/export interface [|start|] { } // // export interface stop { } // } +// === /findAllRefsOnDefinition2.ts === +// import Second = require("./findAllRefsOnDefinition2-import"); +// +// var start: Second.Test.[|start|]; +// var stop: Second.Test.stop; + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnPrivateParameterProperty1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnPrivateParameterProperty1.baseline.jsonc index a353dee861..ff228b6549 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnPrivateParameterProperty1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsOnPrivateParameterProperty1.baseline.jsonc @@ -1,11 +1,13 @@ // === findAllReferences === // === /findAllRefsOnPrivateParameterProperty1.ts === // class ABCD { -// constructor(private x: number, public y: number, /*FIND ALL REFS*/private z: number) { +// constructor(private x: number, public y: number, /*FIND ALL REFS*/private [|z|]: number) { // } // // func() { -// // --- (line: 6) skipped --- +// return this.[|z|]; +// } +// } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsPrivateNameAccessors.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsPrivateNameAccessors.baseline.jsonc index 450a19bbe9..590bc48285 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsPrivateNameAccessors.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsPrivateNameAccessors.baseline.jsonc @@ -1,11 +1,14 @@ // === findAllReferences === // === /findAllRefsPrivateNameAccessors.ts === // class C { -// /*FIND ALL REFS*/get #foo(){ return 1; } -// set #foo(value: number){ } +// /*FIND ALL REFS*/get [|#foo|](){ return 1; } +// set [|#foo|](value: number){ } // constructor() { -// this.#foo(); -// // --- (line: 6) skipped --- +// this.[|#foo|](); +// } +// } +// class D extends C { +// // --- (line: 9) skipped --- @@ -26,12 +29,14 @@ // === findAllReferences === // === /findAllRefsPrivateNameAccessors.ts === // class C { -// get #foo(){ return 1; } -// /*FIND ALL REFS*/set #foo(value: number){ } +// get [|#foo|](){ return 1; } +// /*FIND ALL REFS*/set [|#foo|](value: number){ } // constructor() { -// this.#foo(); +// this.[|#foo|](); // } -// // --- (line: 7) skipped --- +// } +// class D extends C { +// // --- (line: 9) skipped --- @@ -69,10 +74,10 @@ // } // } // class E { -// /*FIND ALL REFS*/get #foo(){ return 1; } -// set #foo(value: number){ } +// /*FIND ALL REFS*/get [|#foo|](){ return 1; } +// set [|#foo|](value: number){ } // constructor() { -// this.#foo(); +// this.[|#foo|](); // } // } @@ -95,13 +100,14 @@ // === findAllReferences === // === /findAllRefsPrivateNameAccessors.ts === -// --- (line: 12) skipped --- +// --- (line: 11) skipped --- +// } // } // class E { -// get #foo(){ return 1; } -// /*FIND ALL REFS*/set #foo(value: number){ } +// get [|#foo|](){ return 1; } +// /*FIND ALL REFS*/set [|#foo|](value: number){ } // constructor() { -// this.#foo(); +// this.[|#foo|](); // } // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc index 275b2415e7..38bc2fe401 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc @@ -1,11 +1,11 @@ // === findAllReferences === // === /findAllRefsWithLeadingUnderscoreNames1.ts === // class Foo { -// /*FIND ALL REFS*/public _bar() { return 0; } +// /*FIND ALL REFS*/public [|_bar|]() { return 0; } // } // // var x: Foo; -// x._bar; +// x.[|_bar|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc index 0627485bd8..def74d86dd 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc @@ -1,11 +1,11 @@ // === findAllReferences === // === /findAllRefsWithLeadingUnderscoreNames2.ts === // class Foo { -// /*FIND ALL REFS*/public __bar() { return 0; } +// /*FIND ALL REFS*/public [|__bar|]() { return 0; } // } // // var x: Foo; -// x.__bar; +// x.[|__bar|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc index ba2b00295d..b1c169241e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc @@ -1,11 +1,11 @@ // === findAllReferences === // === /findAllRefsWithLeadingUnderscoreNames3.ts === // class Foo { -// /*FIND ALL REFS*/public ___bar() { return 0; } +// /*FIND ALL REFS*/public [|___bar|]() { return 0; } // } // // var x: Foo; -// x.___bar; +// x.[|___bar|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc index 4c995ceb99..ba04ab6467 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc @@ -1,11 +1,11 @@ // === findAllReferences === // === /findAllRefsWithLeadingUnderscoreNames4.ts === // class Foo { -// /*FIND ALL REFS*/public ____bar() { return 0; } +// /*FIND ALL REFS*/public [|____bar|]() { return 0; } // } // // var x: Foo; -// x.____bar; +// x.[|____bar|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc index 68b9058871..18e8118cfb 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc @@ -3,11 +3,15 @@ // class Foo { // public _bar; // public __bar; -// /*FIND ALL REFS*/public ___bar; +// /*FIND ALL REFS*/public [|___bar|]; // public ____bar; // } // -// // --- (line: 8) skipped --- +// var x: Foo; +// x._bar; +// x.__bar; +// x.[|___bar|]; +// x.____bar; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc index 5cea661dd5..371052938b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc @@ -2,11 +2,16 @@ // === /findAllRefsWithLeadingUnderscoreNames6.ts === // class Foo { // public _bar; -// /*FIND ALL REFS*/public __bar; +// /*FIND ALL REFS*/public [|__bar|]; // public ___bar; // public ____bar; // } -// // --- (line: 7) skipped --- +// +// var x: Foo; +// x._bar; +// x.[|__bar|]; +// x.___bar; +// x.____bar; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc index 761a4899a3..46abb67ad4 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /findAllRefsWithLeadingUnderscoreNames7.ts === -// /*FIND ALL REFS*/function __foo() { -// __foo(); +// /*FIND ALL REFS*/function [|__foo|]() { +// [|__foo|](); // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_meaningAtLocation.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_meaningAtLocation.baseline.jsonc index 41f5903eec..a39cb0e4e4 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_meaningAtLocation.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_meaningAtLocation.baseline.jsonc @@ -1,8 +1,12 @@ // === findAllReferences === // === /a.ts === -// /*FIND ALL REFS*/export type T = 0; +// /*FIND ALL REFS*/export type [|T|] = 0; // export const T = 0; +// === /b.ts === +// const x: import("./a").[|T|] = 0; +// const x: typeof import("./a").T = 0; + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_named.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_named.baseline.jsonc index 55c3e1d76c..2d8b8e38a2 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_named.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_named.baseline.jsonc @@ -1,8 +1,12 @@ // === findAllReferences === // === /a.ts === -// /*FIND ALL REFS*/export type T = number; +// /*FIND ALL REFS*/export type [|T|] = number; // export type U = string; +// === /b.ts === +// const x: import("./a").[|T|] = 0; +// const x: import("./a").U = 0; + // === findAllReferences === @@ -19,7 +23,11 @@ // === findAllReferences === // === /a.ts === // export type T = number; -// /*FIND ALL REFS*/export type U = string; +// /*FIND ALL REFS*/export type [|U|] = string; + +// === /b.ts === +// const x: import("./a").T = 0; +// const x: import("./a").[|U|] = 0; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_typeofImport.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_typeofImport.baseline.jsonc index 33e67cb257..b1dc44da2b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_typeofImport.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_importType_typeofImport.baseline.jsonc @@ -1,6 +1,6 @@ // === findAllReferences === // === /b.ts === -// /*FIND ALL REFS*/const x: typeof import("./a") = { x: 0 }; +// /*FIND ALL REFS*/const [|x|]: typeof import("./a") = { x: 0 }; // const y: typeof import("./a") = { x: 0 }; @@ -15,7 +15,7 @@ // === findAllReferences === // === /b.ts === // const x: typeof import("./a") = { x: 0 }; -// /*FIND ALL REFS*/const y: typeof import("./a") = { x: 0 }; +// /*FIND ALL REFS*/const [|y|]: typeof import("./a") = { x: 0 }; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_jsEnum.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_jsEnum.baseline.jsonc index 14c23a2f5f..77cd5d46e7 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_jsEnum.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefs_jsEnum.baseline.jsonc @@ -1,10 +1,10 @@ // === findAllReferences === // === /a.js === // /** @enum {string} */ -// /*FIND ALL REFS*/const E = { A: "" }; -// E["A"]; +// /*FIND ALL REFS*/const [|E|] = { A: "" }; +// [|E|]["A"]; // /** @type {E} */ -// const e = E.A; +// const e = [|E|].A; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findReferencesAcrossMultipleProjects.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findReferencesAcrossMultipleProjects.baseline.jsonc index ec494e6888..2b80f1d44d 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findReferencesAcrossMultipleProjects.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findReferencesAcrossMultipleProjects.baseline.jsonc @@ -1,6 +1,14 @@ // === findAllReferences === // === /a.ts === -// /*FIND ALL REFS*/var x: number; +// /*FIND ALL REFS*/var [|x|]: number; + +// === /b.ts === +// /// +// [|x|]++; + +// === /c.ts === +// /// +// [|x|]++; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findReferencesJSXTagName2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findReferencesJSXTagName2.baseline.jsonc index a3b65b722a..aac6454a10 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findReferencesJSXTagName2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findReferencesJSXTagName2.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /index.tsx === -// /*FIND ALL REFS*/const obj = {Component: () =>
}; -// const element = ; +// /*FIND ALL REFS*/const [|obj|] = {Component: () =>
}; +// const element = <[|obj|].Component/>; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc index d47a9cd615..45d4e9154c 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfArrowFunction.ts === -// /*FIND ALL REFS*/var f = x => x + 1; -// f(12); +// /*FIND ALL REFS*/var [|f|] = x => x + 1; +// [|f|](12); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfClass.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfClass.baseline.jsonc index 66aa26aa9b..250b824282 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfClass.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfClass.baseline.jsonc @@ -1,10 +1,12 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfClass.ts === -// /*FIND ALL REFS*/class C { +// /*FIND ALL REFS*/class [|C|] { // n: number; // constructor() { // this.n = 12; -// // --- (line: 5) skipped --- +// } +// } +// let c = new [|C|](); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfEnum.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfEnum.baseline.jsonc index e0b28c98c1..fc51da704e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfEnum.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfEnum.baseline.jsonc @@ -1,10 +1,10 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfEnum.ts === -// /*FIND ALL REFS*/enum E { +// /*FIND ALL REFS*/enum [|E|] { // First, // Second // } -// let first = E.First; +// let first = [|E|].First; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfFunction.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfFunction.baseline.jsonc index 93a9afb726..fb25553e8f 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfFunction.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfFunction.baseline.jsonc @@ -1,8 +1,8 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfFunction.ts === -// /*FIND ALL REFS*/function func(x: number) { +// /*FIND ALL REFS*/function [|func|](x: number) { // } -// func(x) +// [|func|](x) diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterface.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterface.baseline.jsonc index 1d3cb221db..3465e29156 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterface.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterface.baseline.jsonc @@ -1,9 +1,9 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfInterface.ts === -// /*FIND ALL REFS*/interface I { +// /*FIND ALL REFS*/interface [|I|] { // p: number; // } -// let i: I = { p: 12 }; +// let i: [|I|] = { p: 12 }; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc index 0482d27845..06b881e54c 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc @@ -1,10 +1,18 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === -// /*FIND ALL REFS*/interface Numbers { +// /*FIND ALL REFS*/interface [|Numbers|] { // p: number; // } -// interface Numbers { -// // --- (line: 5) skipped --- +// interface [|Numbers|] { +// m: number; +// } +// class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); @@ -28,14 +36,19 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === -// interface Numbers { +// interface [|Numbers|] { // p: number; // } -// /*FIND ALL REFS*/interface Numbers { +// /*FIND ALL REFS*/interface [|Numbers|] { // m: number; // } -// class Numbers { -// // --- (line: 8) skipped --- +// class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); @@ -59,15 +72,19 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === -// --- (line: 3) skipped --- -// interface Numbers { +// interface [|Numbers|] { +// p: number; +// } +// interface [|Numbers|] { // m: number; // } -// /*FIND ALL REFS*/class Numbers { +// /*FIND ALL REFS*/class [|Numbers|] { // f(n: number) { // return this.p + this.m + n; // } -// // --- (line: 11) skipped --- +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc index bba65c8c91..1ea8914044 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc @@ -1,9 +1,9 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfNamespace.ts === -// /*FIND ALL REFS*/namespace Numbers { +// /*FIND ALL REFS*/namespace [|Numbers|] { // export var n = 12; // } -// let x = Numbers.n + 1; +// let x = [|Numbers|].n + 1; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc index 588c2d0769..7dfa3f7a3b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfTypeAlias.ts === -// /*FIND ALL REFS*/type Alias= number; -// let n: Alias = 12; +// /*FIND ALL REFS*/type [|Alias|]= number; +// let n: [|Alias|] = 12; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfVariable.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfVariable.baseline.jsonc index 3e18059318..9ee407ef13 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfVariable.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/getOccurrencesIsDefinitionOfVariable.baseline.jsonc @@ -1,10 +1,22 @@ // === findAllReferences === // === /getOccurrencesIsDefinitionOfVariable.ts === -// /*FIND ALL REFS*/var x = 0; -// var assignmentRightHandSide = x; -// var assignmentRightHandSide2 = 1 + x; +// /*FIND ALL REFS*/var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; // -// // --- (line: 5) skipped --- +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning0.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning0.baseline.jsonc index 662ccb87d3..db5fd49cb4 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning0.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning0.baseline.jsonc @@ -19,9 +19,9 @@ // === findAllReferences === // === /a.js === // /** @typedef {number} T */ -// /*FIND ALL REFS*/const T = 1; +// /*FIND ALL REFS*/const [|T|] = 1; // /** @type {T} */ -// const n = T; +// const n = [|T|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning1.baseline.jsonc index 72f2f31da3..f67cbe6091 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/jsdocTypedefTagSemanticMeaning1.baseline.jsonc @@ -1,9 +1,9 @@ // === findAllReferences === // === /a.js === // /** @typedef {number} */ -// /*FIND ALL REFS*/const T = 1; +// /*FIND ALL REFS*/const [|T|] = 1; // /** @type {T} */ -// const n = T; +// const n = [|T|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/localGetReferences.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/localGetReferences.baseline.jsonc index 3dd7634782..11a750c0a7 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/localGetReferences.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/localGetReferences.baseline.jsonc @@ -2,11 +2,71 @@ // === /localGetReferences_1.ts === // // Comment Refence Test: globalVar // // References to a variable declared in global. -// /*FIND ALL REFS*/var globalVar: number = 2; +// /*FIND ALL REFS*/var [|globalVar|]: number = 2; // // class fooCls { // // References to static variable declared in a class. -// // --- (line: 7) skipped --- +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// // --- (line: 17) skipped --- + +// --- (line: 25) skipped --- +// +// //Increments +// fooCls.clsSVar++; +// [|globalVar|]++; +// modTest.modVar++; +// fnVar++; +// +// // --- (line: 33) skipped --- + +// --- (line: 38) skipped --- +// export var modVar:number; +// +// //Increments +// [|globalVar|]++; +// fooCls.clsSVar++; +// modVar++; +// +// // --- (line: 46) skipped --- + +// --- (line: 50) skipped --- +// static boo = foo; +// +// //Increments +// [|globalVar|]++; +// fooCls.clsSVar++; +// modVar++; +// } +// // --- (line: 58) skipped --- + +// --- (line: 65) skipped --- +// +// //Arguments +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// // --- (line: 83) skipped --- @@ -88,11 +148,59 @@ // // class fooCls { // // References to static variable declared in a class. -// /*FIND ALL REFS*/static clsSVar = 1; +// /*FIND ALL REFS*/static [|clsSVar|] = 1; // // References to a variable declared in a class. // clsVar = 1; // -// // --- (line: 11) skipped --- +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.[|clsSVar|]++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// // --- (line: 19) skipped --- + +// --- (line: 24) skipped --- +// var fnVar = 1; +// +// //Increments +// fooCls.[|clsSVar|]++; +// globalVar++; +// modTest.modVar++; +// fnVar++; +// // --- (line: 32) skipped --- + +// --- (line: 39) skipped --- +// +// //Increments +// globalVar++; +// fooCls.[|clsSVar|]++; +// modVar++; +// +// class testCls { +// // --- (line: 47) skipped --- + +// --- (line: 51) skipped --- +// +// //Increments +// globalVar++; +// fooCls.[|clsSVar|]++; +// modVar++; +// } +// +// // --- (line: 59) skipped --- + +// --- (line: 70) skipped --- +// foo(globalVar); +// +// //Increments +// fooCls.[|clsSVar|]++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// // --- (line: 78) skipped --- @@ -183,11 +291,17 @@ // // References to a variable declared in a class. // clsVar = 1; // -// constructor (/*FIND ALL REFS*/public clsParam: number) { +// constructor (/*FIND ALL REFS*/public [|clsParam|]: number) { // //Increments // globalVar++; // this.clsVar++; -// // --- (line: 15) skipped --- +// fooCls.clsSVar++; +// // References to a class parameter. +// this.[|clsParam|]++; +// modTest.modVar++; +// } +// } +// // --- (line: 21) skipped --- @@ -390,12 +504,55 @@ // } // // // References to a function parameter. -// /*FIND ALL REFS*/function foo(x: number) { +// /*FIND ALL REFS*/function [|foo|](x: number) { // // References to a variable declared in a function. // var fnVar = 1; // // // --- (line: 27) skipped --- +// --- (line: 43) skipped --- +// modVar++; +// +// class testCls { +// static boo = [|foo|]; +// } +// +// function testFn(){ +// static boo = [|foo|]; +// +// //Increments +// globalVar++; +// fooCls.clsSVar++; +// modVar++; +// } +// +// module testMod { +// var boo = [|foo|]; +// } +// } +// +// // --- (line: 64) skipped --- + +// --- (line: 67) skipped --- +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// [|foo|](globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// [|foo|] = [|foo|] + 1; +// err = err++; +// +// //Shadowed fn Parameter +// // --- (line: 85) skipped --- + // === findAllReferences === @@ -485,11 +642,17 @@ // // References to a function parameter. // function foo(x: number) { // // References to a variable declared in a function. -// /*FIND ALL REFS*/var fnVar = 1; +// /*FIND ALL REFS*/var [|fnVar|] = 1; // // //Increments // fooCls.clsSVar++; -// // --- (line: 29) skipped --- +// globalVar++; +// modTest.modVar++; +// [|fnVar|]++; +// +// //Return +// return x++; +// // --- (line: 35) skipped --- diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForAmbients.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForAmbients.baseline.jsonc index b70c6b36cd..9643fbc873 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForAmbients.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForAmbients.baseline.jsonc @@ -1,10 +1,15 @@ // === findAllReferences === // === /referencesForAmbients.ts === -// /*FIND ALL REFS*/declare module "foo" { +// /*FIND ALL REFS*/declare module "[|foo|]" { // var f: number; // } // -// // --- (line: 5) skipped --- +// declare module "bar" { +// export import foo = require("[|foo|]"); +// var f2: typeof foo.f; +// } +// +// // --- (line: 10) skipped --- @@ -26,11 +31,16 @@ // === findAllReferences === // === /referencesForAmbients.ts === // declare module "foo" { -// /*FIND ALL REFS*/var f: number; +// /*FIND ALL REFS*/var [|f|]: number; // } // // declare module "bar" { -// // --- (line: 6) skipped --- +// export import foo = require("foo"); +// var f2: typeof foo.[|f|]; +// } +// +// declare module "baz" { +// // --- (line: 11) skipped --- @@ -56,11 +66,15 @@ // var f: number; // } // -// /*FIND ALL REFS*/declare module "bar" { +// /*FIND ALL REFS*/declare module "[|bar|]" { // export import foo = require("foo"); // var f2: typeof foo.f; // } -// // --- (line: 9) skipped --- +// +// declare module "baz" { +// import bar = require("[|bar|]"); +// var f2: typeof bar.foo; +// } @@ -89,11 +103,14 @@ // } // // declare module "bar" { -// /*FIND ALL REFS*/export import foo = require("foo"); -// var f2: typeof foo.f; +// /*FIND ALL REFS*/export import [|foo|] = require("foo"); +// var f2: typeof [|foo|].f; // } // -// // --- (line: 10) skipped --- +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.[|foo|]; +// } @@ -170,8 +187,8 @@ // } // // declare module "baz" { -// /*FIND ALL REFS*/import bar = require("bar"); -// var f2: typeof bar.foo; +// /*FIND ALL REFS*/import [|bar|] = require("bar"); +// var f2: typeof [|bar|].foo; // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassLocal.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassLocal.baseline.jsonc index 6eba7c7b66..1644f2ca65 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassLocal.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassLocal.baseline.jsonc @@ -3,11 +3,18 @@ // var n = 14; // // class foo { -// /*FIND ALL REFS*/private n = 0; +// /*FIND ALL REFS*/private [|n|] = 0; // // public bar() { -// this.n = 9; -// // --- (line: 8) skipped --- +// this.[|n|] = 9; +// } +// +// constructor() { +// this.[|n|] = 4; +// } +// +// public bar2() { +// // --- (line: 15) skipped --- diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassParameter.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassParameter.baseline.jsonc index e5b662d166..b1565d329a 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassParameter.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForClassParameter.baseline.jsonc @@ -5,11 +5,17 @@ // class p { } // // class foo { -// constructor (/*FIND ALL REFS*/public p: any) { +// constructor (/*FIND ALL REFS*/public [|p|]: any) { // } // // public f(p) { -// // --- (line: 10) skipped --- +// this.[|p|] = p; +// } +// +// } +// +// var n = new foo(undefined); +// n.[|p|] = null; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForDeclarationKeywords.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForDeclarationKeywords.baseline.jsonc index 1eaba5ce64..f690bc1ada 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForDeclarationKeywords.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForDeclarationKeywords.baseline.jsonc @@ -2,7 +2,7 @@ // === /referencesForDeclarationKeywords.ts === // class Base {} // interface Implemented1 {} -// /*FIND ALL REFS*/class C1 extends Base implements Implemented1 { +// /*FIND ALL REFS*/class [|C1|] extends Base implements Implemented1 { // get e() { return 1; } // set e(v) {} // } @@ -12,21 +12,25 @@ // === findAllReferences === // === /referencesForDeclarationKeywords.ts === -// class Base {} +// class [|Base|] {} // interface Implemented1 {} -// class C1 /*FIND ALL REFS*/extends Base implements Implemented1 { +// class C1 /*FIND ALL REFS*/extends [|Base|] implements Implemented1 { // get e() { return 1; } // set e(v) {} // } -// // --- (line: 7) skipped --- +// interface I1 extends [|Base|] { } +// type T = { } +// enum E { } +// namespace N { } +// // --- (line: 11) skipped --- // === findAllReferences === // === /referencesForDeclarationKeywords.ts === // class Base {} -// interface Implemented1 {} -// class C1 extends Base /*FIND ALL REFS*/implements Implemented1 { +// interface [|Implemented1|] {} +// class C1 extends Base /*FIND ALL REFS*/implements [|Implemented1|] { // get e() { return 1; } // set e(v) {} // } @@ -50,11 +54,12 @@ // class Base {} // interface Implemented1 {} // class C1 extends Base implements Implemented1 { -// /*FIND ALL REFS*/get e() { return 1; } -// set e(v) {} +// /*FIND ALL REFS*/get [|e|]() { return 1; } +// set [|e|](v) {} // } // interface I1 extends Base { } -// // --- (line: 8) skipped --- +// type T = { } +// // --- (line: 9) skipped --- @@ -63,8 +68,8 @@ // class Base {} // interface Implemented1 {} // class C1 extends Base implements Implemented1 { -// get e() { return 1; } -// /*FIND ALL REFS*/set e(v) {} +// get [|e|]() { return 1; } +// /*FIND ALL REFS*/set [|e|](v) {} // } // interface I1 extends Base { } // type T = { } @@ -78,7 +83,7 @@ // get e() { return 1; } // set e(v) {} // } -// /*FIND ALL REFS*/interface I1 extends Base { } +// /*FIND ALL REFS*/interface [|I1|] extends Base { } // type T = { } // enum E { } // namespace N { } @@ -88,11 +93,13 @@ // === findAllReferences === // === /referencesForDeclarationKeywords.ts === -// --- (line: 3) skipped --- +// class [|Base|] {} +// interface Implemented1 {} +// class C1 extends [|Base|] implements Implemented1 { // get e() { return 1; } // set e(v) {} // } -// interface I1 /*FIND ALL REFS*/extends Base { } +// interface I1 /*FIND ALL REFS*/extends [|Base|] { } // type T = { } // enum E { } // namespace N { } @@ -116,7 +123,7 @@ // set e(v) {} // } // interface I1 extends Base { } -// /*FIND ALL REFS*/type T = { } +// /*FIND ALL REFS*/type [|T|] = { } // enum E { } // namespace N { } // module M { } @@ -130,7 +137,7 @@ // } // interface I1 extends Base { } // type T = { } -// /*FIND ALL REFS*/enum E { } +// /*FIND ALL REFS*/enum [|E|] { } // namespace N { } // module M { } // function fn() {} @@ -144,7 +151,7 @@ // interface I1 extends Base { } // type T = { } // enum E { } -// /*FIND ALL REFS*/namespace N { } +// /*FIND ALL REFS*/namespace [|N|] { } // module M { } // function fn() {} // var x; @@ -158,7 +165,7 @@ // type T = { } // enum E { } // namespace N { } -// /*FIND ALL REFS*/module M { } +// /*FIND ALL REFS*/module [|M|] { } // function fn() {} // var x; // let y; @@ -172,7 +179,7 @@ // enum E { } // namespace N { } // module M { } -// /*FIND ALL REFS*/function fn() {} +// /*FIND ALL REFS*/function [|fn|]() {} // var x; // let y; // const z = 1; @@ -186,7 +193,7 @@ // namespace N { } // module M { } // function fn() {} -// /*FIND ALL REFS*/var x; +// /*FIND ALL REFS*/var [|x|]; // let y; // const z = 1; // interface Implemented2 {} @@ -200,7 +207,7 @@ // module M { } // function fn() {} // var x; -// /*FIND ALL REFS*/let y; +// /*FIND ALL REFS*/let [|y|]; // const z = 1; // interface Implemented2 {} // interface Implemented3 {} @@ -215,7 +222,7 @@ // function fn() {} // var x; // let y; -// /*FIND ALL REFS*/const z = 1; +// /*FIND ALL REFS*/const [|z|] = 1; // interface Implemented2 {} // interface Implemented3 {} // class C2 implements Implemented2, Implemented3 {} diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForExpressionKeywords.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForExpressionKeywords.baseline.jsonc index 845f1c7ced..c7d0181ab8 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForExpressionKeywords.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForExpressionKeywords.baseline.jsonc @@ -1,83 +1,114 @@ // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// class C { +// class [|C|] { // static x = 1; // } -// /*FIND ALL REFS*/new C(); -// void C; -// typeof C; -// delete C.x; -// // --- (line: 8) skipped --- +// /*FIND ALL REFS*/new [|C|](); +// void [|C|]; +// typeof [|C|]; +// delete [|C|].x; +// async function* f() { +// yield [|C|]; +// await [|C|]; +// } +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// class C { +// class [|C|] { // static x = 1; // } -// new C(); -// /*FIND ALL REFS*/void C; -// typeof C; -// delete C.x; +// new [|C|](); +// /*FIND ALL REFS*/void [|C|]; +// typeof [|C|]; +// delete [|C|].x; // async function* f() { -// // --- (line: 9) skipped --- +// yield [|C|]; +// await [|C|]; +// } +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// class C { +// class [|C|] { // static x = 1; // } -// new C(); -// void C; -// /*FIND ALL REFS*/[|typeof|] C; -// delete C.x; +// new [|C|](); +// void [|C|]; +// /*FIND ALL REFS*/typeof [|C|]; +// delete [|C|].x; // async function* f() { -// yield C; -// // --- (line: 10) skipped --- +// yield [|C|]; +// await [|C|]; +// } +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// --- (line: 5) skipped --- -// typeof C; -// delete C.x; +// class [|C|] { +// static x = 1; +// } +// new [|C|](); +// void [|C|]; +// typeof [|C|]; +// delete [|C|].x; // async function* f() { -// /*FIND ALL REFS*/yield C; -// await C; +// /*FIND ALL REFS*/yield [|C|]; +// await [|C|]; // } -// "x" in C; -// undefined instanceof C; -// undefined as C; +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// --- (line: 6) skipped --- -// delete C.x; +// class [|C|] { +// static x = 1; +// } +// new [|C|](); +// void [|C|]; +// typeof [|C|]; +// delete [|C|].x; // async function* f() { -// yield C; -// /*FIND ALL REFS*/await C; +// yield [|C|]; +// /*FIND ALL REFS*/await [|C|]; // } -// "x" in C; -// undefined instanceof C; -// undefined as C; +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// --- (line: 8) skipped --- -// yield C; -// await C; +// class [|C|] { +// static x = 1; // } -// "x" /*FIND ALL REFS*/in C; -// undefined instanceof C; -// undefined as C; +// new [|C|](); +// void [|C|]; +// typeof [|C|]; +// delete [|C|].x; +// async function* f() { +// yield [|C|]; +// await [|C|]; +// } +// "x" /*FIND ALL REFS*/in [|C|]; +// undefined instanceof [|C|]; +// undefined as [|C|]; @@ -102,21 +133,32 @@ // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// --- (line: 10) skipped --- +// class [|C|] { +// static x = 1; // } -// "x" in C; -// undefined instanceof C; -// undefined /*FIND ALL REFS*/as C; +// new [|C|](); +// void [|C|]; +// typeof [|C|]; +// delete [|C|].x; +// async function* f() { +// yield [|C|]; +// await [|C|]; +// } +// "x" in [|C|]; +// undefined instanceof [|C|]; +// undefined /*FIND ALL REFS*/as [|C|]; // === findAllReferences === // === /referencesForExpressionKeywords.ts === -// --- (line: 3) skipped --- +// class C { +// static [|x|] = 1; +// } // new C(); // void C; // typeof C; -// /*FIND ALL REFS*/delete C.x; +// /*FIND ALL REFS*/delete C.[|x|]; // async function* f() { // yield C; // await C; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForExternalModuleNames.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForExternalModuleNames.baseline.jsonc index 6f1cb201fe..cdbcdc4593 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForExternalModuleNames.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForExternalModuleNames.baseline.jsonc @@ -1,9 +1,12 @@ // === findAllReferences === // === /referencesForGlobals_1.ts === -// /*FIND ALL REFS*/declare module "foo" { +// /*FIND ALL REFS*/declare module "[|foo|]" { // var f: number; // } +// === /referencesForGlobals_2.ts === +// import f = require("[|foo|]"); + // === findAllReferences === @@ -19,7 +22,7 @@ // === findAllReferences === // === /referencesForGlobals_2.ts === -// /*FIND ALL REFS*/import f = require("foo"); +// /*FIND ALL REFS*/import [|f|] = require("foo"); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForFunctionOverloads.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForFunctionOverloads.baseline.jsonc index 86de4ff51c..02172bb86d 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForFunctionOverloads.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForFunctionOverloads.baseline.jsonc @@ -1,8 +1,8 @@ // === findAllReferences === // === /referencesForFunctionOverloads.ts === -// /*FIND ALL REFS*/function foo(x: string); -// function foo(x: string, y: number) { -// foo('', 43); +// /*FIND ALL REFS*/function [|foo|](x: string); +// function [|foo|](x: string, y: number) { +// [|foo|]('', 43); // } @@ -18,9 +18,9 @@ // === findAllReferences === // === /referencesForFunctionOverloads.ts === -// function foo(x: string); -// /*FIND ALL REFS*/function foo(x: string, y: number) { -// foo('', 43); +// function [|foo|](x: string); +// /*FIND ALL REFS*/function [|foo|](x: string, y: number) { +// [|foo|]('', 43); // } diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals.baseline.jsonc index 54bec186f0..7942e20845 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals.baseline.jsonc @@ -1,10 +1,26 @@ // === findAllReferences === // === /referencesForGlobals_1.ts === -// /*FIND ALL REFS*/var global = 2; +// /*FIND ALL REFS*/var [|global|] = 2; // // class foo { // constructor (public global) { } -// // --- (line: 5) skipped --- +// public f(global) { } +// public f2(global) { } +// } +// +// class bar { +// constructor () { +// var n = [|global|]; +// +// var f = new foo(''); +// f.global = ''; +// } +// } +// +// var k = [|global|]; + +// === /referencesForGlobals_2.ts === +// var m = [|global|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals2.baseline.jsonc index 31467511fe..d610d04261 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals2.baseline.jsonc @@ -1,9 +1,12 @@ // === findAllReferences === // === /referencesForGlobals_1.ts === -// /*FIND ALL REFS*/class globalClass { +// /*FIND ALL REFS*/class [|globalClass|] { // public f() { } // } +// === /referencesForGlobals_2.ts === +// var c = [|globalClass|](); + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals3.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals3.baseline.jsonc index 79f09ba209..900a8652b7 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals3.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals3.baseline.jsonc @@ -1,9 +1,12 @@ // === findAllReferences === // === /referencesForGlobals_1.ts === -// /*FIND ALL REFS*/interface globalInterface { +// /*FIND ALL REFS*/interface [|globalInterface|] { // f(); // } +// === /referencesForGlobals_2.ts === +// var i: [|globalInterface|]; + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals4.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals4.baseline.jsonc index 92d11768c4..0d1e16d30b 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals4.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals4.baseline.jsonc @@ -1,9 +1,12 @@ // === findAllReferences === // === /referencesForGlobals_1.ts === -// /*FIND ALL REFS*/module globalModule { +// /*FIND ALL REFS*/module [|globalModule|] { // export f() { }; // } +// === /referencesForGlobals_2.ts === +// var m = [|globalModule|]; + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals5.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals5.baseline.jsonc index 1345e76576..1fe53ef3aa 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals5.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobals5.baseline.jsonc @@ -4,7 +4,10 @@ // export var x; // } // -// /*FIND ALL REFS*/import globalAlias = globalModule; +// /*FIND ALL REFS*/import [|globalAlias|] = globalModule; + +// === /referencesForGlobals_2.ts === +// var m = [|globalAlias|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobalsInExternalModule.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobalsInExternalModule.baseline.jsonc index 73e1bc6410..f676331fc7 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobalsInExternalModule.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForGlobalsInExternalModule.baseline.jsonc @@ -1,10 +1,11 @@ // === findAllReferences === // === /referencesForGlobalsInExternalModule.ts === -// /*FIND ALL REFS*/var topLevelVar = 2; -// var topLevelVar2 = topLevelVar; +// /*FIND ALL REFS*/var [|topLevelVar|] = 2; +// var topLevelVar2 = [|topLevelVar|]; // // class topLevelClass { } -// // --- (line: 5) skipped --- +// var c = new topLevelClass(); +// // --- (line: 6) skipped --- @@ -35,11 +36,12 @@ // var topLevelVar = 2; // var topLevelVar2 = topLevelVar; // -// /*FIND ALL REFS*/class topLevelClass { } -// var c = new topLevelClass(); +// /*FIND ALL REFS*/class [|topLevelClass|] { } +// var c = new [|topLevelClass|](); // // interface topLevelInterface { } -// // --- (line: 8) skipped --- +// var i: topLevelInterface; +// // --- (line: 9) skipped --- @@ -77,11 +79,12 @@ // class topLevelClass { } // var c = new topLevelClass(); // -// /*FIND ALL REFS*/interface topLevelInterface { } -// var i: topLevelInterface; +// /*FIND ALL REFS*/interface [|topLevelInterface|] { } +// var i: [|topLevelInterface|]; // // module topLevelModule { -// // --- (line: 11) skipped --- +// export var x; +// // --- (line: 12) skipped --- @@ -121,10 +124,10 @@ // interface topLevelInterface { } // var i: topLevelInterface; // -// /*FIND ALL REFS*/module topLevelModule { +// /*FIND ALL REFS*/module [|topLevelModule|] { // export var x; // } -// var x = topLevelModule.x; +// var x = [|topLevelModule|].x; // // export = x; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForImports.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForImports.baseline.jsonc index 81aaedb024..bd03e117e5 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForImports.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForImports.baseline.jsonc @@ -4,8 +4,8 @@ // function $(s: string): any; // export = $; // } -// /*FIND ALL REFS*/import $ = require("jquery"); -// $("a"); +// /*FIND ALL REFS*/import [|$|] = require("jquery"); +// [|$|]("a"); // import $ = require("jquery"); @@ -40,7 +40,7 @@ // } // import $ = require("jquery"); // $("a"); -// /*FIND ALL REFS*/import $ = require("jquery"); +// /*FIND ALL REFS*/import [|$|] = require("jquery"); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations.baseline.jsonc index 9a876c8f4b..d6508f7d33 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations.baseline.jsonc @@ -1,11 +1,18 @@ // === findAllReferences === // === /referencesForMergedDeclarations.ts === -// /*FIND ALL REFS*/interface Foo { +// /*FIND ALL REFS*/interface [|Foo|] { // } // // module Foo { // // --- (line: 5) skipped --- +// --- (line: 8) skipped --- +// } +// +// var f1: Foo.Bar; +// var f2: [|Foo|]; +// Foo.bind(this); + // === findAllReferences === @@ -30,11 +37,16 @@ // interface Foo { // } // -// /*FIND ALL REFS*/module Foo { +// /*FIND ALL REFS*/module [|Foo|] { // export interface Bar { } // } // -// // --- (line: 8) skipped --- +// function Foo(): void { +// } +// +// var f1: [|Foo|].Bar; +// var f2: Foo; +// Foo.bind(this); @@ -62,12 +74,12 @@ // export interface Bar { } // } // -// /*FIND ALL REFS*/function Foo(): void { +// /*FIND ALL REFS*/function [|Foo|](): void { // } // // var f1: Foo.Bar; // var f2: Foo; -// Foo.bind(this); +// [|Foo|].bind(this); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations2.baseline.jsonc index 377113b9d1..fa095d184e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations2.baseline.jsonc @@ -4,10 +4,10 @@ // // function ATest() { } // -// /*FIND ALL REFS*/import alias = ATest; // definition +// /*FIND ALL REFS*/import [|alias|] = ATest; // definition // -// var a: alias.Bar; // namespace -// alias.call(this); // value +// var a: [|alias|].Bar; // namespace +// [|alias|].call(this); // value diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations4.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations4.baseline.jsonc index fc54de7f4b..5896510ddb 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations4.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations4.baseline.jsonc @@ -1,10 +1,24 @@ // === findAllReferences === // === /referencesForMergedDeclarations4.ts === -// /*FIND ALL REFS*/class testClass { +// /*FIND ALL REFS*/class [|testClass|] { // static staticMethod() { } // method() { } // } -// // --- (line: 5) skipped --- +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); @@ -34,16 +48,25 @@ // === findAllReferences === // === /referencesForMergedDeclarations4.ts === -// class testClass { +// class [|testClass|] { // static staticMethod() { } // method() { } // } // -// /*FIND ALL REFS*/module testClass { +// /*FIND ALL REFS*/module [|testClass|] { // export interface Bar { // // } -// // --- (line: 10) skipped --- +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations6.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations6.baseline.jsonc index f7f9fd6965..7746adb1e4 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations6.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations6.baseline.jsonc @@ -1,11 +1,14 @@ // === findAllReferences === // === /referencesForMergedDeclarations6.ts === // interface Foo { } -// /*FIND ALL REFS*/module Foo { +// /*FIND ALL REFS*/module [|Foo|] { // export interface Bar { } // export module Bar { export interface Baz { } } // export function Bar() { } -// // --- (line: 6) skipped --- +// } +// +// // module +// import a1 = [|Foo|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc index ce8d974534..01b41d14f3 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForMergedDeclarations8.baseline.jsonc @@ -3,12 +3,12 @@ // interface Foo { } // module Foo { // export interface Bar { } -// /*FIND ALL REFS*/export module Bar { export interface Baz { } } +// /*FIND ALL REFS*/export module [|Bar|] { export interface Baz { } } // export function Bar() { } // } // // // module -// import a3 = Foo.Bar.Baz; +// import a3 = Foo.[|Bar|].Baz; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForModifiers.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForModifiers.baseline.jsonc index b4505a6fce..5edfd5392f 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForModifiers.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForModifiers.baseline.jsonc @@ -1,6 +1,6 @@ // === findAllReferences === // === /referencesForModifiers.ts === -// /*FIND ALL REFS*/declare abstract class C1 { +// /*FIND ALL REFS*/declare abstract class [|C1|] { // static a; // readonly b; // public c; @@ -10,7 +10,7 @@ // === findAllReferences === // === /referencesForModifiers.ts === -// declare /*FIND ALL REFS*/abstract class C1 { +// declare /*FIND ALL REFS*/abstract class [|C1|] { // static a; // readonly b; // public c; @@ -21,7 +21,7 @@ // === findAllReferences === // === /referencesForModifiers.ts === // declare abstract class C1 { -// /*FIND ALL REFS*/static a; +// /*FIND ALL REFS*/static [|a|]; // readonly b; // public c; // protected d; @@ -33,7 +33,7 @@ // === /referencesForModifiers.ts === // declare abstract class C1 { // static a; -// /*FIND ALL REFS*/readonly b; +// /*FIND ALL REFS*/readonly [|b|]; // public c; // protected d; // private e; @@ -46,7 +46,7 @@ // declare abstract class C1 { // static a; // readonly b; -// /*FIND ALL REFS*/public c; +// /*FIND ALL REFS*/public [|c|]; // protected d; // private e; // } @@ -60,7 +60,7 @@ // static a; // readonly b; // public c; -// /*FIND ALL REFS*/protected d; +// /*FIND ALL REFS*/protected [|d|]; // private e; // } // const enum E { @@ -75,7 +75,7 @@ // readonly b; // public c; // protected d; -// /*FIND ALL REFS*/private e; +// /*FIND ALL REFS*/private [|e|]; // } // const enum E { // } @@ -90,7 +90,7 @@ // protected d; // private e; // } -// /*FIND ALL REFS*/const enum E { +// /*FIND ALL REFS*/const enum [|E|] { // } // async function fn() {} // export default class C2 {} @@ -103,7 +103,7 @@ // } // const enum E { // } -// /*FIND ALL REFS*/async function fn() {} +// /*FIND ALL REFS*/async function [|fn|]() {} // export default class C2 {} @@ -114,7 +114,7 @@ // const enum E { // } // async function fn() {} -// /*FIND ALL REFS*/export default class C2 {} +// /*FIND ALL REFS*/export default class [|C2|] {} diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatic.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatic.baseline.jsonc index d51eb433e8..05be2ced9c 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatic.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStatic.baseline.jsonc @@ -3,11 +3,29 @@ // var n = 43; // // class foo { -// /*FIND ALL REFS*/static n = ''; +// /*FIND ALL REFS*/static [|n|] = ''; // // public bar() { -// foo.n = "'"; -// // --- (line: 8) skipped --- +// foo.[|n|] = "'"; +// if(foo.[|n|]) { +// var x = foo.[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo.[|n|]; +// constructor() { +// foo.[|n|] = x; +// } +// +// function b(n) { +// n = foo.[|n|]; +// } +// } + +// === /referencesOnStatic_2.ts === +// var q = foo.[|n|]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStaticsAndMembersWithSameNames.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStaticsAndMembersWithSameNames.baseline.jsonc index 84334b385e..98a98b58e6 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStaticsAndMembersWithSameNames.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStaticsAndMembersWithSameNames.baseline.jsonc @@ -27,12 +27,20 @@ // module MixedStaticsClassTest { // export class Foo { // bar: Foo; -// /*FIND ALL REFS*/static bar: Foo; +// /*FIND ALL REFS*/static [|bar|]: Foo; // // public foo(): void { // } // // --- (line: 9) skipped --- +// --- (line: 18) skipped --- +// +// // static function +// MixedStaticsClassTest.Foo.foo(); +// MixedStaticsClassTest.Foo.[|bar|]; +// } +// } + // === findAllReferences === @@ -63,11 +71,21 @@ // bar: Foo; // static bar: Foo; // -// /*FIND ALL REFS*/public foo(): void { +// /*FIND ALL REFS*/public [|foo|](): void { // } // public static foo(): void { // } -// // --- (line: 11) skipped --- +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.[|foo|](); +// x.bar; +// +// // static function +// // --- (line: 21) skipped --- @@ -101,12 +119,21 @@ // // public foo(): void { // } -// /*FIND ALL REFS*/public static foo(): void { +// /*FIND ALL REFS*/public static [|foo|](): void { // } // } // } // // --- (line: 13) skipped --- +// --- (line: 17) skipped --- +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo.[|foo|](); +// MixedStaticsClassTest.Foo.bar; +// } +// } + // === findAllReferences === diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStringLiteralPropertyNames3.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStringLiteralPropertyNames3.baseline.jsonc index 3a61f5954d..d2ff4badc6 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForStringLiteralPropertyNames3.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForStringLiteralPropertyNames3.baseline.jsonc @@ -1,12 +1,12 @@ // === findAllReferences === // === /referencesForStringLiteralPropertyNames3.ts === // class Foo2 { -// /*FIND ALL REFS*/get "42"() { return 0; } -// set 42(n) { } +// /*FIND ALL REFS*/get "[|42|]"() { return 0; } +// set [|42|](n) { } // } // // var y: Foo2; -// y[42]; +// y[[|42|]]; @@ -25,12 +25,12 @@ // === findAllReferences === // === /referencesForStringLiteralPropertyNames3.ts === // class Foo2 { -// get "42"() { return 0; } -// /*FIND ALL REFS*/set 42(n) { } +// get "[|42|]"() { return 0; } +// /*FIND ALL REFS*/set [|42|](n) { } // } // // var y: Foo2; -// y[42]; +// y[[|42|]]; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc index e458b9c5e7..343a4a0883 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/referencesForTypeKeywords.baseline.jsonc @@ -1,7 +1,7 @@ // === findAllReferences === // === /referencesForTypeKeywords.ts === -// interface I {} -// function f() {} +// interface [|I|] {} +// function f() {} // type A1 = T extends U ? 1 : 0; // type A2 = T extends infer U ? 1 : 0; // type A3 = { [P in keyof T]: 1 }; @@ -14,7 +14,7 @@ // === /referencesForTypeKeywords.ts === // interface I {} // function f() {} -// type A1 = T /*FIND ALL REFS*/extends U ? 1 : 0; +// type A1 = T /*FIND ALL REFS*/extends [|U|] ? 1 : 0; // type A2 = T extends infer U ? 1 : 0; // type A3 = { [P in keyof T]: 1 }; // type A4 = keyof T; @@ -27,7 +27,7 @@ // interface I {} // function f() {} // type A1 = T extends U ? 1 : 0; -// type A2 = T extends /*FIND ALL REFS*/[|infer|] U ? 1 : 0; +// type A2 = T extends /*FIND ALL REFS*/infer [|U|] ? 1 : 0; // type A3 = { [P in keyof T]: 1 }; // type A4 = keyof T; // type A5 = readonly T[]; @@ -40,7 +40,7 @@ // function f() {} // type A1 = T extends U ? 1 : 0; // type A2 = T extends infer U ? 1 : 0; -// type A3 = { [P /*FIND ALL REFS*/in keyof T]: 1 }; +// type A3 = { [[|P|] /*FIND ALL REFS*/in keyof T]: 1 }; // type A4 = keyof T; // type A5 = readonly T[]; @@ -52,8 +52,8 @@ // function f() {} // type A1 = T extends U ? 1 : 0; // type A2 = T extends infer U ? 1 : 0; -// type A3 = { [P in [|keyof|] T]: 1 }; -// type A4 = /*FIND ALL REFS*/[|keyof|] T; +// type A3 = { [P in keyof T]: 1 }; +// type A4<[|T|]> = /*FIND ALL REFS*/keyof [|T|]; // type A5 = readonly T[]; @@ -64,4 +64,4 @@ // type A2 = T extends infer U ? 1 : 0; // type A3 = { [P in keyof T]: 1 }; // type A4 = keyof T; -// type A5 = /*FIND ALL REFS*/[|readonly|] T[]; \ No newline at end of file +// type A5<[|T|]> = /*FIND ALL REFS*/readonly [|T|][]; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/remoteGetReferences.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/remoteGetReferences.baseline.jsonc index 2515a755e4..3858ed4b25 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/remoteGetReferences.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/remoteGetReferences.baseline.jsonc @@ -682,12 +682,71 @@ // === findAllReferences === +// === /remoteGetReferences_1.ts === +// --- (line: 85) skipped --- +// var remoteclsTest: remotefooCls; +// +// //Arguments +// remoteclsTest = new remotefooCls([|remoteglobalVar|]); +// remotefoo([|remoteglobalVar|]); +// +// //Increments +// remotefooCls.remoteclsSVar++; +// remotemodTest.remotemodVar++; +// [|remoteglobalVar|] = [|remoteglobalVar|] + [|remoteglobalVar|]; +// +// //ETC - Other cases +// [|remoteglobalVar|] = 3; +// +// //Find References misses method param +// var +// // --- (line: 102) skipped --- + // === /remoteGetReferences_2.ts === -// /*FIND ALL REFS*/var remoteglobalVar: number = 2; +// /*FIND ALL REFS*/var [|remoteglobalVar|]: number = 2; // // class remotefooCls { // //Declare -// // --- (line: 5) skipped --- +// remoteclsVar = 1; +// static remoteclsSVar = 1; +// +// constructor(public remoteclsParam: number) { +// //Increments +// [|remoteglobalVar|]++; +// this.remoteclsVar++; +// remotefooCls.remoteclsSVar++; +// this.remoteclsParam++; +// // --- (line: 14) skipped --- + +// --- (line: 20) skipped --- +// +// //Increments +// remotefooCls.remoteclsSVar++; +// [|remoteglobalVar|]++; +// remotemodTest.remotemodVar++; +// remotefnVar++; +// +// // --- (line: 28) skipped --- + +// --- (line: 33) skipped --- +// export var remotemodVar: number; +// +// //Increments +// [|remoteglobalVar|]++; +// remotefooCls.remoteclsSVar++; +// remotemodVar++; +// +// // --- (line: 41) skipped --- + +// --- (line: 45) skipped --- +// static remoteboo = remotefoo; +// +// //Increments +// [|remoteglobalVar|]++; +// remotefooCls.remoteclsSVar++; +// remotemodVar++; +// } +// // --- (line: 53) skipped --- @@ -761,14 +820,71 @@ // === findAllReferences === +// === /remoteGetReferences_1.ts === +// --- (line: 82) skipped --- +// +// //Remotes +// //Type test +// var remoteclsTest: [|remotefooCls|]; +// +// //Arguments +// remoteclsTest = new [|remotefooCls|](remoteglobalVar); +// remotefoo(remoteglobalVar); +// +// //Increments +// [|remotefooCls|].remoteclsSVar++; +// remotemodTest.remotemodVar++; +// remoteglobalVar = remoteglobalVar + remoteglobalVar; +// +// // --- (line: 97) skipped --- + // === /remoteGetReferences_2.ts === // var remoteglobalVar: number = 2; // -// /*FIND ALL REFS*/class remotefooCls { +// /*FIND ALL REFS*/class [|remotefooCls|] { // //Declare // remoteclsVar = 1; // static remoteclsSVar = 1; -// // --- (line: 7) skipped --- +// +// constructor(public remoteclsParam: number) { +// //Increments +// remoteglobalVar++; +// this.remoteclsVar++; +// [|remotefooCls|].remoteclsSVar++; +// this.remoteclsParam++; +// remotemodTest.remotemodVar++; +// } +// // --- (line: 16) skipped --- + +// --- (line: 19) skipped --- +// var remotefnVar = 1; +// +// //Increments +// [|remotefooCls|].remoteclsSVar++; +// remoteglobalVar++; +// remotemodTest.remotemodVar++; +// remotefnVar++; +// // --- (line: 27) skipped --- + +// --- (line: 34) skipped --- +// +// //Increments +// remoteglobalVar++; +// [|remotefooCls|].remoteclsSVar++; +// remotemodVar++; +// +// class remotetestCls { +// // --- (line: 42) skipped --- + +// --- (line: 46) skipped --- +// +// //Increments +// remoteglobalVar++; +// [|remotefooCls|].remoteclsSVar++; +// remotemodVar++; +// } +// +// // --- (line: 54) skipped --- @@ -862,17 +978,64 @@ // === findAllReferences === +// === /remoteGetReferences_1.ts === +// --- (line: 89) skipped --- +// remotefoo(remoteglobalVar); +// +// //Increments +// remotefooCls.[|remoteclsSVar|]++; +// remotemodTest.remotemodVar++; +// remoteglobalVar = remoteglobalVar + remoteglobalVar; +// +// // --- (line: 97) skipped --- + // === /remoteGetReferences_2.ts === // var remoteglobalVar: number = 2; // // class remotefooCls { // //Declare // remoteclsVar = 1; -// /*FIND ALL REFS*/static remoteclsSVar = 1; +// /*FIND ALL REFS*/static [|remoteclsSVar|] = 1; // // constructor(public remoteclsParam: number) { // //Increments -// // --- (line: 10) skipped --- +// remoteglobalVar++; +// this.remoteclsVar++; +// remotefooCls.[|remoteclsSVar|]++; +// this.remoteclsParam++; +// remotemodTest.remotemodVar++; +// } +// // --- (line: 16) skipped --- + +// --- (line: 19) skipped --- +// var remotefnVar = 1; +// +// //Increments +// remotefooCls.[|remoteclsSVar|]++; +// remoteglobalVar++; +// remotemodTest.remotemodVar++; +// remotefnVar++; +// // --- (line: 27) skipped --- + +// --- (line: 34) skipped --- +// +// //Increments +// remoteglobalVar++; +// remotefooCls.[|remoteclsSVar|]++; +// remotemodVar++; +// +// class remotetestCls { +// // --- (line: 42) skipped --- + +// --- (line: 46) skipped --- +// +// //Increments +// remoteglobalVar++; +// remotefooCls.[|remoteclsSVar|]++; +// remotemodVar++; +// } +// +// // --- (line: 54) skipped --- diff --git a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences4.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences4.baseline.jsonc index a65332382e..2fb055c836 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences4.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences4.baseline.jsonc @@ -4,11 +4,14 @@ // } // interface ElementAttributesProperty { props } // } -// /*FIND ALL REFS*/class MyClass { +// /*FIND ALL REFS*/class [|MyClass|] { // props: { // name?: string; // size?: number; -// // --- (line: 11) skipped --- +// } +// +// +// var x = <[|MyClass|] name='hello'>; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences5.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences5.baseline.jsonc index 8c15f502a3..c7fa566bf2 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences5.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences5.baseline.jsonc @@ -4,12 +4,12 @@ // propString: string // optional?: boolean // } -// /*FIND ALL REFS*/declare function Opt(attributes: OptionPropBag): JSX.Element; -// let opt = ; -// let opt1 = ; -// let opt2 = ; -// let opt3 = ; -// let opt4 = ; +// /*FIND ALL REFS*/declare function [|Opt|](attributes: OptionPropBag): JSX.Element; +// let opt = <[|Opt|] />; +// let opt1 = <[|Opt|] propx={100} propString />; +// let opt2 = <[|Opt|] propx={100} optional/>; +// let opt3 = <[|Opt|] wrong />; +// let opt4 = <[|Opt|] propx={100} propString="hi" />; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences8.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences8.baseline.jsonc index 4cce5cf782..dac2cf2682 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences8.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferences8.baseline.jsonc @@ -4,11 +4,15 @@ // interface LinkProps extends ClickableProps { // goTo: string; // } -// /*FIND ALL REFS*/declare function MainButton(buttonProps: ButtonProps): JSX.Element; -// declare function MainButton(linkProps: LinkProps): JSX.Element; -// declare function MainButton(props: ButtonProps | LinkProps): JSX.Element; -// let opt = ; -// // --- (line: 21) skipped --- +// /*FIND ALL REFS*/declare function [|MainButton|](buttonProps: ButtonProps): JSX.Element; +// declare function [|MainButton|](linkProps: LinkProps): JSX.Element; +// declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; @@ -32,15 +36,19 @@ // === findAllReferences === // === /file.tsx === -// --- (line: 14) skipped --- +// --- (line: 13) skipped --- +// interface LinkProps extends ClickableProps { // goTo: string; // } -// declare function MainButton(buttonProps: ButtonProps): JSX.Element; -// /*FIND ALL REFS*/declare function MainButton(linkProps: LinkProps): JSX.Element; -// declare function MainButton(props: ButtonProps | LinkProps): JSX.Element; -// let opt = ; -// let opt = ; -// // --- (line: 22) skipped --- +// declare function [|MainButton|](buttonProps: ButtonProps): JSX.Element; +// /*FIND ALL REFS*/declare function [|MainButton|](linkProps: LinkProps): JSX.Element; +// declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; @@ -64,15 +72,19 @@ // === findAllReferences === // === /file.tsx === -// --- (line: 15) skipped --- +// --- (line: 13) skipped --- +// interface LinkProps extends ClickableProps { +// goTo: string; // } -// declare function MainButton(buttonProps: ButtonProps): JSX.Element; -// declare function MainButton(linkProps: LinkProps): JSX.Element; -// /*FIND ALL REFS*/declare function MainButton(props: ButtonProps | LinkProps): JSX.Element; -// let opt = ; -// let opt = ; -// let opt = {}} />; -// // --- (line: 23) skipped --- +// declare function [|MainButton|](buttonProps: ButtonProps): JSX.Element; +// declare function [|MainButton|](linkProps: LinkProps): JSX.Element; +// /*FIND ALL REFS*/declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType1.baseline.jsonc index f93c9e0604..590e0bcf5c 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType1.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType1.baseline.jsonc @@ -4,8 +4,8 @@ // function SFC2(prop: { x: boolean }) { // return

World

; // } -// /*FIND ALL REFS*/var SFCComp = SFC1 || SFC2; -// +// /*FIND ALL REFS*/var [|SFCComp|] = SFC1 || SFC2; +// <[|SFCComp|] x={ "hi" } /> diff --git a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType2.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType2.baseline.jsonc index fa4cc25d78..b02df6df6e 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType2.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/tsxFindAllReferencesUnionElementType2.baseline.jsonc @@ -4,8 +4,8 @@ // } // private method() { } // } -// /*FIND ALL REFS*/var RCComp = RC1 || RC2; -// +// /*FIND ALL REFS*/var [|RCComp|] = RC1 || RC2; +// <[|RCComp|] /> From 30cbd102b372758990b8f22e08f9b9eec5767dce Mon Sep 17 00:00:00 2001 From: Twacqwq <69360546+Twacqwq@users.noreply.github.com> Date: Tue, 21 Oct 2025 02:40:52 +0800 Subject: [PATCH 009/152] Fix panic of empty string in type reference directive (#1908) --- internal/module/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/module/util.go b/internal/module/util.go index 7f6d093d05..04f75150f4 100644 --- a/internal/module/util.go +++ b/internal/module/util.go @@ -45,7 +45,7 @@ func ParsePackageName(moduleName string) (packageName, rest string) { } func MangleScopedPackageName(packageName string) string { - if packageName[0] == '@' { + if len(packageName) > 0 && packageName[0] == '@' { idx := strings.Index(packageName, "/") if idx == -1 { return packageName From 7ee8b4e44f88f92c5691683f4a0fb8c8c9bfdffd Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 20 Oct 2025 14:48:14 -0400 Subject: [PATCH 010/152] Consistently error on full circle of circular import aliases (#1904) --- internal/ast/symbol.go | 1 - internal/checker/checker.go | 23 +++++++-------- internal/testrunner/compiler_runner.go | 5 ---- .../compiler/circularModuleImports.errors.txt | 5 +++- .../circularModuleImports.errors.txt.diff | 23 +++++++++++++++ .../declarationEmitUnknownImport.errors.txt | 7 +++-- ...clarationEmitUnknownImport.errors.txt.diff | 22 ++++++++++++++ .../declarationEmitUnknownImport2.errors.txt | 7 +++-- ...larationEmitUnknownImport2.errors.txt.diff | 22 ++++++++++++++ .../exportAsNamespaceConflict.errors.txt | 5 +++- .../exportAsNamespaceConflict.errors.txt.diff | 16 ++++++++++ .../conformance/circular1.errors.txt | 5 +++- .../conformance/circular1.errors.txt.diff | 15 ++++++++++ .../conformance/circular3.errors.txt | 13 +++++++-- .../conformance/circular3.errors.txt.diff | 29 +++++++++++++++++++ 15 files changed, 170 insertions(+), 28 deletions(-) create mode 100644 testdata/baselines/reference/submodule/compiler/circularModuleImports.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/exportAsNamespaceConflict.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/circular1.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/circular3.errors.txt.diff diff --git a/internal/ast/symbol.go b/internal/ast/symbol.go index 926d9bd53a..56cfb2ba1b 100644 --- a/internal/ast/symbol.go +++ b/internal/ast/symbol.go @@ -43,7 +43,6 @@ const ( InternalSymbolNameClass = InternalSymbolNamePrefix + "class" // Unnamed class expression InternalSymbolNameFunction = InternalSymbolNamePrefix + "function" // Unnamed function expression InternalSymbolNameComputed = InternalSymbolNamePrefix + "computed" // Computed property name declaration with dynamic name - InternalSymbolNameResolving = InternalSymbolNamePrefix + "resolving" // Indicator symbol used to mark partially resolved type aliases InternalSymbolNameInstantiationExpression = InternalSymbolNamePrefix + "instantiationExpression" // Instantiation expressions InternalSymbolNameImportAttributes = InternalSymbolNamePrefix + "importAttributes" InternalSymbolNameExportEquals = "export=" // Export assignment symbol diff --git a/internal/checker/checker.go b/internal/checker/checker.go index ddf31c26ec..da46eb8d95 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -61,6 +61,7 @@ const ( TypeSystemPropertyNameResolvedBaseTypes TypeSystemPropertyNameWriteType TypeSystemPropertyNameInitializerIsUndefined + TypeSystemPropertyNameAliasTarget ) type TypeResolution struct { @@ -618,7 +619,6 @@ type Checker struct { argumentsSymbol *ast.Symbol requireSymbol *ast.Symbol unknownSymbol *ast.Symbol - resolvingSymbol *ast.Symbol unresolvedSymbols map[string]*ast.Symbol errorTypes map[string]*Type globalThisSymbol *ast.Symbol @@ -915,7 +915,6 @@ func NewChecker(program Program) *Checker { c.argumentsSymbol = c.newSymbol(ast.SymbolFlagsProperty, "arguments") c.requireSymbol = c.newSymbol(ast.SymbolFlagsProperty, "require") c.unknownSymbol = c.newSymbol(ast.SymbolFlagsProperty, "unknown") - c.resolvingSymbol = c.newSymbol(ast.SymbolFlagsNone, ast.InternalSymbolNameResolving) c.unresolvedSymbols = make(map[string]*ast.Symbol) c.errorTypes = make(map[string]*Type) c.globalThisSymbol = c.newSymbolEx(ast.SymbolFlagsModule, "globalThis", ast.CheckFlagsReadonly) @@ -15652,29 +15651,25 @@ func (c *Checker) resolveAlias(symbol *ast.Symbol) *ast.Symbol { } links := c.aliasSymbolLinks.Get(symbol) if links.aliasTarget == nil { - links.aliasTarget = c.resolvingSymbol + if !c.pushTypeResolution(symbol, TypeSystemPropertyNameAliasTarget) { + return c.unknownSymbol + } node := c.getDeclarationOfAliasSymbol(symbol) if node == nil { panic("Unexpected nil in resolveAlias for symbol: " + c.symbolToString(symbol)) } - target := c.getTargetOfAliasDeclaration(node, false /*dontRecursivelyResolve*/) - if links.aliasTarget == c.resolvingSymbol { - if target == nil { - target = c.unknownSymbol - } - links.aliasTarget = target - } else { + links.aliasTarget = core.OrElse(c.getTargetOfAliasDeclaration(node, false /*dontRecursivelyResolve*/), c.unknownSymbol) + if !c.popTypeResolution() { c.error(node, diagnostics.Circular_definition_of_import_alias_0, c.symbolToString(symbol)) + links.aliasTarget = c.unknownSymbol } - } else if links.aliasTarget == c.resolvingSymbol { - links.aliasTarget = c.unknownSymbol } return links.aliasTarget } func (c *Checker) tryResolveAlias(symbol *ast.Symbol) *ast.Symbol { links := c.aliasSymbolLinks.Get(symbol) - if links.aliasTarget != c.resolvingSymbol { + if links.aliasTarget != nil || c.findResolutionCycleStartIndex(symbol, TypeSystemPropertyNameAliasTarget) < 0 { return c.resolveAlias(symbol) } return nil @@ -18097,6 +18092,8 @@ func (c *Checker) typeResolutionHasProperty(r *TypeResolution) bool { return c.nodeLinks.Get(r.target.(*ast.Node)).flags&NodeCheckFlagsInitializerIsUndefinedComputed != 0 case TypeSystemPropertyNameWriteType: return c.valueSymbolLinks.Get(r.target.(*ast.Symbol)).writeType != nil + case TypeSystemPropertyNameAliasTarget: + return c.aliasSymbolLinks.Get(r.target.(*ast.Symbol)).aliasTarget != nil } panic("Unhandled case in typeResolutionHasProperty") } diff --git a/internal/testrunner/compiler_runner.go b/internal/testrunner/compiler_runner.go index 215cba9c8d..35eac30102 100644 --- a/internal/testrunner/compiler_runner.go +++ b/internal/testrunner/compiler_runner.go @@ -337,11 +337,6 @@ func newCompilerTest( } var concurrentSkippedErrorBaselines = map[string]string{ - "circular1.ts": "Circular error reported in an extra position.", - "circular3.ts": "Circular error reported in an extra position.", - "recursiveExportAssignmentAndFindAliasedType1.ts": "Circular error reported in an extra position.", - "recursiveExportAssignmentAndFindAliasedType2.ts": "Circular error reported in an extra position.", - "recursiveExportAssignmentAndFindAliasedType3.ts": "Circular error reported in an extra position.", "typeOnlyMerge2.ts": "Type-only merging is not detected when files are checked on different checkers.", "typeOnlyMerge3.ts": "Type-only merging is not detected when files are checked on different checkers.", } diff --git a/testdata/baselines/reference/submodule/compiler/circularModuleImports.errors.txt b/testdata/baselines/reference/submodule/compiler/circularModuleImports.errors.txt index d7fdcefcfd..2629296c6b 100644 --- a/testdata/baselines/reference/submodule/compiler/circularModuleImports.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/circularModuleImports.errors.txt @@ -1,7 +1,8 @@ circularModuleImports.ts(5,5): error TS2303: Circular definition of import alias 'A'. +circularModuleImports.ts(7,5): error TS2303: Circular definition of import alias 'B'. -==== circularModuleImports.ts (1 errors) ==== +==== circularModuleImports.ts (2 errors) ==== module M { @@ -11,6 +12,8 @@ circularModuleImports.ts(5,5): error TS2303: Circular definition of import alias !!! error TS2303: Circular definition of import alias 'A'. import B = A; + ~~~~~~~~~~~~~ +!!! error TS2303: Circular definition of import alias 'B'. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/circularModuleImports.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/circularModuleImports.errors.txt.diff new file mode 100644 index 0000000000..dd48f7b787 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/circularModuleImports.errors.txt.diff @@ -0,0 +1,23 @@ +--- old.circularModuleImports.errors.txt ++++ new.circularModuleImports.errors.txt +@@= skipped -0, +0 lines =@@ + circularModuleImports.ts(5,5): error TS2303: Circular definition of import alias 'A'. +- +- +-==== circularModuleImports.ts (1 errors) ==== ++circularModuleImports.ts(7,5): error TS2303: Circular definition of import alias 'B'. ++ ++ ++==== circularModuleImports.ts (2 errors) ==== + module M + + { +@@= skipped -10, +11 lines =@@ + !!! error TS2303: Circular definition of import alias 'A'. + + import B = A; ++ ~~~~~~~~~~~~~ ++!!! error TS2303: Circular definition of import alias 'B'. + + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport.errors.txt index ffde8f5e80..1826289e03 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport.errors.txt @@ -1,9 +1,10 @@ declarationEmitUnknownImport.ts(1,1): error TS2303: Circular definition of import alias 'Foo'. declarationEmitUnknownImport.ts(1,14): error TS2304: Cannot find name 'SomeNonExistingName'. declarationEmitUnknownImport.ts(1,14): error TS2503: Cannot find namespace 'SomeNonExistingName'. +declarationEmitUnknownImport.ts(2,9): error TS2303: Circular definition of import alias 'Foo'. -==== declarationEmitUnknownImport.ts (3 errors) ==== +==== declarationEmitUnknownImport.ts (4 errors) ==== import Foo = SomeNonExistingName ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2303: Circular definition of import alias 'Foo'. @@ -11,4 +12,6 @@ declarationEmitUnknownImport.ts(1,14): error TS2503: Cannot find namespace 'Some !!! error TS2304: Cannot find name 'SomeNonExistingName'. ~~~~~~~~~~~~~~~~~~~ !!! error TS2503: Cannot find namespace 'SomeNonExistingName'. - export {Foo} \ No newline at end of file + export {Foo} + ~~~ +!!! error TS2303: Circular definition of import alias 'Foo'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport.errors.txt.diff new file mode 100644 index 0000000000..486c3ff82d --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.declarationEmitUnknownImport.errors.txt ++++ new.declarationEmitUnknownImport.errors.txt +@@= skipped -0, +0 lines =@@ + declarationEmitUnknownImport.ts(1,1): error TS2303: Circular definition of import alias 'Foo'. + declarationEmitUnknownImport.ts(1,14): error TS2304: Cannot find name 'SomeNonExistingName'. + declarationEmitUnknownImport.ts(1,14): error TS2503: Cannot find namespace 'SomeNonExistingName'. +- +- +-==== declarationEmitUnknownImport.ts (3 errors) ==== ++declarationEmitUnknownImport.ts(2,9): error TS2303: Circular definition of import alias 'Foo'. ++ ++ ++==== declarationEmitUnknownImport.ts (4 errors) ==== + import Foo = SomeNonExistingName + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS2303: Circular definition of import alias 'Foo'. +@@= skipped -11, +12 lines =@@ + ~~~~~~~~~~~~~~~~~~~ + !!! error TS2503: Cannot find namespace 'SomeNonExistingName'. + export {Foo} ++ ~~~ ++!!! error TS2303: Circular definition of import alias 'Foo'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport2.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport2.errors.txt index 37d7841f4b..f52b6fd9af 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport2.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport2.errors.txt @@ -3,9 +3,10 @@ declarationEmitUnknownImport2.ts(1,12): error TS1005: '=' expected. declarationEmitUnknownImport2.ts(1,12): error TS2304: Cannot find name 'From'. declarationEmitUnknownImport2.ts(1,12): error TS2503: Cannot find namespace 'From'. declarationEmitUnknownImport2.ts(1,17): error TS1005: ';' expected. +declarationEmitUnknownImport2.ts(2,1): error TS2303: Circular definition of import alias 'Foo'. -==== declarationEmitUnknownImport2.ts (5 errors) ==== +==== declarationEmitUnknownImport2.ts (6 errors) ==== import Foo From './Foo'; // Syntax error ~~~~~~~~~~~~~~~ !!! error TS2303: Circular definition of import alias 'Foo'. @@ -17,4 +18,6 @@ declarationEmitUnknownImport2.ts(1,17): error TS1005: ';' expected. !!! error TS2503: Cannot find namespace 'From'. ~~~~~~~ !!! error TS1005: ';' expected. - export default Foo \ No newline at end of file + export default Foo + ~~~~~~~~~~~~~~~~~~ +!!! error TS2303: Circular definition of import alias 'Foo'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport2.errors.txt.diff new file mode 100644 index 0000000000..00d4874583 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUnknownImport2.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.declarationEmitUnknownImport2.errors.txt ++++ new.declarationEmitUnknownImport2.errors.txt +@@= skipped -2, +2 lines =@@ + declarationEmitUnknownImport2.ts(1,12): error TS2304: Cannot find name 'From'. + declarationEmitUnknownImport2.ts(1,12): error TS2503: Cannot find namespace 'From'. + declarationEmitUnknownImport2.ts(1,17): error TS1005: ';' expected. +- +- +-==== declarationEmitUnknownImport2.ts (5 errors) ==== ++declarationEmitUnknownImport2.ts(2,1): error TS2303: Circular definition of import alias 'Foo'. ++ ++ ++==== declarationEmitUnknownImport2.ts (6 errors) ==== + import Foo From './Foo'; // Syntax error + ~~~~~~~~~~~~~~~ + !!! error TS2303: Circular definition of import alias 'Foo'. +@@= skipped -15, +16 lines =@@ + ~~~~~~~ + !!! error TS1005: ';' expected. + export default Foo ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2303: Circular definition of import alias 'Foo'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportAsNamespaceConflict.errors.txt b/testdata/baselines/reference/submodule/compiler/exportAsNamespaceConflict.errors.txt index 4b08c73606..0008df30a8 100644 --- a/testdata/baselines/reference/submodule/compiler/exportAsNamespaceConflict.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/exportAsNamespaceConflict.errors.txt @@ -1,9 +1,12 @@ +/a.d.ts(2,1): error TS2303: Circular definition of import alias 'N'. /a.d.ts(3,1): error TS2303: Circular definition of import alias 'N'. -==== /a.d.ts (1 errors) ==== +==== /a.d.ts (2 errors) ==== declare global { namespace N {} } export = N; + ~~~~~~~~~~~ +!!! error TS2303: Circular definition of import alias 'N'. export as namespace N; ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2303: Circular definition of import alias 'N'. diff --git a/testdata/baselines/reference/submodule/compiler/exportAsNamespaceConflict.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/exportAsNamespaceConflict.errors.txt.diff new file mode 100644 index 0000000000..78e304bf69 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/exportAsNamespaceConflict.errors.txt.diff @@ -0,0 +1,16 @@ +--- old.exportAsNamespaceConflict.errors.txt ++++ new.exportAsNamespaceConflict.errors.txt +@@= skipped -0, +0 lines =@@ ++/a.d.ts(2,1): error TS2303: Circular definition of import alias 'N'. + /a.d.ts(3,1): error TS2303: Circular definition of import alias 'N'. + + +-==== /a.d.ts (1 errors) ==== ++==== /a.d.ts (2 errors) ==== + declare global { namespace N {} } + export = N; ++ ~~~~~~~~~~~ ++!!! error TS2303: Circular definition of import alias 'N'. + export as namespace N; + ~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS2303: Circular definition of import alias 'N'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/circular1.errors.txt b/testdata/baselines/reference/submodule/conformance/circular1.errors.txt index eb583371b3..fe5a13637d 100644 --- a/testdata/baselines/reference/submodule/conformance/circular1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/circular1.errors.txt @@ -1,8 +1,11 @@ +/a.ts(1,15): error TS2303: Circular definition of import alias 'A'. /b.ts(1,15): error TS2303: Circular definition of import alias 'A'. -==== /a.ts (0 errors) ==== +==== /a.ts (1 errors) ==== export type { A } from './b'; + ~ +!!! error TS2303: Circular definition of import alias 'A'. ==== /b.ts (1 errors) ==== export type { A } from './a'; diff --git a/testdata/baselines/reference/submodule/conformance/circular1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/circular1.errors.txt.diff new file mode 100644 index 0000000000..6927a68e06 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/circular1.errors.txt.diff @@ -0,0 +1,15 @@ +--- old.circular1.errors.txt ++++ new.circular1.errors.txt +@@= skipped -0, +0 lines =@@ ++/a.ts(1,15): error TS2303: Circular definition of import alias 'A'. + /b.ts(1,15): error TS2303: Circular definition of import alias 'A'. + + +-==== /a.ts (0 errors) ==== ++==== /a.ts (1 errors) ==== + export type { A } from './b'; ++ ~ ++!!! error TS2303: Circular definition of import alias 'A'. + + ==== /b.ts (1 errors) ==== + export type { A } from './a'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/circular3.errors.txt b/testdata/baselines/reference/submodule/conformance/circular3.errors.txt index 5da3e36406..0c72601d6c 100644 --- a/testdata/baselines/reference/submodule/conformance/circular3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/circular3.errors.txt @@ -1,13 +1,22 @@ +/a.ts(1,15): error TS2303: Circular definition of import alias 'A'. +/a.ts(2,15): error TS2303: Circular definition of import alias 'B'. /b.ts(1,15): error TS2303: Circular definition of import alias 'B'. +/b.ts(2,15): error TS2303: Circular definition of import alias 'A'. -==== /a.ts (0 errors) ==== +==== /a.ts (2 errors) ==== import type { A } from './b'; + ~ +!!! error TS2303: Circular definition of import alias 'A'. export type { A as B }; + ~~~~~~ +!!! error TS2303: Circular definition of import alias 'B'. -==== /b.ts (1 errors) ==== +==== /b.ts (2 errors) ==== import type { B } from './a'; ~ !!! error TS2303: Circular definition of import alias 'B'. export type { B as A }; + ~~~~~~ +!!! error TS2303: Circular definition of import alias 'A'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/circular3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/circular3.errors.txt.diff new file mode 100644 index 0000000000..c217af658d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/circular3.errors.txt.diff @@ -0,0 +1,29 @@ +--- old.circular3.errors.txt ++++ new.circular3.errors.txt +@@= skipped -0, +0 lines =@@ ++/a.ts(1,15): error TS2303: Circular definition of import alias 'A'. ++/a.ts(2,15): error TS2303: Circular definition of import alias 'B'. + /b.ts(1,15): error TS2303: Circular definition of import alias 'B'. +- +- +-==== /a.ts (0 errors) ==== ++/b.ts(2,15): error TS2303: Circular definition of import alias 'A'. ++ ++ ++==== /a.ts (2 errors) ==== + import type { A } from './b'; ++ ~ ++!!! error TS2303: Circular definition of import alias 'A'. + export type { A as B }; ++ ~~~~~~ ++!!! error TS2303: Circular definition of import alias 'B'. + +-==== /b.ts (1 errors) ==== ++==== /b.ts (2 errors) ==== + import type { B } from './a'; + ~ + !!! error TS2303: Circular definition of import alias 'B'. + export type { B as A }; ++ ~~~~~~ ++!!! error TS2303: Circular definition of import alias 'A'. + \ No newline at end of file From da8e4e0fc03bcd4a60d2972ed4a9ea7180796906 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Oct 2025 22:02:57 +0000 Subject: [PATCH 011/152] Fix panic in textDocument/onTypeFormatting when tokenAtPosition is nil (#1845) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- internal/ls/format.go | 3 +- internal/ls/format_test.go | 72 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 internal/ls/format_test.go diff --git a/internal/ls/format.go b/internal/ls/format.go index 548c766741..9e0f55cf19 100644 --- a/internal/ls/format.go +++ b/internal/ls/format.go @@ -113,7 +113,8 @@ func (l *LanguageService) getFormattingEditsAfterKeystroke( ) []core.TextChange { ctx = format.WithFormatCodeSettings(ctx, options, options.NewLineCharacter) - if isInComment(file, position, nil) == nil { + tokenAtPosition := astnav.GetTokenAtPosition(file, position) + if isInComment(file, position, tokenAtPosition) == nil { switch key { case "{": return format.FormatOnOpeningCurly(ctx, file, position) diff --git a/internal/ls/format_test.go b/internal/ls/format_test.go new file mode 100644 index 0000000000..b1f21d8fff --- /dev/null +++ b/internal/ls/format_test.go @@ -0,0 +1,72 @@ +package ls + +import ( + "context" + "testing" + + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/format" + "github.com/microsoft/typescript-go/internal/parser" +) + +// Test for issue: Panic Handling textDocument/onTypeFormatting +// This reproduces the panic when pressing enter in an empty file +func TestGetFormattingEditsAfterKeystroke_EmptyFile(t *testing.T) { + t.Parallel() + // Create an empty file + text := "" + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/index.ts", + Path: "/index.ts", + }, text, core.ScriptKindTS) + + // Create language service with nil program (we're only testing the formatting function) + langService := &LanguageService{} + + // Test formatting after keystroke with newline character at position 0 + ctx := context.Background() + options := format.GetDefaultFormatCodeSettings("\n") + + // This should not panic + edits := langService.getFormattingEditsAfterKeystroke( + ctx, + sourceFile, + options, + 0, // position + "\n", + ) + + // Should return nil or empty edits, not panic + _ = edits +} + +// Test with a simple statement +func TestGetFormattingEditsAfterKeystroke_SimpleStatement(t *testing.T) { + t.Parallel() + // Create a file with a simple statement + text := "const x = 1" + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/index.ts", + Path: "/index.ts", + }, text, core.ScriptKindTS) + + // Create language service with nil program + langService := &LanguageService{} + + // Test formatting after keystroke with newline character at end of statement + ctx := context.Background() + options := format.GetDefaultFormatCodeSettings("\n") + + // This should not panic + edits := langService.getFormattingEditsAfterKeystroke( + ctx, + sourceFile, + options, + len(text), // position at end of file + "\n", + ) + + // Should return nil or empty edits, not panic + _ = edits +} From fe0cafa1d1eaab50cbf7f132ceb27b005eba5dc9 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 20 Oct 2025 15:23:47 -0700 Subject: [PATCH 012/152] Update submodule (#1913) --- _submodules/TypeScript | 2 +- internal/diagnostics/diagnostics_generated.go | 2 +- internal/fourslash/_scripts/failingTests.txt | 1 - ...rs_StaticWhenBaseTypeIsNotResolved_test.go | 20 +---- ...orStringLiteralNonrelativeImport16_test.go | 1 + ...mpletionsImport_umdDefaultNoCrash2_test.go | 2 +- ...JsonModuleWithoutResolveJsonModule_test.go | 2 +- .../gen/completionsPathsJsonModule_test.go | 2 +- ...completionsPathsRelativeJsonModule_test.go | 2 +- .../gen/completionsPaths_importType_test.go | 2 +- .../gen/completionsWithDeprecatedTag9_test.go | 54 -------------- ...EqualNamespaceClassESModuleInterop_test.go | 2 +- ...encesBindingPatternInJsdocNoCrash1_test.go | 2 +- ...encesBindingPatternInJsdocNoCrash2_test.go | 2 +- ...hCompletionsTypesVersionsWildcard2_test.go | 1 + ...hCompletionsTypesVersionsWildcard3_test.go | 1 + ...hCompletionsTypesVersionsWildcard4_test.go | 1 + .../es6ExportEqualsInterop.errors.txt.diff | 74 ------------------- .../es6ExportEqualsInterop.types.diff | 43 ----------- ...6ImportDefaultBindingInEs5.errors.txt.diff | 16 ---- .../es6ImportDefaultBindingInEs5.types.diff | 8 -- ...xportEqualsDefaultProperty.errors.txt.diff | 21 ------ .../exportEqualsDefaultProperty.symbols.diff | 9 --- .../exportEqualsDefaultProperty.types.diff | 19 ----- .../jsxClassAttributeResolution.errors.txt | 2 +- .../compiler/jsxClassAttributeResolution.js | 2 +- .../moduleElementsInWrongContext.types.diff | 11 --- ...solutionWithSuffixes_empty.errors.txt.diff | 22 ++++++ ...nWithSuffixes_notSpecified.errors.txt.diff | 21 ++++++ ...ResolutionWithSuffixes_one.errors.txt.diff | 25 +++++++ ...utionWithSuffixes_oneBlank.errors.txt.diff | 23 ++++++ ...onWithSuffixes_oneNotFound.errors.txt.diff | 17 +++++ ...xes_one_dirModuleWithIndex.errors.txt.diff | 24 ++++++ ...uffixes_one_externalModule.errors.txt.diff | 39 ++++++++++ ...xes_one_externalModulePath.errors.txt.diff | 39 ++++++++++ ...fixes_one_externalTSModule.errors.txt.diff | 26 +++++++ ...ithSuffixes_one_jsonModule.errors.txt.diff | 33 +++++++++ ...Suffixes_threeLastIsBlank1.errors.txt.diff | 27 +++++++ ...Suffixes_threeLastIsBlank2.errors.txt.diff | 25 +++++++ ...Suffixes_threeLastIsBlank3.errors.txt.diff | 23 ++++++ ...Suffixes_threeLastIsBlank4.errors.txt.diff | 17 +++++ .../module_augmentUninstantiatedModule2.js | 42 ++++++++++- ...odule_augmentUninstantiatedModule2.js.diff | 10 +++ ...odule_augmentUninstantiatedModule2.symbols | 51 ++++++++++--- .../module_augmentUninstantiatedModule2.types | 32 +++++++- ...le_augmentUninstantiatedModule2.types.diff | 18 ----- .../reexportMissingDefault4.errors.txt.diff | 16 ---- .../reexportMissingDefault4.types.diff | 8 -- ...duleNodeResolutionEmitNone.errors.txt.diff | 2 + ...leWithoutResolveJsonModule.errors.txt.diff | 62 +++++++--------- ...OfJsonFileWithoutResolveJsonModule.js.diff | 7 +- ...nFileWithoutResolveJsonModule.symbols.diff | 12 --- ...sonFileWithoutResolveJsonModule.types.diff | 47 ------------ ...(moduleresolution=bundler).errors.txt.diff | 16 ---- ...Field2(moduleresolution=node10).errors.txt | 25 ------- ...kageJsonField2(moduleresolution=node10).js | 21 ------ ...sonField2(moduleresolution=node10).symbols | 17 ----- ...eJsonField2(moduleresolution=node10).types | 18 ----- ...CandidateFromPackageJsonField2.errors.txt} | 0 ...solutionCandidateFromPackageJsonField2.js} | 0 ...ionCandidateFromPackageJsonField2.symbols} | 0 ...utionCandidateFromPackageJsonField2.types} | 0 ...ngExports(module=commonjs).errors.txt.diff | 21 ------ ...(moduleresolution=bundler).errors.txt.diff | 11 --- ...nsions(moduleresolution=node10).errors.txt | 32 -------- .../conformance/bundlerCommonJS.errors.txt | 35 +++++++++ .../submodule/conformance/bundlerCommonJS.js | 45 +++++++++++ .../conformance/bundlerCommonJS.js.diff | 17 +++++ .../conformance/bundlerCommonJS.trace.json | 55 ++++++++++++++ ...,moduleresolution=bundler).errors.txt.diff | 4 +- ...,moduleresolution=bundler).errors.txt.diff | 4 +- ...,moduleresolution=bundler).errors.txt.diff | 4 +- .../bundlerOptionsCompat.errors.txt | 16 ++++ .../bundlerOptionsCompat.errors.txt.diff | 30 ++++---- ...ingPriority(moduleresolution=node).symbols | 25 ------- ...adingPriority(moduleresolution=node).types | 25 ------- ...CallExpressionInExportEqualsCJS.types.diff | 15 ---- ...cifierGenerationConditions.errors.txt.diff | 39 ---------- ...portsSpecifierGenerationConditions.js.diff | 7 +- ...tsSpecifierGenerationConditions.types.diff | 14 ---- ...(moduleresolution=bundler).errors.txt.diff | 32 -------- .../node10IsNode_node.errors.txt.diff | 28 +++++++ .../node10IsNode_node10.types.diff | 12 --- ...(moduleresolution=bundler).errors.txt.diff | 10 --- ...pat(moduleresolution=node).errors.txt.diff | 2 + ...1(moduleresolution=node10).errors.txt.diff | 46 ------------ ...portType1(moduleresolution=node10).symbols | 36 --------- ...ype1(moduleresolution=node10).symbols.diff | 10 --- ...ImportType1(moduleresolution=node10).types | 37 ---------- ...tType1(moduleresolution=node10).types.diff | 11 --- ...resolutionModeTripleSlash4.errors.txt.diff | 12 ++- ...resolutionModeTripleSlash5.errors.txt.diff | 18 +++++ ...1(moduleresolution=node10).errors.txt.diff | 60 --------------- ...ypeOnlyImport1(moduleresolution=node10).js | 62 ---------------- ...lyImport1(moduleresolution=node10).symbols | 73 ------------------ ...ort1(moduleresolution=node10).symbols.diff | 15 ---- ...OnlyImport1(moduleresolution=node10).types | 74 ------------------- ...mport1(moduleresolution=node10).types.diff | 22 ------ .../untypedModuleImport_allowJs.symbols.diff | 9 ++- ...ESM(esmoduleinterop=false).errors.txt.diff | 25 ------- ...tionsESM(esmoduleinterop=false).types.diff | 11 --- ...rmatEmit1(module=commonjs).errors.txt.diff | 41 ---------- ...rmatEmit2(module=commonjs).errors.txt.diff | 44 ----------- ...rmatEmit3(module=commonjs).errors.txt.diff | 46 ------------ ...rmatEmit4(module=commonjs).errors.txt.diff | 46 ------------ ...riptImportDefaultBadExport.errors.txt.diff | 17 ----- ...avascriptImportDefaultBadExport.types.diff | 5 -- ...onWithExtensions_withPaths.errors.txt.diff | 61 +++++---------- ...e_externalModule_withPaths.errors.txt.diff | 58 ++++++--------- ...nWithSuffixes_one_jsModule.errors.txt.diff | 34 +++++++++ ...(moduleresolution=bundler).errors.txt.diff | 24 ------ ...Priority(moduleresolution=node).types.diff | 8 -- ...ternateResult_noResolution.errors.txt.diff | 12 ++- ...e10Alternateresult_noTypes.errors.txt.diff | 4 +- ...ntypedModuleImport_allowJs.errors.txt.diff | 16 ++++ .../untypedModuleImport_allowJs.types.diff | 21 ++++++ 116 files changed, 906 insertions(+), 1604 deletions(-) delete mode 100644 internal/fourslash/tests/gen/completionsWithDeprecatedTag9_test.go delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.types.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingInEs5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingInEs5.types.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.types.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleElementsInWrongContext.types.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_empty.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_notSpecified.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_oneBlank.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_oneNotFound.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_dirModuleWithIndex.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalModule.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalModulePath.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalTSModule.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_jsonModule.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank1.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank2.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank3.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank4.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.types.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reexportMissingDefault4.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reexportMissingDefault4.types.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.types.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).js delete mode 100644 testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).symbols delete mode 100644 testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).types rename testdata/baselines/reference/submodule/compiler/{resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt => resolutionCandidateFromPackageJsonField2.errors.txt} (100%) rename testdata/baselines/reference/submodule/compiler/{resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).js => resolutionCandidateFromPackageJsonField2.js} (100%) rename testdata/baselines/reference/submodule/compiler/{resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).symbols => resolutionCandidateFromPackageJsonField2.symbols} (100%) rename testdata/baselines/reference/submodule/compiler/{resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).types => resolutionCandidateFromPackageJsonField2.types} (100%) delete mode 100644 testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=commonjs).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/allowImportingTsExtensions(moduleresolution=bundler).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/allowImportingTsExtensions(moduleresolution=node10).errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/bundlerCommonJS.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/bundlerCommonJS.js create mode 100644 testdata/baselines/reference/submodule/conformance/bundlerCommonJS.js.diff create mode 100644 testdata/baselines/reference/submodule/conformance/bundlerCommonJS.trace.json create mode 100644 testdata/baselines/reference/submodule/conformance/bundlerOptionsCompat.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/extensionLoadingPriority(moduleresolution=node).symbols delete mode 100644 testdata/baselines/reference/submodule/conformance/extensionLoadingPriority(moduleresolution=node).types delete mode 100644 testdata/baselines/reference/submodule/conformance/importCallExpressionInExportEqualsCJS.types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nestedPackageJsonRedirect(moduleresolution=bundler).errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/node10IsNode_node.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/node10IsNode_node10.types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/packageJsonImportsExportsOptionCompat(moduleresolution=bundler).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).symbols delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).types delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).types.diff create mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).symbols delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).types delete mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit1(module=commonjs).errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit2(module=commonjs).errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit3(module=commonjs).errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit4(module=commonjs).errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_jsModule.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/extensionLoadingPriority(moduleresolution=bundler).errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/extensionLoadingPriority(moduleresolution=node).types.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff diff --git a/_submodules/TypeScript b/_submodules/TypeScript index 1ee9e0d9a2..050a6f8127 160000 --- a/_submodules/TypeScript +++ b/_submodules/TypeScript @@ -1 +1 @@ -Subproject commit 1ee9e0d9a24b629da3a8cae2748616af1dc8fc0c +Subproject commit 050a6f8127f54ce64c79ee992b9f0e27d0d712a2 diff --git a/internal/diagnostics/diagnostics_generated.go b/internal/diagnostics/diagnostics_generated.go index 5c32430d2b..c40232cb15 100644 --- a/internal/diagnostics/diagnostics_generated.go +++ b/internal/diagnostics/diagnostics_generated.go @@ -2326,7 +2326,7 @@ var Compiler_option_0_may_only_be_used_with_build = &Message{code: 5093, categor var Compiler_option_0_may_not_be_used_with_build = &Message{code: 5094, category: CategoryError, key: "Compiler_option_0_may_not_be_used_with_build_5094", text: "Compiler option '--{0}' may not be used with '--build'."} -var Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later = &Message{code: 5095, category: CategoryError, key: "Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095", text: "Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later."} +var Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later = &Message{code: 5095, category: CategoryError, key: "Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095", text: "Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later."} var Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set = &Message{code: 5096, category: CategoryError, key: "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", text: "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."} diff --git a/internal/fourslash/_scripts/failingTests.txt b/internal/fourslash/_scripts/failingTests.txt index 3aef9a7a9f..1db2b09ce7 100644 --- a/internal/fourslash/_scripts/failingTests.txt +++ b/internal/fourslash/_scripts/failingTests.txt @@ -16,7 +16,6 @@ TestCompletionEntryClassMembersWithInferredFunctionReturnType1 TestCompletionEntryForArgumentConstrainedToString TestCompletionEntryForArrayElementConstrainedToString TestCompletionEntryForArrayElementConstrainedToString2 -TestCompletionEntryForClassMembers_StaticWhenBaseTypeIsNotResolved TestCompletionEntryForUnionProperty TestCompletionEntryForUnionProperty2 TestCompletionForComputedStringProperties diff --git a/internal/fourslash/tests/gen/completionEntryForClassMembers_StaticWhenBaseTypeIsNotResolved_test.go b/internal/fourslash/tests/gen/completionEntryForClassMembers_StaticWhenBaseTypeIsNotResolved_test.go index 3f67b274df..3f78988212 100644 --- a/internal/fourslash/tests/gen/completionEntryForClassMembers_StaticWhenBaseTypeIsNotResolved_test.go +++ b/internal/fourslash/tests/gen/completionEntryForClassMembers_StaticWhenBaseTypeIsNotResolved_test.go @@ -10,25 +10,9 @@ import ( func TestCompletionEntryForClassMembers_StaticWhenBaseTypeIsNotResolved(t *testing.T) { t.Parallel() - t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @Filename: /node_modules/@types/react/index.d.ts -export = React; -export as namespace React; -declare namespace React { - function createElement(): any; - interface Component

{ } - class Component { - static contextType?: any; - context: any; - constructor(props: Readonly

); - setState( - state: ((prevState: Readonly, props: Readonly

) => (Pick | S | null)) | (Pick | S | null), - callback?: () => void - ): void; - } -} -// @Filename: /a.ts + const content = `// @Filename: /a.ts import React from 'react' class Slider extends React.Component { static defau/**/ltProps = { diff --git a/internal/fourslash/tests/gen/completionForStringLiteralNonrelativeImport16_test.go b/internal/fourslash/tests/gen/completionForStringLiteralNonrelativeImport16_test.go index be55991de2..a269f1a909 100644 --- a/internal/fourslash/tests/gen/completionForStringLiteralNonrelativeImport16_test.go +++ b/internal/fourslash/tests/gen/completionForStringLiteralNonrelativeImport16_test.go @@ -16,6 +16,7 @@ func TestCompletionForStringLiteralNonrelativeImport16(t *testing.T) { const content = `// @Filename: tsconfig.json { "compilerOptions": { + "resolveJsonModule": false, "baseUrl": "./", "paths": { "module1/path1": ["some/path/whatever.ts"], diff --git a/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash2_test.go b/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash2_test.go index 57ecd5cb67..64dc8a4459 100644 --- a/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash2_test.go +++ b/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash2_test.go @@ -13,7 +13,7 @@ func TestCompletionsImport_umdDefaultNoCrash2(t *testing.T) { t.Parallel() defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @moduleResolution: node + const content = `// @moduleResolution: bundler // @allowJs: true // @checkJs: true // @Filename: /node_modules/dottie/package.json diff --git a/internal/fourslash/tests/gen/completionsPathsJsonModuleWithoutResolveJsonModule_test.go b/internal/fourslash/tests/gen/completionsPathsJsonModuleWithoutResolveJsonModule_test.go index a66a4523b6..0da18ee5e1 100644 --- a/internal/fourslash/tests/gen/completionsPathsJsonModuleWithoutResolveJsonModule_test.go +++ b/internal/fourslash/tests/gen/completionsPathsJsonModuleWithoutResolveJsonModule_test.go @@ -12,7 +12,7 @@ func TestCompletionsPathsJsonModuleWithoutResolveJsonModule(t *testing.T) { t.Parallel() defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @moduleResolution: node + const content = `// @resolveJsonModule: false // @Filename: /project/test.json not read // @Filename: /project/index.ts diff --git a/internal/fourslash/tests/gen/completionsPathsJsonModule_test.go b/internal/fourslash/tests/gen/completionsPathsJsonModule_test.go index b713e79f35..bf86ca473b 100644 --- a/internal/fourslash/tests/gen/completionsPathsJsonModule_test.go +++ b/internal/fourslash/tests/gen/completionsPathsJsonModule_test.go @@ -13,7 +13,7 @@ func TestCompletionsPathsJsonModule(t *testing.T) { t.Parallel() t.Skip() defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @moduleResolution: node + const content = `// @moduleResolution: bundler // @resolveJsonModule: true // @Filename: /project/node_modules/test.json not read diff --git a/internal/fourslash/tests/gen/completionsPathsRelativeJsonModule_test.go b/internal/fourslash/tests/gen/completionsPathsRelativeJsonModule_test.go index 98803f175d..48d174cad0 100644 --- a/internal/fourslash/tests/gen/completionsPathsRelativeJsonModule_test.go +++ b/internal/fourslash/tests/gen/completionsPathsRelativeJsonModule_test.go @@ -13,7 +13,7 @@ func TestCompletionsPathsRelativeJsonModule(t *testing.T) { t.Parallel() t.Skip() defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @moduleResolution: node + const content = `// @moduleResolution: bundler // @resolveJsonModule: true // @Filename: /project/test.json not read diff --git a/internal/fourslash/tests/gen/completionsPaths_importType_test.go b/internal/fourslash/tests/gen/completionsPaths_importType_test.go index 3caae8585e..a0b677054e 100644 --- a/internal/fourslash/tests/gen/completionsPaths_importType_test.go +++ b/internal/fourslash/tests/gen/completionsPaths_importType_test.go @@ -14,7 +14,7 @@ func TestCompletionsPaths_importType(t *testing.T) { t.Skip() defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @allowJs: true -// @moduleResolution: node +// @moduleResolution: bundler // @Filename: /ns.ts file content not read // @Filename: /node_modules/package/index.ts diff --git a/internal/fourslash/tests/gen/completionsWithDeprecatedTag9_test.go b/internal/fourslash/tests/gen/completionsWithDeprecatedTag9_test.go deleted file mode 100644 index 3f86d91582..0000000000 --- a/internal/fourslash/tests/gen/completionsWithDeprecatedTag9_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package fourslash_test - -import ( - "testing" - - "github.com/microsoft/typescript-go/internal/fourslash" - . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" - "github.com/microsoft/typescript-go/internal/ls" - "github.com/microsoft/typescript-go/internal/lsp/lsproto" - "github.com/microsoft/typescript-go/internal/testutil" -) - -func TestCompletionsWithDeprecatedTag9(t *testing.T) { - t.Parallel() - - defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @lib: dom -// @allowJs: true -// @Filename: globals.d.ts -/** @deprecated foo */ -declare var foo: string; -// @Filename: index.ts -class Foo { - foo: number; - m() { - foo/**/ - } -}` - f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ - IsIncomplete: false, - ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ - CommitCharacters: &DefaultCommitCharacters, - EditRange: Ignored, - }, - Items: &fourslash.CompletionsExpectedItems{ - Includes: []fourslash.CompletionsExpectedItem{ - &lsproto.CompletionItem{ - Label: "foo", - Kind: PtrTo(lsproto.CompletionItemKindVariable), - SortText: PtrTo(string(ls.DeprecateSortText(ls.SortTextGlobalsOrKeywords))), - }, - }, - }, - }) - f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ - IsIncomplete: false, - ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ - CommitCharacters: &DefaultCommitCharacters, - EditRange: Ignored, - }, - Items: &fourslash.CompletionsExpectedItems{}, - }) -} diff --git a/internal/fourslash/tests/gen/exportEqualNamespaceClassESModuleInterop_test.go b/internal/fourslash/tests/gen/exportEqualNamespaceClassESModuleInterop_test.go index 32f1db0ff0..b610460f44 100644 --- a/internal/fourslash/tests/gen/exportEqualNamespaceClassESModuleInterop_test.go +++ b/internal/fourslash/tests/gen/exportEqualNamespaceClassESModuleInterop_test.go @@ -13,7 +13,7 @@ func TestExportEqualNamespaceClassESModuleInterop(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @esModuleInterop: true -// @moduleResolution: node +// @moduleResolution: bundler // @target: es2015 // @module: esnext // @Filename: /node_modules/@bar/foo/index.d.ts diff --git a/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash1_test.go b/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash1_test.go index b219b100e5..d12c4f724b 100644 --- a/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash1_test.go +++ b/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash1_test.go @@ -11,7 +11,7 @@ func TestFindReferencesBindingPatternInJsdocNoCrash1(t *testing.T) { t.Parallel() t.Skip() defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @moduleResolution: node + const content = `// @moduleResolution: bundler // @Filename: node_modules/use-query/package.json { "name": "use-query", diff --git a/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash2_test.go b/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash2_test.go index 1fcafea499..94b4584713 100644 --- a/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash2_test.go +++ b/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash2_test.go @@ -11,7 +11,7 @@ func TestFindReferencesBindingPatternInJsdocNoCrash2(t *testing.T) { t.Parallel() t.Skip() defer testutil.RecoverAndFail(t, "Panic on fourslash test") - const content = `// @moduleResolution: node + const content = `// @moduleResolution: bundler // @Filename: node_modules/use-query/package.json { "name": "use-query", diff --git a/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard2_test.go b/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard2_test.go index 558efd2c05..7f60525520 100644 --- a/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard2_test.go +++ b/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard2_test.go @@ -13,6 +13,7 @@ func TestPathCompletionsTypesVersionsWildcard2(t *testing.T) { t.Skip() defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @module: commonjs +// @resolveJsonModule: false // @Filename: /node_modules/foo/package.json { "types": "index.d.ts", diff --git a/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard3_test.go b/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard3_test.go index 8d63214eea..d8f8688a88 100644 --- a/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard3_test.go +++ b/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard3_test.go @@ -13,6 +13,7 @@ func TestPathCompletionsTypesVersionsWildcard3(t *testing.T) { t.Skip() defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @module: commonjs +// @resolveJsonModule: false // @Filename: /node_modules/foo/package.json { "types": "index.d.ts", diff --git a/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard4_test.go b/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard4_test.go index 320a68bfb2..d9f83bb7be 100644 --- a/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard4_test.go +++ b/internal/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard4_test.go @@ -13,6 +13,7 @@ func TestPathCompletionsTypesVersionsWildcard4(t *testing.T) { t.Skip() defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @module: commonjs +// @resolveJsonModule: false // @Filename: /node_modules/foo/package.json { "types": "index.d.ts", diff --git a/testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.errors.txt.diff deleted file mode 100644 index 8120ad3982..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.es6ExportEqualsInterop.errors.txt -+++ new.es6ExportEqualsInterop.errors.txt -@@= skipped -0, +0 lines =@@ - main.ts(15,1): error TS2693: 'z1' only refers to a type, but is being used as a value here. - main.ts(21,4): error TS2339: Property 'a' does not exist on type '() => any'. - main.ts(23,4): error TS2339: Property 'a' does not exist on type 'typeof Foo'. --main.ts(27,8): error TS1259: Module '"interface"' can only be default-imported using the 'esModuleInterop' flag --main.ts(28,8): error TS1259: Module '"variable"' can only be default-imported using the 'esModuleInterop' flag --main.ts(29,8): error TS1259: Module '"interface-variable"' can only be default-imported using the 'esModuleInterop' flag --main.ts(30,8): error TS1259: Module '"module"' can only be default-imported using the 'esModuleInterop' flag --main.ts(31,8): error TS1259: Module '"interface-module"' can only be default-imported using the 'esModuleInterop' flag --main.ts(32,8): error TS1259: Module '"variable-module"' can only be default-imported using the 'esModuleInterop' flag --main.ts(33,8): error TS1259: Module '"function"' can only be default-imported using the 'esModuleInterop' flag --main.ts(34,8): error TS1259: Module '"function-module"' can only be default-imported using the 'esModuleInterop' flag --main.ts(35,8): error TS1259: Module '"class"' can only be default-imported using the 'esModuleInterop' flag --main.ts(36,8): error TS1259: Module '"class-module"' can only be default-imported using the 'esModuleInterop' flag - main.ts(39,21): error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export. - main.ts(45,21): error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export. - main.ts(47,21): error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export. -@@= skipped -40, +30 lines =@@ - main.ts(106,15): error TS2498: Module '"class-module"' uses 'export =' and cannot be used with 'export *'. - - --==== main.ts (41 errors) ==== -+==== main.ts (31 errors) ==== - /// - - // import-equals -@@= skipped -34, +34 lines =@@ - - // default import - import x1 from "interface"; -- ~~ --!!! error TS1259: Module '"interface"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 modules.d.ts:6:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. - import x2 from "variable"; -- ~~ --!!! error TS1259: Module '"variable"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 modules.d.ts:14:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. - import x3 from "interface-variable"; -- ~~ --!!! error TS1259: Module '"interface-variable"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 modules.d.ts:26:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. - import x4 from "module"; -- ~~ --!!! error TS1259: Module '"module"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 modules.d.ts:34:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. - import x5 from "interface-module"; -- ~~ --!!! error TS1259: Module '"interface-module"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 modules.d.ts:46:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. - import x6 from "variable-module"; -- ~~ --!!! error TS1259: Module '"variable-module"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 modules.d.ts:60:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. - import x7 from "function"; -- ~~ --!!! error TS1259: Module '"function"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 modules.d.ts:65:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. - import x8 from "function-module"; -- ~~ --!!! error TS1259: Module '"function-module"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 modules.d.ts:74:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. - import x9 from "class"; -- ~~ --!!! error TS1259: Module '"class"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 modules.d.ts:82:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. - import x0 from "class-module"; -- ~~ --!!! error TS1259: Module '"class-module"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 modules.d.ts:94:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. - - // namespace import - import * as y1 from "interface"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.types.diff b/testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.types.diff deleted file mode 100644 index d79de05db2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.types.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.es6ExportEqualsInterop.types -+++ new.es6ExportEqualsInterop.types -@@= skipped -88, +88 lines =@@ - >x1 : any - - import x2 from "variable"; -->x2 : any -+>x2 : { a: number; b: number; } - - import x3 from "interface-variable"; -->x3 : any -+>x3 : { a: number; b: number; } - - import x4 from "module"; -->x4 : any -+>x4 : typeof z4 - - import x5 from "interface-module"; -->x5 : any -+>x5 : typeof z5 - - import x6 from "variable-module"; -->x6 : any -+>x6 : { a: number; b: number; } - - import x7 from "function"; -->x7 : any -+>x7 : () => any - - import x8 from "function-module"; -->x8 : any -+>x8 : typeof z8 - - import x9 from "class"; -->x9 : any -+>x9 : typeof z9 - - import x0 from "class-module"; -->x0 : any -+>x0 : typeof z0 - - // namespace import - import * as y1 from "interface"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingInEs5.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingInEs5.errors.txt.diff deleted file mode 100644 index 2e5b58dc1b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingInEs5.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.es6ImportDefaultBindingInEs5.errors.txt -+++ new.es6ImportDefaultBindingInEs5.errors.txt -@@= skipped -0, +0 lines =@@ --es6ImportDefaultBindingInEs5_1.ts(1,8): error TS1259: Module '"es6ImportDefaultBindingInEs5_0"' can only be default-imported using the 'esModuleInterop' flag -- -- --==== es6ImportDefaultBindingInEs5_0.ts (0 errors) ==== -- var a = 10; -- export = a; -- --==== es6ImportDefaultBindingInEs5_1.ts (1 errors) ==== -- import defaultBinding from "./es6ImportDefaultBindingInEs5_0"; -- ~~~~~~~~~~~~~~ --!!! error TS1259: Module '"es6ImportDefaultBindingInEs5_0"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 es6ImportDefaultBindingInEs5_0.ts:2:1: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingInEs5.types.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingInEs5.types.diff deleted file mode 100644 index 2ba3f20ec6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingInEs5.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.es6ImportDefaultBindingInEs5.types -+++ new.es6ImportDefaultBindingInEs5.types -@@= skipped -9, +9 lines =@@ - - === es6ImportDefaultBindingInEs5_1.ts === - import defaultBinding from "./es6ImportDefaultBindingInEs5_0"; -->defaultBinding : any -+>defaultBinding : number diff --git a/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.errors.txt.diff deleted file mode 100644 index 3c2bc80adf..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.exportEqualsDefaultProperty.errors.txt -+++ new.exportEqualsDefaultProperty.errors.txt -@@= skipped -0, +0 lines =@@ -- -+imp.ts(2,5): error TS2339: Property 'toExponential' does not exist on type '{ greeting: string; default: number; }'. -+ -+ -+==== exp.ts (0 errors) ==== -+ var x = { -+ "greeting": "hello, world", -+ "default": 42 -+ }; -+ -+ export = x -+ -+==== imp.ts (1 errors) ==== -+ import foo from "./exp"; -+ foo.toExponential(2); -+ ~~~~~~~~~~~~~ -+!!! error TS2339: Property 'toExponential' does not exist on type '{ greeting: string; default: number; }'. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.symbols.diff b/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.symbols.diff deleted file mode 100644 index 35de9ce474..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.symbols.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.exportEqualsDefaultProperty.symbols -+++ new.exportEqualsDefaultProperty.symbols -@@= skipped -19, +19 lines =@@ - >foo : Symbol(foo, Decl(imp.ts, 0, 6)) - - foo.toExponential(2); -->foo.toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --)) - >foo : Symbol(foo, Decl(imp.ts, 0, 6)) -->toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.types.diff b/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.types.diff deleted file mode 100644 index 6b7846da27..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.types.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.exportEqualsDefaultProperty.types -+++ new.exportEqualsDefaultProperty.types -@@= skipped -19, +19 lines =@@ - - === imp.ts === - import foo from "./exp"; -->foo : number -+>foo : { greeting: string; default: number; } - - foo.toExponential(2); -->foo.toExponential(2) : string -->foo.toExponential : (fractionDigits?: number) => string -->foo : number -->toExponential : (fractionDigits?: number) => string -+>foo.toExponential(2) : any -+>foo.toExponential : any -+>foo : { greeting: string; default: number; } -+>toExponential : any - >2 : 2 diff --git a/testdata/baselines/reference/submodule/compiler/jsxClassAttributeResolution.errors.txt b/testdata/baselines/reference/submodule/compiler/jsxClassAttributeResolution.errors.txt index c8e84730f2..384c3e74b4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxClassAttributeResolution.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsxClassAttributeResolution.errors.txt @@ -14,7 +14,7 @@ file.tsx(2,19): error TS2322: Type '{}' is not assignable to type 'IntrinsicClas "name": "@types/react", "version": "0.0.1", "main": "", - "types": "index.d.ts", + "types": "index.d.ts" } ==== node_modules/@types/react/index.d.ts (0 errors) ==== interface IntrinsicClassAttributesAlias { diff --git a/testdata/baselines/reference/submodule/compiler/jsxClassAttributeResolution.js b/testdata/baselines/reference/submodule/compiler/jsxClassAttributeResolution.js index 0b71ffe9f6..474c490d7e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxClassAttributeResolution.js +++ b/testdata/baselines/reference/submodule/compiler/jsxClassAttributeResolution.js @@ -8,7 +8,7 @@ export const a = ; "name": "@types/react", "version": "0.0.1", "main": "", - "types": "index.d.ts", + "types": "index.d.ts" } //// [index.d.ts] interface IntrinsicClassAttributesAlias { diff --git a/testdata/baselines/reference/submodule/compiler/moduleElementsInWrongContext.types.diff b/testdata/baselines/reference/submodule/compiler/moduleElementsInWrongContext.types.diff deleted file mode 100644 index 9e70d381f4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleElementsInWrongContext.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.moduleElementsInWrongContext.types -+++ new.moduleElementsInWrongContext.types -@@= skipped -50, +50 lines =@@ - >Foo : typeof Foo - - import bar from "ambient"; -->bar : any -+>bar : typeof Foo - - import { baz } from "ambient"; - >baz : any \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_empty.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_empty.errors.txt.diff new file mode 100644 index 0000000000..2f2399daf6 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_empty.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.moduleResolutionWithSuffixes_empty.errors.txt ++++ new.moduleResolutionWithSuffixes_empty.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(3,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": [] +- } +- } +-==== /index.ts (0 errors) ==== +- import { base } from "./foo"; +-==== /foo.ts (0 errors) ==== +- export function base() {} +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_notSpecified.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_notSpecified.errors.txt.diff new file mode 100644 index 0000000000..2f26d2d13f --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_notSpecified.errors.txt.diff @@ -0,0 +1,21 @@ +--- old.moduleResolutionWithSuffixes_notSpecified.errors.txt ++++ new.moduleResolutionWithSuffixes_notSpecified.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(3,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- } +- } +-==== /index.ts (0 errors) ==== +- import { base } from "./foo"; +-==== /foo.ts (0 errors) ==== +- export function base() {} +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one.errors.txt.diff new file mode 100644 index 0000000000..7965155fa6 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.moduleResolutionWithSuffixes_one.errors.txt ++++ new.moduleResolutionWithSuffixes_one.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(3,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": [".ios"] +- } +- } +- +-==== /index.ts (0 errors) ==== +- import { ios } from "./foo"; +-==== /foo.ios.ts (0 errors) ==== +- export function ios() {} +-==== /foo.ts (0 errors) ==== +- export function base() {} +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_oneBlank.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_oneBlank.errors.txt.diff new file mode 100644 index 0000000000..b4268cd42f --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_oneBlank.errors.txt.diff @@ -0,0 +1,23 @@ +--- old.moduleResolutionWithSuffixes_oneBlank.errors.txt ++++ new.moduleResolutionWithSuffixes_oneBlank.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(3,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": [""] +- } +- } +- +-==== /index.ts (0 errors) ==== +- import { base } from "./foo"; +-==== /foo.ts (0 errors) ==== +- export function base() {} +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_oneNotFound.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_oneNotFound.errors.txt.diff new file mode 100644 index 0000000000..779eeea7dd --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_oneNotFound.errors.txt.diff @@ -0,0 +1,17 @@ +--- old.moduleResolutionWithSuffixes_oneNotFound.errors.txt ++++ new.moduleResolutionWithSuffixes_oneNotFound.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(3,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. + /index.ts(1,21): error TS2307: Cannot find module './foo' or its corresponding type declarations. + + +-==== /tsconfig.json (1 errors) ==== ++==== /tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. + "traceResolution": true, + "moduleSuffixes": [".ios"] + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_dirModuleWithIndex.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_dirModuleWithIndex.errors.txt.diff new file mode 100644 index 0000000000..69ab38bf7a --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_dirModuleWithIndex.errors.txt.diff @@ -0,0 +1,24 @@ +--- old.moduleResolutionWithSuffixes_one_dirModuleWithIndex.errors.txt ++++ new.moduleResolutionWithSuffixes_one_dirModuleWithIndex.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(3,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": [".ios"] +- } +- } +- +-==== /index.ts (0 errors) ==== +- import { ios } from "./foo"; +-==== /foo/index.ios.ts (0 errors) ==== +- export function ios() {} +-==== /foo/index.ts (0 errors) ==== +- export function base() {} ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalModule.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalModule.errors.txt.diff new file mode 100644 index 0000000000..e85122c087 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalModule.errors.txt.diff @@ -0,0 +1,39 @@ +--- old.moduleResolutionWithSuffixes_one_externalModule.errors.txt ++++ new.moduleResolutionWithSuffixes_one_externalModule.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(6,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "allowJs": true, +- "checkJs": false, +- "outDir": "bin", +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": [".ios"] +- } +- } +- +-==== /index.ts (0 errors) ==== +- import { ios } from "some-library"; +- +-==== /node_modules/some-library/index.ios.js (0 errors) ==== +- "use strict"; +- exports.__esModule = true; +- function ios() {} +- exports.ios = ios; +-==== /node_modules/some-library/index.ios.d.ts (0 errors) ==== +- export declare function ios(): void; +-==== /node_modules/some-library/index.js (0 errors) ==== +- "use strict"; +- exports.__esModule = true; +- function base() {} +- exports.base = base; +-==== /node_modules/some-library/index.d.ts (0 errors) ==== +- export declare function base(): void; +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalModulePath.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalModulePath.errors.txt.diff new file mode 100644 index 0000000000..c3459b508b --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalModulePath.errors.txt.diff @@ -0,0 +1,39 @@ +--- old.moduleResolutionWithSuffixes_one_externalModulePath.errors.txt ++++ new.moduleResolutionWithSuffixes_one_externalModulePath.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(6,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "allowJs": true, +- "checkJs": false, +- "outDir": "bin", +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": [".ios"] +- } +- } +- +-==== /index.ts (0 errors) ==== +- import { iosfoo } from "some-library/foo"; +- +-==== /node_modules/some-library/foo.ios.js (0 errors) ==== +- "use strict"; +- exports.__esModule = true; +- function iosfoo() {} +- exports.iosfoo = iosfoo; +-==== /node_modules/some-library/foo.ios.d.ts (0 errors) ==== +- export declare function iosfoo(): void; +-==== /node_modules/some-library/foo.js (0 errors) ==== +- "use strict"; +- exports.__esModule = true; +- function basefoo() {} +- exports.basefoo = basefoo; +-==== /node_modules/some-library/foo.d.ts (0 errors) ==== +- export declare function basefoo(): void; +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalTSModule.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalTSModule.errors.txt.diff new file mode 100644 index 0000000000..156fb025fd --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_externalTSModule.errors.txt.diff @@ -0,0 +1,26 @@ +--- old.moduleResolutionWithSuffixes_one_externalTSModule.errors.txt ++++ new.moduleResolutionWithSuffixes_one_externalTSModule.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(4,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "outDir": "bin", +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": [".ios"] +- } +- } +- +-==== /test.ts (0 errors) ==== +- import { ios } from "some-library"; +- +-==== /node_modules/some-library/index.ios.ts (0 errors) ==== +- export function ios() {} +-==== /node_modules/some-library/index.ts (0 errors) ==== +- export function base() {} ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_jsonModule.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_jsonModule.errors.txt.diff new file mode 100644 index 0000000000..cada164092 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_one_jsonModule.errors.txt.diff @@ -0,0 +1,33 @@ +--- old.moduleResolutionWithSuffixes_one_jsonModule.errors.txt ++++ new.moduleResolutionWithSuffixes_one_jsonModule.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(6,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "esModuleInterop": true, +- "resolveJsonModule": true, +- "outDir": "bin", +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": [".ios"] +- } +- } +- +-==== /index.ts (0 errors) ==== +- import foo from "./foo.json"; +- console.log(foo.ios); +-==== /foo.ios.json (0 errors) ==== +- { +- "ios": "platform ios" +- } +-==== /foo.json (0 errors) ==== +- { +- "base": "platform base" +- } +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank1.errors.txt.diff new file mode 100644 index 0000000000..35f61639d6 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank1.errors.txt.diff @@ -0,0 +1,27 @@ +--- old.moduleResolutionWithSuffixes_threeLastIsBlank1.errors.txt ++++ new.moduleResolutionWithSuffixes_threeLastIsBlank1.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(3,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": ["-ios", "__native", ""] +- } +- } +- +-==== /index.ts (0 errors) ==== +- import { ios } from "./foo"; +-==== /foo-ios.ts (0 errors) ==== +- export function ios() {} +-==== /foo__native.ts (0 errors) ==== +- export function native() {} +-==== /foo.ts (0 errors) ==== +- export function base() {} +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank2.errors.txt.diff new file mode 100644 index 0000000000..978953794a --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank2.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.moduleResolutionWithSuffixes_threeLastIsBlank2.errors.txt ++++ new.moduleResolutionWithSuffixes_threeLastIsBlank2.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(3,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": ["-ios", "__native", ""] +- } +- } +- +-==== /index.ts (0 errors) ==== +- import { native } from "./foo"; +-==== /foo__native.ts (0 errors) ==== +- export function native() {} +-==== /foo.ts (0 errors) ==== +- export function base() {} +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank3.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank3.errors.txt.diff new file mode 100644 index 0000000000..1672bb7aa0 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank3.errors.txt.diff @@ -0,0 +1,23 @@ +--- old.moduleResolutionWithSuffixes_threeLastIsBlank3.errors.txt ++++ new.moduleResolutionWithSuffixes_threeLastIsBlank3.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(3,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": ["-ios", "__native", ""] +- } +- } +- +-==== /index.ts (0 errors) ==== +- import { base } from "./foo"; +-==== /foo.ts (0 errors) ==== +- export function base() {} +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank4.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank4.errors.txt.diff new file mode 100644 index 0000000000..79da8b925c --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithSuffixes_threeLastIsBlank4.errors.txt.diff @@ -0,0 +1,17 @@ +--- old.moduleResolutionWithSuffixes_threeLastIsBlank4.errors.txt ++++ new.moduleResolutionWithSuffixes_threeLastIsBlank4.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(3,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. + /index.ts(1,22): error TS2307: Cannot find module './foo' or its corresponding type declarations. + + +-==== /tsconfig.json (1 errors) ==== ++==== /tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. + "traceResolution": true, + "moduleSuffixes": ["-ios", "__native", ""] + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.js b/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.js index 98c93b07b7..727cbed30c 100644 --- a/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.js +++ b/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.js @@ -1,8 +1,42 @@ //// [tests/cases/compiler/module_augmentUninstantiatedModule2.ts] //// -//// [module_augmentUninstantiatedModule2.ts] -declare var ng: ng.IAngularStatic; declare module ng { export interface IModule { name: string; } export interface IAngularStatic { module: (s: string) => IModule; } } export = ng; +//// [app.ts] +import ng = require("angular"); +import "./moduleAugmentation"; + +var x: number = ng.getNumber(); -//// [module_augmentUninstantiatedModule2.js] +//// [moduleAugmentation.ts] +import * as ng from "angular" +declare module "angular" { + export interface IAngularStatic { + getNumber: () => number; + } +} + +//// [index.d.ts] +declare var ng: ng.IAngularStatic; + +declare module ng { + export interface IModule { + name: string; + } + + export interface IAngularStatic { + module: (s: string) => IModule; + } +} + +export = ng; + + + +//// [moduleAugmentation.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//// [app.js] "use strict"; -module.exports = ng; +Object.defineProperty(exports, "__esModule", { value: true }); +const ng = require("angular"); +require("./moduleAugmentation"); +var x = ng.getNumber(); diff --git a/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.js.diff b/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.js.diff new file mode 100644 index 0000000000..314247865d --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.js.diff @@ -0,0 +1,10 @@ +--- old.module_augmentUninstantiatedModule2.js ++++ new.module_augmentUninstantiatedModule2.js +@@= skipped -36, +36 lines =@@ + //// [app.js] + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); +-var ng = require("angular"); ++const ng = require("angular"); + require("./moduleAugmentation"); + var x = ng.getNumber(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.symbols b/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.symbols index d8a3779193..17c284df01 100644 --- a/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.symbols +++ b/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.symbols @@ -1,32 +1,59 @@ //// [tests/cases/compiler/module_augmentUninstantiatedModule2.ts] //// -=== module_augmentUninstantiatedModule2.ts === +=== app.ts === +import ng = require("angular"); +>ng : Symbol(ng, Decl(app.ts, 0, 0)) + +import "./moduleAugmentation"; + +var x: number = ng.getNumber(); +>x : Symbol(x, Decl(app.ts, 3, 3)) +>ng.getNumber : Symbol(ng.IAngularStatic.getNumber, Decl(moduleAugmentation.ts, 2, 37)) +>ng : Symbol(ng, Decl(app.ts, 0, 0)) +>getNumber : Symbol(ng.IAngularStatic.getNumber, Decl(moduleAugmentation.ts, 2, 37)) + +=== moduleAugmentation.ts === +import * as ng from "angular" +>ng : Symbol(ng, Decl(moduleAugmentation.ts, 0, 6)) + +declare module "angular" { +>"angular" : Symbol(ng, Decl(index.d.ts, 0, 11), Decl(index.d.ts, 0, 34), Decl(moduleAugmentation.ts, 0, 29)) + + export interface IAngularStatic { +>IAngularStatic : Symbol(IAngularStatic, Decl(index.d.ts, 5, 4), Decl(moduleAugmentation.ts, 1, 26)) + + getNumber: () => number; +>getNumber : Symbol(IAngularStatic.getNumber, Decl(moduleAugmentation.ts, 2, 37)) + } +} + +=== node_modules/angular/index.d.ts === declare var ng: ng.IAngularStatic; ->ng : Symbol(ng, Decl(module_augmentUninstantiatedModule2.ts, 0, 11), Decl(module_augmentUninstantiatedModule2.ts, 0, 34)) ->ng : Symbol(ng, Decl(module_augmentUninstantiatedModule2.ts, 0, 11), Decl(module_augmentUninstantiatedModule2.ts, 0, 34)) ->IAngularStatic : Symbol(ng.IAngularStatic, Decl(module_augmentUninstantiatedModule2.ts, 5, 4)) +>ng : Symbol(ng, Decl(index.d.ts, 0, 11), Decl(index.d.ts, 0, 34), Decl(moduleAugmentation.ts, 0, 29)) +>ng : Symbol(ng, Decl(index.d.ts, 0, 11), Decl(index.d.ts, 0, 34), Decl(moduleAugmentation.ts, 0, 29)) +>IAngularStatic : Symbol(ng.IAngularStatic, Decl(index.d.ts, 5, 4), Decl(moduleAugmentation.ts, 1, 26)) declare module ng { ->ng : Symbol(ng, Decl(module_augmentUninstantiatedModule2.ts, 0, 11), Decl(module_augmentUninstantiatedModule2.ts, 0, 34)) +>ng : Symbol(ng, Decl(index.d.ts, 0, 11), Decl(index.d.ts, 0, 34), Decl(moduleAugmentation.ts, 0, 29)) export interface IModule { ->IModule : Symbol(IModule, Decl(module_augmentUninstantiatedModule2.ts, 2, 19)) +>IModule : Symbol(IModule, Decl(index.d.ts, 2, 19)) name: string; ->name : Symbol(IModule.name, Decl(module_augmentUninstantiatedModule2.ts, 3, 29)) +>name : Symbol(IModule.name, Decl(index.d.ts, 3, 29)) } export interface IAngularStatic { ->IAngularStatic : Symbol(IAngularStatic, Decl(module_augmentUninstantiatedModule2.ts, 5, 4)) +>IAngularStatic : Symbol(IAngularStatic, Decl(index.d.ts, 5, 4), Decl(moduleAugmentation.ts, 1, 26)) module: (s: string) => IModule; ->module : Symbol(IAngularStatic.module, Decl(module_augmentUninstantiatedModule2.ts, 7, 36)) ->s : Symbol(s, Decl(module_augmentUninstantiatedModule2.ts, 8, 16)) ->IModule : Symbol(IModule, Decl(module_augmentUninstantiatedModule2.ts, 2, 19)) +>module : Symbol(IAngularStatic.module, Decl(index.d.ts, 7, 36)) +>s : Symbol(s, Decl(index.d.ts, 8, 16)) +>IModule : Symbol(IModule, Decl(index.d.ts, 2, 19)) } } export = ng; ->ng : Symbol(ng, Decl(module_augmentUninstantiatedModule2.ts, 0, 11), Decl(module_augmentUninstantiatedModule2.ts, 0, 34)) +>ng : Symbol(ng, Decl(index.d.ts, 0, 11), Decl(index.d.ts, 0, 34), Decl(moduleAugmentation.ts, 0, 29)) diff --git a/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.types b/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.types index 4256b711e0..c4feae8337 100644 --- a/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.types +++ b/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.types @@ -1,8 +1,34 @@ //// [tests/cases/compiler/module_augmentUninstantiatedModule2.ts] //// -=== module_augmentUninstantiatedModule2.ts === +=== app.ts === +import ng = require("angular"); +>ng : ng.IAngularStatic + +import "./moduleAugmentation"; + +var x: number = ng.getNumber(); +>x : number +>ng.getNumber() : number +>ng.getNumber : () => number +>ng : ng.IAngularStatic +>getNumber : () => number + +=== moduleAugmentation.ts === +import * as ng from "angular" +>ng : ng.IAngularStatic + +declare module "angular" { +>"angular" : IAngularStatic + + export interface IAngularStatic { + getNumber: () => number; +>getNumber : () => number + } +} + +=== node_modules/angular/index.d.ts === declare var ng: ng.IAngularStatic; ->ng : import("module_augmentUninstantiatedModule2").IAngularStatic +>ng : import("node_modules/angular/index.d.ts").IAngularStatic >ng : any declare module ng { @@ -19,6 +45,6 @@ declare module ng { } export = ng; ->ng : import("module_augmentUninstantiatedModule2").IAngularStatic +>ng : import("node_modules/angular/index.d.ts").IAngularStatic diff --git a/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.types.diff b/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.types.diff deleted file mode 100644 index 2f98d353d6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.types.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.module_augmentUninstantiatedModule2.types -+++ new.module_augmentUninstantiatedModule2.types -@@= skipped -1, +1 lines =@@ - - === module_augmentUninstantiatedModule2.ts === - declare var ng: ng.IAngularStatic; -->ng : ng.IAngularStatic -+>ng : import("module_augmentUninstantiatedModule2").IAngularStatic - >ng : any - - declare module ng { -@@= skipped -17, +17 lines =@@ - } - - export = ng; -->ng : ng.IAngularStatic -+>ng : import("module_augmentUninstantiatedModule2").IAngularStatic - diff --git a/testdata/baselines/reference/submodule/compiler/reexportMissingDefault4.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/reexportMissingDefault4.errors.txt.diff deleted file mode 100644 index fa73d785e0..0000000000 --- a/testdata/baselines/reference/submodule/compiler/reexportMissingDefault4.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.reexportMissingDefault4.errors.txt -+++ new.reexportMissingDefault4.errors.txt -@@= skipped -0, +0 lines =@@ --a.ts(2,10): error TS2305: Module '"./b"' has no exported member 'default'. -- -- --==== b.d.ts (0 errors) ==== -- declare var b: number; -- export { b }; -- --==== a.ts (1 errors) ==== -- export { b } from "./b"; -- export { default } from "./b"; -- ~~~~~~~ --!!! error TS2305: Module '"./b"' has no exported member 'default'. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/reexportMissingDefault4.types.diff b/testdata/baselines/reference/submodule/compiler/reexportMissingDefault4.types.diff deleted file mode 100644 index b2f037525c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/reexportMissingDefault4.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.reexportMissingDefault4.types -+++ new.reexportMissingDefault4.types -@@= skipped -11, +11 lines =@@ - >b : number - - export { default } from "./b"; -->default : any -+>default : typeof import("b") diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithModuleNodeResolutionEmitNone.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithModuleNodeResolutionEmitNone.errors.txt.diff index 6c5fc37220..ced70dff4b 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithModuleNodeResolutionEmitNone.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithModuleNodeResolutionEmitNone.errors.txt.diff @@ -2,10 +2,12 @@ +++ new.requireOfJsonFileWithModuleNodeResolutionEmitNone.errors.txt @@= skipped -0, +0 lines =@@ -error TS5071: Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'. +-error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later. -file1.ts(1,1): error TS1148: Cannot use imports, exports, or module augmentations when '--module' is 'none'. - - -!!! error TS5071: Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'. +-!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later. -==== file1.ts (1 errors) ==== - import * as b from './b.json'; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.errors.txt.diff index 44608e6282..eccd38e743 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.errors.txt.diff @@ -1,47 +1,37 @@ --- old.requireOfJsonFileWithoutResolveJsonModule.errors.txt +++ new.requireOfJsonFileWithoutResolveJsonModule.errors.txt @@= skipped -0, +0 lines =@@ --file1.ts(1,21): error TS2732: Cannot find module './b.json'. Consider using '--resolveJsonModule' to import module with '.json' extension. --file1.ts(3,21): error TS2732: Cannot find module './b.json'. Consider using '--resolveJsonModule' to import module with '.json' extension. -- -- --==== file1.ts (2 errors) ==== -+b.json(1,1): error TS1005: '{' expected. -+b.json(1,10): error TS1005: ',' expected. -+b.json(1,14): error TS1005: ',' expected. -+b.json(1,18): error TS1005: '}' expected. -+file1.ts(2,12): error TS2339: Property 'a' does not exist on type '{ contents: any; Not: any; read: any; }'. -+file1.ts(5,16): error TS2339: Property 'b' does not exist on type '{ contents: any; Not: any; read: any; }'. -+file1.ts(6,13): error TS2339: Property 'b' does not exist on type '{ contents: any; Not: any; read: any; }'. -+ -+ -+==== file1.ts (3 errors) ==== - import b1 = require('./b.json'); // error -- ~~~~~~~~~~ --!!! error TS2732: Cannot find module './b.json'. Consider using '--resolveJsonModule' to import module with '.json' extension. - let x = b1.a; -+ ~ -+!!! error TS2339: Property 'a' does not exist on type '{ contents: any; Not: any; read: any; }'. - import b2 = require('./b.json'); // error -- ~~~~~~~~~~ --!!! error TS2732: Cannot find module './b.json'. Consider using '--resolveJsonModule' to import module with '.json' extension. - if (x) { - let b = b2.b; -+ ~ -+!!! error TS2339: Property 'b' does not exist on type '{ contents: any; Not: any; read: any; }'. - x = (b1.b === b); -+ ~ -+!!! error TS2339: Property 'b' does not exist on type '{ contents: any; Not: any; read: any; }'. + b.json(1,1): error TS1005: '{' expected. +-b.json(1,1): error TS1136: Property assignment expected. + b.json(1,10): error TS1005: ',' expected. +-b.json(1,10): error TS1136: Property assignment expected. + b.json(1,14): error TS1005: ',' expected. +-b.json(1,14): error TS1136: Property assignment expected. + b.json(1,18): error TS1005: '}' expected. + file1.ts(2,12): error TS2339: Property 'a' does not exist on type '{ contents: any; Not: any; read: any; }'. + file1.ts(5,16): error TS2339: Property 'b' does not exist on type '{ contents: any; Not: any; read: any; }'. +@@= skipped -24, +21 lines =@@ + !!! error TS2339: Property 'b' does not exist on type '{ contents: any; Not: any; read: any; }'. } --==== b.json (0 errors) ==== +-==== b.json (7 errors) ==== +==== b.json (4 errors) ==== contents Not read -+ ~~~~~~~~ -+!!! error TS1005: '{' expected. + ~~~~~~~~ + !!! error TS1005: '{' expected. +- ~~~~~~~~ +-!!! error TS1136: Property assignment expected. +- ~~~ +-!!! error TS1005: ',' expected. +- ~~~ +-!!! error TS1136: Property assignment expected. +- ~~~~ +-!!! error TS1005: ',' expected. +- ~~~~ +-!!! error TS1136: Property assignment expected. + ~~~ +!!! error TS1005: ',' expected. + ~~~~ +!!! error TS1005: ',' expected. -+ -+!!! error TS1005: '}' expected. \ No newline at end of file + + !!! error TS1005: '}' expected. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.js.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.js.diff index 8663a3403b..d1d1ffc48a 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.js.diff +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.js.diff @@ -1,11 +1,6 @@ --- old.requireOfJsonFileWithoutResolveJsonModule.js +++ new.requireOfJsonFileWithoutResolveJsonModule.js -@@= skipped -11, +11 lines =@@ - //// [b.json] - contents Not read - -+//// [out/b.json] -+{ contents, Not, read } +@@= skipped -16, +16 lines =@@ //// [out/file1.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.symbols.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.symbols.diff deleted file mode 100644 index 49a2c5f46f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.symbols.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.requireOfJsonFileWithoutResolveJsonModule.symbols -+++ new.requireOfJsonFileWithoutResolveJsonModule.symbols -@@= skipped -23, +23 lines =@@ - >b : Symbol(b, Decl(file1.ts, 4, 7)) - } - -+=== b.json === -+contents Not read -+>contents : Symbol(contents, Decl(b.json, 0, 0)) -+>Not : Symbol(Not, Decl(b.json, 0, 8)) -+>read : Symbol(read, Decl(b.json, 0, 12)) -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.types.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.types.diff deleted file mode 100644 index a5c1231997..0000000000 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.types.diff +++ /dev/null @@ -1,47 +0,0 @@ ---- old.requireOfJsonFileWithoutResolveJsonModule.types -+++ new.requireOfJsonFileWithoutResolveJsonModule.types -@@= skipped -1, +1 lines =@@ - - === file1.ts === - import b1 = require('./b.json'); // error -->b1 : any -+>b1 : { contents: any; Not: any; read: any; } - - let x = b1.a; - >x : any - >b1.a : any -->b1 : any -+>b1 : { contents: any; Not: any; read: any; } - >a : any - - import b2 = require('./b.json'); // error -->b2 : any -+>b2 : { contents: any; Not: any; read: any; } - - if (x) { - >x : any -@@= skipped -17, +17 lines =@@ - let b = b2.b; - >b : any - >b2.b : any -->b2 : any -+>b2 : { contents: any; Not: any; read: any; } - >b : any - - x = (b1.b === b); -@@= skipped -9, +9 lines =@@ - >(b1.b === b) : boolean - >b1.b === b : boolean - >b1.b : any -->b1 : any -+>b1 : { contents: any; Not: any; read: any; } - >b : any - >b : any - } -+ -+=== b.json === -+contents Not read -+>contents Not read : { contents: any; Not: any; read: any; } -+>contents : any -+>Not : any -+>read : any diff --git a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt.diff deleted file mode 100644 index 170780f0b0..0000000000 --- a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt -+++ new.resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt -@@= skipped -0, +0 lines =@@ --tsconfig.json(2,5): error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. - test.ts(1,19): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. - - --==== tsconfig.json (1 errors) ==== -+==== tsconfig.json (0 errors) ==== - { - "compilerOptions": { -- ~~~~~~~~~~~~~~~~~ --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. - "paths": { - "foo/*": ["./dist/*"], - "baz/*.ts": ["./types/*.d.ts"] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).errors.txt b/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).errors.txt deleted file mode 100644 index 40b353506a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).errors.txt +++ /dev/null @@ -1,25 +0,0 @@ -test.ts(1,19): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. - - -==== tsconfig.json (0 errors) ==== - { - "compilerOptions": { - "paths": { - "foo/*": ["./dist/*"], - "baz/*.ts": ["./types/*.d.ts"] - } - } - } - -==== dist/bar.ts (0 errors) ==== - export const a = 1234; - -==== types/main.d.ts (0 errors) ==== - export const b: string; - -==== test.ts (1 errors) ==== - import { a } from "foo/bar.ts"; - ~~~~~~~~~~~~ -!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. - import { b } from "baz/main.ts"; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).js b/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).js deleted file mode 100644 index fc322d5465..0000000000 --- a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).js +++ /dev/null @@ -1,21 +0,0 @@ -//// [tests/cases/compiler/resolutionCandidateFromPackageJsonField2.ts] //// - -//// [bar.ts] -export const a = 1234; - -//// [main.d.ts] -export const b: string; - -//// [test.ts] -import { a } from "foo/bar.ts"; -import { b } from "baz/main.ts"; - - -//// [bar.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = 1234; -//// [test.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).symbols b/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).symbols deleted file mode 100644 index 5ea0f09478..0000000000 --- a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).symbols +++ /dev/null @@ -1,17 +0,0 @@ -//// [tests/cases/compiler/resolutionCandidateFromPackageJsonField2.ts] //// - -=== dist/bar.ts === -export const a = 1234; ->a : Symbol(a, Decl(bar.ts, 0, 12)) - -=== types/main.d.ts === -export const b: string; ->b : Symbol(b, Decl(main.d.ts, 0, 12)) - -=== test.ts === -import { a } from "foo/bar.ts"; ->a : Symbol(a, Decl(test.ts, 0, 8)) - -import { b } from "baz/main.ts"; ->b : Symbol(b, Decl(test.ts, 1, 8)) - diff --git a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).types b/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).types deleted file mode 100644 index 297dbfbfe9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=node10).types +++ /dev/null @@ -1,18 +0,0 @@ -//// [tests/cases/compiler/resolutionCandidateFromPackageJsonField2.ts] //// - -=== dist/bar.ts === -export const a = 1234; ->a : 1234 ->1234 : 1234 - -=== types/main.d.ts === -export const b: string; ->b : string - -=== test.ts === -import { a } from "foo/bar.ts"; ->a : 1234 - -import { b } from "baz/main.ts"; ->b : string - diff --git a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt b/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2.errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt rename to testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2.errors.txt diff --git a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).js b/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2.js similarity index 100% rename from testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).js rename to testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2.js diff --git a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).symbols b/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2.symbols similarity index 100% rename from testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).symbols rename to testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2.symbols diff --git a/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).types b/testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2.types similarity index 100% rename from testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).types rename to testdata/baselines/reference/submodule/compiler/resolutionCandidateFromPackageJsonField2.types diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=commonjs).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=commonjs).errors.txt.diff deleted file mode 100644 index d1bf09c663..0000000000 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=commonjs).errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.tripleSlashTypesReferenceWithMissingExports(module=commonjs).errors.txt -+++ new.tripleSlashTypesReferenceWithMissingExports(module=commonjs).errors.txt -@@= skipped -0, +0 lines =@@ -- -+usage.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. -+ -+ -+==== node_modules/pkg/index.d.ts (0 errors) ==== -+ interface GlobalThing { a: number } -+==== node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "types": "index.d.ts", -+ "exports": "some-other-thing.js" -+ } -+==== usage.ts (1 errors) ==== -+ /// -+ ~~~ -+!!! error TS2688: Cannot find type definition file for 'pkg'. -+ -+ const a: GlobalThing = { a: 0 }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/allowImportingTsExtensions(moduleresolution=bundler).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/allowImportingTsExtensions(moduleresolution=bundler).errors.txt.diff deleted file mode 100644 index 46acfb6e3b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/allowImportingTsExtensions(moduleresolution=bundler).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.allowImportingTsExtensions(moduleresolution=bundler).errors.txt -+++ new.allowImportingTsExtensions(moduleresolution=bundler).errors.txt -@@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. - /c.ts(1,16): error TS2307: Cannot find module './thisfiledoesnotexist.ts' or its corresponding type declarations. - - --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. - ==== /ts.ts (0 errors) ==== - export {}; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/allowImportingTsExtensions(moduleresolution=node10).errors.txt b/testdata/baselines/reference/submodule/conformance/allowImportingTsExtensions(moduleresolution=node10).errors.txt deleted file mode 100644 index 755f0d6eeb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/allowImportingTsExtensions(moduleresolution=node10).errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -/c.ts(1,16): error TS2307: Cannot find module './thisfiledoesnotexist.ts' or its corresponding type declarations. - - -==== /ts.ts (0 errors) ==== - export {}; - -==== /tsx.tsx (0 errors) ==== - export {}; - -==== /dts.d.ts (0 errors) ==== - export {}; - -==== /b.ts (0 errors) ==== - import {} from "./ts.js"; - import {} from "./ts.ts"; - import type {} from "./ts.d.ts"; - - import {} from "./tsx.js"; - import {} from "./tsx.jsx"; - import {} from "./tsx.ts"; - import {} from "./tsx.tsx"; - import type {} from "./tsx.d.ts"; - - import {} from "./dts.js"; - import {} from "./dts.ts"; - import type {} from "./dts.d.ts"; - -==== /c.ts (1 errors) ==== - import {} from "./thisfiledoesnotexist.ts"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './thisfiledoesnotexist.ts' or its corresponding type declarations. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.errors.txt b/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.errors.txt new file mode 100644 index 0000000000..3d67812bd0 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.errors.txt @@ -0,0 +1,35 @@ +/real-imports.mts(1,19): error TS2307: Cannot find module 'pkg' or its corresponding type declarations. + + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "1.0.0", + "type": "commonjs", + "exports": { + "require": "./index.js" + } + } + +==== /node_modules/pkg/index.d.ts (0 errors) ==== + export declare const x: number; + +==== /package.json (0 errors) ==== + { + "": "type module is ignored in --module commonjs", + "type": "module" + } + +==== /requires.ts (0 errors) ==== + import pkg = require("pkg"); + pkg.x; + +==== /imports.ts (0 errors) ==== + import { x } from "pkg"; + x; + +==== /real-imports.mts (1 errors) ==== + import { x } from "pkg"; // Error + ~~~~~ +!!! error TS2307: Cannot find module 'pkg' or its corresponding type declarations. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.js b/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.js new file mode 100644 index 0000000000..6d419cecbc --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.js @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerCommonJS.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "1.0.0", + "type": "commonjs", + "exports": { + "require": "./index.js" + } +} + +//// [index.d.ts] +export declare const x: number; + +//// [package.json] +{ + "": "type module is ignored in --module commonjs", + "type": "module" +} + +//// [requires.ts] +import pkg = require("pkg"); +pkg.x; + +//// [imports.ts] +import { x } from "pkg"; +x; + +//// [real-imports.mts] +import { x } from "pkg"; // Error + + +//// [requires.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const pkg = require("pkg"); +pkg.x; +//// [imports.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const pkg_1 = require("pkg"); +pkg_1.x; +//// [real-imports.mjs] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.js.diff b/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.js.diff new file mode 100644 index 0000000000..42e1efe9d2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.js.diff @@ -0,0 +1,17 @@ +--- old.bundlerCommonJS.js ++++ new.bundlerCommonJS.js +@@= skipped -33, +33 lines =@@ + //// [requires.js] + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); +-var pkg = require("pkg"); ++const pkg = require("pkg"); + pkg.x; + //// [imports.js] + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); +-var pkg_1 = require("pkg"); ++const pkg_1 = require("pkg"); + pkg_1.x; + //// [real-imports.mjs] + export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.trace.json b/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.trace.json new file mode 100644 index 0000000000..4ccef64129 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/bundlerCommonJS.trace.json @@ -0,0 +1,55 @@ +======== Resolving module 'pkg' from '/requires.ts'. ======== +Explicitly specified module resolution kind: 'Bundler'. +Resolving in CJS mode with conditions 'require', 'types'. +Found 'package.json' at '/package.json'. +Loading module 'pkg' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +Found 'package.json' at '/node_modules/pkg/package.json'. +Entering conditional exports. +Matched 'exports' condition 'require'. +Using 'exports' subpath '.' with target './index.js'. +File name '/node_modules/pkg/index.js' has a '.js' extension - stripping it. +File '/node_modules/pkg/index.ts' does not exist. +File '/node_modules/pkg/index.tsx' does not exist. +File '/node_modules/pkg/index.d.ts' exists - use it as a name resolution result. +'package.json' does not have a 'peerDependencies' field. +Resolved under condition 'require'. +Exiting conditional exports. +Resolving real path for '/node_modules/pkg/index.d.ts', result '/node_modules/pkg/index.d.ts'. +======== Module name 'pkg' was successfully resolved to '/node_modules/pkg/index.d.ts' with Package ID 'pkg/index.d.ts@1.0.0'. ======== +======== Resolving module 'pkg' from '/imports.ts'. ======== +Explicitly specified module resolution kind: 'Bundler'. +Resolving in CJS mode with conditions 'require', 'types'. +File '/package.json' exists according to earlier cached lookups. +Loading module 'pkg' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +File '/node_modules/pkg/package.json' exists according to earlier cached lookups. +Entering conditional exports. +Matched 'exports' condition 'require'. +Using 'exports' subpath '.' with target './index.js'. +File name '/node_modules/pkg/index.js' has a '.js' extension - stripping it. +File '/node_modules/pkg/index.ts' does not exist according to earlier cached lookups. +File '/node_modules/pkg/index.tsx' does not exist according to earlier cached lookups. +File '/node_modules/pkg/index.d.ts' exists - use it as a name resolution result. +'package.json' does not have a 'peerDependencies' field. +Resolved under condition 'require'. +Exiting conditional exports. +Resolving real path for '/node_modules/pkg/index.d.ts', result '/node_modules/pkg/index.d.ts'. +======== Module name 'pkg' was successfully resolved to '/node_modules/pkg/index.d.ts' with Package ID 'pkg/index.d.ts@1.0.0'. ======== +======== Resolving module 'pkg' from '/real-imports.mts'. ======== +Explicitly specified module resolution kind: 'Bundler'. +Resolving in CJS mode with conditions 'import', 'types'. +File '/package.json' exists according to earlier cached lookups. +Loading module 'pkg' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +File '/node_modules/pkg/package.json' exists according to earlier cached lookups. +Entering conditional exports. +Saw non-matching condition 'require'. +Exiting conditional exports. +Directory '/node_modules/@types' does not exist, skipping all lookups in it. +Searching all ancestor node_modules directories for fallback extensions: JavaScript, JSON. +File '/node_modules/pkg/package.json' exists according to earlier cached lookups. +Entering conditional exports. +Saw non-matching condition 'require'. +Exiting conditional exports. +======== Module name 'pkg' was not resolved. ======== diff --git a/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node18,moduleresolution=bundler).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node18,moduleresolution=bundler).errors.txt.diff index eff04db0b2..70ea38d3b0 100644 --- a/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node18,moduleresolution=bundler).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node18,moduleresolution=bundler).errors.txt.diff @@ -1,11 +1,11 @@ --- old.bundlerDirectoryModule(module=node18,moduleresolution=bundler).errors.txt +++ new.bundlerDirectoryModule(module=node18,moduleresolution=bundler).errors.txt @@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. +-error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later. error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node18'. --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. +-!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later. !!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node18'. ==== /app/test.ts (0 errors) ==== import { test } from '../lib'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=bundler).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=bundler).errors.txt.diff index e165b28f03..d5fe908ca2 100644 --- a/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=bundler).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=bundler).errors.txt.diff @@ -1,11 +1,11 @@ --- old.bundlerDirectoryModule(module=node20,moduleresolution=bundler).errors.txt +++ new.bundlerDirectoryModule(module=node20,moduleresolution=bundler).errors.txt @@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. +-error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later. error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. +-!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later. !!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /app/test.ts (0 errors) ==== import { test } from '../lib'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=nodenext,moduleresolution=bundler).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=nodenext,moduleresolution=bundler).errors.txt.diff index 4d64344afc..bb8cb1f706 100644 --- a/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=nodenext,moduleresolution=bundler).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=nodenext,moduleresolution=bundler).errors.txt.diff @@ -1,11 +1,11 @@ --- old.bundlerDirectoryModule(module=nodenext,moduleresolution=bundler).errors.txt +++ new.bundlerDirectoryModule(module=nodenext,moduleresolution=bundler).errors.txt @@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. +-error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later. error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left unspecified) when option 'module' is set to 'NodeNext'. --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. +-!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later. !!! error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left unspecified) when option 'module' is set to 'NodeNext'. ==== /app/test.ts (0 errors) ==== import { test } from '../lib'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerOptionsCompat.errors.txt b/testdata/baselines/reference/submodule/conformance/bundlerOptionsCompat.errors.txt new file mode 100644 index 0000000000..e5e9133062 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/bundlerOptionsCompat.errors.txt @@ -0,0 +1,16 @@ +/tsconfig.json(4,25): error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left unspecified) when option 'module' is set to 'NodeNext'. + + +==== /tsconfig.json (1 errors) ==== + { + "compilerOptions": { + "module": "nodenext", + "moduleResolution": "bundler", + ~~~~~~~~~ +!!! error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left unspecified) when option 'module' is set to 'NodeNext'. + "noEmit": true + } + } + +==== /index.ts (0 errors) ==== + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerOptionsCompat.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/bundlerOptionsCompat.errors.txt.diff index fbffe1fcd9..cb19250ff0 100644 --- a/testdata/baselines/reference/submodule/conformance/bundlerOptionsCompat.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/bundlerOptionsCompat.errors.txt.diff @@ -1,20 +1,18 @@ --- old.bundlerOptionsCompat.errors.txt +++ new.bundlerOptionsCompat.errors.txt @@= skipped -0, +0 lines =@@ --/tsconfig.json(4,25): error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -- -- --==== /tsconfig.json (1 errors) ==== -- { -- "compilerOptions": { -- "module": "commonjs", -- "moduleResolution": "bundler", +-/tsconfig.json(4,25): error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later. + /tsconfig.json(4,25): error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left unspecified) when option 'module' is set to 'NodeNext'. + + +-==== /tsconfig.json (2 errors) ==== ++==== /tsconfig.json (1 errors) ==== + { + "compilerOptions": { + "module": "nodenext", + "moduleResolution": "bundler", - ~~~~~~~~~ --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -- "noEmit": true -- } -- } -- --==== /index.ts (0 errors) ==== -- -+ \ No newline at end of file +-!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later. + ~~~~~~~~~ + !!! error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left unspecified) when option 'module' is set to 'NodeNext'. + "noEmit": true \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/extensionLoadingPriority(moduleresolution=node).symbols b/testdata/baselines/reference/submodule/conformance/extensionLoadingPriority(moduleresolution=node).symbols deleted file mode 100644 index 065ed64eca..0000000000 --- a/testdata/baselines/reference/submodule/conformance/extensionLoadingPriority(moduleresolution=node).symbols +++ /dev/null @@ -1,25 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts] //// - -=== /project/a.js === - -export default "a.js"; - -=== /project/a.js.js === - -export default "a.js.js"; - -=== /project/dir/index.ts === - -export default "dir/index.ts"; - -=== /project/dir.js === - -export default "dir.js"; - -=== /project/b.ts === -import a from "./a.js"; ->a : Symbol(a, Decl(b.ts, 0, 6)) - -import dir from "./dir"; ->dir : Symbol(dir, Decl(b.ts, 1, 6)) - diff --git a/testdata/baselines/reference/submodule/conformance/extensionLoadingPriority(moduleresolution=node).types b/testdata/baselines/reference/submodule/conformance/extensionLoadingPriority(moduleresolution=node).types deleted file mode 100644 index a4a16f8cd5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/extensionLoadingPriority(moduleresolution=node).types +++ /dev/null @@ -1,25 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts] //// - -=== /project/a.js === - -export default "a.js"; - -=== /project/a.js.js === - -export default "a.js.js"; - -=== /project/dir/index.ts === - -export default "dir/index.ts"; - -=== /project/dir.js === - -export default "dir.js"; - -=== /project/b.ts === -import a from "./a.js"; ->a : "a.js" - -import dir from "./dir"; ->dir : "dir.js" - diff --git a/testdata/baselines/reference/submodule/conformance/importCallExpressionInExportEqualsCJS.types.diff b/testdata/baselines/reference/submodule/conformance/importCallExpressionInExportEqualsCJS.types.diff deleted file mode 100644 index 5dc9e8003a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importCallExpressionInExportEqualsCJS.types.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.importCallExpressionInExportEqualsCJS.types -+++ new.importCallExpressionInExportEqualsCJS.types -@@= skipped -8, +8 lines =@@ - >async function() { const something = await import("./something");} : () => Promise - - const something = await import("./something"); -->something : 42 -->await import("./something") : 42 -->import("./something") : Promise<42> -+>something : { default: 42; } -+>await import("./something") : { default: 42; } -+>import("./something") : Promise<{ default: 42; }> - >"./something" : "./something" - - }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.errors.txt.diff deleted file mode 100644 index 112ac7c0a9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.errors.txt.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.legacyNodeModulesExportsSpecifierGenerationConditions.errors.txt -+++ new.legacyNodeModulesExportsSpecifierGenerationConditions.errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.ts(1,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/private'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== index.ts (1 errors) ==== -+ export const a = async () => (await import("inner")).x(); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/private'. This is likely not portable. A type annotation is necessary. -+==== node_modules/inner/index.d.ts (0 errors) ==== -+ export { x } from "./other.js"; -+==== node_modules/inner/other.d.ts (0 errors) ==== -+ import { Thing } from "./private.js" -+ export const x: () => Thing; -+==== node_modules/inner/private.d.ts (0 errors) ==== -+ export interface Thing {} // not exported in export map, inaccessible under new module modes -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.js" -+ } -+==== node_modules/inner/package.json (0 errors) ==== -+ { -+ "name": "inner", -+ "private": true, -+ "type": "module", -+ "exports": { -+ ".": { -+ "default": "./index.js" -+ }, -+ "./other": { -+ "default": "./other.js" -+ } -+ } -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.js.diff b/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.js.diff index 0b8fd49c2f..c49f2d13e9 100644 --- a/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.js.diff +++ b/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.js.diff @@ -18,8 +18,7 @@ -const a = () => __awaiter(void 0, void 0, void 0, function* () { return (yield Promise.resolve().then(function () { return require("inner"); })).x(); }); +const a = async () => (await Promise.resolve().then(() => require("inner"))).x(); exports.a = a; - - - //// [index.d.ts] --export declare const a: () => Promise; ++ ++ ++//// [index.d.ts] +export declare const a: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types.diff b/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types.diff deleted file mode 100644 index 67e8decade..0000000000 --- a/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.legacyNodeModulesExportsSpecifierGenerationConditions.types -+++ new.legacyNodeModulesExportsSpecifierGenerationConditions.types -@@= skipped -5, +5 lines =@@ - >async () => (await import("inner")).x() : () => Promise - >(await import("inner")).x() : import("node_modules/inner/private").Thing - >(await import("inner")).x : () => import("node_modules/inner/private").Thing -->(await import("inner")) : typeof import("node_modules/inner/index") -->await import("inner") : typeof import("node_modules/inner/index") -->import("inner") : Promise -+>(await import("inner")) : { x: () => import("node_modules/inner/private").Thing; default: typeof import("node_modules/inner/index"); } -+>await import("inner") : { x: () => import("node_modules/inner/private").Thing; default: typeof import("node_modules/inner/index"); } -+>import("inner") : Promise<{ x: () => import("node_modules/inner/private").Thing; default: typeof import("node_modules/inner/index"); }> - >"inner" : "inner" - >x : () => import("node_modules/inner/private").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nestedPackageJsonRedirect(moduleresolution=bundler).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nestedPackageJsonRedirect(moduleresolution=bundler).errors.txt.diff deleted file mode 100644 index 3d72a9b126..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nestedPackageJsonRedirect(moduleresolution=bundler).errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.nestedPackageJsonRedirect(moduleresolution=bundler).errors.txt -+++ new.nestedPackageJsonRedirect(moduleresolution=bundler).errors.txt -@@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -- -- --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. --==== /node_modules/@restart/hooks/package.json (0 errors) ==== -- { -- "name": "@restart/hooks", -- "version": "0.3.25", -- "main": "cjs/index.js", -- "types": "cjs/index.d.ts", -- "module": "esm/index.js" -- } -- --==== /node_modules/@restart/hooks/useMergedRefs/package.json (0 errors) ==== -- { -- "name": "@restart/hooks/useMergedRefs", -- "private": true, -- "main": "../cjs/useMergedRefs.js", -- "module": "../esm/useMergedRefs.js", -- "types": "../esm/useMergedRefs.d.ts" -- } -- --==== /node_modules/@restart/hooks/esm/useMergedRefs.d.ts (0 errors) ==== -- export {}; -- --==== /main.ts (0 errors) ==== -- import {} from "@restart/hooks/useMergedRefs"; -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/node10IsNode_node.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/node10IsNode_node.errors.txt.diff new file mode 100644 index 0000000000..2dd569a21b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/node10IsNode_node.errors.txt.diff @@ -0,0 +1,28 @@ +--- old.node10IsNode_node.errors.txt ++++ new.node10IsNode_node.errors.txt +@@= skipped -0, +0 lines =@@ +-error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +-==== /node_modules/fancy-lib/package.json (0 errors) ==== +- { +- "name": "fancy-lib", +- "version": "1.0.0", +- "main": "index.js", +- "exports": { +- ".": "./definitely-not-index.js" +- } +- } +- +-==== /node_modules/fancy-lib/index.d.ts (0 errors) ==== +- export declare const fancy: "feast"; +- +-==== /node_modules/fancy-lib/definitely-not-index.d.ts (0 errors) ==== +- export declare const fancy: "ketchup"; +- +-==== /main.ts (0 errors) ==== +- import { fancy } from "fancy-lib"; +- fancy; +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/node10IsNode_node10.types.diff b/testdata/baselines/reference/submodule/conformance/node10IsNode_node10.types.diff deleted file mode 100644 index 3164038207..0000000000 --- a/testdata/baselines/reference/submodule/conformance/node10IsNode_node10.types.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.node10IsNode_node10.types -+++ new.node10IsNode_node10.types -@@= skipped -9, +9 lines =@@ - - === /main.ts === - import { fancy } from "fancy-lib"; -->fancy : "feast" -+>fancy : "ketchup" - - fancy; -->fancy : "feast" -+>fancy : "ketchup" diff --git a/testdata/baselines/reference/submodule/conformance/packageJsonImportsExportsOptionCompat(moduleresolution=bundler).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/packageJsonImportsExportsOptionCompat(moduleresolution=bundler).errors.txt.diff deleted file mode 100644 index 8ffa17c28d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/packageJsonImportsExportsOptionCompat(moduleresolution=bundler).errors.txt.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.packageJsonImportsExportsOptionCompat(moduleresolution=bundler).errors.txt -+++ new.packageJsonImportsExportsOptionCompat(moduleresolution=bundler).errors.txt -@@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -- -- --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. --==== index.ts (0 errors) ==== -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt.diff index 158e7c15c0..627302df32 100644 --- a/testdata/baselines/reference/submodule/conformance/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt.diff @@ -3,10 +3,12 @@ @@= skipped -0, +0 lines =@@ -error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. -error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. +-error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. - - -!!! error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. -!!! error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -==== index.ts (0 errors) ==== - + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).errors.txt.diff deleted file mode 100644 index 0aded09d59..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).errors.txt.diff +++ /dev/null @@ -1,46 +0,0 @@ ---- old.resolutionModeImportType1(moduleresolution=node10).errors.txt -+++ new.resolutionModeImportType1(moduleresolution=node10).errors.txt -@@= skipped -0, +0 lines =@@ --error TS2688: Cannot find type definition file for 'foo'. -- The file is in the program because: -- Entry point for implicit type library 'foo' --/app.ts(1,30): error TS2307: Cannot find module 'foo' or its corresponding type declarations. -- There are types at '/node_modules/@types/foo/index.d.mts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. -- -- --!!! error TS2688: Cannot find type definition file for 'foo'. --!!! error TS2688: The file is in the program because: --!!! error TS2688: Entry point for implicit type library 'foo' --==== /node_modules/@types/foo/package.json (0 errors) ==== -- { -- "name": "@types/foo", -- "version": "1.0.0", -- "exports": { -- ".": { -- "import": "./index.d.mts", -- "require": "./index.d.cts" -- } -- } -- } -- --==== /node_modules/@types/foo/index.d.mts (0 errors) ==== -- export declare const x: "module"; -- --==== /node_modules/@types/foo/index.d.cts (0 errors) ==== -- export declare const x: "script"; -- --==== /app.ts (1 errors) ==== -- type Default = typeof import("foo").x; -- ~~~~~ --!!! error TS2307: Cannot find module 'foo' or its corresponding type declarations. --!!! error TS2307: There are types at '/node_modules/@types/foo/index.d.mts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. -- type Import = typeof import("foo", { assert: { "resolution-mode": "import" } }).x; -- type Require = typeof import("foo", { assert: { "resolution-mode": "require" } }).x; -- // resolution-mode does not enforce file extension in `bundler`, just sets conditions -- type ImportRelative = typeof import("./other", { assert: { "resolution-mode": "import" } }).x; -- type RequireRelative = typeof import("./other", { assert: { "resolution-mode": "require" } }).x; -- --==== /other.ts (0 errors) ==== -- export const x = "other"; -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).symbols b/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).symbols deleted file mode 100644 index 3b36b51d0a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).symbols +++ /dev/null @@ -1,36 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/resolutionModeImportType1.ts] //// - -=== /node_modules/@types/foo/index.d.mts === -export declare const x: "module"; ->x : Symbol(x, Decl(index.d.mts, 0, 20)) - -=== /node_modules/@types/foo/index.d.cts === -export declare const x: "script"; ->x : Symbol(x, Decl(index.d.cts, 0, 20)) - -=== /app.ts === -type Default = typeof import("foo").x; ->Default : Symbol(Default, Decl(app.ts, 0, 0)) ->x : Symbol(x, Decl(index.d.mts, 0, 20)) - -type Import = typeof import("foo", { assert: { "resolution-mode": "import" } }).x; ->Import : Symbol(Import, Decl(app.ts, 0, 38)) ->x : Symbol(x, Decl(index.d.mts, 0, 20)) - -type Require = typeof import("foo", { assert: { "resolution-mode": "require" } }).x; ->Require : Symbol(Require, Decl(app.ts, 1, 82)) ->x : Symbol(x, Decl(index.d.cts, 0, 20)) - -// resolution-mode does not enforce file extension in `bundler`, just sets conditions -type ImportRelative = typeof import("./other", { assert: { "resolution-mode": "import" } }).x; ->ImportRelative : Symbol(ImportRelative, Decl(app.ts, 2, 84)) ->x : Symbol(x, Decl(other.ts, 0, 12)) - -type RequireRelative = typeof import("./other", { assert: { "resolution-mode": "require" } }).x; ->RequireRelative : Symbol(RequireRelative, Decl(app.ts, 4, 94)) ->x : Symbol(x, Decl(other.ts, 0, 12)) - -=== /other.ts === -export const x = "other"; ->x : Symbol(x, Decl(other.ts, 0, 12)) - diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).symbols.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).symbols.diff deleted file mode 100644 index 9105647d6d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).symbols.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.resolutionModeImportType1(moduleresolution=node10).symbols -+++ new.resolutionModeImportType1(moduleresolution=node10).symbols -@@= skipped -10, +10 lines =@@ - === /app.ts === - type Default = typeof import("foo").x; - >Default : Symbol(Default, Decl(app.ts, 0, 0)) -+>x : Symbol(x, Decl(index.d.mts, 0, 20)) - - type Import = typeof import("foo", { assert: { "resolution-mode": "import" } }).x; - >Import : Symbol(Import, Decl(app.ts, 0, 38)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).types b/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).types deleted file mode 100644 index 376327dbeb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).types +++ /dev/null @@ -1,37 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/resolutionModeImportType1.ts] //// - -=== /node_modules/@types/foo/index.d.mts === -export declare const x: "module"; ->x : "module" - -=== /node_modules/@types/foo/index.d.cts === -export declare const x: "script"; ->x : "script" - -=== /app.ts === -type Default = typeof import("foo").x; ->Default : "module" ->x : any - -type Import = typeof import("foo", { assert: { "resolution-mode": "import" } }).x; ->Import : "module" ->x : any - -type Require = typeof import("foo", { assert: { "resolution-mode": "require" } }).x; ->Require : "script" ->x : any - -// resolution-mode does not enforce file extension in `bundler`, just sets conditions -type ImportRelative = typeof import("./other", { assert: { "resolution-mode": "import" } }).x; ->ImportRelative : "other" ->x : any - -type RequireRelative = typeof import("./other", { assert: { "resolution-mode": "require" } }).x; ->RequireRelative : "other" ->x : any - -=== /other.ts === -export const x = "other"; ->x : "other" ->"other" : "other" - diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).types.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).types.diff deleted file mode 100644 index b3c686f1fe..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=node10).types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.resolutionModeImportType1(moduleresolution=node10).types -+++ new.resolutionModeImportType1(moduleresolution=node10).types -@@= skipped -9, +9 lines =@@ - - === /app.ts === - type Default = typeof import("foo").x; -->Default : any -+>Default : "module" - >x : any - - type Import = typeof import("foo", { assert: { "resolution-mode": "import" } }).x; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash4.errors.txt.diff index f89f6b38a7..21390f0820 100644 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash4.errors.txt.diff @@ -1,12 +1,22 @@ --- old.resolutionModeTripleSlash4.errors.txt +++ new.resolutionModeTripleSlash4.errors.txt @@= skipped -0, +0 lines =@@ +-/tsconfig.json(4,25): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -/app.ts(1,23): error TS2688: Cannot find type definition file for 'foo'. -/app.ts(2,1): error TS2304: Cannot find name 'MODULE'. /app.ts(3,1): error TS2552: Cannot find name 'SCRIPT'. Did you mean 'WScript'? -@@= skipped -12, +10 lines =@@ +-==== /tsconfig.json (1 errors) ==== ++==== /tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "module": "esnext", + "moduleResolution": "node10", +- ~~~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. + "noEmit": true, + "types": [] } } diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash5.errors.txt.diff new file mode 100644 index 0000000000..9ab160155c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash5.errors.txt.diff @@ -0,0 +1,18 @@ +--- old.resolutionModeTripleSlash5.errors.txt ++++ new.resolutionModeTripleSlash5.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(4,25): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. + /app.ts(3,1): error TS2552: Cannot find name 'SCRIPT'. Did you mean 'WScript'? + + +-==== /tsconfig.json (1 errors) ==== ++==== /tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "module": "esnext", + "moduleResolution": "node10", +- ~~~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. + "noEmit": true, + "types": [] + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).errors.txt.diff deleted file mode 100644 index d3c2ba7e29..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).errors.txt.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.resolutionModeTypeOnlyImport1(moduleresolution=node10).errors.txt -+++ new.resolutionModeTypeOnlyImport1(moduleresolution=node10).errors.txt -@@= skipped -0, +0 lines =@@ --error TS2688: Cannot find type definition file for 'foo'. -- The file is in the program because: -- Entry point for implicit type library 'foo' --/app.ts(1,35): error TS2307: Cannot find module 'foo' or its corresponding type declarations. -- There are types at '/node_modules/@types/foo/index.d.mts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. -- -- --!!! error TS2688: Cannot find type definition file for 'foo'. --!!! error TS2688: The file is in the program because: --!!! error TS2688: Entry point for implicit type library 'foo' --==== /node_modules/@types/foo/package.json (0 errors) ==== -- { -- "name": "@types/foo", -- "version": "1.0.0", -- "exports": { -- ".": { -- "import": "./index.d.mts", -- "require": "./index.d.cts" -- } -- } -- } -- --==== /node_modules/@types/foo/index.d.mts (0 errors) ==== -- export declare const x: "module"; -- --==== /node_modules/@types/foo/index.d.cts (0 errors) ==== -- export declare const x: "script"; -- --==== /app.ts (1 errors) ==== -- import type { x as Default } from "foo"; -- ~~~~~ --!!! error TS2307: Cannot find module 'foo' or its corresponding type declarations. --!!! error TS2307: There are types at '/node_modules/@types/foo/index.d.mts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. -- import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -- import type { x as Require } from "foo" assert { "resolution-mode": "require" }; -- type _Default = typeof Default; -- type _Import = typeof Import; -- type _Require = typeof Require; -- -- // resolution-mode does not enforce file extension in `bundler`, just sets conditions -- import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -- import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; -- type _ImportRelative = typeof ImportRelative; -- type _RequireRelative = typeof RequireRelative; -- -- export { -- _Default, -- _Import, -- _Require, -- _ImportRelative, -- _RequireRelative -- } -- --==== /other.ts (0 errors) ==== -- export const x = "other"; -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js deleted file mode 100644 index 961512bfab..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js +++ /dev/null @@ -1,62 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts] //// - -//// [package.json] -{ - "name": "@types/foo", - "version": "1.0.0", - "exports": { - ".": { - "import": "./index.d.mts", - "require": "./index.d.cts" - } - } -} - -//// [index.d.mts] -export declare const x: "module"; - -//// [index.d.cts] -export declare const x: "script"; - -//// [app.ts] -import type { x as Default } from "foo"; -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; -type _Default = typeof Default; -type _Import = typeof Import; -type _Require = typeof Require; - -// resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; -type _ImportRelative = typeof ImportRelative; -type _RequireRelative = typeof RequireRelative; - -export { - _Default, - _Import, - _Require, - _ImportRelative, - _RequireRelative -} - -//// [other.ts] -export const x = "other"; - - - - -//// [other.d.ts] -export declare const x = "other"; -//// [app.d.ts] -import type { x as Default } from "foo"; -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; -type _Default = typeof Default; -type _Import = typeof Import; -type _Require = typeof Require; -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; -type _ImportRelative = typeof ImportRelative; -type _RequireRelative = typeof RequireRelative; -export { _Default, _Import, _Require, _ImportRelative, _RequireRelative }; diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).symbols b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).symbols deleted file mode 100644 index 1d28242ebf..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).symbols +++ /dev/null @@ -1,73 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts] //// - -=== /node_modules/@types/foo/index.d.mts === -export declare const x: "module"; ->x : Symbol(x, Decl(index.d.mts, 0, 20)) - -=== /node_modules/@types/foo/index.d.cts === -export declare const x: "script"; ->x : Symbol(x, Decl(index.d.cts, 0, 20)) - -=== /app.ts === -import type { x as Default } from "foo"; ->x : Symbol(Default, Decl(index.d.mts, 0, 20)) ->Default : Symbol(Default, Decl(app.ts, 0, 13)) - -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; ->x : Symbol(Default, Decl(index.d.mts, 0, 20)) ->Import : Symbol(Import, Decl(app.ts, 1, 13)) - -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; ->x : Symbol(Require, Decl(index.d.cts, 0, 20)) ->Require : Symbol(Require, Decl(app.ts, 2, 13)) - -type _Default = typeof Default; ->_Default : Symbol(_Default, Decl(app.ts, 2, 80)) ->Default : Symbol(Default, Decl(app.ts, 0, 13)) - -type _Import = typeof Import; ->_Import : Symbol(_Import, Decl(app.ts, 3, 31)) ->Import : Symbol(Import, Decl(app.ts, 1, 13)) - -type _Require = typeof Require; ->_Require : Symbol(_Require, Decl(app.ts, 4, 29)) ->Require : Symbol(Require, Decl(app.ts, 2, 13)) - -// resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; ->x : Symbol(ImportRelative, Decl(other.ts, 0, 12)) ->ImportRelative : Symbol(ImportRelative, Decl(app.ts, 8, 13)) - -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; ->x : Symbol(ImportRelative, Decl(other.ts, 0, 12)) ->RequireRelative : Symbol(RequireRelative, Decl(app.ts, 9, 13)) - -type _ImportRelative = typeof ImportRelative; ->_ImportRelative : Symbol(_ImportRelative, Decl(app.ts, 9, 92)) ->ImportRelative : Symbol(ImportRelative, Decl(app.ts, 8, 13)) - -type _RequireRelative = typeof RequireRelative; ->_RequireRelative : Symbol(_RequireRelative, Decl(app.ts, 10, 45)) ->RequireRelative : Symbol(RequireRelative, Decl(app.ts, 9, 13)) - -export { - _Default, ->_Default : Symbol(_Default, Decl(app.ts, 13, 8)) - - _Import, ->_Import : Symbol(_Import, Decl(app.ts, 14, 11)) - - _Require, ->_Require : Symbol(_Require, Decl(app.ts, 15, 10)) - - _ImportRelative, ->_ImportRelative : Symbol(_ImportRelative, Decl(app.ts, 16, 11)) - - _RequireRelative ->_RequireRelative : Symbol(_RequireRelative, Decl(app.ts, 17, 18)) -} - -=== /other.ts === -export const x = "other"; ->x : Symbol(x, Decl(other.ts, 0, 12)) - diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).symbols.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).symbols.diff deleted file mode 100644 index cee9d3c71a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).symbols.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.resolutionModeTypeOnlyImport1(moduleresolution=node10).symbols -+++ new.resolutionModeTypeOnlyImport1(moduleresolution=node10).symbols -@@= skipped -9, +9 lines =@@ - - === /app.ts === - import type { x as Default } from "foo"; -+>x : Symbol(Default, Decl(index.d.mts, 0, 20)) - >Default : Symbol(Default, Decl(app.ts, 0, 13)) - - import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -->x : Symbol(Import, Decl(index.d.mts, 0, 20)) -+>x : Symbol(Default, Decl(index.d.mts, 0, 20)) - >Import : Symbol(Import, Decl(app.ts, 1, 13)) - - import type { x as Require } from "foo" assert { "resolution-mode": "require" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).types b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).types deleted file mode 100644 index 404083065a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).types +++ /dev/null @@ -1,74 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts] //// - -=== /node_modules/@types/foo/index.d.mts === -export declare const x: "module"; ->x : "module" - -=== /node_modules/@types/foo/index.d.cts === -export declare const x: "script"; ->x : "script" - -=== /app.ts === -import type { x as Default } from "foo"; ->x : "module" ->Default : any - -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; ->x : "module" ->Import : any - -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; ->x : "script" ->Require : any - -type _Default = typeof Default; ->_Default : "module" ->Default : "module" - -type _Import = typeof Import; ->_Import : "module" ->Import : "module" - -type _Require = typeof Require; ->_Require : "script" ->Require : "script" - -// resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; ->x : "other" ->ImportRelative : any - -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; ->x : "other" ->RequireRelative : any - -type _ImportRelative = typeof ImportRelative; ->_ImportRelative : "other" ->ImportRelative : "other" - -type _RequireRelative = typeof RequireRelative; ->_RequireRelative : "other" ->RequireRelative : "other" - -export { - _Default, ->_Default : any - - _Import, ->_Import : any - - _Require, ->_Require : any - - _ImportRelative, ->_ImportRelative : any - - _RequireRelative ->_RequireRelative : any -} - -=== /other.ts === -export const x = "other"; ->x : "other" ->"other" : "other" - diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).types.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).types.diff deleted file mode 100644 index 6ac50255e8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).types.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.resolutionModeTypeOnlyImport1(moduleresolution=node10).types -+++ new.resolutionModeTypeOnlyImport1(moduleresolution=node10).types -@@= skipped -9, +9 lines =@@ - - === /app.ts === - import type { x as Default } from "foo"; -->x : any -+>x : "module" - >Default : any - - import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -@@= skipped -12, +12 lines =@@ - >Require : any - - type _Default = typeof Default; -->_Default : any -->Default : any -+>_Default : "module" -+>Default : "module" - - type _Import = typeof Import; - >_Import : "module" \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff index b8241f1ff0..09efca276a 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff @@ -1,6 +1,13 @@ --- old.untypedModuleImport_allowJs.symbols +++ new.untypedModuleImport_allowJs.symbols -@@= skipped -11, +11 lines =@@ +@@= skipped -4, +4 lines =@@ + >foo : Symbol(foo, Decl(a.ts, 0, 6)) + + foo.bar(); ++>foo.bar : Symbol(bar, Decl(index.js, 0, 19)) + >foo : Symbol(foo, Decl(a.ts, 0, 6)) ++>bar : Symbol(bar, Decl(index.js, 0, 19)) + === /node_modules/foo/index.js === exports.default = { bar() { return 0; } } >exports.default : Symbol(default, Decl(index.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).errors.txt.diff deleted file mode 100644 index 0e9b1a3815..0000000000 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).errors.txt -+++ new.verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).errors.txt -@@= skipped -0, +0 lines =@@ - /main.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. --/main.ts(3,8): error TS1259: Module '"/decl"' can only be default-imported using the 'allowSyntheticDefaultImports' flag - - - ==== /decl.d.ts (0 errors) ==== -@@= skipped -15, +14 lines =@@ - interface Typey {} - export type { Typey }; - --==== /main.ts (2 errors) ==== -+==== /main.ts (1 errors) ==== - import CJSy = require("./decl"); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. - import type CJSy2 = require("./decl"); // ok I guess? - import CJSy3 from "./decl"; // ok in esModuleInterop -- ~~~~~ --!!! error TS1259: Module '"/decl"' can only be default-imported using the 'allowSyntheticDefaultImports' flag --!!! related TS2594 /decl.d.ts:2:1: This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. - import * as types from "./types"; // ok - CJSy; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).types.diff b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).types.diff deleted file mode 100644 index fc8ad07d46..0000000000 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).types -+++ new.verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).types -@@= skipped -30, +30 lines =@@ - >CJSy2 : typeof CJSy - - import CJSy3 from "./decl"; // ok in esModuleInterop -->CJSy3 : any -+>CJSy3 : typeof CJSy - - import * as types from "./types"; // ok - >types : typeof types \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit1(module=commonjs).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit1(module=commonjs).errors.txt.diff deleted file mode 100644 index 716f7eb3e0..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit1(module=commonjs).errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.impliedNodeFormatEmit1(module=commonjs).errors.txt -+++ new.impliedNodeFormatEmit1(module=commonjs).errors.txt -@@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -- -- --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. --==== /a.ts (0 errors) ==== -- export const _ = 0; -- --==== /b.mts (0 errors) ==== -- export const _ = 0; -- --==== /c.cts (0 errors) ==== -- export const _ = 0; -- --==== /d.js (0 errors) ==== -- export const _ = 0; -- --==== /e.mjs (0 errors) ==== -- export const _ = 0; -- --==== /f.mjs (0 errors) ==== -- export const _ = 0; -- --==== /g.ts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /h.mts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /i.cts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /dummy.ts (0 errors) ==== -- export {}; -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit2(module=commonjs).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit2(module=commonjs).errors.txt.diff deleted file mode 100644 index b7f0510dc4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit2(module=commonjs).errors.txt.diff +++ /dev/null @@ -1,44 +0,0 @@ ---- old.impliedNodeFormatEmit2(module=commonjs).errors.txt -+++ new.impliedNodeFormatEmit2(module=commonjs).errors.txt -@@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -- -- --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. --==== /package.json (0 errors) ==== -- {} -- --==== /a.ts (0 errors) ==== -- export const _ = 0; -- --==== /b.mts (0 errors) ==== -- export const _ = 0; -- --==== /c.cts (0 errors) ==== -- export const _ = 0; -- --==== /d.js (0 errors) ==== -- export const _ = 0; -- --==== /e.mjs (0 errors) ==== -- export const _ = 0; -- --==== /f.mjs (0 errors) ==== -- export const _ = 0; -- --==== /g.ts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /h.mts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /i.cts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /dummy.ts (0 errors) ==== -- export {}; -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit3(module=commonjs).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit3(module=commonjs).errors.txt.diff deleted file mode 100644 index 1542eb27fb..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit3(module=commonjs).errors.txt.diff +++ /dev/null @@ -1,46 +0,0 @@ ---- old.impliedNodeFormatEmit3(module=commonjs).errors.txt -+++ new.impliedNodeFormatEmit3(module=commonjs).errors.txt -@@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -- -- --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. --==== /package.json (0 errors) ==== -- { -- "type": "module" -- } -- --==== /a.ts (0 errors) ==== -- export const _ = 0; -- --==== /b.mts (0 errors) ==== -- export const _ = 0; -- --==== /c.cts (0 errors) ==== -- export const _ = 0; -- --==== /d.js (0 errors) ==== -- export const _ = 0; -- --==== /e.mjs (0 errors) ==== -- export const _ = 0; -- --==== /f.mjs (0 errors) ==== -- export const _ = 0; -- --==== /g.ts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /h.mts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /i.cts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /dummy.ts (0 errors) ==== -- export {}; -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit4(module=commonjs).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit4(module=commonjs).errors.txt.diff deleted file mode 100644 index 5bcce73555..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/impliedNodeFormatEmit4(module=commonjs).errors.txt.diff +++ /dev/null @@ -1,46 +0,0 @@ ---- old.impliedNodeFormatEmit4(module=commonjs).errors.txt -+++ new.impliedNodeFormatEmit4(module=commonjs).errors.txt -@@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -- -- --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. --==== /package.json (0 errors) ==== -- { -- "type": "commonjs" -- } -- --==== /a.ts (0 errors) ==== -- export const _ = 0; -- --==== /b.mts (0 errors) ==== -- export const _ = 0; -- --==== /c.cts (0 errors) ==== -- export const _ = 0; -- --==== /d.js (0 errors) ==== -- export const _ = 0; -- --==== /e.mjs (0 errors) ==== -- export const _ = 0; -- --==== /f.mjs (0 errors) ==== -- export const _ = 0; -- --==== /g.ts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /h.mts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /i.cts (0 errors) ==== -- import {} from "./a"; -- import a = require("./a"); -- --==== /dummy.ts (0 errors) ==== -- export {}; -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.errors.txt.diff deleted file mode 100644 index f5b43be1b6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.javascriptImportDefaultBadExport.errors.txt -+++ new.javascriptImportDefaultBadExport.errors.txt -@@= skipped -0, +0 lines =@@ --/b.js(1,8): error TS1259: Module '"/a"' can only be default-imported using the 'esModuleInterop' flag -- -- --==== /a.js (0 errors) ==== -- const alias = {}; -- module.exports = alias; -- --==== /b.js (1 errors) ==== -- import a from "./a"; -- ~ --!!! error TS1259: Module '"/a"' can only be default-imported using the 'esModuleInterop' flag --!!! related TS2594 /a.js:2:1: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag. -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff index aeec21acd4..784ed9da3d 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff @@ -8,8 +8,3 @@ +>module : { readonly alias: {}; } >exports : {} >alias : {} - - === /b.js === - import a from "./a"; -->a : any -+>a : {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithExtensions_withPaths.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithExtensions_withPaths.errors.txt.diff index e6c2e15dc9..eabb80cb29 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithExtensions_withPaths.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithExtensions_withPaths.errors.txt.diff @@ -1,55 +1,34 @@ --- old.moduleResolutionWithExtensions_withPaths.errors.txt +++ new.moduleResolutionWithExtensions_withPaths.errors.txt @@= skipped -0, +0 lines =@@ -- +-/tsconfig.json(7,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +/tsconfig.json(6,3): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. + Use '"paths": {"*": ["./*"]}' instead. +/tsconfig.json(11,14): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? + + +==== /tsconfig.json (2 errors) ==== -+ { -+ "compilerOptions": { -+ "outDir": "lib", -+ "target": "ES6", -+ "module": "ES6", -+ "baseUrl": "/", + { + "compilerOptions": { + "outDir": "lib", + "target": "ES6", + "module": "ES6", + "baseUrl": "/", + ~~~~~~~~~ +!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. +!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "moduleResolution": "Node", -+ "noImplicitAny": true, -+ "traceResolution": true, -+ "paths": { -+ "foo/*": ["node_modules/foo/lib/*"] + "moduleResolution": "Node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. + "noImplicitAny": true, + "traceResolution": true, + "paths": { + "foo/*": ["node_modules/foo/lib/*"] + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ } -+ } -+ } -+ -+==== /relative.d.ts (0 errors) ==== -+ export declare function relative(): void; -+ -+ -+==== /test.ts (0 errors) ==== -+ import { test } from "foo/test.js"; -+ import { test as test2 } from "foo/test"; -+ import { relative } from "./relative.js"; -+ import { relative as relative2 } from "./relative"; -+ -+ -+ -+==== /node_modules/foo/lib/test.js (0 errors) ==== -+ export function test() { -+ console.log("test"); -+ } -+ -+==== /node_modules/foo/lib/test.d.ts (0 errors) ==== -+ export declare function test(): void; -+ -+==== /relative.js (0 errors) ==== -+ export function relative() { -+ console.log("test"); -+ } -+ \ No newline at end of file + } + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt.diff index 2b671ba16c..1dc67f7b32 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt.diff @@ -1,7 +1,10 @@ --- old.moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt +++ new.moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt @@= skipped -0, +0 lines =@@ -- +-/tsconfig.json(6,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +/tsconfig.json(9,3): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. + Use '"paths": {"*": ["./*"]}' instead. +/tsconfig.json(11,21): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? @@ -9,46 +12,27 @@ + + +==== /tsconfig.json (3 errors) ==== -+ { -+ "compilerOptions": { -+ "allowJs": true, -+ "checkJs": false, -+ "outDir": "bin", -+ "moduleResolution": "node", -+ "traceResolution": true, -+ "moduleSuffixes": [".ios"], -+ "baseUrl": "/", + { + "compilerOptions": { + "allowJs": true, + "checkJs": false, + "outDir": "bin", + "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. + "traceResolution": true, + "moduleSuffixes": [".ios"], + "baseUrl": "/", + ~~~~~~~~~ +!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. +!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "some-library": ["node_modules/some-library/lib"], + "paths": { + "some-library": ["node_modules/some-library/lib"], + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ "some-library/*": ["node_modules/some-library/lib/*"] + "some-library/*": ["node_modules/some-library/lib/*"] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ } -+ } -+ } -+ -+==== /test.ts (0 errors) ==== -+ import { ios } from "some-library"; -+ import { ios as ios2 } from "some-library/index"; -+ import { ios as ios3 } from "some-library/index.js"; -+ -+==== /node_modules/some-library/lib/index.ios.js (0 errors) ==== -+ "use strict"; -+ exports.__esModule = true; -+ function ios() {} -+ exports.ios = ios; -+==== /node_modules/some-library/lib/index.ios.d.ts (0 errors) ==== -+ export declare function ios(): void; -+==== /node_modules/some-library/lib/index.js (0 errors) ==== -+ "use strict"; -+ exports.__esModule = true; -+ function base() {} -+ exports.base = base; -+==== /node_modules/some-library/lib/index.d.ts (0 errors) ==== -+ export declare function base(): void; -+ \ No newline at end of file + } + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_jsModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_jsModule.errors.txt.diff new file mode 100644 index 0000000000..80d11e391b --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_jsModule.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.moduleResolutionWithSuffixes_one_jsModule.errors.txt ++++ new.moduleResolutionWithSuffixes_one_jsModule.errors.txt +@@= skipped -0, +0 lines =@@ +-/tsconfig.json(6,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- +- +-==== /tsconfig.json (1 errors) ==== +- { +- "compilerOptions": { +- "allowJs": true, +- "checkJs": false, +- "outDir": "bin", +- "moduleResolution": "node", +- ~~~~~~ +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +- "traceResolution": true, +- "moduleSuffixes": [".ios"] +- } +- } +- +-==== /index.ts (0 errors) ==== +- import { ios } from "./foo.js"; +-==== /foo.ios.js (0 errors) ==== +- "use strict"; +- exports.__esModule = true; +- function ios() {} +- exports.ios = ios; +-==== /foo.js (0 errors) ==== +- "use strict"; +- exports.__esModule = true; +- function base() {} +- exports.base = base; +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/extensionLoadingPriority(moduleresolution=bundler).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/extensionLoadingPriority(moduleresolution=bundler).errors.txt.diff deleted file mode 100644 index 61cf962fad..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/extensionLoadingPriority(moduleresolution=bundler).errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.extensionLoadingPriority(moduleresolution=bundler).errors.txt -+++ new.extensionLoadingPriority(moduleresolution=bundler).errors.txt -@@= skipped -0, +0 lines =@@ --error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -- -- --!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. --==== /project/a.js (0 errors) ==== -- export default "a.js"; -- --==== /project/a.js.js (0 errors) ==== -- export default "a.js.js"; -- --==== /project/dir/index.ts (0 errors) ==== -- export default "dir/index.ts"; -- --==== /project/dir.js (0 errors) ==== -- export default "dir.js"; -- --==== /project/b.ts (0 errors) ==== -- import a from "./a.js"; -- import dir from "./dir"; -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/extensionLoadingPriority(moduleresolution=node).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/extensionLoadingPriority(moduleresolution=node).types.diff deleted file mode 100644 index 9d61d367b4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/extensionLoadingPriority(moduleresolution=node).types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.extensionLoadingPriority(moduleresolution=node).types -+++ new.extensionLoadingPriority(moduleresolution=node).types -@@= skipped -20, +20 lines =@@ - >a : "a.js" - - import dir from "./dir"; -->dir : "dir/index.ts" -+>dir : "dir.js" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff index cec346e587..a6775022ac 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff @@ -1,13 +1,19 @@ --- old.node10AlternateResult_noResolution.errors.txt +++ new.node10AlternateResult_noResolution.errors.txt @@= skipped -0, +0 lines =@@ +-error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -/index.ts(1,21): error TS2307: Cannot find module 'pkg' or its corresponding type declarations. - There are types at '/node_modules/pkg/definitely-not-index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. +- +- +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +/index.ts(1,10): error TS2305: Module '"pkg"' has no exported member 'pkg'. - - ++ ++ ==== /node_modules/pkg/package.json (0 errors) ==== -@@= skipped -15, +14 lines =@@ + { + "name": "pkg", +@@= skipped -17, +14 lines =@@ ==== /index.ts (1 errors) ==== import { pkg } from "pkg"; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff index cbdb934c2a..7a0400b9f7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff @@ -1,6 +1,7 @@ --- old.node10Alternateresult_noTypes.errors.txt +++ new.node10Alternateresult_noTypes.errors.txt @@= skipped -0, +0 lines =@@ +-error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -error TS6504: File '/node_modules/pkg/untyped.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? - The file is in the program because: - Root file specified for compilation @@ -8,6 +9,7 @@ - There are types at '/node_modules/pkg/definitely-not-index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. - - +-!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -!!! error TS6504: File '/node_modules/pkg/untyped.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? -!!! error TS6504: The file is in the program because: -!!! error TS6504: Root file specified for compilation @@ -17,7 +19,7 @@ ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", -@@= skipped -25, +18 lines =@@ +@@= skipped -27, +18 lines =@@ ==== /index.ts (1 errors) ==== import { pkg } from "pkg"; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.errors.txt.diff new file mode 100644 index 0000000000..1d8aabb7f2 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.errors.txt.diff @@ -0,0 +1,16 @@ +--- old.untypedModuleImport_allowJs.errors.txt ++++ new.untypedModuleImport_allowJs.errors.txt +@@= skipped -0, +0 lines =@@ +-/a.ts(2,5): error TS2339: Property 'bar' does not exist on type 'typeof import("/node_modules/foo/index")'. +- +- +-==== /a.ts (1 errors) ==== +- import foo from "foo"; +- foo.bar(); +- ~~~ +-!!! error TS2339: Property 'bar' does not exist on type 'typeof import("/node_modules/foo/index")'. +- +-==== /node_modules/foo/index.js (0 errors) ==== +- exports.default = { bar() { return 0; } } +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff new file mode 100644 index 0000000000..ede066d4fe --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff @@ -0,0 +1,21 @@ +--- old.untypedModuleImport_allowJs.types ++++ new.untypedModuleImport_allowJs.types +@@= skipped -1, +1 lines =@@ + + === /a.ts === + import foo from "foo"; +->foo : typeof foo ++>foo : { bar(): number; } + + foo.bar(); +->foo.bar() : any +->foo.bar : any +->foo : typeof foo +->bar : any ++>foo.bar() : number ++>foo.bar : () => number ++>foo : { bar(): number; } ++>bar : () => number + + === /node_modules/foo/index.js === + exports.default = { bar() { return 0; } } \ No newline at end of file From 0a61d1a166bca5715dc4fd116bcf08e11bcc1c80 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 20 Oct 2025 15:45:08 -0700 Subject: [PATCH 013/152] Disable create-cache.yml in forks (#1912) --- .github/workflows/create-cache.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-cache.yml b/.github/workflows/create-cache.yml index df7cf27b7d..7e7eff9783 100644 --- a/.github/workflows/create-cache.yml +++ b/.github/workflows/create-cache.yml @@ -20,6 +20,8 @@ defaults: jobs: cache: + if: github.repository == 'microsoft/typescript-go' + strategy: fail-fast: false matrix: From 55cbeadf4586dddcb859e6021939ae4816bcd12a Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 20 Oct 2025 19:11:30 -0700 Subject: [PATCH 014/152] Forbid platform specific package uses in agnostic files (#1911) --- .golangci.yml | 20 ++++++++++++++++++++ cmd/tsgo/lsp.go | 14 +++++++++++++- internal/fourslash/fourslash.go | 3 ++- internal/lsp/server.go | 17 ++++++----------- internal/tspath/extension.go | 2 +- 5 files changed, 42 insertions(+), 14 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index afb62f07e9..5212cb09a7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,6 +22,7 @@ linters: - errname - errorlint - fatcontext + - forbidigo - gocheckcompilerdirectives - goprintffuncname - govet @@ -70,11 +71,30 @@ linters: - pkg: 'encoding/json$' desc: 'Use "github.com/go-json-experiment/json" instead.' + forbidigo: + analyze-types: true + forbid: + - pattern: '.*' + msg: tspath should likely be used instead + pkg: ^(path|path/filepath)$ + - pattern: '.*' + msg: a host implementation should likely be used instead + pkg: ^os/ + - pattern: 'GOOS' + msg: a host implementation should likely be used instead + pkg: ^runtime$ + exclusions: rules: - path: internal/fourslash/tests/gen/ linters: - misspell + - path: 'internal/(repo|testutil|testrunner|vfs|pprof|execute/tsctests|bundled)|cmd/tsgo' + text: should likely be used instead + - path: '(.+)_test\.go$' + text: should likely be used instead + - path: '_tools' + text: should likely be used instead presets: - comments diff --git a/cmd/tsgo/lsp.go b/cmd/tsgo/lsp.go index 35c973a3a0..0dd04c57fb 100644 --- a/cmd/tsgo/lsp.go +++ b/cmd/tsgo/lsp.go @@ -1,10 +1,14 @@ package main import ( + "context" "flag" "fmt" "os" + "os/exec" + "os/signal" "runtime" + "syscall" "github.com/microsoft/typescript-go/internal/bundled" "github.com/microsoft/typescript-go/internal/core" @@ -49,9 +53,17 @@ func runLSP(args []string) int { FS: fs, DefaultLibraryPath: defaultLibraryPath, TypingsLocation: typingsLocation, + NpmInstall: func(cwd string, args []string) ([]byte, error) { + cmd := exec.Command("npm", args...) + cmd.Dir = cwd + return cmd.Output() + }, }) - if err := s.Run(); err != nil { + ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) + defer stop() + + if err := s.Run(ctx); err != nil { return 1 } return 0 diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 8c64ea2f90..ddac550413 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -1,6 +1,7 @@ package fourslash import ( + "context" "fmt" "io" "maps" @@ -164,7 +165,7 @@ func NewFourslash(t *testing.T, capabilities *lsproto.ClientCapabilities, conten defer func() { outputWriter.Close() }() - err := server.Run() + err := server.Run(context.TODO()) if err != nil { t.Error("server error:", err) } diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 54f78f2e16..2265ebb344 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -5,14 +5,10 @@ import ( "errors" "fmt" "io" - "os" - "os/exec" - "os/signal" "runtime/debug" "slices" "sync" "sync/atomic" - "syscall" "time" "github.com/go-json-experiment/json" @@ -39,6 +35,7 @@ type ServerOptions struct { DefaultLibraryPath string TypingsLocation string ParseCache *project.ParseCache + NpmInstall func(cwd string, args []string) ([]byte, error) } func NewServer(opts *ServerOptions) *Server { @@ -59,6 +56,7 @@ func NewServer(opts *ServerOptions) *Server { defaultLibraryPath: opts.DefaultLibraryPath, typingsLocation: opts.TypingsLocation, parseCache: opts.ParseCache, + npmInstall: opts.NpmInstall, } } @@ -157,6 +155,8 @@ type Server struct { compilerOptionsForInferredProjects *core.CompilerOptions // parseCache can be passed in so separate tests can share ASTs parseCache *project.ParseCache + + npmInstall func(cwd string, args []string) ([]byte, error) } // WatchFiles implements project.Client. @@ -218,10 +218,7 @@ func (s *Server) RefreshDiagnostics(ctx context.Context) error { return nil } -func (s *Server) Run() error { - ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) - defer stop() - +func (s *Server) Run(ctx context.Context) error { g, ctx := errgroup.WithContext(ctx) g.Go(func() error { return s.dispatchLoop(ctx) }) g.Go(func() error { return s.writeLoop(ctx) }) @@ -877,9 +874,7 @@ func (s *Server) SetCompilerOptionsForInferredProjects(ctx context.Context, opti // NpmInstall implements ata.NpmExecutor func (s *Server) NpmInstall(cwd string, args []string) ([]byte, error) { - cmd := exec.Command("npm", args...) - cmd.Dir = cwd - return cmd.Output() + return s.npmInstall(cwd, args) } func isBlockingMethod(method lsproto.Method) bool { diff --git a/internal/tspath/extension.go b/internal/tspath/extension.go index cc30d48a66..1b4422e791 100644 --- a/internal/tspath/extension.go +++ b/internal/tspath/extension.go @@ -51,7 +51,7 @@ func RemoveFileExtension(path string) string { } } // Otherwise just remove single dot extension, if any - return path[:len(path)-len(filepath.Ext(path))] + return path[:len(path)-len(filepath.Ext(path))] //nolint:forbidigo } func TryGetExtensionFromPath(p string) string { From 62fcda71d91eeda9ba619a42351f8e494e0659f0 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Oct 2025 08:41:35 -0700 Subject: [PATCH 015/152] Fix JSDoc comment formatting with tab indentation (#1900) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- internal/format/comment_test.go | 37 +++++++++++++++++++++++++++++++++ internal/format/span.go | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/internal/format/comment_test.go b/internal/format/comment_test.go index b7063bfe5d..50762ab56d 100644 --- a/internal/format/comment_test.go +++ b/internal/format/comment_test.go @@ -64,6 +64,43 @@ func TestCommentFormatting(t *testing.T) { assert.Check(t, !contains(secondFormatted, " sync x()"), "should not corrupt async to sync") assert.Check(t, contains(secondFormatted, "async"), "should preserve async keyword on second pass") }) + + t.Run("format JSDoc with tab indentation", func(t *testing.T) { + t.Parallel() + ctx := format.WithFormatCodeSettings(t.Context(), &format.FormatCodeSettings{ + EditorSettings: format.EditorSettings{ + TabSize: 4, + IndentSize: 4, + BaseIndentSize: 0, + NewLineCharacter: "\n", + ConvertTabsToSpaces: false, // Use tabs + IndentStyle: format.IndentStyleSmart, + TrimTrailingWhitespace: true, + }, + InsertSpaceBeforeTypeAnnotation: core.TSTrue, + }, "\n") + + // Original code with tab indentation (tabs represented as \t) + originalText := "class Foo {\n\t/**\n\t * @param {string} argument - This is a param description.\n\t */\n\texample(argument) {\nconsole.log(argument);\n\t}\n}" + + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/test.ts", + Path: "/test.ts", + }, originalText, core.ScriptKindTS) + + // Apply formatting + edits := format.FormatDocument(ctx, sourceFile) + formatted := applyBulkEdits(originalText, edits) + + // Check that tabs come before spaces (not spaces before tabs) + // The comment lines should have format: tab followed by space and asterisk + // NOT: space followed by tab and asterisk + assert.Check(t, !contains(formatted, " \t*"), "should not have space before tab before asterisk") + assert.Check(t, contains(formatted, "\t *"), "should have tab before space before asterisk") + + // Verify console.log is properly indented with tabs + assert.Check(t, contains(formatted, "\t\tconsole.log"), "console.log should be indented with two tabs") + }) } func contains(s, substr string) bool { diff --git a/internal/format/span.go b/internal/format/span.go index 4657949f7e..c8d0096bed 100644 --- a/internal/format/span.go +++ b/internal/format/span.go @@ -975,7 +975,7 @@ func getIndentationString(indentation int, options *FormatCodeSettings) string { spaces := indentation - (tabs * options.TabSize) res := strings.Repeat("\t", tabs) if spaces > 0 { - res = strings.Repeat(" ", spaces) + res + res = res + strings.Repeat(" ", spaces) } return res From d491e609b5e584a712bfd2510ae466e54fb961fb Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 22 Oct 2025 10:12:01 -0700 Subject: [PATCH 016/152] Clear local baseline dir in hereby test (#1921) --- Herebyfile.mjs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Herebyfile.mjs b/Herebyfile.mjs index b43a2b0115..b1b7e03b91 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -57,6 +57,7 @@ const { values: rawOptions } = parseArgs({ tests: { type: "string", short: "t" }, fix: { type: "boolean" }, debug: { type: "boolean" }, + dirty: { type: "boolean" }, insiders: { type: "boolean" }, @@ -325,6 +326,12 @@ function goTest(taskName) { async function runTests() { warnIfTypeScriptSubmoduleNotCloned(); + + if (!options.dirty) { + await rimraf(localBaseline); + await fs.promises.mkdir(localBaseline, { recursive: true }); + } + await $test`${gotestsum("tests")} ./... ${isCI ? ["--timeout=45m"] : []}`; } @@ -520,10 +527,13 @@ function baselineAcceptTask(localBaseline, refBaseline) { }; } +const localBaseline = "testdata/baselines/local/"; +const refBaseline = "testdata/baselines/reference/"; + export const baselineAccept = task({ name: "baseline-accept", description: "Makes the most recent test results the new baseline, overwriting the old baseline.", - run: baselineAcceptTask("testdata/baselines/local/", "testdata/baselines/reference/"), + run: baselineAcceptTask(localBaseline, refBaseline), }); /** From 58d4391f109239e3cbbe0ef183d7692ca596753f Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:41:05 -0700 Subject: [PATCH 017/152] Unskip passing fourslash test (#1922) --- internal/fourslash/_scripts/failingTests.txt | 1 - .../gen/findAllRefsForDefaultExport03_test.go | 2 +- ...ndAllRefsForDefaultExport03.baseline.jsonc | 141 ++++++++++++++++++ 3 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport03.baseline.jsonc diff --git a/internal/fourslash/_scripts/failingTests.txt b/internal/fourslash/_scripts/failingTests.txt index 1db2b09ce7..09435b6337 100644 --- a/internal/fourslash/_scripts/failingTests.txt +++ b/internal/fourslash/_scripts/failingTests.txt @@ -167,7 +167,6 @@ TestDoubleUnderscoreCompletions TestEditJsdocType TestExportDefaultClass TestExportDefaultFunction -TestFindAllRefsForDefaultExport03 TestFindAllRefsForModule TestFindAllRefsModuleDotExports TestFindReferencesBindingPatternInJsdocNoCrash1 diff --git a/internal/fourslash/tests/gen/findAllRefsForDefaultExport03_test.go b/internal/fourslash/tests/gen/findAllRefsForDefaultExport03_test.go index f41ebfe43a..85578f9b73 100644 --- a/internal/fourslash/tests/gen/findAllRefsForDefaultExport03_test.go +++ b/internal/fourslash/tests/gen/findAllRefsForDefaultExport03_test.go @@ -9,7 +9,7 @@ import ( func TestFindAllRefsForDefaultExport03(t *testing.T) { t.Parallel() - t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `/*1*/function /*2*/f() { return 100; diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport03.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport03.baseline.jsonc new file mode 100644 index 0000000000..137945bf4a --- /dev/null +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForDefaultExport03.baseline.jsonc @@ -0,0 +1,141 @@ +// === findAllReferences === +// === /findAllRefsForDefaultExport03.ts === +// /*FIND ALL REFS*/function [|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + + + +// === findAllReferences === +// === /findAllRefsForDefaultExport03.ts === +// function /*FIND ALL REFS*/[|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + + + +// === findAllReferences === +// === /findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// /*FIND ALL REFS*/export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + + + +// === findAllReferences === +// === /findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// export default /*FIND ALL REFS*/[|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + + + +// === findAllReferences === +// === /findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof /*FIND ALL REFS*/[|f|]; +// +// var y = [|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + + + +// === findAllReferences === +// === /findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = /*FIND ALL REFS*/[|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + + + +// === findAllReferences === +// === /findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// /*FIND ALL REFS*/namespace [|f|] { +// var local = 100; +// } + + + +// === findAllReferences === +// === /findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// namespace /*FIND ALL REFS*/[|f|] { +// var local = 100; +// } \ No newline at end of file From 087464231ae849d7cd71df9e89e1bff4b40303d1 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 22 Oct 2025 11:46:43 -0700 Subject: [PATCH 018/152] Support auto-import completion fourslash tests, fix bugs (#1917) --- .../fourslash/_scripts/convertFourslash.mts | 310 +++++++++++++++++- internal/fourslash/_scripts/failingTests.txt | 78 ++++- internal/fourslash/fourslash.go | 236 +++++++++++-- ...portCompletionAmbientMergedModule1_test.go | 78 +++++ ...CompletionExportEqualsWithDefault1_test.go | 104 ++++++ ...tCompletionExportListAugmentation1_test.go | 70 ++++ ...tCompletionExportListAugmentation2_test.go | 80 +++++ ...tCompletionExportListAugmentation3_test.go | 69 ++++ ...tCompletionExportListAugmentation4_test.go | 78 +++++ .../autoImportFileExcludePatterns3_test.go | 71 ++++ .../autoImportPathsAliasesAndBarrels_test.go | 83 +++++ .../tests/gen/autoImportProvider6_test.go | 50 +++ .../gen/autoImportProvider_exportMap1_test.go | 83 +++++ .../gen/autoImportProvider_exportMap2_test.go | 76 +++++ .../gen/autoImportProvider_exportMap3_test.go | 69 ++++ .../gen/autoImportProvider_exportMap4_test.go | 72 ++++ .../gen/autoImportProvider_exportMap5_test.go | 94 ++++++ .../gen/autoImportProvider_exportMap6_test.go | 101 ++++++ .../gen/autoImportProvider_exportMap7_test.go | 85 +++++ .../gen/autoImportProvider_exportMap8_test.go | 103 ++++++ .../gen/autoImportProvider_exportMap9_test.go | 73 +++++ ...oImportProvider_globalTypingsCache_test.go | 57 ++++ ...vider_namespaceSameNameAsIntrinsic_test.go | 57 ++++ ...utoImportProvider_wildcardExports1_test.go | 122 +++++++ ...utoImportProvider_wildcardExports2_test.go | 67 ++++ ...utoImportProvider_wildcardExports3_test.go | 71 ++++ ...utoImportReExportFromAmbientModule_test.go | 76 +++++ .../autoImportSameNameDefaultExported_test.go | 59 ++++ .../autoImportSortCaseSensitivity2_test.go | 56 ++++ .../gen/autoImportTypeOnlyPreferred1_test.go | 63 ++++ .../gen/autoImportVerbatimTypeOnly1_test.go | 52 +++ .../gen/completionForObjectProperty_test.go | 189 +++++++++++ .../completionInNamedImportLocation_test.go | 2 +- ...PropertyShorthandForObjectLiteral5_test.go | 45 +++ ...lassMemberImportTypeNodeParameter1_test.go | 47 +++ ...lassMemberImportTypeNodeParameter2_test.go | 45 +++ ...lassMemberImportTypeNodeParameter3_test.go | 49 +++ ...lassMemberImportTypeNodeParameter4_test.go | 47 +++ .../gen/completionsImportBaseUrl_test.go | 52 +++ ...mpletionsImportDefaultExportCrash2_test.go | 77 +++++ .../gen/completionsImportFromJSXTag_test.go | 45 +++ ...ionsImportModuleAugmentationWithJS_test.go | 47 +++ .../completionsImportPathsConflict_test.go | 68 ++++ .../gen/completionsImportTypeKeyword_test.go | 50 +++ .../completionsImportYieldExpression_test.go | 32 ++ .../tests/gen/completionsImport_46332_test.go | 101 ++++++ .../gen/completionsImport_ambient_test.go | 76 +++++ .../completionsImport_augmentation_test.go | 60 ++++ ...etionsImport_compilerOptionsModule_test.go | 65 ++++ ...ionsImport_defaultAndNamedConflict_test.go | 72 ++++ ...letionsImport_defaultFalsePositive_test.go | 58 ++++ ...nsImport_default_addToNamedImports_test.go | 54 +++ ...mport_default_addToNamespaceImport_test.go | 53 +++ ...t_default_alreadyExistedWithRename_test.go | 54 +++ ...ompletionsImport_default_anonymous_test.go | 69 ++++ ...nsImport_default_didNotExistBefore_test.go | 54 +++ ...rt_default_exportDefaultIdentifier_test.go | 56 ++++ ...ort_default_fromMergedDeclarations_test.go | 60 ++++ ...completionsImport_default_reExport_test.go | 64 ++++ ...mpletionsImport_default_symbolName_test.go | 62 ++++ ...sImport_details_withMisspelledName_test.go | 46 +++ ...atePackages_scopedTypesAndNotTypes_test.go | 74 +++++ ...port_duplicatePackages_scopedTypes_test.go | 74 +++++ ...onsImport_duplicatePackages_scoped_test.go | 74 +++++ ...duplicatePackages_typesAndNotTypes_test.go | 64 ++++ ...ionsImport_duplicatePackages_types_test.go | 74 +++++ ..._exportEqualsNamespace_noDuplicate_test.go | 52 +++ ...tionsImport_exportEquals_anonymous_test.go | 72 ++++ ...pletionsImport_exportEquals_global_test.go | 50 +++ .../completionsImport_exportEquals_test.go | 91 +++++ ...ilteredByInvalidPackageJson_direct_test.go | 73 +++++ ...lteredByPackageJson_@typesImplicit_test.go | 63 ++++ ...t_filteredByPackageJson_@typesOnly_test.go | 63 ++++ ...port_filteredByPackageJson_ambient_test.go | 153 +++++++++ ...mport_filteredByPackageJson_direct_test.go | 65 ++++ ...mport_filteredByPackageJson_nested_test.go | 89 +++++ ...eredByPackageJson_peerDependencies_test.go | 65 ++++ ...ompletionsImport_fromAmbientModule_test.go | 31 ++ .../gen/completionsImport_importType_test.go | 83 +++++ ...sImport_jsxOpeningTagImportDefault_test.go | 61 ++++ .../completionsImport_mergedReExport_test.go | 85 +++++ ...letionsImport_multipleWithSameName_test.go | 79 +++++ ...ionsImport_named_addToNamedImports_test.go | 54 +++ ...ionsImport_named_didNotExistBefore_test.go | 63 ++++ ...named_exportEqualsNamespace_merged_test.go | 53 +++ ...Import_named_exportEqualsNamespace_test.go | 57 ++++ ...mport_named_fromMergedDeclarations_test.go | 60 ++++ ...Import_named_namespaceImportExists_test.go | 53 +++ .../completionsImport_noSemicolons_test.go | 32 ++ ...ionsImport_ofAlias_preferShortPath_test.go | 59 ++++ ...mport_packageJsonImportsPreference_test.go | 77 +++++ ...mport_preferUpdatingExistingImport_test.go | 52 +++ ...onsImport_previousTokenIsSemicolon_test.go | 46 +++ .../gen/completionsImport_quoteStyle_test.go | 30 ++ ...completionsImport_reExportDefault2_test.go | 56 ++++ .../completionsImport_reExportDefault_test.go | 58 ++++ ...mpletionsImport_reExport_wrongName_test.go | 76 +++++ ...ompletionsImport_reexportTransient_test.go | 51 +++ .../completionsImport_require_addNew_test.go | 54 +++ ...etionsImport_require_addToExisting_test.go | 57 ++++ .../gen/completionsImport_require_test.go | 55 ++++ ...ionsImport_sortingModuleSpecifiers_test.go | 74 +++++ .../tests/gen/completionsImport_tsx_test.go | 49 +++ .../gen/completionsImport_typeOnly_test.go | 32 ++ ...mpletionsImport_umdDefaultNoCrash1_test.go | 70 ++++ ...onsImport_umdModules1_globalAccess_test.go | 49 +++ ...nsImport_umdModules2_moduleExports_test.go | 54 +++ ...mpletionsImport_umdModules3_script_test.go | 48 +++ ...onsImport_uriStyleNodeCoreModules1_test.go | 78 +++++ ...onsImport_uriStyleNodeCoreModules2_test.go | 60 ++++ ...etionsImport_weirdDefaultSynthesis_test.go | 34 ++ ...Import_windowsPathsProjectRelative_test.go | 131 ++++++++ .../completionsRecommended_namespace_test.go | 92 ++++++ .../completionsUniqueSymbol_import_test.go | 70 ++++ .../completionsWithDeprecatedTag10_test.go | 45 +++ .../importNameCodeFixDefaultExport6_test.go | 28 ++ .../importNameCodeFixExportAsDefault_test.go | 29 ++ ...rtSuggestionsCache_exportUndefined_test.go | 70 ++++ ...uggestionsCache_invalidPackageJson_test.go | 58 ++++ .../tests/gen/importTypeCompletions1_test.go | 50 +++ .../tests/gen/importTypeCompletions3_test.go | 50 +++ .../tests/gen/importTypeCompletions4_test.go | 51 +++ .../tests/gen/importTypeCompletions5_test.go | 52 +++ .../tests/gen/importTypeCompletions6_test.go | 51 +++ .../tests/gen/importTypeCompletions7_test.go | 56 ++++ .../tests/gen/importTypeCompletions8_test.go | 50 +++ .../tests/gen/importTypeCompletions9_test.go | 50 +++ .../tests/gen/jsFileImportNoTypes2_test.go | 84 +++++ .../gen/jsxTagNameCompletionClosed_test.go | 145 ++++++++ .../gen/jsxTagNameCompletionUnclosed_test.go | 145 ++++++++ ...agNameCompletionUnderElementClosed_test.go | 84 +++++ ...NameCompletionUnderElementUnclosed_test.go | 84 +++++ .../tests/gen/quickInfoOnNarrowedType_test.go | 2 +- internal/ls/autoimportfixes.go | 108 +++--- internal/ls/autoimports.go | 159 ++++++--- internal/ls/autoimportsexportinfo.go | 3 +- internal/ls/changetracker.go | 54 ++- internal/ls/changetrackerimpl.go | 4 +- internal/ls/completions.go | 113 +++---- internal/ls/organizeimports.go | 259 +++++++++++++++ internal/module/resolver.go | 5 +- internal/modulespecifiers/specifiers.go | 8 +- internal/packagejson/cache.go | 1 + internal/packagejson/packagejson.go | 27 ++ internal/stringutil/compare.go | 20 ++ .../autoImportCompletion2.baseline.md | 2 +- .../autoImportCompletion3.baseline.md | 2 +- ...arationErrorNotEmittedForNonEmittedFile.js | 85 +---- ...onErrorNotEmittedForNonEmittedFile.js.diff | 87 +---- ...arationsIndirectGeneratedAliasReference.js | 28 +- ...onsIndirectGeneratedAliasReference.js.diff | 32 -- .../nodeModuleReexportFromDottedPath.js | 29 +- .../nodeModuleReexportFromDottedPath.js.diff | 34 -- 153 files changed, 9715 insertions(+), 490 deletions(-) create mode 100644 internal/fourslash/tests/gen/autoImportCompletionAmbientMergedModule1_test.go create mode 100644 internal/fourslash/tests/gen/autoImportCompletionExportEqualsWithDefault1_test.go create mode 100644 internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation1_test.go create mode 100644 internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation2_test.go create mode 100644 internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation3_test.go create mode 100644 internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation4_test.go create mode 100644 internal/fourslash/tests/gen/autoImportFileExcludePatterns3_test.go create mode 100644 internal/fourslash/tests/gen/autoImportPathsAliasesAndBarrels_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider6_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_exportMap1_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_exportMap2_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_exportMap3_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_exportMap4_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_exportMap5_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_exportMap6_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_exportMap7_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_exportMap8_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_exportMap9_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_globalTypingsCache_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_namespaceSameNameAsIntrinsic_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_wildcardExports1_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_wildcardExports2_test.go create mode 100644 internal/fourslash/tests/gen/autoImportProvider_wildcardExports3_test.go create mode 100644 internal/fourslash/tests/gen/autoImportReExportFromAmbientModule_test.go create mode 100644 internal/fourslash/tests/gen/autoImportSameNameDefaultExported_test.go create mode 100644 internal/fourslash/tests/gen/autoImportSortCaseSensitivity2_test.go create mode 100644 internal/fourslash/tests/gen/autoImportTypeOnlyPreferred1_test.go create mode 100644 internal/fourslash/tests/gen/autoImportVerbatimTypeOnly1_test.go create mode 100644 internal/fourslash/tests/gen/completionForObjectProperty_test.go create mode 100644 internal/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral5_test.go create mode 100644 internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter1_test.go create mode 100644 internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter2_test.go create mode 100644 internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter3_test.go create mode 100644 internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter4_test.go create mode 100644 internal/fourslash/tests/gen/completionsImportBaseUrl_test.go create mode 100644 internal/fourslash/tests/gen/completionsImportDefaultExportCrash2_test.go create mode 100644 internal/fourslash/tests/gen/completionsImportFromJSXTag_test.go create mode 100644 internal/fourslash/tests/gen/completionsImportModuleAugmentationWithJS_test.go create mode 100644 internal/fourslash/tests/gen/completionsImportPathsConflict_test.go create mode 100644 internal/fourslash/tests/gen/completionsImportTypeKeyword_test.go create mode 100644 internal/fourslash/tests/gen/completionsImportYieldExpression_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_46332_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_ambient_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_augmentation_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_compilerOptionsModule_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_defaultAndNamedConflict_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_defaultFalsePositive_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_default_addToNamedImports_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_default_addToNamespaceImport_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_default_alreadyExistedWithRename_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_default_anonymous_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_default_didNotExistBefore_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_default_exportDefaultIdentifier_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_default_fromMergedDeclarations_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_default_reExport_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_default_symbolName_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_details_withMisspelledName_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypesAndNotTypes_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypes_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_duplicatePackages_scoped_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_duplicatePackages_typesAndNotTypes_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_duplicatePackages_types_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_exportEqualsNamespace_noDuplicate_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_exportEquals_anonymous_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_exportEquals_global_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_exportEquals_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_filteredByInvalidPackageJson_direct_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesImplicit_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesOnly_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_ambient_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_direct_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_nested_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_peerDependencies_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_fromAmbientModule_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_importType_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_jsxOpeningTagImportDefault_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_mergedReExport_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_multipleWithSameName_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_named_addToNamedImports_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_named_didNotExistBefore_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_named_exportEqualsNamespace_merged_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_named_exportEqualsNamespace_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_named_fromMergedDeclarations_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_named_namespaceImportExists_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_noSemicolons_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_ofAlias_preferShortPath_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_packageJsonImportsPreference_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_preferUpdatingExistingImport_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_previousTokenIsSemicolon_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_quoteStyle_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_reExportDefault2_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_reExportDefault_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_reExport_wrongName_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_reexportTransient_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_require_addNew_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_require_addToExisting_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_require_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_sortingModuleSpecifiers_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_tsx_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_typeOnly_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash1_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_umdModules1_globalAccess_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_umdModules2_moduleExports_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_umdModules3_script_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules1_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules2_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_weirdDefaultSynthesis_test.go create mode 100644 internal/fourslash/tests/gen/completionsImport_windowsPathsProjectRelative_test.go create mode 100644 internal/fourslash/tests/gen/completionsRecommended_namespace_test.go create mode 100644 internal/fourslash/tests/gen/completionsUniqueSymbol_import_test.go create mode 100644 internal/fourslash/tests/gen/completionsWithDeprecatedTag10_test.go create mode 100644 internal/fourslash/tests/gen/importNameCodeFixDefaultExport6_test.go create mode 100644 internal/fourslash/tests/gen/importNameCodeFixExportAsDefault_test.go create mode 100644 internal/fourslash/tests/gen/importSuggestionsCache_exportUndefined_test.go create mode 100644 internal/fourslash/tests/gen/importSuggestionsCache_invalidPackageJson_test.go create mode 100644 internal/fourslash/tests/gen/importTypeCompletions1_test.go create mode 100644 internal/fourslash/tests/gen/importTypeCompletions3_test.go create mode 100644 internal/fourslash/tests/gen/importTypeCompletions4_test.go create mode 100644 internal/fourslash/tests/gen/importTypeCompletions5_test.go create mode 100644 internal/fourslash/tests/gen/importTypeCompletions6_test.go create mode 100644 internal/fourslash/tests/gen/importTypeCompletions7_test.go create mode 100644 internal/fourslash/tests/gen/importTypeCompletions8_test.go create mode 100644 internal/fourslash/tests/gen/importTypeCompletions9_test.go create mode 100644 internal/fourslash/tests/gen/jsFileImportNoTypes2_test.go create mode 100644 internal/fourslash/tests/gen/jsxTagNameCompletionClosed_test.go create mode 100644 internal/fourslash/tests/gen/jsxTagNameCompletionUnclosed_test.go create mode 100644 internal/fourslash/tests/gen/jsxTagNameCompletionUnderElementClosed_test.go create mode 100644 internal/fourslash/tests/gen/jsxTagNameCompletionUnderElementUnclosed_test.go diff --git a/internal/fourslash/_scripts/convertFourslash.mts b/internal/fourslash/_scripts/convertFourslash.mts index 534b7d69c7..72a6d879a6 100644 --- a/internal/fourslash/_scripts/convertFourslash.mts +++ b/internal/fourslash/_scripts/convertFourslash.mts @@ -151,14 +151,17 @@ function parseFourslashStatement(statement: ts.Statement): Cmd[] | undefined { } const namespace = callExpression.expression.expression; const func = callExpression.expression.name; - if (!(ts.isIdentifier(namespace) || namespace.getText() === "verify.not") || !ts.isIdentifier(func)) { - console.error(`Expected identifiers for namespace and function, got ${namespace.getText()} and ${func.getText()}`); - return undefined; - } if (!ts.isIdentifier(namespace)) { switch (func.text) { case "quickInfoExists": return parseQuickInfoArgs("notQuickInfoExists", callExpression.arguments); + case "andApplyCodeAction": + // verify.completions({ ... }).andApplyCodeAction(...) + if (!(ts.isCallExpression(namespace) && namespace.expression.getText() === "verify.completions")) { + console.error(`Unrecognized fourslash statement: ${statement.getText()}`); + return undefined; + } + return parseVerifyCompletionsArgs(namespace.arguments, callExpression.arguments); } console.error(`Unrecognized fourslash statement: ${statement.getText()}`); return undefined; @@ -169,6 +172,9 @@ function parseFourslashStatement(statement: ts.Statement): Cmd[] | undefined { case "completions": // `verify.completions(...)` return parseVerifyCompletionsArgs(callExpression.arguments); + case "applyCodeActionFromCompletion": + // `verify.applyCodeActionFromCompletion(...)` + return parseVerifyApplyCodeActionFromCompletionArgs(callExpression.arguments); case "quickInfoAt": case "quickInfoExists": case "quickInfoIs": @@ -271,6 +277,13 @@ function parseEditStatement(funcName: string, args: readonly ts.Expression[]): E } } +function getGoMultiLineStringLiteral(text: string): string { + if (!text.includes("`") && !text.includes("\\")) { + return "`" + text + "`"; + } + return getGoStringLiteral(text); +} + function getGoStringLiteral(text: string): string { return `${JSON.stringify(text)}`; } @@ -362,18 +375,170 @@ function parseGoToArgs(args: readonly ts.Expression[], funcName: string): GoToCm } } -function parseVerifyCompletionsArgs(args: readonly ts.Expression[]): VerifyCompletionsCmd[] | undefined { +function parseVerifyCompletionsArgs(args: readonly ts.Expression[], codeActionArgs?: readonly ts.Expression[]): VerifyCompletionsCmd[] | undefined { const cmds = []; + const codeAction = codeActionArgs?.[0] && parseAndApplyCodeActionArg(codeActionArgs[0]); for (const arg of args) { - const result = parseVerifyCompletionArg(arg); + const result = parseVerifyCompletionArg(arg, codeAction); if (!result) { return undefined; } + if (codeActionArgs?.length) { + result.andApplyCodeActionArgs = parseAndApplyCodeActionArg(codeActionArgs[0]); + } cmds.push(result); } return cmds; } +function parseVerifyApplyCodeActionFromCompletionArgs(args: readonly ts.Expression[]): VerifyApplyCodeActionFromCompletionCmd[] | undefined { + const cmds: VerifyApplyCodeActionFromCompletionCmd[] = []; + if (args.length !== 2) { + console.error(`Expected two arguments in verify.applyCodeActionFromCompletion, got ${args.map(arg => arg.getText()).join(", ")}`); + return undefined; + } + if (!ts.isStringLiteralLike(args[0]) && args[0].getText() !== "undefined") { + console.error(`Expected string literal or "undefined" in verify.applyCodeActionFromCompletion, got ${args[0].getText()}`); + return undefined; + } + const markerName = getStringLiteralLike(args[0])?.text; + const marker = markerName === undefined ? "nil" : `PtrTo(${getGoStringLiteral(markerName)})`; + const options = parseVerifyApplyCodeActionArgs(args[1]); + if (options === undefined) { + return undefined; + } + + cmds.push({ kind: "verifyApplyCodeActionFromCompletion", marker, options }); + return cmds; +} + +function parseVerifyApplyCodeActionArgs(arg: ts.Expression): string | undefined { + const obj = getObjectLiteralExpression(arg); + if (!obj) { + console.error(`Expected object literal for verify.applyCodeActionFromCompletion options, got ${arg.getText()}`); + return undefined; + } + let nameInit, sourceInit, descInit, dataInit; + const props: string[] = []; + for (const prop of obj.properties) { + if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name)) { + if (ts.isShorthandPropertyAssignment(prop) && prop.name.text === "preferences") { + continue; // !!! parse once preferences are supported in fourslash + } + console.error(`Expected property assignment with identifier name in verify.applyCodeActionFromCompletion options, got ${prop.getText()}`); + return undefined; + } + const propName = prop.name.text; + const init = prop.initializer; + switch (propName) { + case "name": + nameInit = getStringLiteralLike(init); + if (!nameInit) { + console.error(`Expected string literal for name in verify.applyCodeActionFromCompletion options, got ${init.getText()}`); + return undefined; + } + props.push(`Name: ${getGoStringLiteral(nameInit.text)},`); + break; + case "source": + sourceInit = getStringLiteralLike(init); + if (!sourceInit) { + console.error(`Expected string literal for source in verify.applyCodeActionFromCompletion options, got ${init.getText()}`); + return undefined; + } + props.push(`Source: ${getGoStringLiteral(sourceInit.text)},`); + break; + case "data": + dataInit = getObjectLiteralExpression(init); + if (!dataInit) { + console.error(`Expected object literal for data in verify.applyCodeActionFromCompletion options, got ${init.getText()}`); + return undefined; + } + const dataProps: string[] = []; + for (const dataProp of dataInit.properties) { + if (!ts.isPropertyAssignment(dataProp) || !ts.isIdentifier(dataProp.name)) { + console.error(`Expected property assignment with identifier name in verify.applyCodeActionFromCompletion data, got ${dataProp.getText()}`); + return undefined; + } + const dataPropName = dataProp.name.text; + switch (dataPropName) { + case "moduleSpecifier": + const moduleSpecifierInit = getStringLiteralLike(dataProp.initializer); + if (!moduleSpecifierInit) { + console.error(`Expected string literal for moduleSpecifier in verify.applyCodeActionFromCompletion data, got ${dataProp.initializer.getText()}`); + return undefined; + } + dataProps.push(`ModuleSpecifier: ${getGoStringLiteral(moduleSpecifierInit.text)},`); + break; + case "exportName": + const exportNameInit = getStringLiteralLike(dataProp.initializer); + if (!exportNameInit) { + console.error(`Expected string literal for exportName in verify.applyCodeActionFromCompletion data, got ${dataProp.initializer.getText()}`); + return undefined; + } + dataProps.push(`ExportName: ${getGoStringLiteral(exportNameInit.text)},`); + break; + case "fileName": + const fileNameInit = getStringLiteralLike(dataProp.initializer); + if (!fileNameInit) { + console.error(`Expected string literal for fileName in verify.applyCodeActionFromCompletion data, got ${dataProp.initializer.getText()}`); + return undefined; + } + dataProps.push(`FileName: ${getGoStringLiteral(fileNameInit.text)},`); + break; + default: + console.error(`Unrecognized property in verify.applyCodeActionFromCompletion data: ${dataProp.getText()}`); + return undefined; + } + } + props.push(`AutoImportData: &ls.AutoImportData{\n${dataProps.join("\n")}\n},`); + break; + case "description": + descInit = getStringLiteralLike(init); + if (!descInit) { + console.error(`Expected string literal for description in verify.applyCodeActionFromCompletion options, got ${init.getText()}`); + return undefined; + } + props.push(`Description: ${getGoStringLiteral(descInit.text)},`); + break; + case "newFileContent": + const newFileContentInit = getStringLiteralLike(init); + if (!newFileContentInit) { + console.error(`Expected string literal for newFileContent in verify.applyCodeActionFromCompletion options, got ${init.getText()}`); + return undefined; + } + props.push(`NewFileContent: PtrTo(${getGoMultiLineStringLiteral(newFileContentInit.text)}),`); + break; + case "newRangeContent": + const newRangeContentInit = getStringLiteralLike(init); + if (!newRangeContentInit) { + console.error(`Expected string literal for newRangeContent in verify.applyCodeActionFromCompletion options, got ${init.getText()}`); + return undefined; + } + props.push(`NewRangeContent: PtrTo(${getGoMultiLineStringLiteral(newRangeContentInit.text)}),`); + break; + case "preferences": + // Few if any tests use non-default preferences + break; + default: + console.error(`Unrecognized property in verify.applyCodeActionFromCompletion options: ${prop.getText()}`); + return undefined; + } + } + if (!nameInit) { + console.error(`Expected name property in verify.applyCodeActionFromCompletion options`); + return undefined; + } + if (!sourceInit && !dataInit) { + console.error(`Expected source property in verify.applyCodeActionFromCompletion options`); + return undefined; + } + if (!descInit) { + console.error(`Expected description property in verify.applyCodeActionFromCompletion options`); + return undefined; + } + return `&fourslash.ApplyCodeActionFromCompletionOptions{\n${props.join("\n")}\n}`; +} + const completionConstants = new Map([ ["completion.globals", "CompletionGlobals"], ["completion.globalTypes", "CompletionGlobalTypes"], @@ -397,7 +562,7 @@ const completionPlus = new Map([ ["completion.typeKeywordsPlus", "CompletionTypeKeywordsPlus"], ]); -function parseVerifyCompletionArg(arg: ts.Expression): VerifyCompletionsCmd | undefined { +function parseVerifyCompletionArg(arg: ts.Expression, codeActionArgs?: VerifyApplyCodeActionArgs): VerifyCompletionsCmd | undefined { let marker: string | undefined; let goArgs: VerifyCompletionsArgs | undefined; const obj = getObjectLiteralExpression(arg); @@ -408,6 +573,9 @@ function parseVerifyCompletionArg(arg: ts.Expression): VerifyCompletionsCmd | un let isNewIdentifierLocation: true | undefined; for (const prop of obj.properties) { if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name)) { + if (ts.isShorthandPropertyAssignment(prop) && prop.name.text === "preferences") { + continue; // !!! parse once preferences are supported in fourslash + } console.error(`Expected property assignment with identifier name, got ${prop.getText()}`); return undefined; } @@ -478,7 +646,7 @@ function parseVerifyCompletionArg(arg: ts.Expression): VerifyCompletionsCmd | un } expected = `${funcName}(\n[]fourslash.CompletionsExpectedItem{`; for (const elem of items.elements) { - const result = parseExpectedCompletionItem(elem); + const result = parseExpectedCompletionItem(elem, codeActionArgs); if (!result) { return undefined; } @@ -589,7 +757,7 @@ function parseVerifyCompletionArg(arg: ts.Expression): VerifyCompletionsCmd | un }; } -function parseExpectedCompletionItem(expr: ts.Expression): string | undefined { +function parseExpectedCompletionItem(expr: ts.Expression, codeActionArgs?: VerifyApplyCodeActionArgs): string | undefined { if (completionConstants.has(expr.getText())) { return completionConstants.get(expr.getText())!; } @@ -600,6 +768,7 @@ function parseExpectedCompletionItem(expr: ts.Expression): string | undefined { if (strExpr = getObjectLiteralExpression(expr)) { let isDeprecated = false; // !!! let isOptional = false; + let sourceInit: ts.StringLiteralLike | undefined; let extensions: string[] = []; // !!! let itemProps: string[] = []; let name: string | undefined; @@ -708,6 +877,33 @@ function parseExpectedCompletionItem(expr: ts.Expression): string | undefined { } case "isFromUncheckedFile": break; // Ignored + case "hasAction": + itemProps.push("AdditionalTextEdits: fourslash.AnyTextEdits,"); + break; + case "source": + case "sourceDisplay": + if (sourceInit !== undefined) { + break; + } + if (sourceInit = getStringLiteralLike(init)) { + if (propName === "source" && sourceInit.text.endsWith("/")) { + // source: "ClassMemberSnippet/" + itemProps.push(`Data: PtrTo(any(&ls.CompletionItemData{ + Source: ${getGoStringLiteral(sourceInit.text)}, + })),`); + break; + } + itemProps.push(`Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: ${getGoStringLiteral(sourceInit.text)}, + }, + })),`); + } + else { + console.error(`Expected string literal for source/sourceDisplay, got ${init.getText()}`); + return undefined; + } + break; case "commitCharacters": // !!! support these later break; @@ -732,6 +928,11 @@ function parseExpectedCompletionItem(expr: ts.Expression): string | undefined { if (!name) { return undefined; // Shouldn't happen } + if (codeActionArgs && codeActionArgs.name === name && codeActionArgs.source === sourceInit?.text) { + itemProps.push(`LabelDetails: &lsproto.CompletionItemLabelDetails{ + Description: PtrTo(${getGoStringLiteral(codeActionArgs.source)}), + },`); + } if (replacementSpanIdx) { itemProps.push(`TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ TextEdit: &lsproto.TextEdit{ @@ -754,6 +955,60 @@ function parseExpectedCompletionItem(expr: ts.Expression): string | undefined { return undefined; // Unsupported expression type } +function parseAndApplyCodeActionArg(arg: ts.Expression): VerifyApplyCodeActionArgs | undefined { + const obj = getObjectLiteralExpression(arg); + if (!obj) { + console.error(`Expected object literal for code action argument, got ${arg.getText()}`); + return undefined; + } + const nameProperty = obj.properties.find(prop => + ts.isPropertyAssignment(prop) && + ts.isIdentifier(prop.name) && + prop.name.text === "name" && + ts.isStringLiteralLike(prop.initializer) + ) as ts.PropertyAssignment | undefined; + if (!nameProperty) { + console.error(`Expected name property in code action argument, got ${obj.getText()}`); + return undefined; + } + const sourceProperty = obj.properties.find(prop => + ts.isPropertyAssignment(prop) && + ts.isIdentifier(prop.name) && + prop.name.text === "source" && + ts.isStringLiteralLike(prop.initializer) + ) as ts.PropertyAssignment | undefined; + if (!sourceProperty) { + console.error(`Expected source property in code action argument, got ${obj.getText()}`); + return undefined; + } + const descriptionProperty = obj.properties.find(prop => + ts.isPropertyAssignment(prop) && + ts.isIdentifier(prop.name) && + prop.name.text === "description" && + ts.isStringLiteralLike(prop.initializer) + ) as ts.PropertyAssignment | undefined; + if (!descriptionProperty) { + console.error(`Expected description property in code action argument, got ${obj.getText()}`); + return undefined; + } + const newFileContentProperty = obj.properties.find(prop => + ts.isPropertyAssignment(prop) && + ts.isIdentifier(prop.name) && + prop.name.text === "newFileContent" && + ts.isStringLiteralLike(prop.initializer) + ) as ts.PropertyAssignment | undefined; + if (!newFileContentProperty) { + console.error(`Expected newFileContent property in code action argument, got ${obj.getText()}`); + return undefined; + } + return { + name: (nameProperty.initializer as ts.StringLiteralLike).text, + source: (sourceProperty.initializer as ts.StringLiteralLike).text, + description: (descriptionProperty.initializer as ts.StringLiteralLike).text, + newFileContent: (newFileContentProperty.initializer as ts.StringLiteralLike).text, + }; +} + function parseBaselineFindAllReferencesArgs(args: readonly ts.Expression[]): [VerifyBaselineFindAllReferencesCmd] | undefined { const newArgs = []; for (const arg of args) { @@ -1287,6 +1542,7 @@ interface VerifyCompletionsCmd { marker: string; isNewIdentifierLocation?: true; args?: VerifyCompletionsArgs | "nil"; + andApplyCodeActionArgs?: VerifyApplyCodeActionArgs; } interface VerifyCompletionsArgs { @@ -1296,6 +1552,19 @@ interface VerifyCompletionsArgs { unsorted?: string; } +interface VerifyApplyCodeActionArgs { + name: string; + source: string; + description: string; + newFileContent: string; +} + +interface VerifyApplyCodeActionFromCompletionCmd { + kind: "verifyApplyCodeActionFromCompletion"; + marker: string; + options: string; +} + interface VerifyBaselineFindAllReferencesCmd { kind: "verifyBaselineFindAllReferences"; markers: string[]; @@ -1360,6 +1629,7 @@ interface VerifyRenameInfoCmd { type Cmd = | VerifyCompletionsCmd + | VerifyApplyCodeActionFromCompletionCmd | VerifyBaselineFindAllReferencesCmd | VerifyBaselineDocumentHighlightsCmd | VerifyBaselineGoToDefinitionCmd @@ -1371,7 +1641,7 @@ type Cmd = | VerifyBaselineRenameCmd | VerifyRenameInfoCmd; -function generateVerifyCompletions({ marker, args, isNewIdentifierLocation }: VerifyCompletionsCmd): string { +function generateVerifyCompletions({ marker, args, isNewIdentifierLocation, andApplyCodeActionArgs }: VerifyCompletionsCmd): string { let expectedList: string; if (args === "nil") { expectedList = "nil"; @@ -1395,7 +1665,21 @@ function generateVerifyCompletions({ marker, args, isNewIdentifierLocation }: Ve }, }`; } - return `f.VerifyCompletions(t, ${marker}, ${expectedList})`; + + const call = `f.VerifyCompletions(t, ${marker}, ${expectedList})`; + if (andApplyCodeActionArgs) { + return `${call}.AndApplyCodeAction(t, &fourslash.CompletionsExpectedCodeAction{ + Name: ${getGoStringLiteral(andApplyCodeActionArgs.name)}, + Source: ${getGoStringLiteral(andApplyCodeActionArgs.source)}, + Description: ${getGoStringLiteral(andApplyCodeActionArgs.description)}, + NewFileContent: ${getGoMultiLineStringLiteral(andApplyCodeActionArgs.newFileContent)}, + })`; + } + return call; +} + +function generateVerifyApplyCodeActionFromCompletion({ marker, options }: VerifyApplyCodeActionFromCompletionCmd): string { + return `f.VerifyApplyCodeActionFromCompletion(t, ${marker}, ${options})`; } function generateBaselineFindAllReferences({ markers, ranges }: VerifyBaselineFindAllReferencesCmd): string { @@ -1456,6 +1740,8 @@ function generateCmd(cmd: Cmd): string { switch (cmd.kind) { case "verifyCompletions": return generateVerifyCompletions(cmd); + case "verifyApplyCodeActionFromCompletion": + return generateVerifyApplyCodeActionFromCompletion(cmd); case "verifyBaselineFindAllReferences": return generateBaselineFindAllReferences(cmd); case "verifyBaselineDocumentHighlights": @@ -1497,7 +1783,7 @@ interface GoTest { } function generateGoTest(failingTests: Set, test: GoTest): string { - const testName = (test.name[0].toUpperCase() + test.name.substring(1)).replaceAll("-", "_"); + const testName = (test.name[0].toUpperCase() + test.name.substring(1)).replaceAll("-", "_").replaceAll(/[^a-zA-Z0-9_]/g, ""); const content = test.content; const commands = test.commands.map(cmd => generateCmd(cmd)).join("\n"); const imports = [`"github.com/microsoft/typescript-go/internal/fourslash"`]; diff --git a/internal/fourslash/_scripts/failingTests.txt b/internal/fourslash/_scripts/failingTests.txt index 09435b6337..3596e01173 100644 --- a/internal/fourslash/_scripts/failingTests.txt +++ b/internal/fourslash/_scripts/failingTests.txt @@ -3,6 +3,29 @@ TestAmbientShorthandGotoDefinition TestArgumentsAreAvailableAfterEditsAtEndOfFunction TestAugmentedTypesClass1 TestAugmentedTypesClass3Fourslash +TestAutoImportCompletionAmbientMergedModule1 +TestAutoImportCompletionExportEqualsWithDefault1 +TestAutoImportCompletionExportListAugmentation1 +TestAutoImportCompletionExportListAugmentation2 +TestAutoImportCompletionExportListAugmentation3 +TestAutoImportCompletionExportListAugmentation4 +TestAutoImportFileExcludePatterns3 +TestAutoImportPathsAliasesAndBarrels +TestAutoImportProvider_exportMap1 +TestAutoImportProvider_exportMap2 +TestAutoImportProvider_exportMap3 +TestAutoImportProvider_exportMap4 +TestAutoImportProvider_exportMap5 +TestAutoImportProvider_exportMap6 +TestAutoImportProvider_exportMap7 +TestAutoImportProvider_exportMap8 +TestAutoImportProvider_exportMap9 +TestAutoImportProvider_globalTypingsCache +TestAutoImportProvider_namespaceSameNameAsIntrinsic +TestAutoImportProvider_wildcardExports1 +TestAutoImportProvider_wildcardExports2 +TestAutoImportProvider_wildcardExports3 +TestAutoImportVerbatimTypeOnly1 TestBestCommonTypeObjectLiterals TestBestCommonTypeObjectLiterals1 TestCodeCompletionEscaping @@ -20,6 +43,7 @@ TestCompletionEntryForUnionProperty TestCompletionEntryForUnionProperty2 TestCompletionForComputedStringProperties TestCompletionForMetaProperty +TestCompletionForObjectProperty TestCompletionForStringLiteral TestCompletionForStringLiteral4 TestCompletionForStringLiteralExport @@ -65,7 +89,6 @@ TestCompletionImportModuleSpecifierEndingUnsupportedExtension TestCompletionInChecks1 TestCompletionInFunctionLikeBody_includesPrimitiveTypes TestCompletionInJsDoc -TestCompletionInNamedImportLocation TestCompletionInUncheckedJSFile TestCompletionListBuilderLocations_VariableDeclarations TestCompletionListForDerivedType1 @@ -115,13 +138,51 @@ TestCompletionOfAwaitPromise6 TestCompletionOfAwaitPromise7 TestCompletionOfInterfaceAndVar TestCompletionPreferredSuggestions1 +TestCompletionPropertyShorthandForObjectLiteral5 TestCompletionWithConditionalOperatorMissingColon TestCompletionsAfterJSDoc TestCompletionsBeforeRestArg1 +TestCompletionsClassMemberImportTypeNodeParameter1 +TestCompletionsClassMemberImportTypeNodeParameter2 +TestCompletionsClassMemberImportTypeNodeParameter3 +TestCompletionsClassMemberImportTypeNodeParameter4 TestCompletionsElementAccessNumeric TestCompletionsExportImport TestCompletionsGenericTypeWithMultipleBases1 +TestCompletionsImportBaseUrl TestCompletionsImportOrExportSpecifier +TestCompletionsImport_default_alreadyExistedWithRename +TestCompletionsImport_default_anonymous +TestCompletionsImport_default_didNotExistBefore +TestCompletionsImport_default_exportDefaultIdentifier +TestCompletionsImport_details_withMisspelledName +TestCompletionsImport_exportEquals_anonymous +TestCompletionsImport_exportEquals_global +TestCompletionsImport_filteredByInvalidPackageJson_direct +TestCompletionsImport_filteredByPackageJson_direct +TestCompletionsImport_filteredByPackageJson_nested +TestCompletionsImport_filteredByPackageJson_peerDependencies +TestCompletionsImport_filteredByPackageJson_typesImplicit +TestCompletionsImport_filteredByPackageJson_typesOnly +TestCompletionsImport_importType +TestCompletionsImport_jsxOpeningTagImportDefault +TestCompletionsImport_mergedReExport +TestCompletionsImport_multipleWithSameName +TestCompletionsImport_named_didNotExistBefore +TestCompletionsImport_named_exportEqualsNamespace +TestCompletionsImport_named_namespaceImportExists +TestCompletionsImport_noSemicolons +TestCompletionsImport_ofAlias_preferShortPath +TestCompletionsImport_packageJsonImportsPreference +TestCompletionsImport_quoteStyle +TestCompletionsImport_reExportDefault +TestCompletionsImport_reExportDefault2 +TestCompletionsImport_reExport_wrongName +TestCompletionsImport_require_addToExisting +TestCompletionsImport_typeOnly +TestCompletionsImport_umdDefaultNoCrash1 +TestCompletionsImport_uriStyleNodeCoreModules2 +TestCompletionsImport_windowsPathsProjectRelative TestCompletionsInExport TestCompletionsInExport_moduleBlock TestCompletionsInRequire @@ -153,6 +214,7 @@ TestCompletionsPaths_kinds TestCompletionsPaths_pathMapping TestCompletionsPaths_pathMapping_nonTrailingWildcard1 TestCompletionsPaths_pathMapping_parentDirectory +TestCompletionsRecommended_namespace TestCompletionsRecommended_union TestCompletionsRedeclareModuleAsGlobal TestCompletionsStringsWithTriggerCharacter @@ -160,6 +222,8 @@ TestCompletionsSymbolMembers TestCompletionsTriggerCharacter TestCompletionsTuple TestCompletionsUniqueSymbol1 +TestCompletionsUniqueSymbol_import +TestCompletionsWithDeprecatedTag10 TestConstEnumQuickInfoAndCompletionList TestConstQuickInfoAndCompletionList TestContextuallyTypedFunctionExpressionGeneric1 @@ -215,6 +279,16 @@ TestImportCompletions_importsMap2 TestImportCompletions_importsMap3 TestImportCompletions_importsMap4 TestImportCompletions_importsMap5 +TestImportNameCodeFixExportAsDefault +TestImportSuggestionsCache_exportUndefined +TestImportTypeCompletions1 +TestImportTypeCompletions3 +TestImportTypeCompletions4 +TestImportTypeCompletions5 +TestImportTypeCompletions6 +TestImportTypeCompletions7 +TestImportTypeCompletions8 +TestImportTypeCompletions9 TestIndexerReturnTypes1 TestIndirectClassInstantiation TestInstanceTypesForGenericType1 @@ -245,6 +319,7 @@ TestJsDocPropertyDescription8 TestJsDocPropertyDescription9 TestJsDocServices TestJsDocTagsWithHyphen +TestJsFileImportNoTypes2 TestJsQuickInfoGenerallyAcceptableSize TestJsRequireQuickInfo TestJsdocCallbackTag @@ -386,7 +461,6 @@ TestQuickInfoOnGenericWithConstraints1 TestQuickInfoOnInternalAliases TestQuickInfoOnJsxNamespacedNameWithDoc1 TestQuickInfoOnMethodOfImportEquals -TestQuickInfoOnNarrowedType TestQuickInfoOnNarrowedTypeInModule TestQuickInfoOnNewKeyword01 TestQuickInfoOnObjectLiteralWithAccessors diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index ddac550413..00f39aac1e 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -503,19 +503,31 @@ type CompletionsExpectedItems struct { Unsorted []CompletionsExpectedItem } +type CompletionsExpectedCodeAction struct { + Name string + Source string + Description string + NewFileContent string +} + +type VerifyCompletionsResult struct { + AndApplyCodeAction func(t *testing.T, expectedAction *CompletionsExpectedCodeAction) +} + // string | *Marker | []string | []*Marker type MarkerInput = any // !!! user preferences param // !!! completion context param -func (f *FourslashTest) VerifyCompletions(t *testing.T, markerInput MarkerInput, expected *CompletionsExpectedList) { +func (f *FourslashTest) VerifyCompletions(t *testing.T, markerInput MarkerInput, expected *CompletionsExpectedList) VerifyCompletionsResult { + var list *lsproto.CompletionList switch marker := markerInput.(type) { case string: f.GoToMarker(t, marker) - f.verifyCompletionsWorker(t, expected) + list = f.verifyCompletionsWorker(t, expected) case *Marker: f.goToMarker(t, marker) - f.verifyCompletionsWorker(t, expected) + list = f.verifyCompletionsWorker(t, expected) case []string: for _, markerName := range marker { f.GoToMarker(t, markerName) @@ -527,13 +539,41 @@ func (f *FourslashTest) VerifyCompletions(t *testing.T, markerInput MarkerInput, f.verifyCompletionsWorker(t, expected) } case nil: - f.verifyCompletionsWorker(t, expected) + list = f.verifyCompletionsWorker(t, expected) default: t.Fatalf("Invalid marker input type: %T. Expected string, *Marker, []string, or []*Marker.", markerInput) } + + return VerifyCompletionsResult{ + AndApplyCodeAction: func(t *testing.T, expectedAction *CompletionsExpectedCodeAction) { + item := core.Find(list.Items, func(item *lsproto.CompletionItem) bool { + if item.Label != expectedAction.Name || item.Data == nil { + return false + } + data, ok := (*item.Data).(*ls.CompletionItemData) + if !ok || data.AutoImport == nil { + return false + } + return data.AutoImport.ModuleSpecifier == expectedAction.Source + }) + if item == nil { + t.Fatalf("Code action '%s' from source '%s' not found in completions.", expectedAction.Name, expectedAction.Source) + } + assert.Check(t, strings.Contains(*item.Detail, expectedAction.Description), "Completion item detail does not contain expected description.") + f.applyTextEdits(t, *item.AdditionalTextEdits) + assert.Equal(t, f.getScriptInfo(f.activeFilename).content, expectedAction.NewFileContent, fmt.Sprintf("File content after applying code action '%s' did not match expected content.", expectedAction.Name)) + }, + } } -func (f *FourslashTest) verifyCompletionsWorker(t *testing.T, expected *CompletionsExpectedList) { +func (f *FourslashTest) verifyCompletionsWorker(t *testing.T, expected *CompletionsExpectedList) *lsproto.CompletionList { + prefix := f.getCurrentPositionPrefix() + list := f.getCompletions(t) + f.verifyCompletionsResult(t, list, expected, prefix) + return list +} + +func (f *FourslashTest) getCompletions(t *testing.T) *lsproto.CompletionList { prefix := f.getCurrentPositionPrefix() params := &lsproto.CompletionParams{ TextDocument: lsproto.TextDocumentIdentifier{ @@ -549,7 +589,7 @@ func (f *FourslashTest) verifyCompletionsWorker(t *testing.T, expected *Completi if !resultOk { t.Fatalf(prefix+"Unexpected response type for completion request: %T", resMsg.AsResponse().Result) } - f.verifyCompletionsResult(t, result.List, expected, prefix) + return result.List } func (f *FourslashTest) verifyCompletionsResult( @@ -633,9 +673,9 @@ func (f *FourslashTest) verifyCompletionsItems(t *testing.T, prefix string, actu } return } - nameToActualItem := make(map[string]*lsproto.CompletionItem) + nameToActualItems := make(map[string][]*lsproto.CompletionItem) for _, item := range actual { - nameToActualItem[item.Label] = item + nameToActualItems[item.Label] = append(nameToActualItems[item.Label], item) } if expected.Unsorted != nil { if expected.Includes != nil { @@ -647,24 +687,30 @@ func (f *FourslashTest) verifyCompletionsItems(t *testing.T, prefix string, actu for _, item := range expected.Unsorted { switch item := item.(type) { case string: - _, ok := nameToActualItem[item] + _, ok := nameToActualItems[item] if !ok { t.Fatalf("%sLabel '%s' not found in actual items. Actual items: %s", prefix, item, cmp.Diff(actual, nil)) } - delete(nameToActualItem, item) + delete(nameToActualItems, item) case *lsproto.CompletionItem: - actualItem, ok := nameToActualItem[item.Label] + actualItems, ok := nameToActualItems[item.Label] if !ok { t.Fatalf("%sLabel '%s' not found in actual items. Actual items: %s", prefix, item.Label, cmp.Diff(actual, nil)) } - delete(nameToActualItem, item.Label) + actualItem := actualItems[0] + actualItems = actualItems[1:] + if len(actualItems) == 0 { + delete(nameToActualItems, item.Label) + } else { + nameToActualItems[item.Label] = actualItems + } f.verifyCompletionItem(t, prefix+"Includes completion item mismatch for label "+item.Label+": ", actualItem, item) default: t.Fatalf("%sExpected completion item to be a string or *lsproto.CompletionItem, got %T", prefix, item) } } if len(expected.Unsorted) != len(actual) { - unmatched := slices.Collect(maps.Keys(nameToActualItem)) + unmatched := slices.Collect(maps.Keys(nameToActualItems)) t.Fatalf("%sAdditional completions found but not included in 'unsorted': %s", prefix, strings.Join(unmatched, "\n")) } return @@ -673,15 +719,22 @@ func (f *FourslashTest) verifyCompletionsItems(t *testing.T, prefix string, actu for _, item := range expected.Includes { switch item := item.(type) { case string: - _, ok := nameToActualItem[item] + _, ok := nameToActualItems[item] if !ok { t.Fatalf("%sLabel '%s' not found in actual items. Actual items: %s", prefix, item, cmp.Diff(actual, nil)) } case *lsproto.CompletionItem: - actualItem, ok := nameToActualItem[item.Label] + actualItems, ok := nameToActualItems[item.Label] if !ok { t.Fatalf("%sLabel '%s' not found in actual items. Actual items: %s", prefix, item.Label, cmp.Diff(actual, nil)) } + actualItem := actualItems[0] + actualItems = actualItems[1:] + if len(actualItems) == 0 { + delete(nameToActualItems, item.Label) + } else { + nameToActualItems[item.Label] = actualItems + } f.verifyCompletionItem(t, prefix+"Includes completion item mismatch for label "+item.Label+": ", actualItem, item) default: t.Fatalf("%sExpected completion item to be a string or *lsproto.CompletionItem, got %T", prefix, item) @@ -689,7 +742,7 @@ func (f *FourslashTest) verifyCompletionsItems(t *testing.T, prefix string, actu } } for _, exclude := range expected.Excludes { - if _, ok := nameToActualItem[exclude]; ok { + if _, ok := nameToActualItems[exclude]; ok { t.Fatalf("%sLabel '%s' should not be in actual items but was found. Actual items: %s", prefix, exclude, cmp.Diff(actual, nil)) } } @@ -712,36 +765,80 @@ func (f *FourslashTest) verifyCompletionsAreExactly(t *testing.T, prefix string, } } -var completionIgnoreOpts = cmp.FilterPath( - func(p cmp.Path) bool { - switch p.Last().String() { - case ".Kind", ".SortText", ".Data": - return true - default: +func ignorePaths(paths ...string) cmp.Option { + return cmp.FilterPath( + func(p cmp.Path) bool { + for _, path := range paths { + if p.Last().String() == path { + return true + } + } return false - } - }, - cmp.Ignore(), + }, + cmp.Ignore(), + ) +} + +var ( + completionIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data") + autoImportIgnoreOpts = ignorePaths(".Kind", ".SortText", ".FilterText", ".Data", ".LabelDetails", ".Detail", ".AdditionalTextEdits") ) func (f *FourslashTest) verifyCompletionItem(t *testing.T, prefix string, actual *lsproto.CompletionItem, expected *lsproto.CompletionItem) { - if expected.Detail != nil || expected.Documentation != nil { - resMsg, result, resultOk := sendRequest(t, f, lsproto.CompletionItemResolveInfo, actual) - if resMsg == nil { - t.Fatal(prefix + "Expected non-nil response for completion item resolve, got nil") + var actualAutoImportData, expectedAutoImportData *ls.AutoImportData + if actual.Data != nil { + if data, ok := (*actual.Data).(*ls.CompletionItemData); ok { + actualAutoImportData = data.AutoImport } - if !resultOk { - t.Fatalf(prefix+"Unexpected response type for completion item resolve: %T", resMsg.AsResponse().Result) + } + if expected.Data != nil { + if data, ok := (*expected.Data).(*ls.CompletionItemData); ok { + expectedAutoImportData = data.AutoImport + } + } + if (actualAutoImportData == nil) != (expectedAutoImportData == nil) { + t.Fatal(prefix + "Mismatch in auto-import data presence") + } + + if expected.Detail != nil || expected.Documentation != nil || actualAutoImportData != nil { + actual = f.resolveCompletionItem(t, actual) + } + + if actualAutoImportData != nil { + assertDeepEqual(t, actual, expected, prefix, autoImportIgnoreOpts) + if expected.AdditionalTextEdits == AnyTextEdits { + assert.Check(t, actual.AdditionalTextEdits != nil && len(*actual.AdditionalTextEdits) > 0, prefix+" Expected non-nil AdditionalTextEdits for auto-import completion item") } - actual = result + if expected.LabelDetails != nil { + assertDeepEqual(t, actual.LabelDetails, expected.LabelDetails, prefix+" LabelDetails mismatch") + } + + assert.Equal(t, actualAutoImportData.ModuleSpecifier, expectedAutoImportData.ModuleSpecifier, prefix+" ModuleSpecifier mismatch") + } else { + assertDeepEqual(t, actual, expected, prefix, completionIgnoreOpts) + } + + if expected.FilterText != nil { + assertDeepEqual(t, actual.FilterText, expected.FilterText, prefix+" FilterText mismatch") } - assertDeepEqual(t, actual, expected, prefix, completionIgnoreOpts) if expected.Kind != nil { assertDeepEqual(t, actual.Kind, expected.Kind, prefix+" Kind mismatch") } assertDeepEqual(t, actual.SortText, core.OrElse(expected.SortText, ptrTo(string(ls.SortTextLocationPriority))), prefix+" SortText mismatch") } +func (f *FourslashTest) resolveCompletionItem(t *testing.T, item *lsproto.CompletionItem) *lsproto.CompletionItem { + prefix := f.getCurrentPositionPrefix() + resMsg, result, resultOk := sendRequest(t, f, lsproto.CompletionItemResolveInfo, item) + if resMsg == nil { + t.Fatal(prefix + "Expected non-nil response for completion item resolve, got nil") + } + if !resultOk { + t.Fatalf(prefix+"Unexpected response type for completion item resolve: %T, Error: %v", resMsg.AsResponse().Result, resMsg.AsResponse().Error) + } + return result +} + func getExpectedLabel(t *testing.T, item CompletionsExpectedItem) string { switch item := item.(type) { case string: @@ -763,6 +860,57 @@ func assertDeepEqual(t *testing.T, actual any, expected any, prefix string, opts } } +type ApplyCodeActionFromCompletionOptions struct { + Name string + Source string + AutoImportData *ls.AutoImportData + Description string + NewFileContent *string + NewRangeContent *string +} + +func (f *FourslashTest) VerifyApplyCodeActionFromCompletion(t *testing.T, markerName *string, options *ApplyCodeActionFromCompletionOptions) { + f.GoToMarker(t, *markerName) + completionsList := f.getCompletions(t) + item := core.Find(completionsList.Items, func(item *lsproto.CompletionItem) bool { + if item.Label != options.Name || item.Data == nil { + return false + } + data, ok := (*item.Data).(*ls.CompletionItemData) + if !ok { + return false + } + if options.AutoImportData != nil { + return data.AutoImport != nil && ((data.AutoImport.FileName == options.AutoImportData.FileName) && + (options.AutoImportData.ModuleSpecifier == "" || data.AutoImport.ModuleSpecifier == options.AutoImportData.ModuleSpecifier) && + (options.AutoImportData.ExportName == "" || data.AutoImport.ExportName == options.AutoImportData.ExportName) && + (options.AutoImportData.AmbientModuleName == nil || data.AutoImport.AmbientModuleName == options.AutoImportData.AmbientModuleName) && + (options.AutoImportData.IsPackageJsonImport == core.TSUnknown || data.AutoImport.IsPackageJsonImport == options.AutoImportData.IsPackageJsonImport)) + } + if data.AutoImport == nil && data.Source != "" && data.Source == options.Source { + return true + } + if data.AutoImport != nil && data.AutoImport.ModuleSpecifier == options.Source { + return true + } + return false + }) + if item == nil { + t.Fatalf("Code action '%s' from source '%s' not found in completions.", options.Name, options.Source) + } + item = f.resolveCompletionItem(t, item) + assert.Check(t, strings.Contains(*item.Detail, options.Description), "Completion item detail does not contain expected description.") + if item.AdditionalTextEdits == nil { + t.Fatalf("Expected non-nil AdditionalTextEdits for code action completion item.") + } + f.applyTextEdits(t, *item.AdditionalTextEdits) + if options.NewFileContent != nil { + assert.Equal(t, f.getScriptInfo(f.activeFilename).content, *options.NewFileContent, "File content after applying code action did not match expected content.") + } else if options.NewRangeContent != nil { + t.Fatal("!!! TODO") + } +} + func (f *FourslashTest) VerifyBaselineFindAllReferences( t *testing.T, markers ...string, @@ -1247,6 +1395,22 @@ func (f *FourslashTest) getSelection() core.TextRange { ) } +func (f *FourslashTest) applyTextEdits(t *testing.T, edits []*lsproto.TextEdit) { + script := f.getScriptInfo(f.activeFilename) + slices.SortFunc(edits, func(a, b *lsproto.TextEdit) int { + aStart := f.converters.LineAndCharacterToPosition(script, a.Range.Start) + bStart := f.converters.LineAndCharacterToPosition(script, b.Range.Start) + return int(aStart) - int(bStart) + }) + // Apply edits in reverse order to avoid affecting the positions of earlier edits. + for i := len(edits) - 1; i >= 0; i-- { + edit := edits[i] + start := int(f.converters.LineAndCharacterToPosition(script, edit.Range.Start)) + end := int(f.converters.LineAndCharacterToPosition(script, edit.Range.End)) + f.editScriptAndUpdateMarkers(t, f.activeFilename, start, end, edit.NewText) + } +} + func (f *FourslashTest) Replace(t *testing.T, start int, length int, text string) { f.editScriptAndUpdateMarkers(t, f.activeFilename, start, start+length, text) // f.checkPostEditInvariants() // !!! do we need this? @@ -1558,7 +1722,7 @@ func (f *FourslashTest) BaselineAutoImportsCompletions(t *testing.T, markerNames t.Fatalf(prefix+"Nil response received for resolve completion", f.lastKnownMarkerName) } if !resultOk { - t.Fatalf(prefix+"Unexpected response type for resolve completion: %T", resMsg.AsResponse().Result) + t.Fatalf(prefix+"Unexpected response type for resolve completion: %T, Error: %v", resMsg.AsResponse().Result, resMsg.AsResponse().Error) } if details == nil || details.AdditionalTextEdits == nil || len(*details.AdditionalTextEdits) == 0 { t.Fatalf(prefix+"Entry %s from %s returned no code changes from completion details request", item.Label, item.Detail) @@ -1792,3 +1956,7 @@ func (f *FourslashTest) verifyBaselines(t *testing.T) { baseline.Run(t, getBaselineFileName(t, command), content.String(), getBaselineOptions(command)) } } + +type anyTextEdits *[]*lsproto.TextEdit + +var AnyTextEdits = anyTextEdits(nil) diff --git a/internal/fourslash/tests/gen/autoImportCompletionAmbientMergedModule1_test.go b/internal/fourslash/tests/gen/autoImportCompletionAmbientMergedModule1_test.go new file mode 100644 index 0000000000..273f99b13e --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportCompletionAmbientMergedModule1_test.go @@ -0,0 +1,78 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportCompletionAmbientMergedModule1(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @strict: true +// @module: commonjs +// @filename: /node_modules/@types/vscode/index.d.ts +declare module "vscode" { + export class Position { + readonly line: number; + readonly character: number; + } +} +// @filename: src/motion.ts +import { Position } from "vscode"; + +export abstract class MoveQuoteMatch { + public override async execActionWithCount( + position: Position, + ): Promise {} +} + +declare module "vscode" { + interface Position { + toString(): string; + } +} +// @filename: src/smartQuotes.ts +import { MoveQuoteMatch } from "./motion"; + +export class MoveInsideNextQuote extends MoveQuoteMatch {/*1*/ + keys = ["i", "n", "q"]; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "execActionWithCount", + InsertText: PtrTo("public execActionWithCount(position: Position): Promise {\n}"), + FilterText: PtrTo("execActionWithCount"), + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + Source: "ClassMemberSnippet/", + })), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("1"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "execActionWithCount", + Source: "ClassMemberSnippet/", + Description: "Includes imports of types referenced by 'execActionWithCount'", + NewFileContent: PtrTo(`import { Position } from "vscode"; +import { MoveQuoteMatch } from "./motion"; + +export class MoveInsideNextQuote extends MoveQuoteMatch { + keys = ["i", "n", "q"]; +}`), + }) +} diff --git a/internal/fourslash/tests/gen/autoImportCompletionExportEqualsWithDefault1_test.go b/internal/fourslash/tests/gen/autoImportCompletionExportEqualsWithDefault1_test.go new file mode 100644 index 0000000000..e5036d3293 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportCompletionExportEqualsWithDefault1_test.go @@ -0,0 +1,104 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportCompletionExportEqualsWithDefault1(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @strict: true +// @module: commonjs +// @esModuleInterop: false +// @allowSyntheticDefaultImports: false +// @filename: node.ts +import Container from "./container.js"; +import Document from "./document.js"; + +declare namespace Node { + class Node extends Node_ {} + + export { Node as default }; +} + +declare abstract class Node_ { + parent: Container | Document | undefined; +} + +declare class Node extends Node_ {} + +export = Node; +// @filename: document.ts +import Container from "./container.js"; + +declare namespace Document { + export { Document_ as default }; +} + +declare class Document_ extends Container {} + +declare class Document extends Document_ {} + +export = Document; +// @filename: container.ts +import Node from "./node.js"; + +declare namespace Container { + export { Container_ as default }; +} + +declare abstract class Container_ extends Node { + p/*1*/ +} + +declare class Container extends Container_ {} + +export = Container;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "parent", + InsertText: PtrTo("parent: Container_ | Document_ | undefined;"), + FilterText: PtrTo("parent"), + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + Source: "ClassMemberSnippet/", + })), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("1"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "parent", + Source: "ClassMemberSnippet/", + Description: "Includes imports of types referenced by 'parent'", + NewFileContent: PtrTo(`import Document_ from "./document.js"; +import Node from "./node.js"; + +declare namespace Container { + export { Container_ as default }; +} + +declare abstract class Container_ extends Node { + p +} + +declare class Container extends Container_ {} + +export = Container;`), + }) +} diff --git a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation1_test.go b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation1_test.go new file mode 100644 index 0000000000..725856e637 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation1_test.go @@ -0,0 +1,70 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportCompletionExportListAugmentation1(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @Filename: /node_modules/@sapphire/pieces/index.d.ts +interface Container { + stores: unknown; +} + +declare class Piece { + container: Container; +} + +export { Piece, type Container }; +// @FileName: /augmentation.ts +declare module "@sapphire/pieces" { + interface Container { + client: unknown; + } + export { Container }; +} +// @Filename: /index.ts +import { Piece } from "@sapphire/pieces"; +class FullPiece extends Piece { + /*1*/ +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "container", + InsertText: PtrTo("container: Container;"), + FilterText: PtrTo("container"), + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + Source: "ClassMemberSnippet/", + })), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("1"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "container", + Source: "ClassMemberSnippet/", + Description: "Includes imports of types referenced by 'container'", + NewFileContent: PtrTo(`import { Container, Piece } from "@sapphire/pieces"; +class FullPiece extends Piece { + +}`), + }) +} diff --git a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation2_test.go b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation2_test.go new file mode 100644 index 0000000000..34b6d1c7eb --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation2_test.go @@ -0,0 +1,80 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportCompletionExportListAugmentation2(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @Filename: /node_modules/@sapphire/pieces/index.d.ts +interface Container { + stores: unknown; +} + +declare class Piece { + get container(): Container; +} + +declare class AliasPiece extends Piece {} + +export { AliasPiece, type Container }; +// @Filename: /node_modules/@sapphire/framework/index.d.ts +import { AliasPiece } from "@sapphire/pieces"; + +declare class Command extends AliasPiece {} + +declare module "@sapphire/pieces" { + interface Container { + client: unknown; + } +} + +export { Command }; +// @Filename: /index.ts +import "@sapphire/pieces"; +import { Command } from "@sapphire/framework"; +class PingCommand extends Command { + /*1*/ +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "container", + InsertText: PtrTo("get container(): Container {\n}"), + FilterText: PtrTo("container"), + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + Source: "ClassMemberSnippet/", + })), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("1"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "container", + Source: "ClassMemberSnippet/", + Description: "Includes imports of types referenced by 'container'", + NewFileContent: PtrTo(`import "@sapphire/pieces"; +import { Command } from "@sapphire/framework"; +import { Container } from "@sapphire/pieces"; +class PingCommand extends Command { + +}`), + }) +} diff --git a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation3_test.go b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation3_test.go new file mode 100644 index 0000000000..1877ab0244 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation3_test.go @@ -0,0 +1,69 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportCompletionExportListAugmentation3(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @Filename: /node_modules/@sapphire/pieces/index.d.ts +export interface Container { + stores: unknown; +} + +declare class Piece { + container: Container; +} + +export { Piece }; +// @FileName: /augmentation.ts +declare module "@sapphire/pieces" { + interface Container { + client: unknown; + } +} +// @Filename: /index.ts +import { Piece } from "@sapphire/pieces"; +class FullPiece extends Piece { + /*1*/ +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "container", + InsertText: PtrTo("container: Container;"), + FilterText: PtrTo("container"), + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + Source: "ClassMemberSnippet/", + })), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("1"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "container", + Source: "ClassMemberSnippet/", + Description: "Includes imports of types referenced by 'container'", + NewFileContent: PtrTo(`import { Container, Piece } from "@sapphire/pieces"; +class FullPiece extends Piece { + +}`), + }) +} diff --git a/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation4_test.go b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation4_test.go new file mode 100644 index 0000000000..b64b116e1b --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportCompletionExportListAugmentation4_test.go @@ -0,0 +1,78 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportCompletionExportListAugmentation4(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @Filename: /node_modules/@sapphire/pieces/index.d.ts +interface Container { + stores: unknown; +} + +declare class Piece { + get container(): Container; +} + +export { Piece as Alias, type Container }; +// @Filename: /node_modules/@sapphire/framework/index.d.ts +import { Alias } from "@sapphire/pieces"; + +declare class Command extends Alias {} + +declare module "@sapphire/pieces" { + interface Container { + client: unknown; + } +} + +export { Command as CommandAlias }; +// @Filename: /index.ts +import "@sapphire/pieces"; +import { CommandAlias } from "@sapphire/framework"; +class PingCommand extends CommandAlias { + /*1*/ +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "container", + InsertText: PtrTo("get container(): Container {\n}"), + FilterText: PtrTo("container"), + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + Source: "ClassMemberSnippet/", + })), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("1"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "container", + Source: "ClassMemberSnippet/", + Description: "Includes imports of types referenced by 'container'", + NewFileContent: PtrTo(`import "@sapphire/pieces"; +import { CommandAlias } from "@sapphire/framework"; +import { Container } from "@sapphire/pieces"; +class PingCommand extends CommandAlias { + +}`), + }) +} diff --git a/internal/fourslash/tests/gen/autoImportFileExcludePatterns3_test.go b/internal/fourslash/tests/gen/autoImportFileExcludePatterns3_test.go new file mode 100644 index 0000000000..e693dda53e --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportFileExcludePatterns3_test.go @@ -0,0 +1,71 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportFileExcludePatterns3(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @Filename: /ambient1.d.ts +declare module "foo" { + export const x = 1; +} +// @Filename: /ambient2.d.ts +declare module "foo" { + export const y = 2; +} +// @Filename: /index.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "x", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "foo", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "y", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "foo", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobals, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportPathsAliasesAndBarrels_test.go b/internal/fourslash/tests/gen/autoImportPathsAliasesAndBarrels_test.go new file mode 100644 index 0000000000..3848049ba1 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportPathsAliasesAndBarrels_test.go @@ -0,0 +1,83 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportPathsAliasesAndBarrels(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /tsconfig.json + { + "compilerOptions": { + "module": "commonjs", + "paths": { + "~/*": ["src/*"] + } + } +} +// @Filename: /src/dirA/index.ts + export * from "./thing1A"; + export * from "./thing2A"; +// @Filename: /src/dirA/thing1A.ts + export class Thing1A {} + Thing/**/ +// @Filename: /src/dirA/thing2A.ts + export class Thing2A {} +// @Filename: /src/dirB/index.ts + export * from "./thing1B"; + export * from "./thing2B"; +// @Filename: /src/dirB/thing1B.ts + export class Thing1B {} +// @Filename: /src/dirB/thing2B.ts + export class Thing2B {}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Thing2A", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./thing2A", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "Thing1B", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "~/dirB", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "Thing2B", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "~/dirB", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider6_test.go b/internal/fourslash/tests/gen/autoImportProvider6_test.go new file mode 100644 index 0000000000..eeb92339c0 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider6_test.go @@ -0,0 +1,50 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider6(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/tsconfig.json +{ "compilerOptions": { "module": "commonjs", "lib": ["es2019"] } } +// @Filename: /home/src/workspaces/project/package.json +{ "dependencies": { "antd": "*", "react": "*" } } +// @Filename: /home/src/workspaces/project/node_modules/@types/react/index.d.ts +export declare function Component(): void; +// @Filename: /home/src/workspaces/project/node_modules/antd/index.d.ts +import "react"; +// @Filename: /home/src/workspaces/project/index.ts +Component/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Component", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap1_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap1_test.go new file mode 100644 index 0000000000..82b994d822 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap1_test.go @@ -0,0 +1,83 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_exportMap1(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "nodenext" + } +} +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "dependency": "^1.0.0" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/package.json +{ + "type": "module", + "name": "dependency", + "version": "1.0.0", + "exports": { + ".": { + "types": "./lib/index.d.ts" + }, + "./lol": { + "types": "./lib/lol.d.ts" + } + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.d.ts +export function fooFromIndex(): void; +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.d.ts +export function fooFromLol(): void; +// @Filename: /home/src/workspaces/project/src/foo.ts +fooFrom/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooFromIndex", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + &lsproto.CompletionItem{ + Label: "fooFromLol", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency/lol", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap2_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap2_test.go new file mode 100644 index 0000000000..57eb4b8e9a --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap2_test.go @@ -0,0 +1,76 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_exportMap2(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "commonjs" + "moduleResolution": "node10", + } +} +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "dependency": "^1.0.0" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/package.json +{ + "type": "module", + "name": "dependency", + "version": "1.0.0", + "types": "./lib/index.d.ts", + "exports": { + ".": { + "types": "./lib/index.d.ts" + }, + "./lol": { + "types": "./lib/lol.d.ts" + } + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.d.ts +export function fooFromIndex(): void; +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.d.ts +export function fooFromLol(): void; +// @Filename: /home/src/workspaces/project/src/foo.ts +fooFrom/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooFromIndex", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap3_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap3_test.go new file mode 100644 index 0000000000..8f44b395be --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap3_test.go @@ -0,0 +1,69 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_exportMap3(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "nodenext" + } +} +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "dependency": "^1.0.0" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/package.json +{ + "name": "dependency", + "version": "1.0.0", + "main": "./lib/index.js", + "exports": "./lib/lol.d.ts" +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.d.ts +export function fooFromIndex(): void; +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.d.ts +export function fooFromLol(): void; +// @Filename: /home/src/workspaces/project/src/foo.ts +fooFrom/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooFromLol", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + Excludes: []string{ + "fooFromIndex", + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap4_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap4_test.go new file mode 100644 index 0000000000..9df1a5a2fd --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap4_test.go @@ -0,0 +1,72 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_exportMap4(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "nodenext" + } +} +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "dependency": "^1.0.0" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/package.json +{ + "type": "module", + "name": "dependency", + "version": "1.0.0", + "exports": { + "types": "./lib/index.d.ts", + "require": "./lib/lol.js" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.d.ts +export function fooFromIndex(): void; +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.d.ts +export function fooFromLol(): void; +// @Filename: /home/src/workspaces/project/src/foo.ts +fooFrom/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooFromIndex", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + Excludes: []string{ + "fooFromLol", + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap5_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap5_test.go new file mode 100644 index 0000000000..7e92a21a2b --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap5_test.go @@ -0,0 +1,94 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_exportMap5(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @types package lookup +// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "nodenext" + } +} +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "dependency": "^1.0.0" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/package.json +{ + "type": "module", + "name": "dependency", + "version": "1.0.0", + "exports": { + ".": "./lib/index.js", + "./lol": "./lib/lol.js" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.js +export function fooFromIndex() {} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.js +export function fooFromLol() {} +// @Filename: /home/src/workspaces/project/node_modules/@types/dependency/package.json +{ + "type": "module", + "name": "@types/dependency", + "version": "1.0.0", + "exports": { + ".": "./lib/index.d.ts", + "./lol": "./lib/lol.d.ts" + } +} +// @Filename: /home/src/workspaces/project/node_modules/@types/dependency/lib/index.d.ts +export declare function fooFromIndex(): void; +// @Filename: /home/src/workspaces/project/node_modules/@types/dependency/lib/lol.d.ts +export declare function fooFromLol(): void; +// @Filename: /home/src/workspaces/project/src/foo.ts +fooFrom/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooFromIndex", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + &lsproto.CompletionItem{ + Label: "fooFromLol", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency/lol", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap6_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap6_test.go new file mode 100644 index 0000000000..47d78b34d8 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap6_test.go @@ -0,0 +1,101 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_exportMap6(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @types package should be ignored because implementation package has types +// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "nodenext" + } +} +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "dependency": "^1.0.0" + }, + "devDependencies": { + "@types/dependency": "^1.0.0" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/package.json +{ + "type": "module", + "name": "dependency", + "version": "1.0.0", + "exports": { + ".": "./lib/index.js", + "./lol": "./lib/lol.js" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.js +export function fooFromIndex() {} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.d.ts +export declare function fooFromIndex(): void +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.js +export function fooFromLol() {} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.d.ts +export declare function fooFromLol(): void +// @Filename: /home/src/workspaces/project/node_modules/@types/dependency/package.json +{ + "type": "module", + "name": "@types/dependency", + "version": "1.0.0", + "exports": { + ".": "./lib/index.d.ts", + "./lol": "./lib/lol.d.ts" + } +} +// @Filename: /home/src/workspaces/project/node_modules/@types/dependency/lib/index.d.ts +export declare function fooFromAtTypesIndex(): void; +// @Filename: /home/src/workspaces/project/node_modules/@types/dependency/lib/lol.d.ts +export declare function fooFromAtTypesLol(): void; +// @Filename: /home/src/workspaces/project/src/foo.ts +fooFrom/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooFromIndex", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + &lsproto.CompletionItem{ + Label: "fooFromLol", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency/lol", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap7_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap7_test.go new file mode 100644 index 0000000000..7088378a8e --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap7_test.go @@ -0,0 +1,85 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_exportMap7(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "nodenext" + } +} +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "dependency": "^1.0.0" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/package.json +{ + "type": "module", + "name": "dependency", + "version": "1.0.0", + "exports": { + ".": { + "types": "./lib/index.d.ts" + }, + "./lol": { + "types": "./lib/lol.d.ts" + } + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.d.ts +export function fooFromIndex(): void; +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.d.ts +export function fooFromLol(): void; +// @Filename: /home/src/workspaces/project/src/bar.ts +import { fooFromIndex } from "dependency"; +// @Filename: /home/src/workspaces/project/src/foo.ts +fooFrom/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooFromIndex", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + &lsproto.CompletionItem{ + Label: "fooFromLol", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency/lol", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap8_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap8_test.go new file mode 100644 index 0000000000..c31f19f053 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap8_test.go @@ -0,0 +1,103 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_exportMap8(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "nodenext" + } +} +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "dependency": "^1.0.0" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/package.json +{ + "type": "module", + "name": "dependency", + "version": "1.0.0", + "exports": { + "./lol": { + "import": "./lib/index.js", + "require": "./lib/lol.js" + } + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.d.ts +export function fooFromIndex(): void; +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.d.ts +export function fooFromLol(): void; +// @Filename: /home/src/workspaces/project/src/bar.ts +import { fooFromIndex } from "dependency"; +// @Filename: /home/src/workspaces/project/src/foo.cts +fooFrom/*cts*/ +// @Filename: /home/src/workspaces/project/src/foo.mts +fooFrom/*mts*/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "cts") + f.VerifyCompletions(t, "cts", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooFromLol", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency/lol", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + Excludes: []string{ + "fooFromIndex", + }, + }, + }) + f.GoToMarker(t, "mts") + f.VerifyCompletions(t, "mts", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooFromIndex", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency/lol", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + Excludes: []string{ + "fooFromLol", + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_exportMap9_test.go b/internal/fourslash/tests/gen/autoImportProvider_exportMap9_test.go new file mode 100644 index 0000000000..dd90f2c0fa --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_exportMap9_test.go @@ -0,0 +1,73 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_exportMap9(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "nodenext" + } +} +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "dependency": "^1.0.0" + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/package.json +{ + "type": "module", + "name": "dependency", + "version": "1.0.0", + "exports": { + "./lol": ["./lib/index.js", "./lib/lol.js"] + } +} +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/index.d.ts +export function fooFromIndex(): void; +// @Filename: /home/src/workspaces/project/node_modules/dependency/lib/lol.d.ts +export function fooFromLol(): void; +// @Filename: /home/src/workspaces/project/src/bar.ts +import { fooFromIndex } from "dependency"; +// @Filename: /home/src/workspaces/project/src/foo.ts +fooFrom/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooFromIndex", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dependency/lol", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + Excludes: []string{ + "fooFromLol", + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_globalTypingsCache_test.go b/internal/fourslash/tests/gen/autoImportProvider_globalTypingsCache_test.go new file mode 100644 index 0000000000..e4c20f6b8c --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_globalTypingsCache_test.go @@ -0,0 +1,57 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_globalTypingsCache(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/Library/Caches/typescript/node_modules/@types/react-router-dom/package.json + { "name": "@types/react-router-dom", "version": "16.8.4", "types": "index.d.ts" } +// @Filename: /home/src/Library/Caches/typescript/node_modules/@types/react-router-dom/index.d.ts + export class BrowserRouterFromDts {} +// @Filename: /home/src/workspaces/project/package.json + { "dependencies": { "react-router-dom": "*" } } +// @Filename: /home/src/workspaces/project/tsconfig.json + { "compilerOptions": { "module": "commonjs", "allowJs": true, "checkJs": true, "maxNodeModuleJsDepth": 2 }, "typeAcquisition": { "enable": true } } +// @Filename: /home/src/workspaces/project/node_modules/react-router-dom/package.json + { "name": "react-router-dom", "version": "16.8.4", "main": "index.js" } +// @Filename: /home/src/workspaces/project/node_modules/react-router-dom/index.js + import "./BrowserRouter"; + export {}; +// @Filename: /home/src/workspaces/project/node_modules/react-router-dom/BrowserRouter.js + export const BrowserRouterFromJs = () => null; +// @Filename: /home/src/workspaces/project/index.js +BrowserRouter/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsInJSPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "BrowserRouterFromDts", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react-router-dom", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_namespaceSameNameAsIntrinsic_test.go b/internal/fourslash/tests/gen/autoImportProvider_namespaceSameNameAsIntrinsic_test.go new file mode 100644 index 0000000000..958cb934c0 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_namespaceSameNameAsIntrinsic_test.go @@ -0,0 +1,57 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_namespaceSameNameAsIntrinsic(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/node_modules/fp-ts/package.json +{ "name": "fp-ts", "version": "0.10.4" } +// @Filename: /home/src/workspaces/project/node_modules/fp-ts/index.d.ts +export * as string from "./lib/string"; +// @Filename: /home/src/workspaces/project/node_modules/fp-ts/lib/string.d.ts +export declare const fromString: (s: string) => string; +export type SafeString = string; +// @Filename: /home/src/workspaces/project/package.json +{ "dependencies": { "fp-ts": "^0.10.4" } } +// @Filename: /home/src/workspaces/project/tsconfig.json +{ "compilerOptions": { "module": "commonjs" } } +// @Filename: /home/src/workspaces/project/index.ts +type A = { name: string/**/ }` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "string", + SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)), + }, + &lsproto.CompletionItem{ + Label: "string", + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "fp-ts", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_wildcardExports1_test.go b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports1_test.go new file mode 100644 index 0000000000..4a12fc1dde --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports1_test.go @@ -0,0 +1,122 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_wildcardExports1(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/node_modules/pkg/package.json +{ + "name": "pkg", + "version": "1.0.0", + "exports": { + "./*": "./a/*.js", + "./b/*.js": "./b/*.js", + "./c/*": "./c/*", + "./d/*": { + "import": "./d/*.mjs" + } + } +} +// @Filename: /home/src/workspaces/project/node_modules/pkg/a/a1.d.ts +export const a1: number; +// @Filename: /home/src/workspaces/project/node_modules/pkg/b/b1.d.ts +export const b1: number; +// @Filename: /home/src/workspaces/project/node_modules/pkg/b/b2.d.mts +export const NOT_REACHABLE: number; +// @Filename: /home/src/workspaces/project/node_modules/pkg/c/c1.d.ts +export const c1: number; +// @Filename: /home/src/workspaces/project/node_modules/pkg/c/subfolder/c2.d.mts +export const c2: number; +// @Filename: /home/src/workspaces/project/node_modules/pkg/d/d1.d.mts +export const d1: number; +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "pkg": "1.0.0" + } +} +// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "nodenext" + } +} +// @Filename: /home/src/workspaces/project/main.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "a1", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "pkg/a1", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "b1", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "pkg/b/b1.js", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "c1", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "pkg/c/c1.js", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "c2", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "pkg/c/subfolder/c2.mjs", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "d1", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "pkg/d/d1", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + Excludes: []string{ + "NOT_REACHABLE", + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_wildcardExports2_test.go b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports2_test.go new file mode 100644 index 0000000000..efaa6244a9 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports2_test.go @@ -0,0 +1,67 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_wildcardExports2(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/node_modules/pkg/package.json +{ + "name": "pkg", + "version": "1.0.0", + "exports": { + "./core/*": { + "types": "./lib/core/*.d.ts", + "default": "./lib/core/*.js" + } + } +} +// @Filename: /home/src/workspaces/project/node_modules/pkg/lib/core/test.d.ts +export function test(): void; +// @Filename: /home/src/workspaces/project/package.json +{ + "type": "module", + "dependencies": { + "pkg": "1.0.0" + } +} +// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "nodenext" + } +} +// @Filename: /home/src/workspaces/project/main.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "test", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "pkg/core/test", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportProvider_wildcardExports3_test.go b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports3_test.go new file mode 100644 index 0000000000..ac0430073b --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportProvider_wildcardExports3_test.go @@ -0,0 +1,71 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportProvider_wildcardExports3(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/packages/ui/package.json +{ + "name": "@repo/ui", + "version": "1.0.0", + "exports": { + "./*": "./src/*.tsx" + } +} +// @Filename: /home/src/workspaces/project/packages/ui/src/Card.tsx +export const Card = () => null; +// @Filename: /home/src/workspaces/project/apps/web/package.json +{ + "name": "web", + "version": "1.0.0", + "dependencies": { + "@repo/ui": "workspace:*" + } +} +// @Filename: /home/src/workspaces/project/apps/web/tsconfig.json +{ + "compilerOptions": { + "module": "esnext", + "moduleResolution": "bundler", + "noEmit": true, + "jsx": "preserve" + }, + "include": ["app"] +} +// @Filename: /home/src/workspaces/project/apps/web/app/index.tsx +(); +// @link: /home/src/workspaces/project/packages/ui -> /home/src/workspaces/project/apps/web/node_modules/@repo/ui` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Card", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "@repo/ui/Card", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportReExportFromAmbientModule_test.go b/internal/fourslash/tests/gen/autoImportReExportFromAmbientModule_test.go new file mode 100644 index 0000000000..a685a1a371 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportReExportFromAmbientModule_test.go @@ -0,0 +1,76 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportReExportFromAmbientModule(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/tsconfig.json +{ + "compilerOptions": { + "module": "commonjs" + } +} +// @Filename: /home/src/workspaces/project/node_modules/@types/node/index.d.ts +declare module "fs" { + export function accessSync(path: string): void; +} +// @Filename: /home/src/workspaces/project/node_modules/@types/fs-extra/index.d.ts +export * from "fs"; +// @Filename: /home/src/workspaces/project/index.ts +access/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "accessSync", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "fs", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "accessSync", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "fs-extra", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "accessSync", + Source: "fs-extra", + Description: "Add import from \"fs-extra\"", + NewFileContent: PtrTo(`import { accessSync } from "fs-extra"; + +access`), + AutoImportData: &ls.AutoImportData{ + ExportName: "accessSync", + FileName: "/home/src/workspaces/project/node_modules/@types/fs-extra/index.d.ts", + ModuleSpecifier: "fs-extra", + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportSameNameDefaultExported_test.go b/internal/fourslash/tests/gen/autoImportSameNameDefaultExported_test.go new file mode 100644 index 0000000000..1c4e6a85be --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportSameNameDefaultExported_test.go @@ -0,0 +1,59 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportSameNameDefaultExported(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @Filename: /node_modules/antd/index.d.ts +declare function Table(): void; +export default Table; +// @Filename: /node_modules/rc-table/index.d.ts +declare function Table(): void; +export default Table; +// @Filename: /index.ts +Table/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Table", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "antd", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + &lsproto.CompletionItem{ + Label: "Table", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "rc-table", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportSortCaseSensitivity2_test.go b/internal/fourslash/tests/gen/autoImportSortCaseSensitivity2_test.go new file mode 100644 index 0000000000..ff585d978d --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportSortCaseSensitivity2_test.go @@ -0,0 +1,56 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportSortCaseSensitivity2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +export interface HasBar { bar: number } +export function hasBar(x: unknown): x is HasBar { return x && typeof x.bar === "number" } +export function foo() {} +export type __String = string; +// @Filename: /b.ts +import { __String, HasBar, hasBar } from "./a"; +f/**/;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("function foo(): void"), + Kind: PtrTo(lsproto.CompletionItemKindFunction), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "foo", + Source: "./a", + Description: "Update import from \"./a\"", + NewFileContent: PtrTo(`import { __String, foo, HasBar, hasBar } from "./a"; +f;`), + }) +} diff --git a/internal/fourslash/tests/gen/autoImportTypeOnlyPreferred1_test.go b/internal/fourslash/tests/gen/autoImportTypeOnlyPreferred1_test.go new file mode 100644 index 0000000000..3a89a0273c --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportTypeOnlyPreferred1_test.go @@ -0,0 +1,63 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportTypeOnlyPreferred1(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @verbatimModuleSyntax: true +// @module: esnext +// @moduleResolution: bundler +// @Filename: /ts.d.ts +declare namespace ts { + interface SourceFile { + text: string; + } + function createSourceFile(): SourceFile; +} +export = ts; +// @Filename: /types.ts +export interface VFS { + getSourceFile(path: string): ts/**/ +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "ts", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./ts", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }).AndApplyCodeAction(t, &fourslash.CompletionsExpectedCodeAction{ + Name: "ts", + Source: "./ts", + Description: "Add import from \"./ts\"", + NewFileContent: `import type ts from "./ts"; + +export interface VFS { + getSourceFile(path: string): ts +}`, + }) +} diff --git a/internal/fourslash/tests/gen/autoImportVerbatimTypeOnly1_test.go b/internal/fourslash/tests/gen/autoImportVerbatimTypeOnly1_test.go new file mode 100644 index 0000000000..6d8622d386 --- /dev/null +++ b/internal/fourslash/tests/gen/autoImportVerbatimTypeOnly1_test.go @@ -0,0 +1,52 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestAutoImportVerbatimTypeOnly1(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @verbatimModuleSyntax: true +// @Filename: /mod.ts +export const value = 0; +export class C { constructor(v: any) {} } +export interface I {} +// @Filename: /a.mts +const x: /**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "I", + Source: "./mod", + Description: "Add import from \"./mod.js\"", + AutoImportData: &ls.AutoImportData{ + ExportName: "I", + FileName: "/mod.ts", + ModuleSpecifier: "./mod.js", + }, + NewFileContent: PtrTo(`import type { I } from "./mod.js"; + +const x: `), + }) + f.Insert(t, "I = new C") + f.VerifyApplyCodeActionFromCompletion(t, nil, &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "C", + Source: "./mod", + Description: "Update import from \"./mod.js\"", + AutoImportData: &ls.AutoImportData{ + ExportName: "C", + FileName: "/mod.ts", + ModuleSpecifier: "./mod.js", + }, + NewFileContent: PtrTo(`import { C, type I } from "./mod.js"; + +const x: I = new C`), + }) +} diff --git a/internal/fourslash/tests/gen/completionForObjectProperty_test.go b/internal/fourslash/tests/gen/completionForObjectProperty_test.go new file mode 100644 index 0000000000..3ccb4b9527 --- /dev/null +++ b/internal/fourslash/tests/gen/completionForObjectProperty_test.go @@ -0,0 +1,189 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionForObjectProperty(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +export const foo = { bar: 'baz' }; +// @Filename: /b.ts +const test = foo/*1*/ +// @Filename: /c.ts +const test2 = {...foo/*2*/} +// @Filename: /d.ts +const test3 = [{...foo/*3*/}] +// @Filename: /e.ts +const test4 = { foo/*4*/ } +// @Filename: /f.ts +const test5 = { foo: /*5*/ } +// @Filename: /g.ts +const test6 = { unrelated: foo/*6*/ } +// @Filename: /i.ts +const test7: { foo/*7*/: "unrelated" } +// @Filename: /h.ts +const test8: { foo: string } = { foo/*8*/ }` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "4", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "5", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "6", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "7", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Excludes: []string{ + "foo", + }, + }, + }) + f.VerifyCompletions(t, "8", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + SortText: PtrTo(string(ls.SortTextLocationPriority)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionInNamedImportLocation_test.go b/internal/fourslash/tests/gen/completionInNamedImportLocation_test.go index 70e23f84fa..dd636cca8b 100644 --- a/internal/fourslash/tests/gen/completionInNamedImportLocation_test.go +++ b/internal/fourslash/tests/gen/completionInNamedImportLocation_test.go @@ -12,7 +12,7 @@ import ( func TestCompletionInNamedImportLocation(t *testing.T) { t.Parallel() - t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @Filename: file.ts export var x = 10; diff --git a/internal/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral5_test.go b/internal/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral5_test.go new file mode 100644 index 0000000000..ed5e08c7ff --- /dev/null +++ b/internal/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral5_test.go @@ -0,0 +1,45 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionPropertyShorthandForObjectLiteral5(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @Filename: /a.ts +export const exportedConstant = 0; +// @Filename: /b.ts +const foo = 'foo' +const obj = { exp/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "exportedConstant", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "/a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter1_test.go b/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter1_test.go new file mode 100644 index 0000000000..1a537ea7ce --- /dev/null +++ b/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter1_test.go @@ -0,0 +1,47 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsClassMemberImportTypeNodeParameter1(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @Filename: /generation.d.ts +export type GenerationConfigType = { max_length?: number }; +// @FileName: /index.d.ts +export declare class PreTrainedModel { + _get_generation_config( + param: import("./generation.js").GenerationConfigType, + ): import("./generation.js").GenerationConfigType; +} + +export declare class BlenderbotSmallPreTrainedModel extends PreTrainedModel { + /*1*/ +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "_get_generation_config", + InsertText: PtrTo("_get_generation_config(param: import(\"./generation.js\").GenerationConfigType): import(\"./generation.js\").GenerationConfigType;"), + FilterText: PtrTo("_get_generation_config"), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter2_test.go b/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter2_test.go new file mode 100644 index 0000000000..291c5f4023 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter2_test.go @@ -0,0 +1,45 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsClassMemberImportTypeNodeParameter2(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @FileName: /index.d.ts +export declare class Cls { + method( + param: import("./doesntexist.js").Foo, + ): import("./doesntexist.js").Foo; +} + +export declare class Derived extends Cls { + /*1*/ +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "method", + InsertText: PtrTo("method(param: import(\"./doesntexist.js\").Foo);"), + FilterText: PtrTo("method"), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter3_test.go b/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter3_test.go new file mode 100644 index 0000000000..d3a0eb7fc7 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter3_test.go @@ -0,0 +1,49 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsClassMemberImportTypeNodeParameter3(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @FileName: /other/foo.d.ts +export declare type Bar = { baz: string }; +// @FileName: /other/cls.d.ts +export declare class Cls { + method( + param: import("./foo.js").Bar, + ): import("./foo.js").Bar; +} +// @FileName: /index.d.ts +import { Cls } from "./other/cls.js"; + +export declare class Derived extends Cls { + /*1*/ +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "method", + InsertText: PtrTo("method(param: import(\"./other/foo.js\").Bar): import(\"./other/foo.js\").Bar;"), + FilterText: PtrTo("method"), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter4_test.go b/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter4_test.go new file mode 100644 index 0000000000..52343b3055 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsClassMemberImportTypeNodeParameter4_test.go @@ -0,0 +1,47 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsClassMemberImportTypeNodeParameter4(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @FileName: /other/cls.d.ts +export declare class Cls { + method( + param: import("./doesntexist.js").Foo, + ): import("./doesntexist.js").Foo; +} +// @FileName: /index.d.ts +import { Cls } from "./other/cls.js"; + +export declare class Derived extends Cls { + /*1*/ +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "method", + InsertText: PtrTo("method(param: import(\"./doesntexist.js\").Foo);"), + FilterText: PtrTo("method"), + AdditionalTextEdits: fourslash.AnyTextEdits, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImportBaseUrl_test.go b/internal/fourslash/tests/gen/completionsImportBaseUrl_test.go new file mode 100644 index 0000000000..e73fae4069 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImportBaseUrl_test.go @@ -0,0 +1,52 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImportBaseUrl(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "module": "esnext" + } +} +// @Filename: /src/a.ts +export const foo = 0; +// @Filename: /src/b.ts +fo/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "/src/a", + }, + })), + Detail: PtrTo("const foo: 0"), + Kind: PtrTo(lsproto.CompletionItemKindVariable), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImportDefaultExportCrash2_test.go b/internal/fourslash/tests/gen/completionsImportDefaultExportCrash2_test.go new file mode 100644 index 0000000000..f300628828 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImportDefaultExportCrash2_test.go @@ -0,0 +1,77 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImportDefaultExportCrash2(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @allowJs: true +// @Filename: /node_modules/dom7/index.d.ts +export interface Dom7Array { + length: number; + prop(propName: string): any; +} + +export interface Dom7 { + (): Dom7Array; + fn: any; +} + +declare const Dom7: Dom7; + +export { + Dom7 as $, +}; +// @Filename: /dom7.js +import * as methods from 'dom7'; +Object.keys(methods).forEach((methodName) => { + if (methodName === '$') return; + methods.$.fn[methodName] = methods[methodName]; +}); + +export default methods.$; +// @Filename: /swipe-back.js +/*1*/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "$", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dom7", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "Dom7", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./dom7", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImportFromJSXTag_test.go b/internal/fourslash/tests/gen/completionsImportFromJSXTag_test.go new file mode 100644 index 0000000000..c0488b300a --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImportFromJSXTag_test.go @@ -0,0 +1,45 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImportFromJSXTag(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @jsx: react +// @Filename: /types.d.ts +declare namespace JSX { + interface IntrinsicElements { a } +} +// @Filename: /Box.tsx +export function Box(props: any) { return null; } +// @Filename: /App.tsx +export function App() { + return ( +

+ + ) +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "Box", + Source: "./Box", + Description: "Add import from \"./Box\"", + NewFileContent: PtrTo(`import { Box } from "./Box"; + +export function App() { + return ( +
+ + ) +}`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImportModuleAugmentationWithJS_test.go b/internal/fourslash/tests/gen/completionsImportModuleAugmentationWithJS_test.go new file mode 100644 index 0000000000..39ec087d07 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImportModuleAugmentationWithJS_test.go @@ -0,0 +1,47 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImportModuleAugmentationWithJS(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @checkJs: true +// @noEmit: true +// @Filename: /test.js +class Abcde { + x +} + +module.exports = { + Abcde +}; +// @Filename: /index.ts +export {}; +declare module "./test" { + interface Abcde { b: string } +} + +Abcde/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "Abcde", + Source: "./test", + Description: "Add import from \"./test\"", + NewFileContent: PtrTo(`import { Abcde } from "./test"; + +export {}; +declare module "./test" { + interface Abcde { b: string } +} + +Abcde`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImportPathsConflict_test.go b/internal/fourslash/tests/gen/completionsImportPathsConflict_test.go new file mode 100644 index 0000000000..da67a8a511 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImportPathsConflict_test.go @@ -0,0 +1,68 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImportPathsConflict(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /tsconfig.json +{ + "compilerOptions": { + "module": "esnext", + "paths": { + "@reduxjs/toolkit": ["src/index.ts"], + "@internal/*": ["src/*"] + } + } +} +// @Filename: /src/index.ts +export { configureStore } from "./configureStore"; +// @Filename: /src/configureStore.ts +export function configureStore() {} +// @Filename: /src/tests/createAsyncThunk.typetest.ts +import {} from "@reduxjs/toolkit"; +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "configureStore", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "@reduxjs/toolkit", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "configureStore", + Source: "@reduxjs/toolkit", + AutoImportData: &ls.AutoImportData{ + ExportName: "configureStore", + FileName: "/src/configureStore.ts", + ModuleSpecifier: "@reduxjs/toolkit", + }, + Description: "Update import from \"@reduxjs/toolkit\"", + NewFileContent: PtrTo(`import { configureStore } from "@reduxjs/toolkit"; +`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImportTypeKeyword_test.go b/internal/fourslash/tests/gen/completionsImportTypeKeyword_test.go new file mode 100644 index 0000000000..42b83f978e --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImportTypeKeyword_test.go @@ -0,0 +1,50 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImportTypeKeyword(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: node18 +// @Filename: /os.d.ts +declare module "os" { + export function type(): string; +} +// @Filename: /index.ts +type/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "type", + SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)), + }, + &lsproto.CompletionItem{ + Label: "type", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "os", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImportYieldExpression_test.go b/internal/fourslash/tests/gen/completionsImportYieldExpression_test.go new file mode 100644 index 0000000000..f0c76cee39 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImportYieldExpression_test.go @@ -0,0 +1,32 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImportYieldExpression(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +export function a() {} +// @Filename: /b.ts +function *f() { + yield a/**/ +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "a", + Source: "./a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import { a } from "./a"; + +function *f() { + yield a +}`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_46332_test.go b/internal/fourslash/tests/gen/completionsImport_46332_test.go new file mode 100644 index 0000000000..bee727e2cc --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_46332_test.go @@ -0,0 +1,101 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_46332(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @moduleResolution: bundler +// @Filename: /node_modules/vue/package.json +{ + "name": "vue", + "types": "dist/vue.d.ts" +} +// @Filename: /node_modules/vue/dist/vue.d.ts +export * from "@vue/runtime-dom" +// @Filename: /node_modules/@vue/runtime-dom/package.json +{ + "name": "@vue/runtime-dom", + "types": "dist/runtime-dom.d.ts" +} +// @Filename: /node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +export * from "@vue/runtime-core"; +export {} +declare module '@vue/reactivity' { + export interface RefUnwrapBailTypes { + runtimeDOMBailTypes: any + } +} +// @Filename: /node_modules/@vue/runtime-core/package.json +{ + "name": "@vue/runtime-core", + "types": "dist/runtime-core.d.ts" +} +// @Filename: /node_modules/@vue/runtime-core/dist/runtime-core.d.ts +import { ref } from '@vue/reactivity'; +export { ref }; +declare module '@vue/reactivity' { + export interface RefUnwrapBailTypes { + runtimeCoreBailTypes: any + } +} +// @Filename: /node_modules/@vue/reactivity/package.json +{ + "name": "@vue/reactivity", + "types": "dist/reactivity.d.ts" +} +// @Filename: /node_modules/@vue/reactivity/dist/reactivity.d.ts +export declare function ref(): T; +// @Filename: /package.json +{ + "dependencies": { + "vue": "*" + } +} +// @Filename: /index.ts +import {} from "vue"; +ref/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "ref", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "vue", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "ref", + Source: "vue", + Description: "Update import from \"vue\"", + AutoImportData: &ls.AutoImportData{ + ExportName: "ref", + FileName: "/node_modules/vue/dist/vue.d.ts", + }, + NewFileContent: PtrTo(`import { ref } from "vue"; +ref`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_ambient_test.go b/internal/fourslash/tests/gen/completionsImport_ambient_test.go new file mode 100644 index 0000000000..611fdb9572 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_ambient_test.go @@ -0,0 +1,76 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_ambient(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @Filename: a.d.ts +declare namespace foo { class Bar {} } +declare module 'path1' { + import Bar = foo.Bar; + export default Bar; +} +declare module 'path2longer' { + import Bar = foo.Bar; + export {Bar}; +} + +// @Filename: b.ts +Ba/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)), + }, + &lsproto.CompletionItem{ + Label: "Bar", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "path1", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "Bar", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "path2longer", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "Bar", + Source: "path2longer", + Description: "Add import from \"path2longer\"", + NewFileContent: PtrTo(`import { Bar } from "path2longer"; + +Ba`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_augmentation_test.go b/internal/fourslash/tests/gen/completionsImport_augmentation_test.go new file mode 100644 index 0000000000..2c7cdce25b --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_augmentation_test.go @@ -0,0 +1,60 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_augmentation(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +export const foo = 0; +// @Filename: /bar.ts +export {}; +declare module "./a" { + export const bar = 0; +} +// @Filename: /user.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Detail: PtrTo("const foo: 0"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "bar", + Detail: PtrTo("const bar: 0"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_compilerOptionsModule_test.go b/internal/fourslash/tests/gen/completionsImport_compilerOptionsModule_test.go new file mode 100644 index 0000000000..62a31af0ac --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_compilerOptionsModule_test.go @@ -0,0 +1,65 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_compilerOptionsModule(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @module: commonjs +// @Filename: /node_modules/a/index.d.ts +export const foo = 0; +// @Filename: /b.js +const a = require("./a"); +fo/*b*/ +// @Filename: /c.js +const x = 0;/*c*/ +// @Filename: /c1.js +// @ts-check +const x = 0;/*ccheck*/ +// @Filename: /c2.ts +const x = 0;/*cts*/ +// @Filename: /d.js +const a = import("./a"); // Does not make this an external module +fo/*d*/ +// @Filename: /d1.js +// @ts-check +const a = import("./a"); // Does not make this an external module +fo/*dcheck*/ +// @Filename: /d2.ts +const a = import("./a"); // Does not make this an external module +fo/*dts*/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, []string{"b", "c", "ccheck", "cts", "d", "dcheck", "dts"}, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "a", + }, + })), + Detail: PtrTo("const foo: 0"), + Kind: PtrTo(lsproto.CompletionItemKindVariable), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_defaultAndNamedConflict_test.go b/internal/fourslash/tests/gen/completionsImport_defaultAndNamedConflict_test.go new file mode 100644 index 0000000000..f60bf9f376 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_defaultAndNamedConflict_test.go @@ -0,0 +1,72 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_defaultAndNamedConflict(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @noLib: true +// @Filename: /someModule.ts +export const someModule = 0; +export default 1; +// @Filename: /index.ts +someMo/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "someModule", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./someModule", + }, + })), + Detail: PtrTo("(property) default: 1"), + Kind: PtrTo(lsproto.CompletionItemKindField), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "someModule", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./someModule", + }, + })), + Detail: PtrTo("const someModule: 0"), + Kind: PtrTo(lsproto.CompletionItemKindVariable), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, true), + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "someModule", + Source: "./someModule", + AutoImportData: &ls.AutoImportData{ + ExportName: "default", + FileName: "/someModule.ts", + }, + Description: "Add import from \"./someModule\"", + NewFileContent: PtrTo(`import someModule from "./someModule"; + +someMo`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_defaultFalsePositive_test.go b/internal/fourslash/tests/gen/completionsImport_defaultFalsePositive_test.go new file mode 100644 index 0000000000..38d4aef0f8 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_defaultFalsePositive_test.go @@ -0,0 +1,58 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_defaultFalsePositive(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /node_modules/foo/index.ts +export default function f(): void; +// @Filename: /node_modules/bar/concat.d.ts +export const concat = 0; +// @Filename: /a.ts +export {}; +conca/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "/a.ts") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "concat", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "bar/concat", + }, + })), + Detail: PtrTo("const concat: 0"), + Kind: PtrTo(lsproto.CompletionItemKindVariable), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "concat", + Source: "bar/concat", + Description: "Add import from \"bar/concat\"", + NewFileContent: PtrTo(`import { concat } from "bar/concat"; + +export {}; +conca`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_default_addToNamedImports_test.go b/internal/fourslash/tests/gen/completionsImport_default_addToNamedImports_test.go new file mode 100644 index 0000000000..d98caac868 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_default_addToNamedImports_test.go @@ -0,0 +1,54 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_default_addToNamedImports(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +export default function foo() {} +export const x = 0; +// @Filename: /b.ts +import { x } from "./a"; +f/**/;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("function foo(): void"), + Kind: PtrTo(lsproto.CompletionItemKindFunction), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "foo", + Source: "./a", + Description: "Update import from \"./a\"", + NewFileContent: PtrTo(`import foo, { x } from "./a"; +f;`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_default_addToNamespaceImport_test.go b/internal/fourslash/tests/gen/completionsImport_default_addToNamespaceImport_test.go new file mode 100644 index 0000000000..23d8638a44 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_default_addToNamespaceImport_test.go @@ -0,0 +1,53 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_default_addToNamespaceImport(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +export default function foo() {} +// @Filename: /b.ts +import * as a from "./a"; +f/**/;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("function foo(): void"), + Kind: PtrTo(lsproto.CompletionItemKindFunction), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "foo", + Source: "./a", + Description: "Update import from \"./a\"", + NewFileContent: PtrTo(`import foo, * as a from "./a"; +f;`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_default_alreadyExistedWithRename_test.go b/internal/fourslash/tests/gen/completionsImport_default_alreadyExistedWithRename_test.go new file mode 100644 index 0000000000..4ffdba061b --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_default_alreadyExistedWithRename_test.go @@ -0,0 +1,54 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_default_alreadyExistedWithRename(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +export default function foo() {} +// @Filename: /b.ts +import f_o_o from "./a"; +f/**/;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("function foo(): void"), + Kind: PtrTo(lsproto.CompletionItemKindFunction), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "foo", + Source: "./a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import foo from "./a"; +import f_o_o from "./a"; +f;`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_default_anonymous_test.go b/internal/fourslash/tests/gen/completionsImport_default_anonymous_test.go new file mode 100644 index 0000000000..fce12a0932 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_default_anonymous_test.go @@ -0,0 +1,69 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_default_anonymous(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @noLib: true +// @Filename: /src/foo-bar.ts +export default 0; +// @Filename: /src/b.ts +def/*0*/ +fooB/*1*/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "0") + f.VerifyCompletions(t, "0", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{}, true), + }, + }) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooBar", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "/src/foo-bar", + }, + })), + Detail: PtrTo("(property) default: 0"), + Kind: PtrTo(lsproto.CompletionItemKindField), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("1"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "fooBar", + Source: "/src/foo-bar", + Description: "Add import from \"./foo-bar\"", + NewFileContent: PtrTo(`import fooBar from "./foo-bar" + +def +fooB`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_default_didNotExistBefore_test.go b/internal/fourslash/tests/gen/completionsImport_default_didNotExistBefore_test.go new file mode 100644 index 0000000000..26576cab49 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_default_didNotExistBefore_test.go @@ -0,0 +1,54 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_default_didNotExistBefore(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @Filename: /a.ts +export default function foo() {} +// @Filename: /b.ts +f/**/;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "/a", + }, + })), + Detail: PtrTo("function foo(): void"), + Kind: PtrTo(lsproto.CompletionItemKindFunction), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "foo", + Source: "/a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import foo from "./a"; + +f;`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_default_exportDefaultIdentifier_test.go b/internal/fourslash/tests/gen/completionsImport_default_exportDefaultIdentifier_test.go new file mode 100644 index 0000000000..ae41e12f86 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_default_exportDefaultIdentifier_test.go @@ -0,0 +1,56 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_default_exportDefaultIdentifier(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @Filename: /a.ts +const foo = 0; +export default foo; +// @Filename: /b.ts +f/**/;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "/a", + }, + })), + Detail: PtrTo("(alias) const foo: 0\nexport default foo"), + Kind: PtrTo(lsproto.CompletionItemKindVariable), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "foo", + Source: "/a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import foo from "./a"; + +f;`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_default_fromMergedDeclarations_test.go b/internal/fourslash/tests/gen/completionsImport_default_fromMergedDeclarations_test.go new file mode 100644 index 0000000000..5123c8e3cd --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_default_fromMergedDeclarations_test.go @@ -0,0 +1,60 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_default_fromMergedDeclarations(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @Filename: /a.ts +declare module "m" { + export default class M {} +} +// @Filename: /b.ts +declare module "m" { + export default interface M {} +} +// @Filename: /c.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "M", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "m", + }, + })), + Detail: PtrTo("class M"), + Kind: PtrTo(lsproto.CompletionItemKindClass), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "M", + Source: "m", + Description: "Add import from \"m\"", + NewFileContent: PtrTo(`import M from "m"; + +`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_default_reExport_test.go b/internal/fourslash/tests/gen/completionsImport_default_reExport_test.go new file mode 100644 index 0000000000..52e55cdecb --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_default_reExport_test.go @@ -0,0 +1,64 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_default_reExport(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @allowJs: true +// @Filename: /file1.js +const a = 1; +export { + a as b +}; +export default a; +// @Filename: /file2.js +import * as foo from './file1'; +/**/ +export default foo.b;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsInJSPlus( + []fourslash.CompletionsExpectedItem{ + "foo", + &lsproto.CompletionItem{ + Label: "a", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./file1", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "b", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./file1", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_default_symbolName_test.go b/internal/fourslash/tests/gen/completionsImport_default_symbolName_test.go new file mode 100644 index 0000000000..bae20c6a6d --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_default_symbolName_test.go @@ -0,0 +1,62 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_default_symbolName(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @esModuleInterop: false +// @allowSyntheticDefaultImports: false +// @Filename: /node_modules/@types/range-parser/index.d.ts +declare function RangeParser(): string; +declare namespace RangeParser { + interface Options { + combine?: boolean; + } +} +export = RangeParser; +// @Filename: /b.ts +R/*0*/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "0", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "RangeParser", + Kind: PtrTo(lsproto.CompletionItemKindFunction), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "range-parser", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + Detail: PtrTo("namespace RangeParser\nfunction RangeParser(): string"), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("0"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "RangeParser", + Source: "range-parser", + Description: "Add import from \"range-parser\"", + NewFileContent: PtrTo(`import RangeParser = require("range-parser"); + +R`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_details_withMisspelledName_test.go b/internal/fourslash/tests/gen/completionsImport_details_withMisspelledName_test.go new file mode 100644 index 0000000000..f0201764ec --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_details_withMisspelledName_test.go @@ -0,0 +1,46 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_details_withMisspelledName(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +export const abc = 0; +// @Filename: /b.ts +acb/*1*/; +// @Filename: /c.ts +acb/*2*/;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "1") + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("1"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "abc", + Source: "./a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import { abc } from "./a"; + +acb;`), + }) + f.GoToMarker(t, "2") + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("2"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "abc", + Source: "./a", + AutoImportData: &ls.AutoImportData{ + ExportName: "abc", + FileName: "/a.ts", + ModuleSpecifier: "./a", + }, + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import { abc } from "./a"; + +acb;`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypesAndNotTypes_test.go b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypesAndNotTypes_test.go new file mode 100644 index 0000000000..650cff95f6 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypesAndNotTypes_test.go @@ -0,0 +1,74 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_duplicatePackages_scopedTypesAndNotTypes(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @esModuleInterop: true +// @Filename: /node_modules/@types/scope__react-dom/package.json +{ "name": "react-dom", "version": "1.0.0", "types": "./index.d.ts" } +// @Filename: /node_modules/@types/scope__react-dom/index.d.ts +import * as React from "react"; +export function render(): void; +// @Filename: /node_modules/@types/scope__react/package.json +{ "name": "react", "version": "1.0.0", "types": "./index.d.ts" } +// @Filename: /node_modules/@types/scope__react/index.d.ts +import "./other"; +export declare function useState(): void; +// @Filename: /node_modules/@types/scope__react/other.d.ts +export declare function useRef(): void; +// @Filename: /packages/a/node_modules/@scope/react/package.json +{ "name": "react", "version": "1.0.1", "types": "./index.d.ts" } +// @Filename: /packages/a/node_modules/@scope/react/index.d.ts +export declare function useState(): void; +// @Filename: /packages/a/index.ts +import "react-dom"; +import "react"; +// @Filename: /packages/a/foo.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "render", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "@scope/react-dom", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "useState", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "@scope/react", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypes_test.go b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypes_test.go new file mode 100644 index 0000000000..ef1bbfc4b9 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scopedTypes_test.go @@ -0,0 +1,74 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_duplicatePackages_scopedTypes(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @esModuleInterop: true +// @Filename: /node_modules/@types/scope__react-dom/package.json +{ "name": "react-dom", "version": "1.0.0", "types": "./index.d.ts" } +// @Filename: /node_modules/@types/scope__react-dom/index.d.ts +import * as React from "react"; +export function render(): void; +// @Filename: /node_modules/@types/scope__react/package.json +{ "name": "react", "version": "1.0.0", "types": "./index.d.ts" } +// @Filename: /node_modules/@types/scope__react/index.d.ts +import "./other"; +export declare function useState(): void; +// @Filename: /node_modules/@types/scope__react/other.d.ts +export declare function useRef(): void; +// @Filename: /packages/a/node_modules/@types/scope__react/package.json +{ "name": "react", "version": "1.0.1", "types": "./index.d.ts" } +// @Filename: /packages/a/node_modules/@types/scope__react/index.d.ts +export declare function useState(): void; +// @Filename: /packages/a/index.ts +import "@scope/react-dom"; +import "@scope/react"; +// @Filename: /packages/a/foo.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "render", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "@scope/react-dom", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "useState", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "@scope/react", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scoped_test.go b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scoped_test.go new file mode 100644 index 0000000000..7bdc35017a --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_scoped_test.go @@ -0,0 +1,74 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_duplicatePackages_scoped(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @esModuleInterop: true +// @Filename: /node_modules/@scope/react-dom/package.json +{ "name": "react-dom", "version": "1.0.0", "types": "./index.d.ts" } +// @Filename: /node_modules/@scope/react-dom/index.d.ts +import * as React from "react"; +export function render(): void; +// @Filename: /node_modules/@scope/react/package.json +{ "name": "react", "version": "1.0.0", "types": "./index.d.ts" } +// @Filename: /node_modules/@scope/react/index.d.ts +import "./other"; +export declare function useState(): void; +// @Filename: /node_modules/@scope/react/other.d.ts +export declare function useRef(): void; +// @Filename: /packages/a/node_modules/@scope/react/package.json +{ "name": "react", "version": "1.0.1", "types": "./index.d.ts" } +// @Filename: /packages/a/node_modules/@scope/react/index.d.ts +export declare function useState(): void; +// @Filename: /packages/a/index.ts +import "@scope/react-dom"; +import "@scope/react"; +// @Filename: /packages/a/foo.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "render", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "@scope/react-dom", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "useState", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "@scope/react", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_typesAndNotTypes_test.go b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_typesAndNotTypes_test.go new file mode 100644 index 0000000000..380ddb701d --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_typesAndNotTypes_test.go @@ -0,0 +1,64 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_duplicatePackages_typesAndNotTypes(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @esModuleInterop: true +// @Filename: /node_modules/@types/react-dom/package.json +{ "name": "react-dom", "version": "1.0.0", "types": "./index.d.ts" } +// @Filename: /node_modules/@types/react-dom/index.d.ts +import * as React from "react"; +export function render(): void; +// @Filename: /node_modules/@types/react/package.json +{ "name": "react", "version": "1.0.0", "types": "./index.d.ts" } +// @Filename: /node_modules/@types/react/index.d.ts +import "./other"; +export declare function useState(): void; +// @Filename: /node_modules/@types/react/other.d.ts +export declare function useRef(): void; +// @Filename: /packages/a/node_modules/react/package.json +{ "name": "react", "version": "1.0.1", "types": "./index.d.ts" } +// @Filename: /packages/a/node_modules/react/index.d.ts +export declare function useState(): void; +// @Filename: /packages/a/index.ts +import "react-dom"; +import "react"; +// @Filename: /packages/a/foo.ts +useState/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "useState", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_duplicatePackages_types_test.go b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_types_test.go new file mode 100644 index 0000000000..6653f114ec --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_duplicatePackages_types_test.go @@ -0,0 +1,74 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_duplicatePackages_types(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @esModuleInterop: true +// @Filename: /node_modules/@types/react-dom/package.json +{ "name": "react-dom", "version": "1.0.0", "types": "./index.d.ts" } +// @Filename: /node_modules/@types/react-dom/index.d.ts +import * as React from "react"; +export function render(): void; +// @Filename: /node_modules/@types/react/package.json +{ "name": "react", "version": "1.0.0", "types": "./index.d.ts" } +// @Filename: /node_modules/@types/react/index.d.ts +import "./other"; +export declare function useState(): void; +// @Filename: /node_modules/@types/react/other.d.ts +export declare function useRef(): void; +// @Filename: /packages/a/node_modules/@types/react/package.json +{ "name": "react", "version": "1.0.1", "types": "./index.d.ts" } +// @Filename: /packages/a/node_modules/@types/react/index.d.ts +export declare function useState(): void; +// @Filename: /packages/a/index.ts +import "react-dom"; +import "react"; +// @Filename: /packages/a/foo.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "render", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react-dom", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "useState", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_exportEqualsNamespace_noDuplicate_test.go b/internal/fourslash/tests/gen/completionsImport_exportEqualsNamespace_noDuplicate_test.go new file mode 100644 index 0000000000..df2677b55e --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_exportEqualsNamespace_noDuplicate_test.go @@ -0,0 +1,52 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_exportEqualsNamespace_noDuplicate(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /node_modules/a/index.d.ts +declare namespace core { + const foo: number; +} +declare module "a" { + export = core; +} +declare module "a/alias" { + export = core; +} +// @Filename: /user.ts +import * as a from "a"; +/**/foo;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_exportEquals_anonymous_test.go b/internal/fourslash/tests/gen/completionsImport_exportEquals_anonymous_test.go new file mode 100644 index 0000000000..f3b7805d04 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_exportEquals_anonymous_test.go @@ -0,0 +1,72 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_exportEquals_anonymous(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @noLib: true +// @module: commonjs +// @esModuleInterop: false +// @allowSyntheticDefaultImports: false +// @Filename: /src/foo-bar.ts +export = 0; +// @Filename: /src/b.ts +exp/*0*/ +fooB/*1*/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "0") + f.VerifyCompletions(t, "0", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{}, true), + }, + }) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "fooBar", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./foo-bar", + }, + })), + Detail: PtrTo("(property) export=: 0"), + Kind: PtrTo(lsproto.CompletionItemKindField), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, true), + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("0"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "fooBar", + Source: "./foo-bar", + Description: "Add import from \"./foo-bar\"", + NewFileContent: PtrTo(`import fooBar = require("./foo-bar") + +exp +fooB`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_exportEquals_global_test.go b/internal/fourslash/tests/gen/completionsImport_exportEquals_global_test.go new file mode 100644 index 0000000000..9f4f618159 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_exportEquals_global_test.go @@ -0,0 +1,50 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_exportEquals_global(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: es6 +// @Filename: /console.d.ts + interface Console {} + declare var console: Console; + declare module "console" { + export = console; + } +// @Filename: /react-native.d.ts + import 'console'; + declare global { + interface Console {} + var console: Console; + } +// @Filename: /a.ts +conso/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "console", + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_exportEquals_test.go b/internal/fourslash/tests/gen/completionsImport_exportEquals_test.go new file mode 100644 index 0000000000..5a1ef9edd0 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_exportEquals_test.go @@ -0,0 +1,91 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_exportEquals(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @esModuleInterop: false +// @allowSyntheticDefaultImports: false +// @Filename: /a.d.ts +declare function a(): void; +declare namespace a { + export interface b {} +} +export = a; +// @Filename: /b.ts +a/*0*/; +let x: b/*1*/;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "0", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "a", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "b", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("1"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "b", + Source: "./a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import { b } from "./a"; + +a; +let x: b;`), + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("0"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "a", + Source: "./a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import { b } from "./a"; +import a = require("./a"); + +a; +let x: b;`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByInvalidPackageJson_direct_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByInvalidPackageJson_direct_test.go new file mode 100644 index 0000000000..7d7f135186 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_filteredByInvalidPackageJson_direct_test.go @@ -0,0 +1,73 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_filteredByInvalidPackageJson_direct(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@noEmit: true +//@Filename: /package.json +{ + "mod" + "dependencies": { + "react": "*" + } +} +//@Filename: /node_modules/react/index.d.ts +export declare var React: any; +//@Filename: /node_modules/react/package.json +{ + "name": "react", + "types": "./index.d.ts" +} +//@Filename: /node_modules/fake-react/index.d.ts +export declare var ReactFake: any; +//@Filename: /node_modules/fake-react/package.json +{ + "name": "fake-react", + "types": "./index.d.ts" +} +//@Filename: /src/index.ts +const x = Re/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "React", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "ReactFake", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "fake-react", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesImplicit_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesImplicit_test.go new file mode 100644 index 0000000000..bd53aa7be8 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesImplicit_test.go @@ -0,0 +1,63 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_filteredByPackageJson_typesImplicit(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@noEmit: true +//@Filename: /package.json +{ + "dependencies": { + "react": "*" + } +} +//@Filename: /node_modules/@types/react/index.d.ts +export declare var React: any; +//@Filename: /node_modules/@types/react/package.json +{ + "name": "@types/react" +} +//@Filename: /node_modules/@types/fake-react/index.d.ts +export declare var ReactFake: any; +//@Filename: /node_modules/@types/fake-react/package.json +{ + "name": "@types/fake-react" +} +//@Filename: /src/index.ts +const x = Re/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "React", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + Excludes: []string{ + "ReactFake", + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesOnly_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesOnly_test.go new file mode 100644 index 0000000000..27ccbf38d8 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_@typesOnly_test.go @@ -0,0 +1,63 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_filteredByPackageJson_typesOnly(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@noEmit: true +//@Filename: /package.json +{ + "devDependencies": { + "@types/react": "*" + } +} +//@Filename: /node_modules/@types/react/index.d.ts +export declare var React: any; +//@Filename: /node_modules/@types/react/package.json +{ + "name": "@types/react" +} +//@Filename: /node_modules/@types/fake-react/index.d.ts +export declare var ReactFake: any; +//@Filename: /node_modules/@types/fake-react/package.json +{ + "name": "@types/fake-react" +} +//@Filename: /src/index.ts +const x = Re/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "React", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + Excludes: []string{ + "ReactFake", + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_ambient_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_ambient_test.go new file mode 100644 index 0000000000..69fd73678f --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_ambient_test.go @@ -0,0 +1,153 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_filteredByPackageJson_ambient(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@noEmit: true +//@Filename: /package.json +{ + "dependencies": { + "react-syntax-highlighter": "*", + "declared-by-foo": "*" + } +} +//@Filename: /node_modules/@types/foo/index.d.ts +declare module "foo" { + export const foo: any; +} +declare module "declared-by-foo" { + export const declaredBySomethingNotInPackageJson: any; +} +//@Filename: /node_modules/@types/foo/package.json +{ + "name": "@types/node" +} +//@Filename: /node_modules/@types/react-syntax-highlighter/index.d.ts +declare module "react-syntax-highlighter/sub" { + const agate: any; + export default agate; +} +declare module "something-else" { + export const somethingElse: any; +} +//@Filename: /node_modules/@types/react-syntax-highlighter/package.json +{ + "name": "@types/react-syntax-highlighter" +} +//@Filename: /src/ambient.ts +declare module "local" { + export const local: any'; +} +//@Filename: /src/index.ts +fo/*1*/ +aga/*2*/ +somethi/*3*/ +declaredBy/*4*/ +loca/*5*/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobals, + }, + }) + f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "agate", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react-syntax-highlighter/sub", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "somethingElse", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "something-else", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "4", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "declaredBySomethingNotInPackageJson", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "declared-by-foo", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "5", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "local", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "local", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_direct_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_direct_test.go new file mode 100644 index 0000000000..52dee82f49 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_direct_test.go @@ -0,0 +1,65 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_filteredByPackageJson_direct(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@noEmit: true +//@Filename: /package.json +{ + "dependencies": { + "react": "*" + } +} +//@Filename: /node_modules/react/index.d.ts +export declare var React: any; +//@Filename: /node_modules/react/package.json +{ + "name": "react", + "types": "./index.d.ts" +} +//@Filename: /node_modules/fake-react/index.d.ts +export declare var ReactFake: any; +//@Filename: /node_modules/fake-react/package.json +{ + "name": "fake-react", + "types": "./index.d.ts" +} +//@Filename: /src/index.ts +const x = Re/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "React", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + Excludes: []string{ + "ReactFake", + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_nested_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_nested_test.go new file mode 100644 index 0000000000..f2116414aa --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_nested_test.go @@ -0,0 +1,89 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_filteredByPackageJson_nested(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@noEmit: true +//@Filename: /package.json +{ + "dependencies": { + "react": "*" + } +} +//@Filename: /node_modules/react/index.d.ts +export declare var React: any; +//@Filename: /node_modules/react/package.json +{ + "name": "react", + "types": "./index.d.ts" +} +//@Filename: /dir/package.json +{ + "dependencies": { + "redux": "*" + } +} +//@Filename: /dir/node_modules/redux/package.json +{ + "name": "redux", + "types": "./index.d.ts" +} +//@Filename: /dir/node_modules/redux/index.d.ts +export declare var Redux: any; +//@Filename: /dir/index.ts +const x = Re/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "React", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Redux", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "redux", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_peerDependencies_test.go b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_peerDependencies_test.go new file mode 100644 index 0000000000..8997b6e93a --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_filteredByPackageJson_peerDependencies_test.go @@ -0,0 +1,65 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_filteredByPackageJson_peerDependencies(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@noEmit: true +//@Filename: /package.json +{ + "peerDependencies": { + "react": "*" + } +} +//@Filename: /node_modules/react/index.d.ts +export declare var React: any; +//@Filename: /node_modules/react/package.json +{ + "name": "react", + "types": "./index.d.ts" +} +//@Filename: /node_modules/fake-react/index.d.ts +export declare var ReactFake: any; +//@Filename: /node_modules/fake-react/package.json +{ + "name": "fake-react", + "types": "./index.d.ts" +} +//@Filename: /src/index.ts +const x = Re/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "React", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "react", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + Excludes: []string{ + "ReactFake", + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_fromAmbientModule_test.go b/internal/fourslash/tests/gen/completionsImport_fromAmbientModule_test.go new file mode 100644 index 0000000000..e070b3e47f --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_fromAmbientModule_test.go @@ -0,0 +1,31 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_fromAmbientModule(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @Filename: /a.ts +declare module "m" { + export const x: number; +} +// @Filename: /b.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "x", + Source: "m", + Description: "Add import from \"m\"", + NewFileContent: PtrTo(`import { x } from "m"; + +`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_importType_test.go b/internal/fourslash/tests/gen/completionsImport_importType_test.go new file mode 100644 index 0000000000..28c24d84d2 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_importType_test.go @@ -0,0 +1,83 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_importType(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: /a.js +export const x = 0; +export class C {} +/** @typedef {number} T */ +// @Filename: /b.js +export const m = 0; +/** @type {/*0*/} */ +/** @type {/*1*/} */` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, []string{"0", "1"}, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "C", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("class C"), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "T", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("type T = number"), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + Excludes: []string{ + "x", + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("0"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "C", + Source: "./a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import { C } from "./a"; + +export const m = 0; +/** @type {} */ +/** @type {} */`), + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("1"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "T", + Source: "./a", + Description: "Change 'T' to 'import(\"./a\").T'", + NewFileContent: PtrTo(`import { C } from "./a"; + +export const m = 0; +/** @type {} */ +/** @type {import("./a").} */`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_jsxOpeningTagImportDefault_test.go b/internal/fourslash/tests/gen/completionsImport_jsxOpeningTagImportDefault_test.go new file mode 100644 index 0000000000..1dc2706366 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_jsxOpeningTagImportDefault_test.go @@ -0,0 +1,61 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_jsxOpeningTagImportDefault(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @jsx: react +// @Filename: /component.tsx +export default function (props: any) {} +// @Filename: /index.tsx +export function Index() { + return void; +declare const namedExport: () => void; + +export default defaultExport; +export { namedExport }; +// @Filename: /node_modules/example/dist/index.d.ts +export { default, namedExport } from "./nested/module"; +// @Filename: /index.mjs +import { namedExport } from "example"; +defaultExp/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsInJSPlus( + []fourslash.CompletionsExpectedItem{ + "namedExport", + &lsproto.CompletionItem{ + Label: "defaultExport", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "example", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_reExportDefault_test.go b/internal/fourslash/tests/gen/completionsImport_reExportDefault_test.go new file mode 100644 index 0000000000..f6e4129652 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_reExportDefault_test.go @@ -0,0 +1,58 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_reExportDefault(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @moduleResolution: node10 +// @Filename: /a/b/impl.ts +export default function foo() {} +// @Filename: /a/index.ts +export { default as foo } from "./b/impl"; +// @Filename: /use.ts +fo/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "/a/b/impl", + }, + })), + Detail: PtrTo("function foo(): void"), + Kind: PtrTo(lsproto.CompletionItemKindFunction), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "foo", + Source: "/a/b/impl", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import { foo } from "./a"; + +fo`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_reExport_wrongName_test.go b/internal/fourslash/tests/gen/completionsImport_reExport_wrongName_test.go new file mode 100644 index 0000000000..4651f917c1 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_reExport_wrongName_test.go @@ -0,0 +1,76 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_reExport_wrongName(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @moduleResolution: bundler +// @Filename: /a.ts +export const x = 0; +// @Filename: /index.ts +export { x as y } from "./a"; +// @Filename: /c.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "x", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("const x: 0"), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "y", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: ".", + }, + })), + Detail: PtrTo("(alias) const y: 0\nexport y"), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "x", + Source: "./a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import { x } from "./a"; + +`), + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "y", + Source: ".", + Description: "Add import from \".\"", + NewFileContent: PtrTo(`import { y } from "."; +import { x } from "./a"; + +`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_reexportTransient_test.go b/internal/fourslash/tests/gen/completionsImport_reexportTransient_test.go new file mode 100644 index 0000000000..14e7c532c9 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_reexportTransient_test.go @@ -0,0 +1,51 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_reexportTransient(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @esModuleInterop: true +// @Filename: /transient.d.ts +declare const map: { [K in "one"]: number }; +export = map; +// @Filename: /r1.ts +export { one } from "./transient"; +// @Filename: /r2.ts +export { one } from "./r1"; +// @Filename: /index.ts +one/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "one", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./transient", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_require_addNew_test.go b/internal/fourslash/tests/gen/completionsImport_require_addNew_test.go new file mode 100644 index 0000000000..5f38f4b5b1 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_require_addNew_test.go @@ -0,0 +1,54 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_require_addNew(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: /a.js +const x = 0; +module.exports = { x }; +// @Filename: /b.js +x/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "x", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("(alias) const x: 0\nimport x"), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "x", + Source: "./a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`const { x } = require("./a"); + +x`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_require_addToExisting_test.go b/internal/fourslash/tests/gen/completionsImport_require_addToExisting_test.go new file mode 100644 index 0000000000..e0ee34df82 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_require_addToExisting_test.go @@ -0,0 +1,57 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_require_addToExisting(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: /a.js +const x = 0; +function f() {} +module.exports = { x, f }; +// @Filename: /b.js +const { f } = require("./a"); + +x/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "x", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("(alias) const x: 0\nimport x"), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "x", + Source: "./a", + Description: "Update import from \"./a\"", + NewFileContent: PtrTo(`const { f, x } = require("./a"); + +x`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_require_test.go b/internal/fourslash/tests/gen/completionsImport_require_test.go new file mode 100644 index 0000000000..aab622f2ef --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_require_test.go @@ -0,0 +1,55 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_require(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: /a.ts +export const foo = 0; +// @Filename: /b.js +import * as s from "something"; +fo/*b*/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "b", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("const foo: 0"), + Kind: PtrTo(lsproto.CompletionItemKindVariable), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo("b"), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "foo", + Source: "./a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import * as s from "something"; +import { foo } from "./a"; +fo`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_sortingModuleSpecifiers_test.go b/internal/fourslash/tests/gen/completionsImport_sortingModuleSpecifiers_test.go new file mode 100644 index 0000000000..625ab87cce --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_sortingModuleSpecifiers_test.go @@ -0,0 +1,74 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_sortingModuleSpecifiers(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: tsconfig.json +{ "compilerOptions": { "module": "commonjs" } } +// @Filename: path.d.ts +declare module "path/posix" { + export function normalize(p: string): string; +} +declare module "path/win32" { + export function normalize(p: string): string; +} +declare module "path" { + export function normalize(p: string): string; +} +// @Filename: main.ts +normalize/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "normalize", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "path", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "normalize", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "path/posix", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "normalize", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "path/win32", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_tsx_test.go b/internal/fourslash/tests/gen/completionsImport_tsx_test.go new file mode 100644 index 0000000000..4f8e7c38b5 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_tsx_test.go @@ -0,0 +1,49 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_tsx(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @noLib: true +// @jsx: preserve +// @Filename: /a.tsx +export type Bar = 0; +export default function Foo() {}; +// @Filename: /b.tsx +;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + Excludes: []string{ + "Bar", + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_typeOnly_test.go b/internal/fourslash/tests/gen/completionsImport_typeOnly_test.go new file mode 100644 index 0000000000..27d374d54e --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_typeOnly_test.go @@ -0,0 +1,32 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_typeOnly(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @target: esnext +// @moduleResolution: bundler +// @Filename: /a.ts +export class A {} +export class B {} +// @Filename: /b.ts +import type { A } from './a'; +const b: B/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "/b.ts") + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "B", + Source: "./a", + Description: "Update import from \"./a\"", + NewFileContent: PtrTo(`import type { A, B } from './a'; +const b: B`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash1_test.go b/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash1_test.go new file mode 100644 index 0000000000..f76355c039 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_umdDefaultNoCrash1_test.go @@ -0,0 +1,70 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_umdDefaultNoCrash1(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @moduleResolution: bundler +// @allowJs: true +// @checkJs: true +// @Filename: /node_modules/dottie/package.json +{ + "name": "dottie", + "main": "dottie.js" +} +// @Filename: /node_modules/dottie/dottie.js +(function (undefined) { + var root = this; + + var Dottie = function () {}; + + Dottie["default"] = function (object, path, value) {}; + + if (typeof module !== "undefined" && module.exports) { + exports = module.exports = Dottie; + } else { + root["Dottie"] = Dottie; + root["Dot"] = Dottie; + + if (typeof define === "function") { + define([], function () { + return Dottie; + }); + } + } +})(); +// @Filename: /src/index.js +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Dottie", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "dottie", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_umdModules1_globalAccess_test.go b/internal/fourslash/tests/gen/completionsImport_umdModules1_globalAccess_test.go new file mode 100644 index 0000000000..331af0b944 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_umdModules1_globalAccess_test.go @@ -0,0 +1,49 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_umdModules1_globalAccess(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @filename: /package.json +{ "dependencies": { "@types/classnames": "*" } } +// @filename: /tsconfig.json +{ "compilerOptions": { "allowUmdGlobalAccess": true } } +// @filename: /node_modules/@types/classnames/package.json +{ "name": "@types/classnames", "types": "index.d.ts" } +// @filename: /node_modules/@types/classnames/index.d.ts +declare const classNames: () => string; +export = classNames; +export as namespace classNames; +// @filename: /SomeReactComponent.tsx +import * as React from 'react'; + +const el1 =
foo
;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "1") + f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "classNames", + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_umdModules2_moduleExports_test.go b/internal/fourslash/tests/gen/completionsImport_umdModules2_moduleExports_test.go new file mode 100644 index 0000000000..a1dfd2d6d8 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_umdModules2_moduleExports_test.go @@ -0,0 +1,54 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_umdModules2_moduleExports(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @filename: /package.json +{ "dependencies": { "@types/classnames": "*" } } +// @filename: /tsconfig.json +{} +// @filename: /node_modules/@types/classnames/package.json +{ "name": "@types/classnames", "types": "index.d.ts" } +// @filename: /node_modules/@types/classnames/index.d.ts +declare const classNames: () => string; +export = classNames; +export as namespace classNames; +// @filename: /SomeReactComponent.tsx +import * as React from 'react'; + +const el1 =
foo
;` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "1") + f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "classNames", + AdditionalTextEdits: fourslash.AnyTextEdits, + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "classnames", + }, + })), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_umdModules3_script_test.go b/internal/fourslash/tests/gen/completionsImport_umdModules3_script_test.go new file mode 100644 index 0000000000..f3781b3757 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_umdModules3_script_test.go @@ -0,0 +1,48 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_umdModules3_script(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @filename: /package.json +{ "dependencies": { "@types/classnames": "*" } } +// @filename: /tsconfig.json +{ "compilerOptions": { "module": "es2015" }} +// @filename: /node_modules/@types/classnames/package.json +{ "name": "@types/classnames", "types": "index.d.ts" } +// @filename: /node_modules/@types/classnames/index.d.ts +declare const classNames: () => string; +export = classNames; +export as namespace classNames; +// @filename: /SomeReactComponent.tsx + +const el1 =
foo
` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "1") + f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "classNames", + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules1_test.go b/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules1_test.go new file mode 100644 index 0000000000..993593f4d2 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules1_test.go @@ -0,0 +1,78 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_uriStyleNodeCoreModules1(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @Filename: /node_modules/@types/node/index.d.ts +declare module "fs" { function writeFile(): void } +declare module "fs/promises" { function writeFile(): Promise } +declare module "node:fs" { export * from "fs"; } +declare module "node:fs/promises" { export * from "fs/promises"; } +// @Filename: /index.ts +write/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "writeFile", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "fs", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "writeFile", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "node:fs", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "writeFile", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "fs/promises", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "writeFile", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "node:fs/promises", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules2_test.go b/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules2_test.go new file mode 100644 index 0000000000..5c295f65f2 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_uriStyleNodeCoreModules2_test.go @@ -0,0 +1,60 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_uriStyleNodeCoreModules2(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @Filename: /node_modules/@types/node/index.d.ts +declare module "fs" { function writeFile(): void } +declare module "fs/promises" { function writeFile(): Promise } +declare module "node:fs" { export * from "fs"; } +declare module "node:fs/promises" { export * from "fs/promises"; } +// @Filename: /other.ts +import "node:fs/promises"; +// @Filename: /index.ts +write/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: CompletionGlobalsPlus( + []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "writeFile", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "node:fs", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "writeFile", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "node:fs/promises", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, false), + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_weirdDefaultSynthesis_test.go b/internal/fourslash/tests/gen/completionsImport_weirdDefaultSynthesis_test.go new file mode 100644 index 0000000000..5514308ba0 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_weirdDefaultSynthesis_test.go @@ -0,0 +1,34 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_weirdDefaultSynthesis(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: commonjs +// @esModuleInterop: false +// @allowSyntheticDefaultImports: false +// @Filename: /collection.ts +class Collection { + public static readonly default: typeof Collection = Collection; +} +export = Collection as typeof Collection & { default: typeof Collection }; +// @Filename: /index.ts +Colle/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "Collection", + Source: "./collection", + Description: "Add import from \"./collection\"", + NewFileContent: PtrTo(`import Collection = require("./collection"); + +Colle`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsImport_windowsPathsProjectRelative_test.go b/internal/fourslash/tests/gen/completionsImport_windowsPathsProjectRelative_test.go new file mode 100644 index 0000000000..8533cb5bea --- /dev/null +++ b/internal/fourslash/tests/gen/completionsImport_windowsPathsProjectRelative_test.go @@ -0,0 +1,131 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsImport_windowsPathsProjectRelative(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: c:/project/tsconfig.json +{ + "compilerOptions": { + "paths": { + "~/noIndex/*": ["./src/noIndex/*"], + "~/withIndex": ["./src/withIndex/index.ts"] + } + } +} +// @Filename: c:/project/package.json +{} +// @Filename: c:/project/src/noIndex/a.ts +export const myFunctionA = () => {}; +// @Filename: c:/project/src/withIndex/b.ts +export const myFunctionB = () => {}; +// @Filename: c:/project/src/withIndex/index.ts +export * from './b'; +// @Filename: c:/project/src/reproduction/1.ts +myFunction/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "myFunctionA", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "~/noIndex/a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "myFunctionB", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "~/withIndex", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "myFunctionA", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "../noIndex/a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "myFunctionB", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "../withIndex", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "myFunctionA", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "../noIndex/a", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + &lsproto.CompletionItem{ + Label: "myFunctionB", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "../withIndex", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsRecommended_namespace_test.go b/internal/fourslash/tests/gen/completionsRecommended_namespace_test.go new file mode 100644 index 0000000000..f81d6b2f98 --- /dev/null +++ b/internal/fourslash/tests/gen/completionsRecommended_namespace_test.go @@ -0,0 +1,92 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsRecommended_namespace(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @noLib: true +// @Filename: /a.ts +export namespace Name { + export class C {} +} +export function f(c: Name.C) {} +f(new N/*a0*/); +f(new /*a1*/); +// @Filename: /b.ts +import { f } from "./a"; +f(new N/*b0*/); +f(new /*b1*/); +// @Filename: /c.ts +import * as alpha from "./a"; +alpha.f(new a/*c0*/); +alpha.f(new /*c1*/);` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, []string{"a0", "a1"}, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Name", + Detail: PtrTo("namespace Name"), + Kind: PtrTo(lsproto.CompletionItemKindModule), + Preselect: PtrTo(true), + }, + }, + }, + }) + f.VerifyCompletions(t, []string{"b0", "b1"}, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Name", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./a", + }, + })), + Detail: PtrTo("namespace Name"), + Kind: PtrTo(lsproto.CompletionItemKindModule), + AdditionalTextEdits: fourslash.AnyTextEdits, + Preselect: PtrTo(true), + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) + f.VerifyCompletions(t, []string{"c0", "c1"}, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "alpha", + Detail: PtrTo("import alpha"), + Kind: PtrTo(lsproto.CompletionItemKindVariable), + Preselect: PtrTo(true), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/completionsUniqueSymbol_import_test.go b/internal/fourslash/tests/gen/completionsUniqueSymbol_import_test.go new file mode 100644 index 0000000000..acdd1674ab --- /dev/null +++ b/internal/fourslash/tests/gen/completionsUniqueSymbol_import_test.go @@ -0,0 +1,70 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsUniqueSymbol_import(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @noLib: true +// @Filename: /globals.d.ts +declare const Symbol: () => symbol; +// @Filename: /a.ts +const privateSym = Symbol(); +export const publicSym = Symbol(); +export interface I { + [privateSym]: number; + [publicSym]: number; + [defaultPublicSym]: number; + n: number; +} +export const i: I; +// @Filename: /user.ts +import { i } from "./a"; +i[|./**/|];` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: []fourslash.CompletionsExpectedItem{ + "n", + &lsproto.CompletionItem{ + Label: "publicSym", + InsertText: PtrTo("[publicSym]"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "/a", + }, + })), + SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)), + AdditionalTextEdits: fourslash.AnyTextEdits, + TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ + TextEdit: &lsproto.TextEdit{ + NewText: "publicSym", + Range: f.Ranges()[0].LSRange, + }, + }, + }, + }, + }, + }) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "publicSym", + Source: "/a", + Description: "Update import from \"./a\"", + NewFileContent: PtrTo(`import { i, publicSym } from "./a"; +i.;`), + }) +} diff --git a/internal/fourslash/tests/gen/completionsWithDeprecatedTag10_test.go b/internal/fourslash/tests/gen/completionsWithDeprecatedTag10_test.go new file mode 100644 index 0000000000..104b77761c --- /dev/null +++ b/internal/fourslash/tests/gen/completionsWithDeprecatedTag10_test.go @@ -0,0 +1,45 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestCompletionsWithDeprecatedTag10(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /foo.ts +/** @deprecated foo */ +export const foo = 0; +// @Filename: /index.ts +/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "foo", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./foo", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + Kind: PtrTo(lsproto.CompletionItemKindVariable), + SortText: PtrTo(string(ls.DeprecateSortText(ls.SortTextAutoImportSuggestions))), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/importNameCodeFixDefaultExport6_test.go b/internal/fourslash/tests/gen/importNameCodeFixDefaultExport6_test.go new file mode 100644 index 0000000000..43b6d1076a --- /dev/null +++ b/internal/fourslash/tests/gen/importNameCodeFixDefaultExport6_test.go @@ -0,0 +1,28 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportNameCodeFixDefaultExport6(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +export default Math.foo; +// @Filename: /index.ts +a/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "a", + Source: "./a", + Description: "Add import from \"./a\"", + NewFileContent: PtrTo(`import a from "./a"; + +a`), + }) +} diff --git a/internal/fourslash/tests/gen/importNameCodeFixExportAsDefault_test.go b/internal/fourslash/tests/gen/importNameCodeFixExportAsDefault_test.go new file mode 100644 index 0000000000..d5b712b078 --- /dev/null +++ b/internal/fourslash/tests/gen/importNameCodeFixExportAsDefault_test.go @@ -0,0 +1,29 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportNameCodeFixExportAsDefault(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /foo.ts +const foo = 'foo' +export { foo as default } +// @Filename: /index.ts + foo/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyApplyCodeActionFromCompletion(t, PtrTo(""), &fourslash.ApplyCodeActionFromCompletionOptions{ + Name: "foo", + Source: "./foo", + Description: "Add import from \"./foo\"", + NewFileContent: PtrTo(`import foo from "./foo"; + +foo`), + }) +} diff --git a/internal/fourslash/tests/gen/importSuggestionsCache_exportUndefined_test.go b/internal/fourslash/tests/gen/importSuggestionsCache_exportUndefined_test.go new file mode 100644 index 0000000000..33022ac27d --- /dev/null +++ b/internal/fourslash/tests/gen/importSuggestionsCache_exportUndefined_test.go @@ -0,0 +1,70 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportSuggestionsCache_exportUndefined(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/tsconfig.json +{ "compilerOptions": { "module": "esnext" } } +// @Filename: /home/src/workspaces/project/undefined.ts +export = undefined; +// @Filename: /home/src/workspaces/project/undefinedAlias.ts +const x = undefined; +export = x; +// @Filename: /home/src/workspaces/project/index.ts + /**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "x", + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "/home/src/workspaces/project/undefinedAlias", + }, + })), + }, + }, + }, + }) + f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "x", + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "/home/src/workspaces/project/undefinedAlias", + }, + })), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/importSuggestionsCache_invalidPackageJson_test.go b/internal/fourslash/tests/gen/importSuggestionsCache_invalidPackageJson_test.go new file mode 100644 index 0000000000..7ca5b026fc --- /dev/null +++ b/internal/fourslash/tests/gen/importSuggestionsCache_invalidPackageJson_test.go @@ -0,0 +1,58 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportSuggestionsCache_invalidPackageJson(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /home/src/workspaces/project/jsconfig.json +{ + "compilerOptions": { + "module": "commonjs", + }, +} +// @Filename: /home/src/workspaces/project/node_modules/@types/node/index.d.ts +declare module 'fs' { + export function readFile(): void; +} +declare module 'util' { + export function promisify(): void; +} +// @Filename: /home/src/workspaces/project/package.json +{ "mod" } +// @Filename: /home/src/workspaces/project/a.js + +readF/**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToMarker(t, "") + f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "readFile", + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "fs", + }, + })), + AdditionalTextEdits: fourslash.AnyTextEdits, + SortText: PtrTo(string(ls.SortTextAutoImportSuggestions)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/importTypeCompletions1_test.go b/internal/fourslash/tests/gen/importTypeCompletions1_test.go new file mode 100644 index 0000000000..3e586eb516 --- /dev/null +++ b/internal/fourslash/tests/gen/importTypeCompletions1_test.go @@ -0,0 +1,50 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportTypeCompletions1(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @target: esnext +// @filename: /foo.ts +export interface Foo {} +// @filename: /bar.ts +[|import type F/**/|]` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "/bar.ts") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + InsertText: PtrTo("import type { Foo } from \"./foo\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./foo", + }, + })), + TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ + TextEdit: &lsproto.TextEdit{ + NewText: "Foo", + Range: f.Ranges()[0].LSRange, + }, + }, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/importTypeCompletions3_test.go b/internal/fourslash/tests/gen/importTypeCompletions3_test.go new file mode 100644 index 0000000000..64d207be07 --- /dev/null +++ b/internal/fourslash/tests/gen/importTypeCompletions3_test.go @@ -0,0 +1,50 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportTypeCompletions3(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @target: esnext +// @filename: /foo.ts +export interface Foo {} +// @filename: /bar.ts +[|import type { F/**/ }|]` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "/bar.ts") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + InsertText: PtrTo("import type { Foo } from \"./foo\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./foo", + }, + })), + TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ + TextEdit: &lsproto.TextEdit{ + NewText: "Foo", + Range: f.Ranges()[0].LSRange, + }, + }, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/importTypeCompletions4_test.go b/internal/fourslash/tests/gen/importTypeCompletions4_test.go new file mode 100644 index 0000000000..ba2465a5e1 --- /dev/null +++ b/internal/fourslash/tests/gen/importTypeCompletions4_test.go @@ -0,0 +1,51 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportTypeCompletions4(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @esModuleInterop: true +// @Filename: /foo.ts +interface Foo { }; +export = Foo; +// @Filename: /bar.ts + [|import type f/**/|]` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "/bar.ts") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + InsertText: PtrTo("import type Foo from \"./foo\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./foo", + }, + })), + TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ + TextEdit: &lsproto.TextEdit{ + NewText: "Foo", + Range: f.Ranges()[0].LSRange, + }, + }, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/importTypeCompletions5_test.go b/internal/fourslash/tests/gen/importTypeCompletions5_test.go new file mode 100644 index 0000000000..543d69aa3f --- /dev/null +++ b/internal/fourslash/tests/gen/importTypeCompletions5_test.go @@ -0,0 +1,52 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportTypeCompletions5(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowSyntheticDefaultImports: false +// @esModuleInterop: false +// @Filename: /foo.ts +interface Foo { }; +export = Foo; +// @Filename: /bar.ts + [|import type f/**/|]` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "/bar.ts") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + InsertText: PtrTo("import type Foo = require(\"./foo\");"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./foo", + }, + })), + TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ + TextEdit: &lsproto.TextEdit{ + NewText: "Foo", + Range: f.Ranges()[0].LSRange, + }, + }, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/importTypeCompletions6_test.go b/internal/fourslash/tests/gen/importTypeCompletions6_test.go new file mode 100644 index 0000000000..49d825be38 --- /dev/null +++ b/internal/fourslash/tests/gen/importTypeCompletions6_test.go @@ -0,0 +1,51 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportTypeCompletions6(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @Filename: /foo.ts +export const foo = { }; +export interface Foo { }; +// @Filename: /bar.ts + [|import type * as f/**/|]` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "/bar.ts") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + InsertText: PtrTo("import type { Foo } from \"./foo\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./foo", + }, + })), + TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ + TextEdit: &lsproto.TextEdit{ + NewText: "Foo", + Range: f.Ranges()[0].LSRange, + }, + }, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/importTypeCompletions7_test.go b/internal/fourslash/tests/gen/importTypeCompletions7_test.go new file mode 100644 index 0000000000..e927da63ff --- /dev/null +++ b/internal/fourslash/tests/gen/importTypeCompletions7_test.go @@ -0,0 +1,56 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportTypeCompletions7(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @target: es2020 +// @module: esnext +// @Filename: /foo.d.ts +declare namespace Foo {} +export = Foo; +// @Filename: /test.ts +[|import F/**/|]` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "/test.ts") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + InsertText: PtrTo("import * as Foo from \"./foo\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./foo", + }, + })), + TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ + TextEdit: &lsproto.TextEdit{ + NewText: "Foo", + Range: f.Ranges()[0].LSRange, + }, + }, + }, + &lsproto.CompletionItem{ + Label: "type", + SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/importTypeCompletions8_test.go b/internal/fourslash/tests/gen/importTypeCompletions8_test.go new file mode 100644 index 0000000000..024b38ff05 --- /dev/null +++ b/internal/fourslash/tests/gen/importTypeCompletions8_test.go @@ -0,0 +1,50 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportTypeCompletions8(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @target: esnext +// @filename: /foo.ts +export interface Foo {} +// @filename: /bar.ts +[|import { type F/**/ }|]` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "/bar.ts") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + InsertText: PtrTo("import { type Foo } from \"./foo\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./foo", + }, + })), + TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ + TextEdit: &lsproto.TextEdit{ + NewText: "Foo", + Range: f.Ranges()[0].LSRange, + }, + }, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/importTypeCompletions9_test.go b/internal/fourslash/tests/gen/importTypeCompletions9_test.go new file mode 100644 index 0000000000..d6460a2e54 --- /dev/null +++ b/internal/fourslash/tests/gen/importTypeCompletions9_test.go @@ -0,0 +1,50 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestImportTypeCompletions9(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @target: esnext +// @filename: /foo.ts +export interface Foo {} +// @filename: /bar.ts +[|import { type /**/ }|]` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.GoToFile(t, "/bar.ts") + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + InsertText: PtrTo("import { type Foo } from \"./foo\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./foo", + }, + })), + TextEdit: &lsproto.TextEditOrInsertReplaceEdit{ + TextEdit: &lsproto.TextEdit{ + NewText: "Foo", + Range: f.Ranges()[0].LSRange, + }, + }, + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/jsFileImportNoTypes2_test.go b/internal/fourslash/tests/gen/jsFileImportNoTypes2_test.go new file mode 100644 index 0000000000..84c2d97611 --- /dev/null +++ b/internal/fourslash/tests/gen/jsFileImportNoTypes2_test.go @@ -0,0 +1,84 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/ls" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestJsFileImportNoTypes2(t *testing.T) { + t.Parallel() + t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @allowJs: true +// @Filename: /default.ts +export default class TestDefaultClass {} +// @Filename: /defaultType.ts +export default interface TestDefaultInterface {} +// @Filename: /reExport/toReExport.ts +export class TestClassReExport {} +export interface TestInterfaceReExport {} +// @Filename: /reExport/index.ts +export { TestClassReExport, TestInterfaceReExport } from './toReExport'; +// @Filename: /exportList.ts +class TestClassExportList {}; +interface TestInterfaceExportList {}; +export { TestClassExportList, TestInterfaceExportList }; +// @Filename: /baseline.ts +export class TestClassBaseline {} +export interface TestInterfaceBaseline {} +// @Filename: /a.js +import /**/` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &[]string{}, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Exact: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "TestClassBaseline", + InsertText: PtrTo("import { TestClassBaseline } from \"./baseline\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./baseline", + }, + })), + }, + &lsproto.CompletionItem{ + Label: "TestClassExportList", + InsertText: PtrTo("import { TestClassExportList } from \"./exportList\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./exportList", + }, + })), + }, + &lsproto.CompletionItem{ + Label: "TestClassReExport", + InsertText: PtrTo("import { TestClassReExport } from \"./reExport\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./reExport", + }, + })), + }, + &lsproto.CompletionItem{ + Label: "TestDefaultClass", + InsertText: PtrTo("import TestDefaultClass from \"./default\";"), + Data: PtrTo(any(&ls.CompletionItemData{ + AutoImport: &ls.AutoImportData{ + ModuleSpecifier: "./default", + }, + })), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/jsxTagNameCompletionClosed_test.go b/internal/fourslash/tests/gen/jsxTagNameCompletionClosed_test.go new file mode 100644 index 0000000000..9358ac1196 --- /dev/null +++ b/internal/fourslash/tests/gen/jsxTagNameCompletionClosed_test.go @@ -0,0 +1,145 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestJsxTagNameCompletionClosed(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@Filename: file.tsx +interface NestedInterface { + Foo: NestedInterface; + (props: {}): any; +} + +declare const Foo: NestedInterface; + +function fn1() { + return + + +} +function fn2() { + return + + +} +function fn3() { + return + + +} +function fn4() { + return + + +} +function fn5() { + return + + +} +function fn6() { + return + + +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("const Foo: NestedInterface"), + }, + }, + }, + }) + f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("const Foo: NestedInterface"), + }, + }, + }, + }) + f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("(property) NestedInterface.Foo: NestedInterface"), + }, + }, + }, + }) + f.VerifyCompletions(t, "4", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("(property) NestedInterface.Foo: NestedInterface"), + }, + }, + }, + }) + f.VerifyCompletions(t, "5", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("(property) NestedInterface.Foo: NestedInterface"), + }, + }, + }, + }) + f.VerifyCompletions(t, "6", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("(property) NestedInterface.Foo: NestedInterface"), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/jsxTagNameCompletionUnclosed_test.go b/internal/fourslash/tests/gen/jsxTagNameCompletionUnclosed_test.go new file mode 100644 index 0000000000..78ab4a048d --- /dev/null +++ b/internal/fourslash/tests/gen/jsxTagNameCompletionUnclosed_test.go @@ -0,0 +1,145 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestJsxTagNameCompletionUnclosed(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@Filename: file.tsx +interface NestedInterface { + Foo: NestedInterface; + (props: {}): any; +} + +declare const Foo: NestedInterface; + +function fn1() { + return + +} +function fn2() { + return + +} +function fn3() { + return + +} +function fn4() { + return + +} +function fn5() { + return + +} +function fn6() { + return + +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("const Foo: NestedInterface"), + }, + }, + }, + }) + f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("const Foo: NestedInterface"), + }, + }, + }, + }) + f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("(property) NestedInterface.Foo: NestedInterface"), + }, + }, + }, + }) + f.VerifyCompletions(t, "4", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("(property) NestedInterface.Foo: NestedInterface"), + }, + }, + }, + }) + f.VerifyCompletions(t, "5", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("(property) NestedInterface.Foo: NestedInterface"), + }, + }, + }, + }) + f.VerifyCompletions(t, "6", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "Foo", + Detail: PtrTo("(property) NestedInterface.Foo: NestedInterface"), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/jsxTagNameCompletionUnderElementClosed_test.go b/internal/fourslash/tests/gen/jsxTagNameCompletionUnderElementClosed_test.go new file mode 100644 index 0000000000..8e509858f3 --- /dev/null +++ b/internal/fourslash/tests/gen/jsxTagNameCompletionUnderElementClosed_test.go @@ -0,0 +1,84 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestJsxTagNameCompletionUnderElementClosed(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@Filename: file.tsx +declare namespace JSX { + interface IntrinsicElements { + button: any; + div: any; + } +} +function fn() { + return <> + + ; +} +function fn2() { + return <> + preceding junk + ; +} +function fn3() { + return <> + + ; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "button", + Detail: PtrTo("(property) JSX.IntrinsicElements.button: any"), + }, + }, + }, + }) + f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "button", + Detail: PtrTo("(property) JSX.IntrinsicElements.button: any"), + }, + }, + }, + }) + f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "button", + Detail: PtrTo("(property) JSX.IntrinsicElements.button: any"), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/jsxTagNameCompletionUnderElementUnclosed_test.go b/internal/fourslash/tests/gen/jsxTagNameCompletionUnderElementUnclosed_test.go new file mode 100644 index 0000000000..568c195177 --- /dev/null +++ b/internal/fourslash/tests/gen/jsxTagNameCompletionUnderElementUnclosed_test.go @@ -0,0 +1,84 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + . "github.com/microsoft/typescript-go/internal/fourslash/tests/util" + "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestJsxTagNameCompletionUnderElementUnclosed(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `//@Filename: file.tsx +declare namespace JSX { + interface IntrinsicElements { + button: any; + div: any; + } +} +function fn() { + return <> + ; +} +function fn2() { + return <> + preceding junk ; +} +function fn3() { + return <> + ; +}` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "button", + Detail: PtrTo("(property) JSX.IntrinsicElements.button: any"), + }, + }, + }, + }) + f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "button", + Detail: PtrTo("(property) JSX.IntrinsicElements.button: any"), + }, + }, + }, + }) + f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{ + IsIncomplete: false, + ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ + CommitCharacters: &DefaultCommitCharacters, + EditRange: Ignored, + }, + Items: &fourslash.CompletionsExpectedItems{ + Includes: []fourslash.CompletionsExpectedItem{ + &lsproto.CompletionItem{ + Label: "button", + Detail: PtrTo("(property) JSX.IntrinsicElements.button: any"), + }, + }, + }, + }) +} diff --git a/internal/fourslash/tests/gen/quickInfoOnNarrowedType_test.go b/internal/fourslash/tests/gen/quickInfoOnNarrowedType_test.go index f917e01054..203d4dc986 100644 --- a/internal/fourslash/tests/gen/quickInfoOnNarrowedType_test.go +++ b/internal/fourslash/tests/gen/quickInfoOnNarrowedType_test.go @@ -11,7 +11,7 @@ import ( func TestQuickInfoOnNarrowedType(t *testing.T) { t.Parallel() - t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @strictNullChecks: true function foo(strOrNum: string | number) { diff --git a/internal/ls/autoimportfixes.go b/internal/ls/autoimportfixes.go index 4aa8104bb1..0fb1864455 100644 --- a/internal/ls/autoimportfixes.go +++ b/internal/ls/autoimportfixes.go @@ -1,10 +1,13 @@ package ls import ( + "slices" + "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/astnav" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/debug" + "github.com/microsoft/typescript-go/internal/stringutil" ) type Import struct { @@ -81,8 +84,7 @@ func (ct *changeTracker) doAddExistingFix( } if len(namedImports) > 0 { - // !!! OrganizeImports not yet implemented - // specifierComparer, isSorted := OrganizeImports.getNamedImportSpecifierComparerWithDetection(importClause.Parent, preferences, sourceFile); + specifierComparer, isSorted := getNamedImportSpecifierComparerWithDetection(importClause.Parent, preferences, sourceFile) newSpecifiers := core.Map(namedImports, func(namedImport *Import) *ast.Node { var identifier *ast.Node if namedImport.propertyName != "" { @@ -93,7 +95,8 @@ func (ct *changeTracker) doAddExistingFix( identifier, ct.NodeFactory.NewIdentifier(namedImport.name), ) - }) // !!! sort with specifierComparer + }) + slices.SortFunc(newSpecifiers, specifierComparer) // !!! remove imports not implemented // if (removeExistingImportSpecifiers) { @@ -108,30 +111,41 @@ func (ct *changeTracker) doAddExistingFix( // append(core.Filter(existingSpecifiers, func (s *ast.ImportSpecifier) bool {return !removeExistingImportSpecifiers.Has(s)}), newSpecifiers...), // !!! sort with specifierComparer // ), // ); - // } else if (len(existingSpecifiers) > 0 && isSorted != false) { - // !!! OrganizeImports not implemented - // The sorting preference computed earlier may or may not have validated that these particular - // import specifiers are sorted. If they aren't, `getImportSpecifierInsertionIndex` will return - // nonsense. So if there are existing specifiers, even if we know the sorting preference, we - // need to ensure that the existing specifiers are sorted according to the preference in order - // to do a sorted insertion. - // changed to check if existing specifiers are sorted - // if we're promoting the clause from type-only, we need to transform the existing imports before attempting to insert the new named imports - // transformedExistingSpecifiers := existingSpecifiers - // if promoteFromTypeOnly && existingSpecifiers { - // transformedExistingSpecifiers = ct.NodeFactory.updateNamedImports( - // importClause.NamedBindings.AsNamedImports(), - // core.SameMap(existingSpecifiers, func(e *ast.ImportSpecifier) *ast.ImportSpecifier { - // return ct.NodeFactory.updateImportSpecifier(e, /*isTypeOnly*/ true, e.propertyName, e.name) - // }), - // ).elements - // } - // for _, spec := range newSpecifiers { - // insertionIndex := OrganizeImports.getImportSpecifierInsertionIndex(transformedExistingSpecifiers, spec, specifierComparer); - // ct.insertImportSpecifierAtIndex(sourceFile, spec, importClause.namedBindings as NamedImports, insertionIndex); - // } - // } else - if len(existingSpecifiers) > 0 { + // + if len(existingSpecifiers) > 0 && isSorted != core.TSFalse { + // The sorting preference computed earlier may or may not have validated that these particular + // import specifiers are sorted. If they aren't, `getImportSpecifierInsertionIndex` will return + // nonsense. So if there are existing specifiers, even if we know the sorting preference, we + // need to ensure that the existing specifiers are sorted according to the preference in order + // to do a sorted insertion. + // if we're promoting the clause from type-only, we need to transform the existing imports before attempting to insert the new named imports + // transformedExistingSpecifiers := existingSpecifiers + // if promoteFromTypeOnly && existingSpecifiers { + // transformedExistingSpecifiers = ct.NodeFactory.updateNamedImports( + // importClause.NamedBindings.AsNamedImports(), + // core.SameMap(existingSpecifiers, func(e *ast.ImportSpecifier) *ast.ImportSpecifier { + // return ct.NodeFactory.updateImportSpecifier(e, /*isTypeOnly*/ true, e.propertyName, e.name) + // }), + // ).elements + // } + for _, spec := range newSpecifiers { + insertionIndex := getImportSpecifierInsertionIndex(existingSpecifiers, spec, specifierComparer) + ct.insertImportSpecifierAtIndex(sourceFile, spec, importClause.NamedBindings, insertionIndex) + } + } else if len(existingSpecifiers) > 0 && isSorted.IsTrue() { + // Existing specifiers are sorted, so insert each new specifier at the correct position + for _, spec := range newSpecifiers { + insertionIndex := getImportSpecifierInsertionIndex(existingSpecifiers, spec, specifierComparer) + if insertionIndex >= len(existingSpecifiers) { + // Insert at the end + ct.insertNodeInListAfter(sourceFile, existingSpecifiers[len(existingSpecifiers)-1], spec.AsNode(), existingSpecifiers) + } else { + // Insert before the element at insertionIndex + ct.insertNodeInListAfter(sourceFile, existingSpecifiers[insertionIndex], spec.AsNode(), existingSpecifiers) + } + } + } else if len(existingSpecifiers) > 0 { + // Existing specifiers may not be sorted, append to the end for _, spec := range newSpecifiers { ct.insertNodeInListAfter(sourceFile, existingSpecifiers[len(existingSpecifiers)-1], spec.AsNode(), existingSpecifiers) } @@ -202,10 +216,11 @@ func (ct *changeTracker) insertImports(sourceFile *ast.SourceFile, imports []*as } else { existingImportStatements = core.Filter(sourceFile.Statements.Nodes, ast.IsAnyImportSyntax) } - // !!! OrganizeImports - // { comparer, isSorted } := OrganizeImports.getOrganizeImportsStringComparerWithDetection(existingImportStatements, preferences); - // sortedNewImports := isArray(imports) ? toSorted(imports, (a, b) => OrganizeImports.compareImportsOrRequireStatements(a, b, comparer)) : [imports]; - sortedNewImports := imports + comparer, isSorted := getOrganizeImportsStringComparerWithDetection(existingImportStatements, preferences) + sortedNewImports := slices.Clone(imports) + slices.SortFunc(sortedNewImports, func(a, b *ast.Statement) int { + return compareImportsOrRequireStatements(a, b, comparer) + }) // !!! FutureSourceFile // if !isFullSourceFile(sourceFile) { // for _, newImport := range sortedNewImports { @@ -216,22 +231,21 @@ func (ct *changeTracker) insertImports(sourceFile *ast.SourceFile, imports []*as // return; // } - // if len(existingImportStatements) > 0 && isSorted { - // for _, newImport := range sortedNewImports { - // insertionIndex := OrganizeImports.getImportDeclarationInsertionIndex(existingImportStatements, newImport, comparer) - // if insertionIndex == 0 { - // // If the first import is top-of-file, insert after the leading comment which is likely the header. - // options := existingImportStatements[0] == sourceFile.statements[0] ? { leadingTriviaOption: textchanges.LeadingTriviaOption.Exclude } : {}; - // ct.insertNodeBefore(sourceFile, existingImportStatements[0], newImport, /*blankLineBetween*/ false, options); - // } else { - // prevImport := existingImportStatements[insertionIndex - 1] - // ct.insertNodeAfter(sourceFile, prevImport, newImport); - // } - // } - // return - // } - - if len(existingImportStatements) > 0 { + if len(existingImportStatements) > 0 && isSorted { + // Existing imports are sorted, insert each new import at the correct position + for _, newImport := range sortedNewImports { + insertionIndex := getImportDeclarationInsertIndex(existingImportStatements, newImport, func(a, b *ast.Statement) stringutil.Comparison { + return compareImportsOrRequireStatements(a, b, comparer) + }) + if insertionIndex == 0 { + // If the first import is top-of-file, insert after the leading comment which is likely the header + ct.insertNodeAt(sourceFile, core.TextPos(astnav.GetStartOfNode(existingImportStatements[0], sourceFile, false)), newImport.AsNode(), changeNodeOptions{}) + } else { + prevImport := existingImportStatements[insertionIndex-1] + ct.insertNodeAfter(sourceFile, prevImport.AsNode(), newImport.AsNode()) + } + } + } else if len(existingImportStatements) > 0 { ct.insertNodesAfter(sourceFile, existingImportStatements[len(existingImportStatements)-1], sortedNewImports) } else { ct.insertAtTopOfFile(sourceFile, sortedNewImports, blankLineBetween) diff --git a/internal/ls/autoimports.go b/internal/ls/autoimports.go index cf89e08fab..2a20436d0c 100644 --- a/internal/ls/autoimports.go +++ b/internal/ls/autoimports.go @@ -17,6 +17,7 @@ import ( "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/module" "github.com/microsoft/typescript-go/internal/modulespecifiers" + "github.com/microsoft/typescript-go/internal/packagejson" "github.com/microsoft/typescript-go/internal/stringutil" "github.com/microsoft/typescript-go/internal/tspath" ) @@ -69,7 +70,7 @@ type CachedSymbolExportInfo struct { } type exportInfoMap struct { - exportInfo collections.MultiMap[ExportInfoMapKey, CachedSymbolExportInfo] + exportInfo collections.OrderedMap[ExportInfoMapKey, []*CachedSymbolExportInfo] symbols map[int]symbolExportEntry exportInfoId int usableByFileName tspath.Path @@ -83,7 +84,7 @@ type exportInfoMap struct { func (e *exportInfoMap) clear() { e.symbols = map[int]symbolExportEntry{} - e.exportInfo = collections.MultiMap[ExportInfoMapKey, CachedSymbolExportInfo]{} + e.exportInfo = collections.OrderedMap[ExportInfoMapKey, []*CachedSymbolExportInfo]{} e.usableByFileName = "" } @@ -91,7 +92,7 @@ func (e *exportInfoMap) get(importingFile tspath.Path, ch *checker.Checker, key if e.usableByFileName != importingFile { return nil } - return core.Map(e.exportInfo.Get(key), func(info CachedSymbolExportInfo) *SymbolExportInfo { return e.rehydrateCachedInfo(ch, info) }) + return core.Map(e.exportInfo.GetOrZero(key), func(info *CachedSymbolExportInfo) *SymbolExportInfo { return e.rehydrateCachedInfo(ch, info) }) } func (e *exportInfoMap) add( @@ -164,7 +165,8 @@ func (e *exportInfoMap) add( } moduleName := stringutil.StripQuotes(moduleSymbol.Name) - id := e.exportInfoId + 1 + e.exportInfoId++ + id := e.exportInfoId target := ch.SkipAlias(symbol) if flagMatch != nil && !flagMatch(target.Flags) { @@ -193,7 +195,9 @@ func (e *exportInfoMap) add( if moduleFile != nil { moduleFileName = moduleFile.FileName() } - e.exportInfo.Add(newExportInfoMapKey(symbolName, symbol, moduleKey, ch), CachedSymbolExportInfo{ + key := newExportInfoMapKey(symbolName, symbol, moduleKey, ch) + infos := e.exportInfo.GetOrZero(key) + infos = append(infos, &CachedSymbolExportInfo{ id: id, symbolTableKey: symbolTableKey, symbolName: symbolName, @@ -209,6 +213,7 @@ func (e *exportInfoMap) add( targetFlags: target.Flags, isFromPackageJson: isFromPackageJson, }) + e.exportInfo.Set(key, infos) } func (e *exportInfoMap) search( @@ -221,13 +226,13 @@ func (e *exportInfoMap) search( if importingFile != e.usableByFileName { return nil } - for key, info := range e.exportInfo.M { + for key, info := range e.exportInfo.Entries() { symbolName, ambientModuleName := key.SymbolName, key.AmbientModuleName if preferCapitalized && info[0].capitalizedSymbolName != "" { symbolName = info[0].capitalizedSymbolName } if matches(symbolName, info[0].targetFlags) { - rehydrated := core.Map(info, func(info CachedSymbolExportInfo) *SymbolExportInfo { + rehydrated := core.Map(info, func(info *CachedSymbolExportInfo) *SymbolExportInfo { return e.rehydrateCachedInfo(ch, info) }) filtered := core.FilterIndex(rehydrated, func(r *SymbolExportInfo, i int, _ []*SymbolExportInfo) bool { @@ -254,7 +259,7 @@ func (e *exportInfoMap) isNotShadowedByDeeperNodeModulesPackage(info *SymbolExpo return !ok || strings.HasPrefix(info.moduleFileName, packageDeepestNodeModulesPath) } -func (e *exportInfoMap) rehydrateCachedInfo(ch *checker.Checker, info CachedSymbolExportInfo) *SymbolExportInfo { +func (e *exportInfoMap) rehydrateCachedInfo(ch *checker.Checker, info *CachedSymbolExportInfo) *SymbolExportInfo { if info.symbol != nil && info.moduleSymbol != nil { return &SymbolExportInfo{ symbol: info.symbol, @@ -340,32 +345,6 @@ type packageJsonFilterResult struct { importable bool packageName string } -type projectPackageJsonInfo struct { - fileName string - parseable bool - dependencies map[string]string - devDependencies map[string]string - peerDependencies map[string]string - optionalDependencies map[string]string -} - -func (info *projectPackageJsonInfo) has(dependencyName string) bool { - if _, ok := info.dependencies[dependencyName]; ok { - return true - } - if _, ok := info.devDependencies[dependencyName]; ok { - return true - } - - if _, ok := info.peerDependencies[dependencyName]; ok { - return true - } - if _, ok := info.optionalDependencies[dependencyName]; ok { - return true - } - - return false -} func (l *LanguageService) getImportCompletionAction( ctx context.Context, @@ -400,7 +379,7 @@ func NewExportInfoMap(globalsTypingCacheLocation string) *exportInfoMap { return &exportInfoMap{ packages: map[string]string{}, symbols: map[int]symbolExportEntry{}, - exportInfo: collections.MultiMap[ExportInfoMapKey, CachedSymbolExportInfo]{}, + exportInfo: collections.OrderedMap[ExportInfoMapKey, []*CachedSymbolExportInfo]{}, globalTypingsCacheLocation: globalsTypingCacheLocation, } } @@ -653,10 +632,23 @@ func (l *LanguageService) getImportFixes( } func (l *LanguageService) createPackageJsonImportFilter(fromFile *ast.SourceFile, preferences UserPreferences) *packageJsonImportFilter { - packageJsons := []*projectPackageJsonInfo{} - // packageJsons := ( - // (host.getPackageJsonsVisibleToFile && host.getPackageJsonsVisibleToFile(fromFile.fileName)) || getPackageJsonsVisibleToFile(fromFile.fileName, host) - // ).filter(p => p.parseable); + // !!! The program package.json cache may not have every relevant package.json. + // This should eventually be integrated with the session. + var packageJsons []*packagejson.PackageJson + dir := tspath.GetDirectoryPath(fromFile.FileName()) + for { + packageJsonDir := l.GetProgram().GetNearestAncestorDirectoryWithPackageJson(dir) + if packageJsonDir == "" { + break + } + if packageJson := l.GetProgram().GetPackageJsonInfo(tspath.CombinePaths(packageJsonDir, "package.json")).GetContents(); packageJson != nil && packageJson.Parseable { + packageJsons = append(packageJsons, packageJson) + } + dir = tspath.GetDirectoryPath(packageJsonDir) + if dir == packageJsonDir { + break + } + } var usesNodeCoreModules *bool ambientModuleCache := map[*ast.Symbol]bool{} @@ -674,7 +666,7 @@ func (l *LanguageService) createPackageJsonImportFilter(fromFile *ast.SourceFile moduleSpecifierIsCoveredByPackageJson := func(specifier string) bool { packageName := getNodeModuleRootSpecifier(specifier) for _, packageJson := range packageJsons { - if packageJson.has(packageName) || packageJson.has(module.GetTypesPackageName(packageName)) { + if packageJson.HasDependency(packageName) || packageJson.HasDependency(module.GetTypesPackageName(packageName)) { return true } } @@ -721,7 +713,7 @@ func (l *LanguageService) createPackageJsonImportFilter(fromFile *ast.SourceFile } allowsImportingAmbientModule := func(moduleSymbol *ast.Symbol, moduleSpecifierResolutionHost modulespecifiers.ModuleSpecifierGenerationHost) bool { - if len(packageJsons) > 0 || moduleSymbol.ValueDeclaration == nil { + if len(packageJsons) == 0 || moduleSymbol.ValueDeclaration == nil { return true } @@ -1442,8 +1434,7 @@ func (l *LanguageService) codeActionForFixWorker( } if fix.useRequire { - // !!! require - // declarations = getNewRequires(fixAddNew.moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, l.GetProgram().Options(), preferences) + declarations = changeTracker.getNewRequires(fix.moduleSpecifier, defaultImport, namedImports, namespaceLikeImport, l.GetProgram().Options(), preferences) } else { declarations = changeTracker.getNewImports(fix.moduleSpecifier, defaultImport, namedImports, namespaceLikeImport, l.GetProgram().Options(), preferences) } @@ -1474,6 +1465,88 @@ func (l *LanguageService) codeActionForFixWorker( return nil } +func (c *changeTracker) getNewRequires( + moduleSpecifier string, + defaultImport *Import, + namedImports []*Import, + namespaceLikeImport *Import, + compilerOptions *core.CompilerOptions, + preferences *UserPreferences, +) []*ast.Statement { + quotedModuleSpecifier := c.NodeFactory.NewStringLiteral(moduleSpecifier) + var statements []*ast.Statement + + // const { default: foo, bar, etc } = require('./mod'); + if defaultImport != nil || len(namedImports) > 0 { + bindingElements := []*ast.Node{} + for _, namedImport := range namedImports { + var propertyName *ast.Node + if namedImport.propertyName != "" { + propertyName = c.NodeFactory.NewIdentifier(namedImport.propertyName) + } + bindingElements = append(bindingElements, c.NodeFactory.NewBindingElement( + /*dotDotDotToken*/ nil, + propertyName, + c.NodeFactory.NewIdentifier(namedImport.name), + /*initializer*/ nil, + )) + } + if defaultImport != nil { + bindingElements = append([]*ast.Node{ + c.NodeFactory.NewBindingElement( + /*dotDotDotToken*/ nil, + c.NodeFactory.NewIdentifier("default"), + c.NodeFactory.NewIdentifier(defaultImport.name), + /*initializer*/ nil, + ), + }, bindingElements...) + } + declaration := c.createConstEqualsRequireDeclaration( + c.NodeFactory.NewBindingPattern( + ast.KindObjectBindingPattern, + c.NodeFactory.NewNodeList(bindingElements), + ), + quotedModuleSpecifier, + ) + statements = append(statements, declaration) + } + + // const foo = require('./mod'); + if namespaceLikeImport != nil { + declaration := c.createConstEqualsRequireDeclaration( + c.NodeFactory.NewIdentifier(namespaceLikeImport.name), + quotedModuleSpecifier, + ) + statements = append(statements, declaration) + } + + debug.AssertIsDefined(statements) + return statements +} + +func (c *changeTracker) createConstEqualsRequireDeclaration(name *ast.Node, quotedModuleSpecifier *ast.Node) *ast.Statement { + return c.NodeFactory.NewVariableStatement( + /*modifiers*/ nil, + c.NodeFactory.NewVariableDeclarationList( + ast.NodeFlagsConst, + c.NodeFactory.NewNodeList([]*ast.Node{ + c.NodeFactory.NewVariableDeclaration( + name, + /*exclamationToken*/ nil, + /*type*/ nil, + c.NodeFactory.NewCallExpression( + c.NodeFactory.NewIdentifier("require"), + /*questionDotToken*/ nil, + /*typeArguments*/ nil, + c.NodeFactory.NewNodeList([]*ast.Node{quotedModuleSpecifier}), + ast.NodeFlagsNone, + ), + ), + }), + ), + ) +} + func getModuleSpecifierText(promotedDeclaration *ast.ImportDeclaration) string { if promotedDeclaration.Kind == ast.KindImportEqualsDeclaration { importEqualsDeclaration := promotedDeclaration.AsImportEqualsDeclaration() diff --git a/internal/ls/autoimportsexportinfo.go b/internal/ls/autoimportsexportinfo.go index 65de5e82ad..a68767e964 100644 --- a/internal/ls/autoimportsexportinfo.go +++ b/internal/ls/autoimportsexportinfo.go @@ -8,6 +8,7 @@ import ( "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/scanner" + "github.com/microsoft/typescript-go/internal/stringutil" ) func (l *LanguageService) getExportInfos( @@ -31,7 +32,7 @@ func (l *LanguageService) getExportInfos( if moduleCount = moduleCount + 1; moduleCount%100 == 0 && ctx.Err() != nil { return } - if moduleFile == nil && moduleSymbol.Name != exportMapKey.AmbientModuleName { + if moduleFile == nil && stringutil.StripQuotes(moduleSymbol.Name) != exportMapKey.AmbientModuleName { return } seenExports := collections.Set[string]{} diff --git a/internal/ls/changetracker.go b/internal/ls/changetracker.go index 34397aa546..db7cfb3fec 100644 --- a/internal/ls/changetracker.go +++ b/internal/ls/changetracker.go @@ -165,6 +165,10 @@ func (ct *changeTracker) insertNodesAfter(sourceFile *ast.SourceFile, after *ast ct.insertNodesAt(sourceFile, endPosition, newNodes, ct.getInsertNodeAfterOptions(sourceFile, after)) } +func (ct *changeTracker) insertNodeBefore(sourceFile *ast.SourceFile, before *ast.Node, newNode *ast.Node, blankLineBetween bool) { + ct.insertNodeAt(sourceFile, core.TextPos(ct.getAdjustedStartPosition(sourceFile, before, leadingTriviaOptionNone, false)), newNode, ct.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween)) +} + func (ct *changeTracker) endPosForInsertNodeAfter(sourceFile *ast.SourceFile, after *ast.Node, newNode *ast.Node) core.TextPos { if (needSemicolonBetween(after, newNode)) && (rune(sourceFile.Text()[after.End()-1]) != ';') { // check if previous statement ends with semicolon @@ -213,10 +217,10 @@ func (ct *changeTracker) insertNodeInListAfter(sourceFile *ast.SourceFile, after // ###b, // c, nextNode := containingList[index+1] - startPos := scanner.SkipTriviaEx(sourceFile.Text(), nextNode.Pos(), &scanner.SkipTriviaOptions{StopAfterLineBreak: true, StopAtComments: false}) + startPos := scanner.SkipTriviaEx(sourceFile.Text(), nextNode.Pos(), &scanner.SkipTriviaOptions{StopAfterLineBreak: false, StopAtComments: true}) // write separator and leading trivia of the next element as suffix - suffix := scanner.TokenToString(nextToken.Kind) + sourceFile.Text()[nextNode.End():startPos] + suffix := scanner.TokenToString(nextToken.Kind) + sourceFile.Text()[nextToken.End():startPos] ct.insertNodeAt(sourceFile, core.TextPos(startPos), newNode, changeNodeOptions{suffix: suffix}) } return @@ -278,6 +282,21 @@ func (ct *changeTracker) insertNodeInListAfter(sourceFile *ast.SourceFile, after ) } +// insertImportSpecifierAtIndex inserts a new import specifier at the specified index in a NamedImports list +func (ct *changeTracker) insertImportSpecifierAtIndex(sourceFile *ast.SourceFile, newSpecifier *ast.Node, namedImports *ast.Node, index int) { + namedImportsNode := namedImports.AsNamedImports() + elements := namedImportsNode.Elements.Nodes + + if index > 0 && len(elements) > index { + ct.insertNodeInListAfter(sourceFile, elements[index-1], newSpecifier, elements) + } else { + // Insert before the first element + firstElement := elements[0] + multiline := printer.GetLinesBetweenPositions(sourceFile, firstElement.Pos(), namedImports.Parent.Parent.Pos()) != 0 + ct.insertNodeBefore(sourceFile, firstElement, newSpecifier, multiline) + } +} + func (ct *changeTracker) insertAtTopOfFile(sourceFile *ast.SourceFile, insert []*ast.Statement, blankLineBetween bool) { if len(insert) == 0 { return @@ -288,7 +307,7 @@ func (ct *changeTracker) insertAtTopOfFile(sourceFile *ast.SourceFile, insert [] if pos != 0 { options.prefix = ct.newLine } - if !stringutil.IsLineBreak(rune(sourceFile.Text()[pos])) { + if len(sourceFile.Text()) == 0 || !stringutil.IsLineBreak(rune(sourceFile.Text()[pos])) { options.suffix = ct.newLine } if blankLineBetween { @@ -334,3 +353,32 @@ func (ct *changeTracker) getInsertNodeAfterOptions(sourceFile *ast.SourceFile, n return options } + +func (ct *changeTracker) getOptionsForInsertNodeBefore(before *ast.Node, inserted *ast.Node, blankLineBetween bool) changeNodeOptions { + if ast.IsStatement(before) || ast.IsClassOrTypeElement(before) { + if blankLineBetween { + return changeNodeOptions{suffix: ct.newLine + ct.newLine} + } + return changeNodeOptions{suffix: ct.newLine} + } else if before.Kind == ast.KindVariableDeclaration { + // insert `x = 1, ` into `const x = 1, y = 2; + return changeNodeOptions{suffix: ", "} + } else if before.Kind == ast.KindParameter { + if inserted.Kind == ast.KindParameter { + return changeNodeOptions{suffix: ", "} + } + return changeNodeOptions{} + } else if (before.Kind == ast.KindStringLiteral && before.Parent != nil && before.Parent.Kind == ast.KindImportDeclaration) || before.Kind == ast.KindNamedImports { + return changeNodeOptions{suffix: ", "} + } else if before.Kind == ast.KindImportSpecifier { + suffix := "," + if blankLineBetween { + suffix += ct.newLine + } else { + suffix += " " + } + return changeNodeOptions{suffix: suffix} + } + // We haven't handled this kind of node yet -- add it + panic("unimplemented node type " + before.Kind.String() + " in changeTracker.getOptionsForInsertNodeBefore") +} diff --git a/internal/ls/changetrackerimpl.go b/internal/ls/changetrackerimpl.go index e8f3d13e69..b36c1ea982 100644 --- a/internal/ls/changetrackerimpl.go +++ b/internal/ls/changetrackerimpl.go @@ -84,7 +84,7 @@ func (ct *changeTracker) computeNewText(change *trackerEdit, targetSourceFile *a if !(change.options.indentation != nil && *change.options.indentation != 0 || format.GetLineStartPositionForPosition(pos, targetSourceFile) == pos) { noIndent = strings.TrimLeftFunc(text, unicode.IsSpace) } - return change.options.prefix + noIndent // !!! +((!options.suffix || endsWith(noIndent, options.suffix)) ? "" : options.suffix); + return change.options.prefix + noIndent + core.IfElse(strings.HasSuffix(noIndent, change.options.suffix), "", change.options.suffix) } /** Note: this may mutate `nodeIn`. */ @@ -121,7 +121,6 @@ func getFormatCodeSettingsForWriting(options *format.FormatCodeSettings, sourceF return options } -/** Note: output node may be mutated input node. */ func (ct *changeTracker) getNonformattedText(node *ast.Node, sourceFile *ast.SourceFile) (string, *ast.Node) { nodeIn := node eofToken := ct.Factory.NewToken(ast.KindEndOfFile) @@ -146,6 +145,7 @@ func (ct *changeTracker) getNonformattedText(node *ast.Node, sourceFile *ast.Sou ).Write(nodeIn, sourceFile, writer, nil) text := writer.String() + text = strings.TrimSuffix(text, ct.newLine) // Newline artifact from printing a SourceFile instead of a node nodeOut := writer.AssignPositionsToNode(nodeIn, ct.NodeFactory) var sourceFileLike *ast.Node diff --git a/internal/ls/completions.go b/internal/ls/completions.go index 95934780dc..65db54b937 100644 --- a/internal/ls/completions.go +++ b/internal/ls/completions.go @@ -63,7 +63,7 @@ func ensureItemData(fileName string, pos int, list *lsproto.CompletionList) *lsp } for _, item := range list.Items { if item.Data == nil { - var data any = &itemData{ + var data any = &CompletionItemData{ FileName: fileName, Position: pos, Name: item.Label, @@ -87,7 +87,7 @@ type completionDataData struct { location *ast.Node keywordFilters KeywordCompletionFilters literals []literalValue - symbolToOriginInfoMap map[ast.SymbolId]*symbolOriginInfo + symbolToOriginInfoMap map[int]*symbolOriginInfo symbolToSortTextMap map[ast.SymbolId]sortText recommendedCompletion *ast.Symbol previousToken *ast.Node @@ -246,7 +246,7 @@ func (origin *symbolOriginInfo) moduleSymbol() *ast.Symbol { } } -func (origin *symbolOriginInfo) toCompletionEntryData() *completionEntryData { +func (origin *symbolOriginInfo) toCompletionEntryData() *AutoImportData { debug.Assert(origin.kind&symbolOriginInfoKindExport != 0, fmt.Sprintf("completionEntryData is not generated for symbolOriginInfo of type %T", origin.data)) var ambientModuleName *string if origin.fileName == "" { @@ -258,12 +258,12 @@ func (origin *symbolOriginInfo) toCompletionEntryData() *completionEntryData { } data := origin.data.(*symbolOriginInfoExport) - return &completionEntryData{ + return &AutoImportData{ ExportName: data.exportName, ExportMapKey: data.exportMapKey, ModuleSpecifier: data.moduleSpecifier, AmbientModuleName: ambientModuleName, - FileName: strPtrTo(origin.fileName), + FileName: origin.fileName, IsPackageJsonImport: isPackageJsonImport, } } @@ -711,7 +711,8 @@ func (l *LanguageService) getCompletionData( hasUnresolvedAutoImports := false // This also gets mutated in nested-functions after the return var symbols []*ast.Symbol - symbolToOriginInfoMap := map[ast.SymbolId]*symbolOriginInfo{} + // Keys are indexes of `symbols`. + symbolToOriginInfoMap := map[int]*symbolOriginInfo{} symbolToSortTextMap := map[ast.SymbolId]sortText{} var seenPropertySymbols collections.Set[ast.SymbolId] importSpecifierResolver := &importSpecifierResolverForCompletions{SourceFile: file, UserPreferences: preferences, l: l} @@ -725,9 +726,9 @@ func (l *LanguageService) getCompletionData( addSymbolOriginInfo := func(symbol *ast.Symbol, insertQuestionDot bool, insertAwait bool) { symbolId := ast.GetSymbolId(symbol) if insertAwait && seenPropertySymbols.AddIfAbsent(symbolId) { - symbolToOriginInfoMap[symbolId] = &symbolOriginInfo{kind: getNullableSymbolOriginInfoKind(symbolOriginInfoKindPromise, insertQuestionDot)} + symbolToOriginInfoMap[len(symbols)-1] = &symbolOriginInfo{kind: getNullableSymbolOriginInfoKind(symbolOriginInfoKindPromise, insertQuestionDot)} } else if insertQuestionDot { - symbolToOriginInfoMap[symbolId] = &symbolOriginInfo{kind: symbolOriginInfoKindNullable} + symbolToOriginInfoMap[len(symbols)-1] = &symbolOriginInfo{kind: symbolOriginInfoKindNullable} } } @@ -772,7 +773,7 @@ func (l *LanguageService) getCompletionData( if moduleSymbol == nil || !checker.IsExternalModuleSymbol(moduleSymbol) || typeChecker.TryGetMemberInModuleExportsAndProperties(firstAccessibleSymbol.Name, moduleSymbol) != firstAccessibleSymbol { - symbolToOriginInfoMap[firstAccessibleSymbolId] = &symbolOriginInfo{kind: getNullableSymbolOriginInfoKind(symbolOriginInfoKindSymbolMemberNoExport, insertQuestionDot)} + symbolToOriginInfoMap[len(symbols)-1] = &symbolOriginInfo{kind: getNullableSymbolOriginInfoKind(symbolOriginInfoKindSymbolMemberNoExport, insertQuestionDot)} } else { var fileName string if tspath.IsExternalModuleNameRelative(stringutil.StripQuotes(moduleSymbol.Name)) { @@ -793,7 +794,7 @@ func (l *LanguageService) getCompletionData( ) if result != nil { - symbolToOriginInfoMap[ast.GetSymbolId(symbol)] = &symbolOriginInfo{ + symbolToOriginInfoMap[len(symbols)-1] = &symbolOriginInfo{ kind: getNullableSymbolOriginInfoKind(symbolOriginInfoKindSymbolMemberExport, insertQuestionDot), isDefaultExport: false, fileName: fileName, @@ -1262,7 +1263,7 @@ func (l *LanguageService) getCompletionData( moduleSpecifier: moduleSpecifier, }, } - symbolToOriginInfoMap[symbolId] = originInfo + symbolToOriginInfoMap[len(symbols)] = originInfo symbolToSortTextMap[symbolId] = core.IfElse(importStatementCompletion != nil, SortTextLocationPriority, SortTextAutoImportSuggestions) symbols = append(symbols, symbol) return nil @@ -1530,17 +1531,16 @@ func (l *LanguageService) getCompletionData( symbols = append(symbols, filterClassMembersList(baseSymbols, decl.Members(), classElementModifierFlags, file, position)...) - for _, symbol := range symbols { + for index, symbol := range symbols { declaration := symbol.ValueDeclaration if declaration != nil && ast.IsClassElement(declaration) && declaration.Name() != nil && ast.IsComputedPropertyName(declaration.Name()) { - symbolId := ast.GetSymbolId(symbol) origin := &symbolOriginInfo{ kind: symbolOriginInfoKindComputedPropertyName, data: &symbolOriginInfoComputedPropertyName{symbolName: typeChecker.SymbolToString(symbol)}, } - symbolToOriginInfoMap[symbolId] = origin + symbolToOriginInfoMap[index] = origin } } } @@ -1647,7 +1647,7 @@ func (l *LanguageService) getCompletionData( symbols = append(symbols, typeChecker.GetSymbolsInScope(scopeNode, symbolMeanings)...) core.CheckEachDefined(symbols, "getSymbolsInScope() should all be defined") - for _, symbol := range symbols { + for index, symbol := range symbols { symbolId := ast.GetSymbolId(symbol) if !typeChecker.IsArgumentsSymbol(symbol) && !core.Some(symbol.Declarations, func(decl *ast.Declaration) bool { @@ -1662,7 +1662,7 @@ func (l *LanguageService) getCompletionData( kind: symbolOriginInfoKindTypeOnlyAlias, data: &symbolOriginInfoTypeOnlyAlias{declaration: typeOnlyAliasDeclaration}, } - symbolToOriginInfoMap[symbolId] = origin + symbolToOriginInfoMap[index] = origin } } } @@ -1677,7 +1677,7 @@ func (l *LanguageService) getCompletionData( for _, symbol := range getPropertiesForCompletion(thisType, typeChecker) { symbolId := ast.GetSymbolId(symbol) symbols = append(symbols, symbol) - symbolToOriginInfoMap[symbolId] = &symbolOriginInfo{kind: symbolOriginInfoKindThisType} + symbolToOriginInfoMap[len(symbols)-1] = &symbolOriginInfo{kind: symbolOriginInfoKindThisType} symbolToSortTextMap[symbolId] = SortTextSuggestedClassMembers } } @@ -1957,9 +1957,8 @@ func (l *LanguageService) getCompletionEntriesFromSymbols( // true otherwise. Based on the order we add things we will always see locals first, then globals, then module exports. // So adding a completion for a local will prevent us from adding completions for external module exports sharing the same name. uniques := make(uniqueNamesMap) - for _, symbol := range data.symbols { - symbolId := ast.GetSymbolId(symbol) - origin := data.symbolToOriginInfoMap[symbolId] + for index, symbol := range data.symbols { + origin := data.symbolToOriginInfoMap[index] name, needsConvertPropertyAccess := getCompletionEntryDisplayNameForSymbol( symbol, origin, @@ -2294,7 +2293,7 @@ func (l *LanguageService) createCompletionItem( } } - var autoImportData *completionEntryData + var autoImportData *AutoImportData if originIsExport(origin) { autoImportData = origin.toCompletionEntryData() hasAction = data.importStatementCompletion == nil @@ -3289,10 +3288,7 @@ func getCompletionsSymbolKind(kind ScriptElementKind) lsproto.CompletionItemKind // Editors will use the `sortText` and then fall back to `name` for sorting, but leave ties in response order. // So, it's important that we sort those ties in the order we want them displayed if it matters. We don't // strictly need to sort by name or SortText here since clients are going to do it anyway, but we have to -// do the work of comparing them so we can sort those ties appropriately; plus, it makes the order returned -// by the language service consistent with what TS Server does and what editors typically do. This also makes -// completions tests make more sense. We used to sort only alphabetically and only in the server layer, but -// this made tests really weird, since most fourslash tests don't use the server. +// do the work of comparing them so we can sort those ties appropriately. func compareCompletionEntries(entryInSlice *lsproto.CompletionItem, entryToInsert *lsproto.CompletionItem) int { compareStrings := stringutil.CompareStringsCaseInsensitiveThenSensitive result := compareStrings(*entryInSlice.SortText, *entryToInsert.SortText) @@ -3300,14 +3296,22 @@ func compareCompletionEntries(entryInSlice *lsproto.CompletionItem, entryToInser result = compareStrings(entryInSlice.Label, entryToInsert.Label) } if result == stringutil.ComparisonEqual && entryInSlice.Data != nil && entryToInsert.Data != nil { - sliceEntryData, ok1 := (*entryInSlice.Data).(*completionEntryData) - insertEntryData, ok2 := (*entryToInsert.Data).(*completionEntryData) - if ok1 && ok2 && sliceEntryData.ModuleSpecifier != "" && insertEntryData.ModuleSpecifier != "" { + sliceEntryData, ok1 := (*entryInSlice.Data).(*CompletionItemData) + insertEntryData, ok2 := (*entryToInsert.Data).(*CompletionItemData) + if ok1 && ok2 && + sliceEntryData.AutoImport != nil && sliceEntryData.AutoImport.ModuleSpecifier != "" && + insertEntryData.AutoImport != nil && insertEntryData.AutoImport.ModuleSpecifier != "" { // Sort same-named auto-imports by module specifier result = compareNumberOfDirectorySeparators( - sliceEntryData.ModuleSpecifier, - insertEntryData.ModuleSpecifier, + sliceEntryData.AutoImport.ModuleSpecifier, + insertEntryData.AutoImport.ModuleSpecifier, ) + if result == stringutil.ComparisonEqual { + result = compareStrings( + sliceEntryData.AutoImport.ModuleSpecifier, + insertEntryData.AutoImport.ModuleSpecifier, + ) + } } } if result == stringutil.ComparisonEqual { @@ -4514,10 +4518,10 @@ func (l *LanguageService) createLSPCompletionItem( hasAction bool, preselect bool, source string, - autoImportEntryData *completionEntryData, + autoImportEntryData *AutoImportData, ) *lsproto.CompletionItem { kind := getCompletionsSymbolKind(elementKind) - var data any = &itemData{ + var data any = &CompletionItemData{ FileName: file.FileName(), Position: position, Source: source, @@ -4949,15 +4953,15 @@ func getArgumentInfoForCompletions(node *ast.Node, position int, file *ast.Sourc } } -type itemData struct { - FileName string `json:"fileName"` - Position int `json:"position"` - Source string `json:"source,omitempty"` - Name string `json:"name,omitempty"` - AutoImport *completionEntryData `json:"autoImport,omitempty"` +type CompletionItemData struct { + FileName string `json:"fileName"` + Position int `json:"position"` + Source string `json:"source,omitempty"` + Name string `json:"name,omitempty"` + AutoImport *AutoImportData `json:"autoImport,omitempty"` } -type completionEntryData struct { +type AutoImportData struct { /** * The name of the property or export in the module's symbol table. Differs from the completion name * in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default. @@ -4967,7 +4971,7 @@ type completionEntryData struct { ModuleSpecifier string `json:"moduleSpecifier"` /** The file name declaring the export's module symbol, if it was an external module */ - FileName *string `json:"fileName"` + FileName string `json:"fileName"` /** The module name (with quotes stripped) of the export's module symbol, if it was an ambient module */ AmbientModuleName *string `json:"ambientModuleName"` @@ -4975,7 +4979,7 @@ type completionEntryData struct { IsPackageJsonImport core.Tristate `json:"isPackageJsonImport"` } -func (d *completionEntryData) toSymbolOriginExport(symbolName string, moduleSymbol *ast.Symbol, isDefaultExport bool) *symbolOriginInfoExport { +func (d *AutoImportData) toSymbolOriginExport(symbolName string, moduleSymbol *ast.Symbol, isDefaultExport bool) *symbolOriginInfoExport { return &symbolOriginInfoExport{ symbolName: symbolName, moduleSymbol: moduleSymbol, @@ -5012,7 +5016,7 @@ const ( func (l *LanguageService) ResolveCompletionItem( ctx context.Context, item *lsproto.CompletionItem, - data *itemData, + data *CompletionItemData, clientOptions *lsproto.CompletionClientCapabilities, preferences *UserPreferences, ) (*lsproto.CompletionItem, error) { @@ -5028,12 +5032,12 @@ func (l *LanguageService) ResolveCompletionItem( return l.getCompletionItemDetails(ctx, program, data.Position, file, item, data, clientOptions, preferences), nil } -func GetCompletionItemData(item *lsproto.CompletionItem) (*itemData, error) { +func GetCompletionItemData(item *lsproto.CompletionItem) (*CompletionItemData, error) { bytes, err := json.Marshal(item.Data) if err != nil { return nil, fmt.Errorf("failed to marshal completion item data: %w", err) } - var itemData itemData + var itemData CompletionItemData if err := json.Unmarshal(bytes, &itemData); err != nil { return nil, fmt.Errorf("failed to unmarshal completion item data: %w", err) } @@ -5046,7 +5050,7 @@ func (l *LanguageService) getCompletionItemDetails( position int, file *ast.SourceFile, item *lsproto.CompletionItem, - itemData *itemData, + itemData *CompletionItemData, clientOptions *lsproto.CompletionClientCapabilities, preferences *UserPreferences, ) *lsproto.CompletionItem { @@ -5145,7 +5149,7 @@ func (l *LanguageService) getSymbolCompletionFromItemData( ch *checker.Checker, file *ast.SourceFile, position int, - itemData *itemData, + itemData *CompletionItemData, clientOptions *lsproto.CompletionClientCapabilities, preferences *UserPreferences, ) detailsData { @@ -5194,9 +5198,8 @@ func (l *LanguageService) getSymbolCompletionFromItemData( // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - for _, symbol := range data.symbols { - symbolId := ast.GetSymbolId(symbol) - origin := data.symbolToOriginInfoMap[symbolId] + for index, symbol := range data.symbols { + origin := data.symbolToOriginInfoMap[index] displayName, _ := getCompletionEntryDisplayNameForSymbol(symbol, origin, data.completionKind, data.isJsxIdentifierExpected) if displayName == itemData.Name && (itemData.Source == string(completionSourceClassMemberSnippet) && symbol.Flags&ast.SymbolFlagsClassMember != 0 || @@ -5219,15 +5222,15 @@ func (l *LanguageService) getSymbolCompletionFromItemData( return detailsData{} } -func (l *LanguageService) getAutoImportSymbolFromCompletionEntryData(ch *checker.Checker, name string, autoImportData *completionEntryData) *symbolDetails { +func (l *LanguageService) getAutoImportSymbolFromCompletionEntryData(ch *checker.Checker, name string, autoImportData *AutoImportData) *symbolDetails { containingProgram := l.GetProgram() // !!! isPackageJson ? packageJsonAutoimportProvider : program var moduleSymbol *ast.Symbol if autoImportData.AmbientModuleName != nil { moduleSymbol = ch.TryFindAmbientModule(*autoImportData.AmbientModuleName) - } else if autoImportData.FileName != nil { - moduleSymbolSourceFile := containingProgram.GetSourceFile(*autoImportData.FileName) + } else if autoImportData.FileName != "" { + moduleSymbolSourceFile := containingProgram.GetSourceFile(autoImportData.FileName) if moduleSymbolSourceFile == nil { - panic("module sourceFile not found: " + *autoImportData.FileName) + panic("module sourceFile not found: " + autoImportData.FileName) } moduleSymbol = ch.GetMergedSymbol(moduleSymbolSourceFile.Symbol) } @@ -5253,7 +5256,7 @@ func (l *LanguageService) getAutoImportSymbolFromCompletionEntryData(ch *checker } origin := &symbolOriginInfo{ kind: symbolOriginInfoKindExport, - fileName: *autoImportData.FileName, + fileName: autoImportData.FileName, isFromPackageJson: autoImportData.IsPackageJsonImport.IsTrue(), isDefaultExport: isDefaultExport, data: autoImportData.toSymbolOriginExport(name, moduleSymbol, isDefaultExport), @@ -5318,7 +5321,7 @@ func createCompletionDetailsForSymbol( } // !!! snippets -func (l *LanguageService) getCompletionItemActions(ctx context.Context, ch *checker.Checker, file *ast.SourceFile, position int, itemData *itemData, symbolDetails *symbolDetails, preferences *UserPreferences) []codeAction { +func (l *LanguageService) getCompletionItemActions(ctx context.Context, ch *checker.Checker, file *ast.SourceFile, position int, itemData *CompletionItemData, symbolDetails *symbolDetails, preferences *UserPreferences) []codeAction { if itemData.AutoImport != nil && itemData.AutoImport.ModuleSpecifier != "" && symbolDetails.previousToken != nil { // Import statement completion: 'import c|' if symbolDetails.contextToken != nil && l.getImportStatementCompletionInfo(symbolDetails.contextToken, file).replacementSpan != nil { diff --git a/internal/ls/organizeimports.go b/internal/ls/organizeimports.go index 8cdeddab5d..b5cfaf68a6 100644 --- a/internal/ls/organizeimports.go +++ b/internal/ls/organizeimports.go @@ -2,15 +2,26 @@ package ls import ( "cmp" + "math" "strings" "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/compiler" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/modulespecifiers" + "github.com/microsoft/typescript-go/internal/stringutil" "github.com/microsoft/typescript-go/internal/tspath" ) +var ( + caseInsensitiveOrganizeImportsComparer = []func(a, b string) int{getOrganizeImportsOrdinalStringComparer(true)} + caseSensitiveOrganizeImportsComparer = []func(a, b string) int{getOrganizeImportsOrdinalStringComparer(false)} + organizeImportsComparers = []func(a, b string) int{ + caseInsensitiveOrganizeImportsComparer[0], + caseSensitiveOrganizeImportsComparer[0], + } +) + // statement = anyImportOrRequireStatement func getImportDeclarationInsertIndex(sortedImports []*ast.Statement, newImport *ast.Statement, comparer func(a, b *ast.Statement) int) int { // !!! @@ -126,3 +137,251 @@ func isIndexFileName(fileName string) bool { } return fileName == "index" } + +func getOrganizeImportsOrdinalStringComparer(ignoreCase bool) func(a, b string) int { + if ignoreCase { + return stringutil.CompareStringsCaseInsensitiveEslintCompatible + } + return stringutil.CompareStringsCaseSensitive +} + +// getModuleSpecifierExpression returns the module specifier expression from an import/require statement +func getModuleSpecifierExpression(declaration *ast.Statement) *ast.Expression { + switch declaration.Kind { + case ast.KindImportEqualsDeclaration: + importEquals := declaration.AsImportEqualsDeclaration() + if importEquals.ModuleReference.Kind == ast.KindExternalModuleReference { + return importEquals.ModuleReference.AsExternalModuleReference().Expression + } + return nil + case ast.KindImportDeclaration: + return declaration.AsImportDeclaration().ModuleSpecifier + case ast.KindVariableStatement: + // For require statements: const x = require('...') + variableStatement := declaration.AsVariableStatement() + declarations := variableStatement.DeclarationList.AsVariableDeclarationList().Declarations.Nodes + if len(declarations) > 0 { + decl := declarations[0] + initializer := decl.Initializer() + if initializer != nil && initializer.Kind == ast.KindCallExpression { + callExpr := initializer.AsCallExpression() + if len(callExpr.Arguments.Nodes) > 0 { + return callExpr.Arguments.Nodes[0] + } + } + } + return nil + default: + return nil + } +} + +func getExternalModuleName(specifier *ast.Expression) string { + if specifier != nil && ast.IsStringLiteralLike(specifier.AsNode()) { + return specifier.Text() + } + return "" +} + +// compareModuleSpecifiersWorker compares two module specifiers +func compareModuleSpecifiersWorker(m1 *ast.Expression, m2 *ast.Expression, comparer func(a, b string) int) int { + name1 := getExternalModuleName(m1) + name2 := getExternalModuleName(m2) + if cmp := compareBooleans(name1 == "", name2 == ""); cmp != 0 { + return cmp + } + if cmp := compareBooleans(tspath.IsExternalModuleNameRelative(name1), tspath.IsExternalModuleNameRelative(name2)); cmp != 0 { + return cmp + } + return comparer(name1, name2) +} + +// compareImportKind returns comparison order based on import kind +func compareImportKind(s1 *ast.Statement, s2 *ast.Statement) int { + return cmp.Compare(getImportKindOrder(s1), getImportKindOrder(s2)) +} + +// getImportKindOrder returns the sort order for different import kinds: +// 1. Side-effect imports +// 2. Type-only imports +// 3. Namespace imports +// 4. Default imports +// 5. Named imports +// 6. ImportEqualsDeclarations +// 7. Require variable statements +func getImportKindOrder(s1 *ast.Statement) int { + switch s1.Kind { + case ast.KindImportDeclaration: + importDecl := s1.AsImportDeclaration() + if importDecl.ImportClause == nil { + return 0 // Side-effect import + } + importClause := importDecl.ImportClause.AsImportClause() + if importClause.IsTypeOnly() { + return 1 // Type-only import + } + if importClause.NamedBindings != nil && importClause.NamedBindings.Kind == ast.KindNamespaceImport { + return 2 // Namespace import + } + if importClause.Name() != nil { + return 3 // Default import + } + return 4 // Named imports + case ast.KindImportEqualsDeclaration: + return 5 + case ast.KindVariableStatement: + return 6 // Require statement + default: + return 7 + } +} + +// compareImportsOrRequireStatements compares two import or require statements for sorting +func compareImportsOrRequireStatements(s1 *ast.Statement, s2 *ast.Statement, comparer func(a, b string) int) int { + if cmp := compareModuleSpecifiersWorker(getModuleSpecifierExpression(s1), getModuleSpecifierExpression(s2), comparer); cmp != 0 { + return cmp + } + return compareImportKind(s1, s2) +} + +// compareImportOrExportSpecifiers compares two import or export specifiers +func compareImportOrExportSpecifiers(s1 *ast.Node, s2 *ast.Node, comparer func(a, b string) int, preferences *UserPreferences) int { + typeOrder := OrganizeImportsTypeOrderLast + if preferences != nil { + typeOrder = preferences.OrganizeImportsTypeOrder + } + + s1Name := s1.Name().Text() + s2Name := s2.Name().Text() + + switch typeOrder { + case OrganizeImportsTypeOrderFirst: + if cmp := compareBooleans(s2.IsTypeOnly(), s1.IsTypeOnly()); cmp != 0 { + return cmp + } + return comparer(s1Name, s2Name) + case OrganizeImportsTypeOrderInline: + return comparer(s1Name, s2Name) + default: // OrganizeImportsTypeOrderLast + if cmp := compareBooleans(s1.IsTypeOnly(), s2.IsTypeOnly()); cmp != 0 { + return cmp + } + return comparer(s1Name, s2Name) + } +} + +// getNamedImportSpecifierComparer returns a comparer function for import/export specifiers +func getNamedImportSpecifierComparer(preferences *UserPreferences, comparer func(a, b string) int) func(s1, s2 *ast.Node) int { + if comparer == nil { + ignoreCase := false + if preferences != nil && !preferences.OrganizeImportsIgnoreCase.IsUnknown() { + ignoreCase = preferences.OrganizeImportsIgnoreCase.IsTrue() + } + comparer = getOrganizeImportsOrdinalStringComparer(ignoreCase) + } + return func(s1, s2 *ast.Node) int { + return compareImportOrExportSpecifiers(s1, s2, comparer, preferences) + } +} + +// getImportSpecifierInsertionIndex finds the insertion index for a new import specifier +func getImportSpecifierInsertionIndex(sortedImports []*ast.Node, newImport *ast.Node, comparer func(s1, s2 *ast.Node) int) int { + return core.FirstResult(core.BinarySearchUniqueFunc(sortedImports, func(mid int, value *ast.Node) int { + return comparer(value, newImport) + })) +} + +// getOrganizeImportsStringComparerWithDetection detects the string comparer to use based on existing imports +func getOrganizeImportsStringComparerWithDetection(originalImportDecls []*ast.Statement, preferences *UserPreferences) (comparer func(a, b string) int, isSorted bool) { + result := detectModuleSpecifierCaseBySort([][]*ast.Statement{originalImportDecls}, getComparers(preferences)) + return result.comparer, result.isSorted +} + +func getComparers(preferences *UserPreferences) []func(a string, b string) int { + if preferences != nil { + switch preferences.OrganizeImportsIgnoreCase { + case core.TSTrue: + return caseInsensitiveOrganizeImportsComparer + case core.TSFalse: + return caseSensitiveOrganizeImportsComparer + } + } + + return organizeImportsComparers +} + +type caseSensitivityDetectionResult struct { + comparer func(a, b string) int + isSorted bool +} + +func detectModuleSpecifierCaseBySort(importDeclsByGroup [][]*ast.Statement, comparersToTest []func(a, b string) int) caseSensitivityDetectionResult { + moduleSpecifiersByGroup := make([][]string, 0, len(importDeclsByGroup)) + for _, importGroup := range importDeclsByGroup { + moduleNames := make([]string, 0, len(importGroup)) + for _, decl := range importGroup { + if expr := getModuleSpecifierExpression(decl); expr != nil { + moduleNames = append(moduleNames, getExternalModuleName(expr)) + } else { + moduleNames = append(moduleNames, "") + } + } + moduleSpecifiersByGroup = append(moduleSpecifiersByGroup, moduleNames) + } + return detectCaseSensitivityBySort(moduleSpecifiersByGroup, comparersToTest) +} + +func detectCaseSensitivityBySort(originalGroups [][]string, comparersToTest []func(a, b string) int) caseSensitivityDetectionResult { + var bestComparer func(a, b string) int + bestDiff := math.MaxInt + + for _, curComparer := range comparersToTest { + diffOfCurrentComparer := 0 + + for _, listToSort := range originalGroups { + if len(listToSort) <= 1 { + continue + } + diff := measureSortedness(listToSort, curComparer) + diffOfCurrentComparer += diff + } + + if diffOfCurrentComparer < bestDiff { + bestDiff = diffOfCurrentComparer + bestComparer = curComparer + } + } + + if bestComparer == nil && len(comparersToTest) > 0 { + bestComparer = comparersToTest[0] + } + + return caseSensitivityDetectionResult{ + comparer: bestComparer, + isSorted: bestDiff == 0, + } +} + +func measureSortedness[T any](arr []T, comparer func(a, b T) int) int { + i := 0 + for j := range len(arr) - 1 { + if comparer(arr[j], arr[j+1]) > 0 { + i++ + } + } + return i +} + +// getNamedImportSpecifierComparerWithDetection detects the appropriate comparer for named imports +func getNamedImportSpecifierComparerWithDetection(importDecl *ast.Node, preferences *UserPreferences, sourceFile *ast.SourceFile) (specifierComparer func(s1, s2 *ast.Node) int, isSorted core.Tristate) { + specifierComparer = getNamedImportSpecifierComparer(preferences, getComparers(preferences)[0]) + // Try to detect from the current import declaration + if (preferences == nil || preferences.OrganizeImportsIgnoreCase.IsUnknown() || preferences.OrganizeImportsTypeOrder == OrganizeImportsTypeOrderLast) && + importDecl.Kind == ast.KindImportDeclaration { + // For now, just return the default comparer + // Full detection logic would require porting detectNamedImportOrganizationBySort + return specifierComparer, core.TSUnknown + } + + return specifierComparer, core.TSUnknown +} diff --git a/internal/module/resolver.go b/internal/module/resolver.go index e88a468cc0..7f83beb76d 100644 --- a/internal/module/resolver.go +++ b/internal/module/resolver.go @@ -1675,7 +1675,7 @@ func (r *resolutionState) getPackageJsonInfo(packageDirectory string, onlyRecord if directoryExists && r.resolver.host.FS().FileExists(packageJsonPath) { // Ignore error contents, _ := r.resolver.host.FS().ReadFile(packageJsonPath) - packageJsonContent, _ := packagejson.Parse([]byte(contents)) + packageJsonContent, err := packagejson.Parse([]byte(contents)) if r.tracer != nil { r.tracer.write(diagnostics.Found_package_json_at_0.Format(packageJsonPath)) } @@ -1683,7 +1683,8 @@ func (r *resolutionState) getPackageJsonInfo(packageDirectory string, onlyRecord PackageDirectory: packageDirectory, DirectoryExists: true, Contents: &packagejson.PackageJson{ - Fields: packageJsonContent, + Fields: packageJsonContent, + Parseable: err == nil, }, } result = r.resolver.packageJsonInfoCache.Set(packageJsonPath, result) diff --git a/internal/modulespecifiers/specifiers.go b/internal/modulespecifiers/specifiers.go index 1f8e26b040..fd040fc14e 100644 --- a/internal/modulespecifiers/specifiers.go +++ b/internal/modulespecifiers/specifiers.go @@ -793,6 +793,8 @@ func tryDirectoryWithPackageJson( fileName := moduleFileToTry[parts.PackageRootIndex+1:] if fileName == "index.d.ts" || fileName == "index.js" || fileName == "index.ts" || fileName == "index.tsx" { return pkgJsonDirAttemptResult{moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath} + } else { + return pkgJsonDirAttemptResult{moduleFileToTry: moduleFileToTry} } } @@ -801,11 +803,7 @@ func tryDirectoryWithPackageJson( importMode = host.GetDefaultResolutionModeForFile(importingSourceFile) } - var packageJsonContent *packagejson.PackageJson - if packageJson != nil { - packageJsonContent = packageJson.GetContents() - } - + packageJsonContent := packageJson.GetContents() if options.GetResolvePackageJsonImports() { // The package name that we found in node_modules could be different from the package // name in the package.json content via url/filepath dependency specifiers. We need to diff --git a/internal/packagejson/cache.go b/internal/packagejson/cache.go index 7b72a4e3e9..ecff10e365 100644 --- a/internal/packagejson/cache.go +++ b/internal/packagejson/cache.go @@ -14,6 +14,7 @@ var typeScriptVersion = semver.MustParse(core.Version()) type PackageJson struct { Fields + Parseable bool versionPaths VersionPaths versionTraces []string once sync.Once diff --git a/internal/packagejson/packagejson.go b/internal/packagejson/packagejson.go index 5db60cebab..7ada92993e 100644 --- a/internal/packagejson/packagejson.go +++ b/internal/packagejson/packagejson.go @@ -28,6 +28,33 @@ type DependencyFields struct { OptionalDependencies Expected[map[string]string] `json:"optionalDependencies"` } +// HasDependency returns true if the package.json has a dependency with the given name +// under any of the dependency fields (dependencies, devDependencies, peerDependencies, +// optionalDependencies). +func (df *DependencyFields) HasDependency(name string) bool { + if deps, ok := df.Dependencies.GetValue(); ok { + if _, ok := deps[name]; ok { + return true + } + } + if devDeps, ok := df.DevDependencies.GetValue(); ok { + if _, ok := devDeps[name]; ok { + return true + } + } + if peerDeps, ok := df.PeerDependencies.GetValue(); ok { + if _, ok := peerDeps[name]; ok { + return true + } + } + if optDeps, ok := df.OptionalDependencies.GetValue(); ok { + if _, ok := optDeps[name]; ok { + return true + } + } + return false +} + type Fields struct { HeaderFields PathFields diff --git a/internal/stringutil/compare.go b/internal/stringutil/compare.go index 832e1dbcf1..0fb1cd3975 100644 --- a/internal/stringutil/compare.go +++ b/internal/stringutil/compare.go @@ -98,3 +98,23 @@ func CompareStringsCaseInsensitiveThenSensitive(a, b string) Comparison { } return CompareStringsCaseSensitive(a, b) } + +// CompareStringsCaseInsensitiveEslintCompatible performs a case-insensitive comparison +// using toLowerCase() instead of toUpperCase() for ESLint compatibility. +// +// `CompareStringsCaseInsensitive` transforms letters to uppercase for unicode reasons, +// while eslint's `sort-imports` rule transforms letters to lowercase. Which one you choose +// affects the relative order of letters and ASCII characters 91-96, of which `_` is a +// valid character in an identifier. So if we used `CompareStringsCaseInsensitive` for +// import sorting, TypeScript and eslint would disagree about the correct case-insensitive +// sort order for `__String` and `Foo`. Since eslint's whole job is to create consistency +// by enforcing nitpicky details like this, it makes way more sense for us to just adopt +// their convention so users can have auto-imports without making eslint angry. +func CompareStringsCaseInsensitiveEslintCompatible(a, b string) Comparison { + if a == b { + return ComparisonEqual + } + a = strings.ToLower(a) + b = strings.ToLower(b) + return strings.Compare(a, b) +} diff --git a/testdata/baselines/reference/fourslash/autoImports/autoImportCompletion2.baseline.md b/testdata/baselines/reference/fourslash/autoImports/autoImportCompletion2.baseline.md index 1fff3fc8ff..a679c95fee 100644 --- a/testdata/baselines/reference/fourslash/autoImports/autoImportCompletion2.baseline.md +++ b/testdata/baselines/reference/fourslash/autoImports/autoImportCompletion2.baseline.md @@ -6,7 +6,7 @@ someVar; a/**/ ``````ts -import {someVar,anotherVar} from "./a.ts"; +import {anotherVar, someVar} from "./a.ts"; someVar; a diff --git a/testdata/baselines/reference/fourslash/autoImports/autoImportCompletion3.baseline.md b/testdata/baselines/reference/fourslash/autoImports/autoImportCompletion3.baseline.md index e565df0c68..b70487e0b7 100644 --- a/testdata/baselines/reference/fourslash/autoImports/autoImportCompletion3.baseline.md +++ b/testdata/baselines/reference/fourslash/autoImports/autoImportCompletion3.baseline.md @@ -6,7 +6,7 @@ someVar; b/**/ ``````ts -import { aa, someVar,bb } from "./a.ts"; +import { aa, bb, someVar } from "./a.ts"; someVar; b diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js b/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js index 3079c4ba18..45192f5a18 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js @@ -68,87 +68,14 @@ exports.publicProcedure = trpc.procedure; //// [index.d.ts] -export declare const middleware: >(fn: import("@trpc/server").MiddlewareFunction<{ - _config: import("@trpc/server").RootConfig<{ - errorShape: import("@trpc/server").ErrorFormatterShape; +export declare const middleware: >(fn: import("@trpc/server/middleware").MiddlewareFunction<{ + _config: import("@trpc/server/internals/config").RootConfig<{ + errorShape: import("@trpc/server/internals/utils").ErrorFormatterShape; }>; -}, TNewParams>) => import("@trpc/server").MiddlewareBuilder<{ - _config: import("@trpc/server").RootConfig<{ - errorShape: import("@trpc/server").ErrorFormatterShape; +}, TNewParams>) => import("@trpc/server/middleware").MiddlewareBuilder<{ + _config: import("@trpc/server/internals/config").RootConfig<{ + errorShape: import("@trpc/server/internals/utils").ErrorFormatterShape; }>; }, TNewParams>; export declare const router: {}; export declare const publicProcedure: {}; - - -//// [DtsFileErrors] - - -index.d.ts(1,102): error TS2694: Namespace '"node_modules/@trpc/server/index"' has no exported member 'MiddlewareFunction'. -index.d.ts(5,43): error TS2694: Namespace '"node_modules/@trpc/server/index"' has no exported member 'MiddlewareBuilder'. - - -==== node_modules/@trpc/server/internals/config.d.ts (0 errors) ==== - export interface RootConfig { - prop: T; - } -==== node_modules/@trpc/server/internals/utils.d.ts (0 errors) ==== - export interface ErrorFormatterShape { - prop: T; - } - export type PickFirstDefined = undefined extends TType - ? undefined extends TPick - ? never - : TPick - : TType; - export interface ErrorFormatter { - prop: [T, U]; - } - export interface DefaultErrorShape { - prop: T; - } -==== node_modules/@trpc/server/middleware.d.ts (0 errors) ==== - export interface MiddlewareFunction { - prop: [T, U]; - } - export interface MiddlewareBuilder { - prop: [T, U]; - } -==== node_modules/@trpc/server/index.d.ts (0 errors) ==== - import { RootConfig } from './internals/config'; - import { ErrorFormatterShape, PickFirstDefined, ErrorFormatter, DefaultErrorShape } from './internals/utils'; - declare class TRPCBuilder { - create>(): { - procedure: {}; - middleware: >(fn: import("./middleware").MiddlewareFunction<{ - _config: RootConfig<{ - errorShape: ErrorFormatterShape>>; - }>; - }, TNewParams>) => import("./middleware").MiddlewareBuilder<{ - _config: RootConfig<{ - errorShape: ErrorFormatterShape>>; - }>; - }, TNewParams>; - router: {}; - }; - } - - export declare const initTRPC: TRPCBuilder; - export {}; -==== index.d.ts (2 errors) ==== - export declare const middleware: >(fn: import("@trpc/server").MiddlewareFunction<{ - ~~~~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"node_modules/@trpc/server/index"' has no exported member 'MiddlewareFunction'. - _config: import("@trpc/server").RootConfig<{ - errorShape: import("@trpc/server").ErrorFormatterShape; - }>; - }, TNewParams>) => import("@trpc/server").MiddlewareBuilder<{ - ~~~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"node_modules/@trpc/server/index"' has no exported member 'MiddlewareBuilder'. - _config: import("@trpc/server").RootConfig<{ - errorShape: import("@trpc/server").ErrorFormatterShape; - }>; - }, TNewParams>; - export declare const router: {}; - export declare const publicProcedure: {}; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js.diff index acd616e574..d4735170cf 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js.diff @@ -13,87 +13,14 @@ + + +//// [index.d.ts] -+export declare const middleware: >(fn: import("@trpc/server").MiddlewareFunction<{ -+ _config: import("@trpc/server").RootConfig<{ -+ errorShape: import("@trpc/server").ErrorFormatterShape; ++export declare const middleware: >(fn: import("@trpc/server/middleware").MiddlewareFunction<{ ++ _config: import("@trpc/server/internals/config").RootConfig<{ ++ errorShape: import("@trpc/server/internals/utils").ErrorFormatterShape; + }>; -+}, TNewParams>) => import("@trpc/server").MiddlewareBuilder<{ -+ _config: import("@trpc/server").RootConfig<{ -+ errorShape: import("@trpc/server").ErrorFormatterShape; ++}, TNewParams>) => import("@trpc/server/middleware").MiddlewareBuilder<{ ++ _config: import("@trpc/server/internals/config").RootConfig<{ ++ errorShape: import("@trpc/server/internals/utils").ErrorFormatterShape; + }>; +}, TNewParams>; +export declare const router: {}; -+export declare const publicProcedure: {}; -+ -+ -+//// [DtsFileErrors] -+ -+ -+index.d.ts(1,102): error TS2694: Namespace '"node_modules/@trpc/server/index"' has no exported member 'MiddlewareFunction'. -+index.d.ts(5,43): error TS2694: Namespace '"node_modules/@trpc/server/index"' has no exported member 'MiddlewareBuilder'. -+ -+ -+==== node_modules/@trpc/server/internals/config.d.ts (0 errors) ==== -+ export interface RootConfig { -+ prop: T; -+ } -+==== node_modules/@trpc/server/internals/utils.d.ts (0 errors) ==== -+ export interface ErrorFormatterShape { -+ prop: T; -+ } -+ export type PickFirstDefined = undefined extends TType -+ ? undefined extends TPick -+ ? never -+ : TPick -+ : TType; -+ export interface ErrorFormatter { -+ prop: [T, U]; -+ } -+ export interface DefaultErrorShape { -+ prop: T; -+ } -+==== node_modules/@trpc/server/middleware.d.ts (0 errors) ==== -+ export interface MiddlewareFunction { -+ prop: [T, U]; -+ } -+ export interface MiddlewareBuilder { -+ prop: [T, U]; -+ } -+==== node_modules/@trpc/server/index.d.ts (0 errors) ==== -+ import { RootConfig } from './internals/config'; -+ import { ErrorFormatterShape, PickFirstDefined, ErrorFormatter, DefaultErrorShape } from './internals/utils'; -+ declare class TRPCBuilder { -+ create>(): { -+ procedure: {}; -+ middleware: >(fn: import("./middleware").MiddlewareFunction<{ -+ _config: RootConfig<{ -+ errorShape: ErrorFormatterShape>>; -+ }>; -+ }, TNewParams>) => import("./middleware").MiddlewareBuilder<{ -+ _config: RootConfig<{ -+ errorShape: ErrorFormatterShape>>; -+ }>; -+ }, TNewParams>; -+ router: {}; -+ }; -+ } -+ -+ export declare const initTRPC: TRPCBuilder; -+ export {}; -+==== index.d.ts (2 errors) ==== -+ export declare const middleware: >(fn: import("@trpc/server").MiddlewareFunction<{ -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS2694: Namespace '"node_modules/@trpc/server/index"' has no exported member 'MiddlewareFunction'. -+ _config: import("@trpc/server").RootConfig<{ -+ errorShape: import("@trpc/server").ErrorFormatterShape; -+ }>; -+ }, TNewParams>) => import("@trpc/server").MiddlewareBuilder<{ -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2694: Namespace '"node_modules/@trpc/server/index"' has no exported member 'MiddlewareBuilder'. -+ _config: import("@trpc/server").RootConfig<{ -+ errorShape: import("@trpc/server").ErrorFormatterShape; -+ }>; -+ }, TNewParams>; -+ export declare const router: {}; -+ export declare const publicProcedure: {}; -+ \ No newline at end of file ++export declare const publicProcedure: {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js b/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js index 916a7548c9..37a14c819a 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js +++ b/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js @@ -29,30 +29,4 @@ exports.MyComp = Ctor.extends({ foo: "bar" }); //// [index.d.ts] import * as ns from "mod"; -export declare const MyComp: import("mod").ExtendedCtor; - - -//// [DtsFileErrors] - - -index.d.ts(2,44): error TS2694: Namespace '"node_modules/mod/index"' has no exported member 'ExtendedCtor'. - - -==== node_modules/mod/ctor.d.ts (0 errors) ==== - export interface Ctor { - x: number; - } - export type ExtendedCtor = {x: number, ext: T}; - export interface CtorConstructor { - extends(x: T): ExtendedCtor; - } - export const Ctor: CtorConstructor; -==== node_modules/mod/index.d.ts (0 errors) ==== - import { Ctor } from "./ctor"; - export default Ctor; -==== index.d.ts (1 errors) ==== - import * as ns from "mod"; - export declare const MyComp: import("mod").ExtendedCtor; - ~~~~~~~~~~~~ -!!! error TS2694: Namespace '"node_modules/mod/index"' has no exported member 'ExtendedCtor'. - \ No newline at end of file +export declare const MyComp: import("mod/ctor").ExtendedCtor; diff --git a/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js.diff b/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js.diff index c460ba5131..0d1946d9ee 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js.diff @@ -8,35 +8,3 @@ +const ns = require("mod"); const Ctor = ns.default; exports.MyComp = Ctor.extends({ foo: "bar" }); - - - //// [index.d.ts] - import * as ns from "mod"; --export declare const MyComp: import("mod/ctor").ExtendedCtor; -+export declare const MyComp: import("mod").ExtendedCtor; -+ -+ -+//// [DtsFileErrors] -+ -+ -+index.d.ts(2,44): error TS2694: Namespace '"node_modules/mod/index"' has no exported member 'ExtendedCtor'. -+ -+ -+==== node_modules/mod/ctor.d.ts (0 errors) ==== -+ export interface Ctor { -+ x: number; -+ } -+ export type ExtendedCtor = {x: number, ext: T}; -+ export interface CtorConstructor { -+ extends(x: T): ExtendedCtor; -+ } -+ export const Ctor: CtorConstructor; -+==== node_modules/mod/index.d.ts (0 errors) ==== -+ import { Ctor } from "./ctor"; -+ export default Ctor; -+==== index.d.ts (1 errors) ==== -+ import * as ns from "mod"; -+ export declare const MyComp: import("mod").ExtendedCtor; -+ ~~~~~~~~~~~~ -+!!! error TS2694: Namespace '"node_modules/mod/index"' has no exported member 'ExtendedCtor'. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeModuleReexportFromDottedPath.js b/testdata/baselines/reference/submodule/compiler/nodeModuleReexportFromDottedPath.js index 8e6036fddd..4959a62228 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeModuleReexportFromDottedPath.js +++ b/testdata/baselines/reference/submodule/compiler/nodeModuleReexportFromDottedPath.js @@ -29,32 +29,5 @@ exports.default = new EnhancedPrisma(); //// [index.d.ts] import { PrismaClient } from "@prisma/client"; -declare const _default: PrismaClient; +declare const _default: PrismaClient; export default _default; - - -//// [DtsFileErrors] - - -/index.d.ts(2,45): error TS2307: Cannot find module '.prisma' or its corresponding type declarations. - - -==== /node_modules/.prisma/client/index.d.ts (0 errors) ==== - export interface PrismaClientOptions { - rejectOnNotFound?: any; - } - - export class PrismaClient { - private fetcher; - } - -==== /node_modules/@prisma/client/index.d.ts (0 errors) ==== - export * from ".prisma/client"; - -==== /index.d.ts (1 errors) ==== - import { PrismaClient } from "@prisma/client"; - declare const _default: PrismaClient; - ~~~~~~~~~ -!!! error TS2307: Cannot find module '.prisma' or its corresponding type declarations. - export default _default; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeModuleReexportFromDottedPath.js.diff b/testdata/baselines/reference/submodule/compiler/nodeModuleReexportFromDottedPath.js.diff index ce61505671..24451f8b04 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeModuleReexportFromDottedPath.js.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeModuleReexportFromDottedPath.js.diff @@ -8,37 +8,3 @@ +const client_1 = require("@prisma/client"); const EnhancedPrisma = enhancePrisma(client_1.PrismaClient); exports.default = new EnhancedPrisma(); - - - //// [index.d.ts] - import { PrismaClient } from "@prisma/client"; --declare const _default: PrismaClient; -+declare const _default: PrismaClient; - export default _default; -+ -+ -+//// [DtsFileErrors] -+ -+ -+/index.d.ts(2,45): error TS2307: Cannot find module '.prisma' or its corresponding type declarations. -+ -+ -+==== /node_modules/.prisma/client/index.d.ts (0 errors) ==== -+ export interface PrismaClientOptions { -+ rejectOnNotFound?: any; -+ } -+ -+ export class PrismaClient { -+ private fetcher; -+ } -+ -+==== /node_modules/@prisma/client/index.d.ts (0 errors) ==== -+ export * from ".prisma/client"; -+ -+==== /index.d.ts (1 errors) ==== -+ import { PrismaClient } from "@prisma/client"; -+ declare const _default: PrismaClient; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module '.prisma' or its corresponding type declarations. -+ export default _default; -+ \ No newline at end of file From fc800a76b9ae1b92ef0f91b6475e42d2b73577da Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:57:58 -0700 Subject: [PATCH 019/152] Fix JSX indentation in JavaScript output (#1792) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- internal/printer/printer.go | 7 +- internal/transformers/jsxtransforms/jsx.go | 23 +++++-- .../compiler/jsxNestedIndentation.js | 20 ++++++ .../compiler/jsxNestedIndentation.symbols | 31 +++++++++ .../compiler/jsxNestedIndentation.types | 34 ++++++++++ .../compiler/jsxUnicodeEscapeSequence.js | 4 +- .../compiler/errorSpanForUnclosedJsxTag.js | 4 +- .../errorSpanForUnclosedJsxTag.js.diff | 10 --- .../compiler/excessiveStackDepthFlatArray.js | 6 +- .../excessiveStackDepthFlatArray.js.diff | 13 ---- .../jsxAttributeWithoutExpressionReact.js | 3 +- ...jsxAttributeWithoutExpressionReact.js.diff | 9 --- .../submodule/compiler/jsxChildWrongType.js | 4 +- .../compiler/jsxChildWrongType.js.diff | 5 +- .../compiler/jsxChildrenArrayWrongType.js | 4 +- .../jsxChildrenArrayWrongType.js.diff | 5 +- .../jsxChildrenIndividualErrorElaborations.js | 12 +++- ...hildrenIndividualErrorElaborations.js.diff | 32 +-------- .../compiler/jsxChildrenWrongType.js | 4 +- .../compiler/jsxChildrenWrongType.js.diff | 5 +- ...yExpressionNotCountedAsChild(jsx=react).js | 3 +- ...essionNotCountedAsChild(jsx=react).js.diff | 5 +- .../jsxFactoryAndJsxFragmentFactory.js | 6 +- .../jsxFactoryAndJsxFragmentFactory.js.diff | 12 ---- ...AndJsxFragmentFactoryErrorNotIdentifier.js | 6 +- ...xFragmentFactoryErrorNotIdentifier.js.diff | 12 ---- .../jsxFactoryAndJsxFragmentFactoryNull.js | 6 +- ...sxFactoryAndJsxFragmentFactoryNull.js.diff | 12 ---- .../jsxFactoryButNoJsxFragmentFactory.js | 6 +- .../jsxFactoryButNoJsxFragmentFactory.js.diff | 12 ---- .../jsxFragmentFactoryNoUnusedLocals.js | 4 +- .../jsxFragmentFactoryNoUnusedLocals.js.diff | 6 +- .../compiler/jsxRuntimePragma(jsx=react).js | 6 +- .../jsxRuntimePragma(jsx=react).js.diff | 16 ++--- .../jsxRuntimePragma(jsx=react-jsx).js | 6 +- .../jsxRuntimePragma(jsx=react-jsx).js.diff | 16 ++--- .../jsxRuntimePragma(jsx=react-jsxdev).js | 6 +- ...jsxRuntimePragma(jsx=react-jsxdev).js.diff | 16 ++--- .../compiler/tsxFragmentChildrenCheck.js | 5 +- .../compiler/tsxFragmentChildrenCheck.js.diff | 11 +-- .../checkJsxChildrenCanBeTupleType.js | 9 ++- .../checkJsxChildrenCanBeTupleType.js.diff | 10 +-- .../correctlyMarkAliasAsReferences1.js | 3 +- .../correctlyMarkAliasAsReferences1.js.diff | 9 --- .../correctlyMarkAliasAsReferences2.js | 3 +- .../correctlyMarkAliasAsReferences2.js.diff | 9 --- .../correctlyMarkAliasAsReferences3.js | 3 +- .../correctlyMarkAliasAsReferences3.js.diff | 9 --- .../conformance/inlineJsxAndJsxFragPragma.js | 6 +- .../inlineJsxAndJsxFragPragma.js.diff | 16 ++--- ...ndJsxFragPragmaOverridesCompilerOptions.js | 12 ++-- ...FragPragmaOverridesCompilerOptions.js.diff | 30 +++----- .../inlineJsxFactoryDeclarationsLocalTypes.js | 44 ++++++++++-- ...neJsxFactoryDeclarationsLocalTypes.js.diff | 68 ++++--------------- .../inlineJsxFactoryWithFragmentIsError.js | 6 +- ...nlineJsxFactoryWithFragmentIsError.js.diff | 10 ++- .../jsxAttributeInitializer(jsx=react).js | 7 +- ...jsxAttributeInitializer(jsx=react).js.diff | 13 ---- ...CjsTransformCustomImport(jsx=react-jsx).js | 6 +- ...ansformCustomImport(jsx=react-jsx).js.diff | 6 +- ...TransformCustomImport(jsx=react-jsxdev).js | 6 +- ...formCustomImport(jsx=react-jsxdev).js.diff | 6 +- ...nsformCustomImportPragma(jsx=react-jsx).js | 12 +++- ...mCustomImportPragma(jsx=react-jsx).js.diff | 12 +++- ...ormCustomImportPragma(jsx=react-jsxdev).js | 12 +++- ...stomImportPragma(jsx=react-jsxdev).js.diff | 12 +++- ...rmNestedSelfClosingChild(jsx=react-jsx).js | 4 +- ...tedSelfClosingChild(jsx=react-jsx).js.diff | 4 +- ...estedSelfClosingChild(jsx=react-jsxdev).js | 4 +- ...SelfClosingChild(jsx=react-jsxdev).js.diff | 4 +- ...SubstitutesNamesFragment(jsx=react-jsx).js | 6 +- ...itutesNamesFragment(jsx=react-jsx).js.diff | 6 +- ...stitutesNamesFragment(jsx=react-jsxdev).js | 6 +- ...tesNamesFragment(jsx=react-jsxdev).js.diff | 6 +- .../submodule/conformance/multiline.js | 9 ++- .../submodule/conformance/multiline.js.diff | 11 +-- .../conformance/tsxFragmentReactEmit.js | 11 ++- .../conformance/tsxFragmentReactEmit.js.diff | 18 ----- .../submodule/conformance/tsxReactEmit1.js | 5 +- .../conformance/tsxReactEmit1.js.diff | 12 +--- .../submodule/conformance/tsxReactEmit3.js | 9 ++- .../conformance/tsxReactEmit3.js.diff | 15 ---- .../conformance/tsxReactEmitNesting.js | 18 ++++- .../conformance/tsxReactEmitNesting.js.diff | 24 ------- .../conformance/tsxReactEmitWhitespace.js | 5 +- .../tsxReactEmitWhitespace.js.diff | 14 ---- .../conformance/tsxReactEmitWhitespace2.js | 13 +++- .../tsxReactEmitWhitespace2.js.diff | 21 ------ .../incremental/serializing-error-chain.js | 4 +- .../cases/compiler/jsxNestedIndentation.js | 9 +++ .../cases/compiler/jsxNestedIndentation.tsx | 14 ++++ 91 files changed, 479 insertions(+), 519 deletions(-) create mode 100644 testdata/baselines/reference/compiler/jsxNestedIndentation.js create mode 100644 testdata/baselines/reference/compiler/jsxNestedIndentation.symbols create mode 100644 testdata/baselines/reference/compiler/jsxNestedIndentation.types delete mode 100644 testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsxAttributeInitializer(jsx=react).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxFragmentReactEmit.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxReactEmit3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxReactEmitNesting.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxReactEmitWhitespace.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxReactEmitWhitespace2.js.diff create mode 100644 testdata/tests/cases/compiler/jsxNestedIndentation.js create mode 100644 testdata/tests/cases/compiler/jsxNestedIndentation.tsx diff --git a/internal/printer/printer.go b/internal/printer/printer.go index 6a1c10b6d8..21ca046e61 100644 --- a/internal/printer/printer.go +++ b/internal/printer/printer.go @@ -783,10 +783,9 @@ func (p *Printer) shouldEmitBlockFunctionBodyOnSingleLine(body *ast.Block) bool } func (p *Printer) shouldEmitOnNewLine(node *ast.Node, format ListFormat) bool { - // !!! TODO: enable multiline emit - // if p.emitContext.EmitFlags(node)&EFStartOnNewLine != 0 { - // return true - // } + if p.emitContext.EmitFlags(node)&EFStartOnNewLine != 0 { + return true + } return format&LFPreferNewLine != 0 } diff --git a/internal/transformers/jsxtransforms/jsx.go b/internal/transformers/jsxtransforms/jsx.go index 3372a23339..2f6915e3ea 100644 --- a/internal/transformers/jsxtransforms/jsx.go +++ b/internal/transformers/jsxtransforms/jsx.go @@ -319,8 +319,9 @@ func (tx *JSXTransformer) convertJsxChildrenToChildrenPropObject(children []*ast } func (tx *JSXTransformer) transformJsxChildToExpression(node *ast.Node) *ast.Node { + prev := tx.inJsxChild tx.setInChild(true) - defer tx.setInChild(false) + defer tx.setInChild(prev) return tx.Visitor().Visit(node) } @@ -688,14 +689,18 @@ func (tx *JSXTransformer) visitJsxOpeningLikeElementCreateElement(element *ast.N for _, c := range children.Nodes { res := tx.transformJsxChildToExpression(c) if res != nil { - if len(children.Nodes) > 1 { - tx.EmitContext().AddEmitFlags(res, printer.EFStartOnNewLine) - } newChildren = append(newChildren, res) } } } + // Add StartOnNewLine flag only if there are multiple actual children (after filtering) + if len(newChildren) > 1 { + for _, child := range newChildren { + tx.EmitContext().AddEmitFlags(child, printer.EFStartOnNewLine) + } + } + args := make([]*ast.Expression, 0, len(newChildren)+2) args = append(args, tagName) args = append(args, objectProperties) @@ -725,14 +730,18 @@ func (tx *JSXTransformer) visitJsxOpeningFragmentCreateElement(fragment *ast.Jsx for _, c := range children.Nodes { res := tx.transformJsxChildToExpression(c) if res != nil { - if len(children.Nodes) > 1 { - tx.EmitContext().AddEmitFlags(res, printer.EFStartOnNewLine) - } newChildren = append(newChildren, res) } } } + // Add StartOnNewLine flag only if there are multiple actual children (after filtering) + if len(newChildren) > 1 { + for _, child := range newChildren { + tx.EmitContext().AddEmitFlags(child, printer.EFStartOnNewLine) + } + } + args := make([]*ast.Expression, 0, len(newChildren)+2) args = append(args, tagName) args = append(args, tx.Factory().NewKeywordExpression(ast.KindNullKeyword)) diff --git a/testdata/baselines/reference/compiler/jsxNestedIndentation.js b/testdata/baselines/reference/compiler/jsxNestedIndentation.js new file mode 100644 index 0000000000..24315ed9a2 --- /dev/null +++ b/testdata/baselines/reference/compiler/jsxNestedIndentation.js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/jsxNestedIndentation.tsx] //// + +//// [jsxNestedIndentation.tsx] +declare var React: any; +declare function Child(props: { children?: any }): any; +function Test() { + return + + + + +} + + +//// [jsxNestedIndentation.js] +function Test() { + return React.createElement(Child, null, + React.createElement(Child, null, + React.createElement(Child, null))); +} diff --git a/testdata/baselines/reference/compiler/jsxNestedIndentation.symbols b/testdata/baselines/reference/compiler/jsxNestedIndentation.symbols new file mode 100644 index 0000000000..630e254a6c --- /dev/null +++ b/testdata/baselines/reference/compiler/jsxNestedIndentation.symbols @@ -0,0 +1,31 @@ +//// [tests/cases/compiler/jsxNestedIndentation.tsx] //// + +=== jsxNestedIndentation.tsx === +declare var React: any; +>React : Symbol(React, Decl(jsxNestedIndentation.tsx, 0, 11)) + +declare function Child(props: { children?: any }): any; +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) +>props : Symbol(props, Decl(jsxNestedIndentation.tsx, 1, 23)) +>children : Symbol(children, Decl(jsxNestedIndentation.tsx, 1, 31)) + +function Test() { +>Test : Symbol(Test, Decl(jsxNestedIndentation.tsx, 1, 55)) + + return +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) + + +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) + + +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) + + +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) + + +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) +} + diff --git a/testdata/baselines/reference/compiler/jsxNestedIndentation.types b/testdata/baselines/reference/compiler/jsxNestedIndentation.types new file mode 100644 index 0000000000..f910202c49 --- /dev/null +++ b/testdata/baselines/reference/compiler/jsxNestedIndentation.types @@ -0,0 +1,34 @@ +//// [tests/cases/compiler/jsxNestedIndentation.tsx] //// + +=== jsxNestedIndentation.tsx === +declare var React: any; +>React : any + +declare function Child(props: { children?: any }): any; +>Child : (props: { children?: any; }) => any +>props : { children?: any; } +>children : any + +function Test() { +>Test : () => any + + return +> : any +>Child : (props: { children?: any; }) => any + + +> : any +>Child : (props: { children?: any; }) => any + + +> : any +>Child : (props: { children?: any; }) => any +>Child : (props: { children?: any; }) => any + + +>Child : (props: { children?: any; }) => any + + +>Child : (props: { children?: any; }) => any +} + diff --git a/testdata/baselines/reference/compiler/jsxUnicodeEscapeSequence.js b/testdata/baselines/reference/compiler/jsxUnicodeEscapeSequence.js index a179ad9931..107acc3fb6 100644 --- a/testdata/baselines/reference/compiler/jsxUnicodeEscapeSequence.js +++ b/testdata/baselines/reference/compiler/jsxUnicodeEscapeSequence.js @@ -34,7 +34,9 @@ export const InlineUnicodeChar = () => { }; export const StandaloneUnicodeChar = () => { // This should reproduce the issue - unicode character on its own line - return (_jsxs("div", { children: [_jsx("span", { children: "\u26A0" }), "\u26A0"] })); + return (_jsxs("div", { children: [ + _jsx("span", { children: "\u26A0" }), + "\u26A0"] })); }; export const MultipleUnicodeChars = () => { // Test multiple unicode characters diff --git a/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js b/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js index 63ec409b0b..81595327fa 100644 --- a/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js +++ b/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js @@ -18,4 +18,6 @@ let Foo = { Bar() { } }; let Baz = () => { }; -let x = React.createElement(Foo.Bar, null, "Hello let y = ", React.createElement(Baz, null, "Hello")); +let x = React.createElement(Foo.Bar, null, + "Hello let y = ", + React.createElement(Baz, null, "Hello")); diff --git a/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js.diff b/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js.diff deleted file mode 100644 index d071260647..0000000000 --- a/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.errorSpanForUnclosedJsxTag.js -+++ new.errorSpanForUnclosedJsxTag.js -@@= skipped -17, +17 lines =@@ - Bar() { } - }; - let Baz = () => { }; --let x = React.createElement(Foo.Bar, null, -- "Hello let y = ", -- React.createElement(Baz, null, "Hello")); -+let x = React.createElement(Foo.Bar, null, "Hello let y = ", React.createElement(Baz, null, "Hello")); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js b/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js index b6e2180083..13fd6616f4 100644 --- a/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js +++ b/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js @@ -48,6 +48,8 @@ configureStore({ }); const Component = () => { const categories = ['Fruit', 'Vegetables']; - return (React.createElement("ul", null, React.createElement("li", null, "All"), categories.map((category) => (React.createElement("li", { key: category }, category) // Error about 'key' only - )))); + return (React.createElement("ul", null, + React.createElement("li", null, "All"), + categories.map((category) => (React.createElement("li", { key: category }, category) // Error about 'key' only + )))); }; diff --git a/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js.diff b/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js.diff deleted file mode 100644 index 0fd96a87b2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.excessiveStackDepthFlatArray.js -+++ new.excessiveStackDepthFlatArray.js -@@= skipped -47, +47 lines =@@ - }); - const Component = () => { - const categories = ['Fruit', 'Vegetables']; -- return (React.createElement("ul", null, -- React.createElement("li", null, "All"), -- categories.map((category) => (React.createElement("li", { key: category }, category) // Error about 'key' only -- )))); -+ return (React.createElement("ul", null, React.createElement("li", null, "All"), categories.map((category) => (React.createElement("li", { key: category }, category) // Error about 'key' only -+ )))); - }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js b/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js index 7444e18d4a..c537ca89a1 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js +++ b/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js @@ -11,4 +11,5 @@ declare var React: any; //// [jsxAttributeWithoutExpressionReact.js] -React.createElement(View, null, React.createElement(ListView, { refreshControl: React.createElement(RefreshControl, { onRefresh: true, refreshing: true }), dataSource: this.state.ds, renderRow: true })); +React.createElement(View, null, + React.createElement(ListView, { refreshControl: React.createElement(RefreshControl, { onRefresh: true, refreshing: true }), dataSource: this.state.ds, renderRow: true })); diff --git a/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js.diff b/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js.diff deleted file mode 100644 index d422561af4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.jsxAttributeWithoutExpressionReact.js -+++ new.jsxAttributeWithoutExpressionReact.js -@@= skipped -10, +10 lines =@@ - - - //// [jsxAttributeWithoutExpressionReact.js] --React.createElement(View, null, -- React.createElement(ListView, { refreshControl: React.createElement(RefreshControl, { onRefresh: true, refreshing: true }), dataSource: this.state.ds, renderRow: true })); -+React.createElement(View, null, React.createElement(ListView, { refreshControl: React.createElement(RefreshControl, { onRefresh: true, refreshing: true }), dataSource: this.state.ds, renderRow: true })); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js b/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js index e98f1efae1..d434ef7198 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js +++ b/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js @@ -15,4 +15,6 @@ const a = ( //// [index.js] /// /// -const a = (React.createElement("main", null, (React.createElement("div", null)), React.createElement("span", null))); +const a = (React.createElement("main", null, + (React.createElement("div", null)), + React.createElement("span", null))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js.diff b/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js.diff index 60fa1c536d..df3d91292e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js.diff @@ -7,7 +7,4 @@ -"use strict"; /// /// --const a = (React.createElement("main", null, -- (React.createElement("div", null)), -- React.createElement("span", null))); -+const a = (React.createElement("main", null, (React.createElement("div", null)), React.createElement("span", null))); \ No newline at end of file + const a = (React.createElement("main", null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js b/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js index 3c3753387f..a01e4ceeae 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js @@ -20,4 +20,6 @@ const b = ( //// [index.js] /// /// -const b = (React.createElement(Foo, null, React.createElement("div", null), "aa")); +const b = (React.createElement(Foo, null, + React.createElement("div", null), + "aa")); diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js.diff b/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js.diff index 0f17e08fc4..d2845cf221 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js.diff @@ -7,7 +7,4 @@ -"use strict"; /// /// --const b = (React.createElement(Foo, null, -- React.createElement("div", null), -- "aa")); -+const b = (React.createElement(Foo, null, React.createElement("div", null), "aa")); \ No newline at end of file + const b = (React.createElement(Foo, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js b/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js index 0570331206..9d0abff513 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js @@ -94,7 +94,9 @@ var a = React.createElement(Blah, null, x => x); // Blah components don't accept text as child elements var a = React.createElement(Blah, null, "Hello unexpected text!"); // Blah components don't accept multiple children. -var a = React.createElement(Blah, null, x => "" + x, x => "" + x); +var a = React.createElement(Blah, null, + x => "" + x, + x => "" + x); function Blah2(props) { return React.createElement(React.Fragment, null); } @@ -103,7 +105,9 @@ var a = React.createElement(Blah2, null, x => x); // Blah2 components don't accept text as child elements var a = React.createElement(Blah2, null, "Hello unexpected text!"); // Blah2 components don't accept multiple children of the wrong type. -var a = React.createElement(Blah2, null, x => x, x => x); +var a = React.createElement(Blah2, null, + x => x, + x => x); function Blah3(props) { return React.createElement(React.Fragment, null); } @@ -112,4 +116,6 @@ var a = React.createElement(Blah3, null, x => x); // Blah3 components don't accept text as child elements var a = React.createElement(Blah3, null, "Hello unexpected text!"); // Blah3 components don't accept multiple children of the wrong type. -var a = React.createElement(Blah3, null, x => x, x => x); +var a = React.createElement(Blah3, null, + x => x, + x => x); diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff b/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff index 9240c8544f..cb4108a499 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff @@ -8,34 +8,4 @@ +const React = require("react"); function Blah(props) { return React.createElement(React.Fragment, null); - } -@@= skipped -9, +9 lines =@@ - // Blah components don't accept text as child elements - var a = React.createElement(Blah, null, "Hello unexpected text!"); - // Blah components don't accept multiple children. --var a = React.createElement(Blah, null, -- x => "" + x, -- x => "" + x); -+var a = React.createElement(Blah, null, x => "" + x, x => "" + x); - function Blah2(props) { - return React.createElement(React.Fragment, null); - } -@@= skipped -11, +9 lines =@@ - // Blah2 components don't accept text as child elements - var a = React.createElement(Blah2, null, "Hello unexpected text!"); - // Blah2 components don't accept multiple children of the wrong type. --var a = React.createElement(Blah2, null, -- x => x, -- x => x); -+var a = React.createElement(Blah2, null, x => x, x => x); - function Blah3(props) { - return React.createElement(React.Fragment, null); - } -@@= skipped -11, +9 lines =@@ - // Blah3 components don't accept text as child elements - var a = React.createElement(Blah3, null, "Hello unexpected text!"); - // Blah3 components don't accept multiple children of the wrong type. --var a = React.createElement(Blah3, null, -- x => x, -- x => x); -+var a = React.createElement(Blah3, null, x => x, x => x); \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js b/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js index a4dc7e7d0d..4ae637d1c4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js @@ -19,4 +19,6 @@ const b = ( //// [other.js] /// /// -const b = (React.createElement(Foo, null, React.createElement("div", null), "aa")); +const b = (React.createElement(Foo, null, + React.createElement("div", null), + "aa")); diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js.diff b/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js.diff index a6b8208467..130688bec5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js.diff @@ -7,7 +7,4 @@ -"use strict"; /// /// --const b = (React.createElement(Foo, null, -- React.createElement("div", null), -- "aa")); -+const b = (React.createElement(Foo, null, React.createElement("div", null), "aa")); \ No newline at end of file + const b = (React.createElement(Foo, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js index 9961ba8b5a..6272ca29c6 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js +++ b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js @@ -27,4 +27,5 @@ const React = require("react"); function Wrapper(props) { return React.createElement("div", null, props.children); } -const element = (React.createElement(Wrapper, null, React.createElement("div", null, "Hello"))); +const element = (React.createElement(Wrapper, null, + React.createElement("div", null, "Hello"))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff index e75b72d689..f92e43abf4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff @@ -8,7 +8,4 @@ +const React = require("react"); function Wrapper(props) { return React.createElement("div", null, props.children); - } --const element = (React.createElement(Wrapper, null, -- React.createElement("div", null, "Hello"))); -+const element = (React.createElement(Wrapper, null, React.createElement("div", null, "Hello"))); \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js index faba591900..18800eb73b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js +++ b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js @@ -9,4 +9,8 @@ declare var Frag: any; //// [jsxFactoryAndJsxFragmentFactory.js] h(Frag, null); -h(Frag, null, h("span", null, "1"), h(Frag, null, h("span", null, "2.1"), h("span", null, "2.2"))); +h(Frag, null, + h("span", null, "1"), + h(Frag, null, + h("span", null, "2.1"), + h("span", null, "2.2"))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js.diff deleted file mode 100644 index 7b47493d91..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.jsxFactoryAndJsxFragmentFactory.js -+++ new.jsxFactoryAndJsxFragmentFactory.js -@@= skipped -8, +8 lines =@@ - - //// [jsxFactoryAndJsxFragmentFactory.js] - h(Frag, null); --h(Frag, null, -- h("span", null, "1"), -- h(Frag, null, -- h("span", null, "2.1"), -- h("span", null, "2.2"))); -+h(Frag, null, h("span", null, "1"), h(Frag, null, h("span", null, "2.1"), h("span", null, "2.2"))); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js index a724406b71..b6882ec8ec 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js +++ b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js @@ -8,4 +8,8 @@ declare var h: any; //// [jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js] h(React.Fragment, null); -h(React.Fragment, null, h("span", null, "1"), h(React.Fragment, null, h("span", null, "2.1"), h("span", null, "2.2"))); +h(React.Fragment, null, + h("span", null, "1"), + h(React.Fragment, null, + h("span", null, "2.1"), + h("span", null, "2.2"))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js.diff deleted file mode 100644 index 77b56ccfe3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js -+++ new.jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js -@@= skipped -7, +7 lines =@@ - - //// [jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js] - h(React.Fragment, null); --h(React.Fragment, null, -- h("span", null, "1"), -- h(React.Fragment, null, -- h("span", null, "2.1"), -- h("span", null, "2.2"))); -+h(React.Fragment, null, h("span", null, "1"), h(React.Fragment, null, h("span", null, "2.1"), h("span", null, "2.2"))); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js index a9d22fd0db..83b4e2ee67 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js +++ b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js @@ -8,4 +8,8 @@ declare var h: any; //// [jsxFactoryAndJsxFragmentFactoryNull.js] h(null, null); -h(null, null, h("span", null, "1"), h(null, null, h("span", null, "2.1"), h("span", null, "2.2"))); +h(null, null, + h("span", null, "1"), + h(null, null, + h("span", null, "2.1"), + h("span", null, "2.2"))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js.diff deleted file mode 100644 index 4069a9e30f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.jsxFactoryAndJsxFragmentFactoryNull.js -+++ new.jsxFactoryAndJsxFragmentFactoryNull.js -@@= skipped -7, +7 lines =@@ - - //// [jsxFactoryAndJsxFragmentFactoryNull.js] - h(null, null); --h(null, null, -- h("span", null, "1"), -- h(null, null, -- h("span", null, "2.1"), -- h("span", null, "2.2"))); -+h(null, null, h("span", null, "1"), h(null, null, h("span", null, "2.1"), h("span", null, "2.2"))); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js b/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js index de9f387250..a62a05ca0b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js +++ b/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js @@ -8,4 +8,8 @@ declare var h: any; //// [jsxFactoryButNoJsxFragmentFactory.js] h(React.Fragment, null); -h(React.Fragment, null, h("span", null, "1"), h(React.Fragment, null, h("span", null, "2.1"), h("span", null, "2.2"))); +h(React.Fragment, null, + h("span", null, "1"), + h(React.Fragment, null, + h("span", null, "2.1"), + h("span", null, "2.2"))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js.diff deleted file mode 100644 index 4456fecc25..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.jsxFactoryButNoJsxFragmentFactory.js -+++ new.jsxFactoryButNoJsxFragmentFactory.js -@@= skipped -7, +7 lines =@@ - - //// [jsxFactoryButNoJsxFragmentFactory.js] - h(React.Fragment, null); --h(React.Fragment, null, -- h("span", null, "1"), -- h(React.Fragment, null, -- h("span", null, "2.1"), -- h("span", null, "2.2"))); -+h(React.Fragment, null, h("span", null, "1"), h(React.Fragment, null, h("span", null, "2.1"), h("span", null, "2.2"))); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js b/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js index 72870d3a61..56a90bc5f3 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js +++ b/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js @@ -24,5 +24,7 @@ exports.Counter = Counter; const react_1 = require("react"); function Counter({ count = 0 }) { const [cnt, setCnt] = null; - return (0, react_1.createElement)(react_1.Fragment, null, (0, react_1.createElement)("p", null, cnt), (0, react_1.createElement)("button", { onClick: () => setCnt((prev) => prev + 1), type: "button" }, "Update")); + return (0, react_1.createElement)(react_1.Fragment, null, + (0, react_1.createElement)("p", null, cnt), + (0, react_1.createElement)("button", { onClick: () => setCnt((prev) => prev + 1), type: "button" }, "Update")); } diff --git a/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff index c831aea953..48fafba0da 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff @@ -8,8 +8,4 @@ +const react_1 = require("react"); function Counter({ count = 0 }) { const [cnt, setCnt] = null; -- return (0, react_1.createElement)(react_1.Fragment, null, -- (0, react_1.createElement)("p", null, cnt), -- (0, react_1.createElement)("button", { onClick: () => setCnt((prev) => prev + 1), type: "button" }, "Update")); -+ return (0, react_1.createElement)(react_1.Fragment, null, (0, react_1.createElement)("p", null, cnt), (0, react_1.createElement)("button", { onClick: () => setCnt((prev) => prev + 1), type: "button" }, "Update")); - } \ No newline at end of file + return (0, react_1.createElement)(react_1.Fragment, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js index 314be06f5a..4caa67cbbc 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js @@ -43,7 +43,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [two.js] "use strict"; @@ -78,7 +79,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js.diff b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js.diff index 856c8d095f..69d7992f5e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js.diff @@ -8,11 +8,8 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [two.js] + exports.frag = React.createElement(React.Fragment, null, +@@= skipped -10, +10 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.selfClosing = exports.frag = exports.HelloWorld = void 0; @@ -46,7 +43,7 @@ //// [four.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -36, +35 lines =@@ +@@= skipped -26, +26 lines =@@ /// /* @jsxRuntime automatic */ /* @jsxRuntime classic */ @@ -54,9 +51,4 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [index.js] - "use strict"; \ No newline at end of file + exports.frag = React.createElement(React.Fragment, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js index 314be06f5a..4caa67cbbc 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js @@ -43,7 +43,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [two.js] "use strict"; @@ -78,7 +79,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js.diff b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js.diff index 613dd4f759..d267f42d42 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js.diff @@ -8,11 +8,8 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [two.js] + exports.frag = React.createElement(React.Fragment, null, +@@= skipped -10, +10 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.selfClosing = exports.frag = exports.HelloWorld = void 0; @@ -46,7 +43,7 @@ //// [four.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -36, +35 lines =@@ +@@= skipped -26, +26 lines =@@ /// /* @jsxRuntime automatic */ /* @jsxRuntime classic */ @@ -54,9 +51,4 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [index.js] - "use strict"; \ No newline at end of file + exports.frag = React.createElement(React.Fragment, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js index a0409f1a58..a7b5fb849c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js @@ -43,7 +43,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [two.js] "use strict"; @@ -78,7 +79,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js.diff b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js.diff index 5f21695144..20bf9be5a4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js.diff @@ -8,11 +8,8 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [two.js] + exports.frag = React.createElement(React.Fragment, null, +@@= skipped -10, +10 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.selfClosing = exports.frag = exports.HelloWorld = void 0; @@ -48,7 +45,7 @@ //// [four.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -38, +35 lines =@@ +@@= skipped -28, +26 lines =@@ /// /* @jsxRuntime automatic */ /* @jsxRuntime classic */ @@ -56,9 +53,4 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [index.js] - "use strict"; \ No newline at end of file + exports.frag = React.createElement(React.Fragment, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js b/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js index 5eacef6509..f4c4b661aa 100644 --- a/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js +++ b/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js @@ -44,7 +44,10 @@ const MY_STRING = 'Ceci n\'est pas une string.'; const MY_CLASSNAME = 'jeclass'; class RenderString extends React.PureComponent { render() { - return (React.createElement(React.Fragment, null, React.createElement(my_component_1.MyComponent, null), React.createElement("span", null, MY_STRING), React.createElement("span", { className: MY_CLASSNAME }))); + return (React.createElement(React.Fragment, null, + React.createElement(my_component_1.MyComponent, null), + React.createElement("span", null, MY_STRING), + React.createElement("span", { className: MY_CLASSNAME }))); } } exports.default = RenderString; diff --git a/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js.diff b/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js.diff index faf9661d65..ee5d7d029c 100644 --- a/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js.diff +++ b/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js.diff @@ -10,13 +10,4 @@ +const my_component_1 = require("./my-component"); const MY_STRING = 'Ceci n\'est pas une string.'; const MY_CLASSNAME = 'jeclass'; - class RenderString extends React.PureComponent { - render() { -- return (React.createElement(React.Fragment, null, -- React.createElement(my_component_1.MyComponent, null), -- React.createElement("span", null, MY_STRING), -- React.createElement("span", { className: MY_CLASSNAME }))); -+ return (React.createElement(React.Fragment, null, React.createElement(my_component_1.MyComponent, null), React.createElement("span", null, MY_STRING), React.createElement("span", { className: MY_CLASSNAME }))); - } - } - exports.default = RenderString; \ No newline at end of file + class RenderString extends React.PureComponent { \ 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 be699a9cb6..71b865abce 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js +++ b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js @@ -33,5 +33,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const react_1 = __importDefault(require("react")); class ResizablePanel extends react_1.default.Component { } -const test = react_1.default.createElement(ResizablePanel, null, react_1.default.createElement("div", null), react_1.default.createElement("div", null)); -const testErr = react_1.default.createElement(ResizablePanel, null, react_1.default.createElement("div", null), react_1.default.createElement("div", null), react_1.default.createElement("div", null)); +const test = react_1.default.createElement(ResizablePanel, null, + react_1.default.createElement("div", null), + react_1.default.createElement("div", null)); +const testErr = react_1.default.createElement(ResizablePanel, null, + react_1.default.createElement("div", null), + react_1.default.createElement("div", null), + react_1.default.createElement("div", null)); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff index f7faf5c777..50f0de8e3c 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff @@ -14,12 +14,4 @@ +const react_1 = __importDefault(require("react")); class ResizablePanel extends react_1.default.Component { } --const test = react_1.default.createElement(ResizablePanel, null, -- react_1.default.createElement("div", null), -- react_1.default.createElement("div", null)); --const testErr = react_1.default.createElement(ResizablePanel, null, -- react_1.default.createElement("div", null), -- react_1.default.createElement("div", null), -- react_1.default.createElement("div", null)); -+const test = react_1.default.createElement(ResizablePanel, null, react_1.default.createElement("div", null), react_1.default.createElement("div", null)); -+const testErr = react_1.default.createElement(ResizablePanel, null, react_1.default.createElement("div", null), react_1.default.createElement("div", null), react_1.default.createElement("div", null)); \ No newline at end of file + const test = react_1.default.createElement(ResizablePanel, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences1.js b/testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences1.js index c75b9dfe77..7816881f4a 100644 --- a/testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences1.js +++ b/testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences1.js @@ -19,4 +19,5 @@ let k = ; @@ -43,9 +76,42 @@ class Button extends React.Component { exports.Button = Button; //// [app.jsx] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.App = void 0; -const React = require("react"); +const React = __importStar(require("react")); // Should see var button_1 = require('./button') here const button_1 = require("./button"); class App extends React.Component { diff --git a/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit1.js.diff b/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit1.js.diff index 456a125e00..1b7535e354 100644 --- a/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit1.js.diff @@ -1,20 +1,20 @@ --- old.tsxExternalModuleEmit1.js +++ new.tsxExternalModuleEmit1.js -@@= skipped -33, +33 lines =@@ - "use strict"; +@@= skipped -66, +66 lines =@@ + })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Button = void 0; --var React = require("react"); -+const React = require("react"); +-var React = __importStar(require("react")); ++const React = __importStar(require("react")); class Button extends React.Component { render() { return ; -@@= skipped -11, +11 lines =@@ - "use strict"; +@@= skipped -44, +44 lines =@@ + })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.App = void 0; --var React = require("react"); -+const React = require("react"); +-var React = __importStar(require("react")); ++const React = __importStar(require("react")); // Should see var button_1 = require('./button') here -var button_1 = require("./button"); +const button_1 = require("./button"); diff --git a/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit2.js b/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit2.js index 13b136d219..bf90371a66 100644 --- a/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit2.js +++ b/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit2.js @@ -29,8 +29,11 @@ var __assign = (this && this.__assign) || function () { }; return __assign.apply(this, arguments); }; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const mod_1 = require("mod"); +const mod_1 = __importDefault(require("mod")); // Should see mod_1['default'] in emit here React.createElement(Foo, { handler: mod_1.default }); // Should see mod_1['default'] in emit here diff --git a/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit2.js.diff b/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit2.js.diff index eaa8490d6b..e2caf49b28 100644 --- a/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit2.js.diff @@ -1,11 +1,11 @@ --- old.tsxExternalModuleEmit2.js +++ new.tsxExternalModuleEmit2.js -@@= skipped -29, +29 lines =@@ - return __assign.apply(this, arguments); +@@= skipped -32, +32 lines =@@ + return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); --var mod_1 = require("mod"); -+const mod_1 = require("mod"); +-var mod_1 = __importDefault(require("mod")); ++const mod_1 = __importDefault(require("mod")); // Should see mod_1['default'] in emit here React.createElement(Foo, { handler: mod_1.default }); // Should see mod_1['default'] in emit here \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.errors.txt b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.errors.txt new file mode 100644 index 0000000000..5826a14fcd --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.errors.txt @@ -0,0 +1,23 @@ +file.tsx(9,14): error TS2786: 'Foo' cannot be used as a JSX component. + Its return type 'undefined' is not a valid JSX element. +file.tsx(10,12): error TS2786: 'Greet' cannot be used as a JSX component. + Its return type 'undefined' is not a valid JSX element. + + +==== file.tsx (2 errors) ==== + import React = require('react'); + + const Foo = (props: any) => undefined; + function Greet(x: {name?: string}) { + return undefined; + } + + // Error + const foo = ; + ~~~ +!!! error TS2786: 'Foo' cannot be used as a JSX component. +!!! error TS2786: Its return type 'undefined' is not a valid JSX element. + const G = ; + ~~~~~ +!!! error TS2786: 'Greet' cannot be used as a JSX component. +!!! error TS2786: Its return type 'undefined' is not a valid JSX element. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.js b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.js new file mode 100644 index 0000000000..b8735dd73c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/jsx/tsxSfcReturnUndefinedStrictNullChecks.tsx] //// + +//// [file.tsx] +import React = require('react'); + +const Foo = (props: any) => undefined; +function Greet(x: {name?: string}) { + return undefined; +} + +// Error +const foo = ; +const G = ; + +//// [file.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const React = require("react"); +const Foo = (props) => undefined; +function Greet(x) { + return undefined; +} +// Error +const foo = ; +const G = ; diff --git a/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.js.diff b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.js.diff new file mode 100644 index 0000000000..07fe1bb435 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.js.diff @@ -0,0 +1,11 @@ +--- old.tsxSfcReturnUndefinedStrictNullChecks.js ++++ new.tsxSfcReturnUndefinedStrictNullChecks.js +@@= skipped -14, +14 lines =@@ + //// [file.jsx] + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); +-var React = require("react"); ++const React = require("react"); + const Foo = (props) => undefined; + function Greet(x) { + return undefined; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.symbols b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.symbols new file mode 100644 index 0000000000..91d7762217 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.symbols @@ -0,0 +1,29 @@ +//// [tests/cases/conformance/jsx/tsxSfcReturnUndefinedStrictNullChecks.tsx] //// + +=== file.tsx === +import React = require('react'); +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +const Foo = (props: any) => undefined; +>Foo : Symbol(Foo, Decl(file.tsx, 2, 5)) +>props : Symbol(props, Decl(file.tsx, 2, 13)) +>undefined : Symbol(undefined) + +function Greet(x: {name?: string}) { +>Greet : Symbol(Greet, Decl(file.tsx, 2, 38)) +>x : Symbol(x, Decl(file.tsx, 3, 15)) +>name : Symbol(name, Decl(file.tsx, 3, 19)) + + return undefined; +>undefined : Symbol(undefined) +} + +// Error +const foo = ; +>foo : Symbol(foo, Decl(file.tsx, 8, 5)) +>Foo : Symbol(Foo, Decl(file.tsx, 2, 5)) + +const G = ; +>G : Symbol(G, Decl(file.tsx, 9, 5)) +>Greet : Symbol(Greet, Decl(file.tsx, 2, 38)) + diff --git a/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.types b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.types new file mode 100644 index 0000000000..3e702b87b5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.types @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/jsx/tsxSfcReturnUndefinedStrictNullChecks.tsx] //// + +=== file.tsx === +import React = require('react'); +>React : typeof React + +const Foo = (props: any) => undefined; +>Foo : (props: any) => undefined +>(props: any) => undefined : (props: any) => undefined +>props : any +>undefined : undefined + +function Greet(x: {name?: string}) { +>Greet : (x: { name?: string | undefined; }) => undefined +>x : { name?: string | undefined; } +>name : string | undefined + + return undefined; +>undefined : undefined +} + +// Error +const foo = ; +>foo : JSX.Element +> : JSX.Element +>Foo : (props: any) => undefined + +const G = ; +>G : JSX.Element +> : JSX.Element +>Greet : (x: { name?: string | undefined; }) => undefined + diff --git a/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.types.diff b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.types.diff new file mode 100644 index 0000000000..f5111867c7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.types.diff @@ -0,0 +1,19 @@ +--- old.tsxSfcReturnUndefinedStrictNullChecks.types ++++ new.tsxSfcReturnUndefinedStrictNullChecks.types +@@= skipped -10, +10 lines =@@ + >undefined : undefined + + function Greet(x: {name?: string}) { +->Greet : (x: { name?: string; }) => undefined +->x : { name?: string; } ++>Greet : (x: { name?: string | undefined; }) => undefined ++>x : { name?: string | undefined; } + >name : string | undefined + + return undefined; +@@= skipped -17, +17 lines =@@ + const G = ; + >G : JSX.Element + > : JSX.Element +->Greet : (x: { name?: string; }) => undefined ++>Greet : (x: { name?: string | undefined; }) => undefined diff --git a/testdata/baselines/reference/submodule/conformance/tsxSpreadChildrenInvalidType(jsx=react-jsx,target=es2015).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/tsxSpreadChildrenInvalidType(jsx=react-jsx,target=es2015).errors.txt.diff deleted file mode 100644 index f48d3c13b3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/tsxSpreadChildrenInvalidType(jsx=react-jsx,target=es2015).errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.tsxSpreadChildrenInvalidType(jsx=react-jsx,target=es2015).errors.txt -+++ new.tsxSpreadChildrenInvalidType(jsx=react-jsx,target=es2015).errors.txt -@@= skipped -0, +0 lines =@@ --tsxSpreadChildrenInvalidType.tsx(17,12): error TS2792: Cannot find module 'react/jsx-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -+tsxSpreadChildrenInvalidType.tsx(17,12): error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - tsxSpreadChildrenInvalidType.tsx(21,9): error TS2609: JSX spread child must be an array type. - - -@@= skipped -20, +20 lines =@@ - function Todo(prop: { key: number, todo: string }) { - return
{prop.key.toString() + prop.todo}
; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2792: Cannot find module 'react/jsx-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -+!!! error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - } - function TodoList({ todos }: TodoListProps) { - return
\ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.errors.txt b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.errors.txt new file mode 100644 index 0000000000..81a5807ab3 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.errors.txt @@ -0,0 +1,144 @@ +file.tsx(12,22): error TS2769: No overload matches this call. + The last overload gave the following error. + Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. +file.tsx(13,13): error TS2769: No overload matches this call. + The last overload gave the following error. + Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'. +file.tsx(14,31): error TS2769: No overload matches this call. + The last overload gave the following error. + Type 'boolean' is not assignable to type 'string'. +file.tsx(16,31): error TS2769: No overload matches this call. + The last overload gave the following error. + Type '{ yy: number; yy1: string; y1: number; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. +file.tsx(17,13): error TS2769: No overload matches this call. + The last overload gave the following error. + Type '{ yy1: string; yy: boolean; }' is not assignable to type '{ yy: number; yy1: string; }'. + Types of property 'yy' are incompatible. + Type 'boolean' is not assignable to type 'number'. +file.tsx(25,13): error TS2769: No overload matches this call. + The last overload gave the following error. + Property 'yy' is missing in type '{ "extra-data": true; }' but required in type '{ yy: string; direction?: number; }'. +file.tsx(26,40): error TS2769: No overload matches this call. + The last overload gave the following error. + Type 'string' is not assignable to type 'number'. +file.tsx(33,32): error TS2769: No overload matches this call. + The last overload gave the following error. + Type 'string' is not assignable to type 'boolean'. +file.tsx(34,29): error TS2769: No overload matches this call. + The last overload gave the following error. + Type 'string' is not assignable to type 'boolean'. +file.tsx(35,29): error TS2769: No overload matches this call. + The last overload gave the following error. + Type 'string' is not assignable to type 'boolean'. +file.tsx(36,29): error TS2769: No overload matches this call. + The last overload gave the following error. + Type 'string' is not assignable to type 'boolean'. + + +==== file.tsx (11 errors) ==== + import React = require('react') + declare function OneThing(): JSX.Element; + declare function OneThing(l: {yy: number, yy1: string}): JSX.Element; + + let obj = { + yy: 10, + yy1: "hello" + } + let obj2: any; + + // Error + const c0 = ; // extra property; + ~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. +!!! error TS2769: Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. +!!! related TS2771 file.tsx:3:18: The last overload is declared here. + const c1 = ; // missing property; + ~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'. +!!! related TS2728 file.tsx:3:43: 'yy1' is declared here. +!!! related TS2771 file.tsx:3:18: The last overload is declared here. + const c2 = ; // type incompatible; + ~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. +!!! related TS6500 file.tsx:3:43: The expected type comes from property 'yy1' which is declared here on type 'IntrinsicAttributes & { yy: number; yy1: string; }' +!!! related TS2771 file.tsx:3:18: The last overload is declared here. + const c3 = ; // This is OK because all attribute are spread + const c4 = ; // extra property; + ~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type '{ yy: number; yy1: string; y1: number; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. +!!! error TS2769: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. +!!! related TS2771 file.tsx:3:18: The last overload is declared here. + const c5 = ; // type incompatible; + ~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type '{ yy1: string; yy: boolean; }' is not assignable to type '{ yy: number; yy1: string; }'. +!!! error TS2769: Types of property 'yy' are incompatible. +!!! error TS2769: Type 'boolean' is not assignable to type 'number'. +!!! related TS2771 file.tsx:3:18: The last overload is declared here. + const c6 = ; // Should error as there is extra attribute that doesn't match any. Current it is not + const c7 = ; // Should error as there is extra attribute that doesn't match any. Current it is not + + declare function TestingOneThing(j: {"extra-data": string}): JSX.Element; + declare function TestingOneThing(n: {yy: string, direction?: number}): JSX.Element; + + // Error + const d1 = + ~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Property 'yy' is missing in type '{ "extra-data": true; }' but required in type '{ yy: string; direction?: number; }'. +!!! related TS2728 file.tsx:22:38: 'yy' is declared here. +!!! related TS2771 file.tsx:22:18: The last overload is declared here. + const d2 = + ~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS6500 file.tsx:22:50: The expected type comes from property 'direction' which is declared here on type 'IntrinsicAttributes & { yy: string; direction?: number; }' +!!! related TS2771 file.tsx:22:18: The last overload is declared here. + + declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element; + declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element; + declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element; + + // Error + const e1 = + ~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 file.tsx:30:64: The expected type comes from property 'y3' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' +!!! related TS2771 file.tsx:30:18: The last overload is declared here. + const e2 = + ~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' +!!! related TS2771 file.tsx:30:18: The last overload is declared here. + const e3 = + ~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' +!!! related TS2771 file.tsx:30:18: The last overload is declared here. + const e4 = Hi + ~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' +!!! related TS2771 file.tsx:30:18: The last overload is declared here. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.errors.txt.diff new file mode 100644 index 0000000000..bdb9658190 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.errors.txt.diff @@ -0,0 +1,254 @@ +--- old.tsxStatelessFunctionComponentOverload4.errors.txt ++++ new.tsxStatelessFunctionComponentOverload4.errors.txt +@@= skipped -0, +0 lines =@@ + file.tsx(12,22): error TS2769: No overload matches this call. +- Overload 1 of 2, '(): Element', gave the following error. +- Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes'. +- Property 'extraProp' does not exist on type 'IntrinsicAttributes'. +- Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. ++ The last overload gave the following error. + Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + file.tsx(13,13): error TS2769: No overload matches this call. +- Overload 1 of 2, '(): Element', gave the following error. +- Type '{ yy: number; }' is not assignable to type 'IntrinsicAttributes'. +- Property 'yy' does not exist on type 'IntrinsicAttributes'. +- Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. ++ The last overload gave the following error. + Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'. + file.tsx(14,31): error TS2769: No overload matches this call. +- Overload 1 of 2, '(): Element', gave the following error. +- Type '{ yy: number; yy1: true; }' is not assignable to type 'IntrinsicAttributes'. +- Property 'yy1' does not exist on type 'IntrinsicAttributes'. +- Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. ++ The last overload gave the following error. + Type 'boolean' is not assignable to type 'string'. + file.tsx(16,31): error TS2769: No overload matches this call. +- Overload 1 of 2, '(): Element', gave the following error. +- Type '{ yy: number; yy1: string; y1: number; }' is not assignable to type 'IntrinsicAttributes'. +- Property 'y1' does not exist on type 'IntrinsicAttributes'. +- Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. ++ The last overload gave the following error. + Type '{ yy: number; yy1: string; y1: number; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + file.tsx(17,13): error TS2769: No overload matches this call. +- Overload 1 of 2, '(): Element', gave the following error. +- Type '{ yy1: string; yy: boolean; }' has no properties in common with type 'IntrinsicAttributes'. +- Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. ++ The last overload gave the following error. + Type '{ yy1: string; yy: boolean; }' is not assignable to type '{ yy: number; yy1: string; }'. + Types of property 'yy' are incompatible. + Type 'boolean' is not assignable to type 'number'. + file.tsx(25,13): error TS2769: No overload matches this call. +- Overload 1 of 2, '(j: { "extra-data": string; }): Element', gave the following error. +- Type '{ "extra-data": true; }' is not assignable to type '{ "extra-data": string; }'. +- Types of property '"extra-data"' are incompatible. +- Type 'boolean' is not assignable to type 'string'. +- Overload 2 of 2, '(n: { yy: string; direction?: number; }): Element', gave the following error. ++ The last overload gave the following error. + Property 'yy' is missing in type '{ "extra-data": true; }' but required in type '{ yy: string; direction?: number; }'. +-file.tsx(26,13): error TS2769: No overload matches this call. +- Overload 1 of 2, '(j: { "extra-data": string; }): Element', gave the following error. +- Type '{ yy: string; direction: string; }' is not assignable to type 'IntrinsicAttributes & { "extra-data": string; }'. +- Property 'yy' does not exist on type 'IntrinsicAttributes & { "extra-data": string; }'. +- Overload 2 of 2, '(n: { yy: string; direction?: number; }): Element', gave the following error. ++file.tsx(26,40): error TS2769: No overload matches this call. ++ The last overload gave the following error. + Type 'string' is not assignable to type 'number'. +-file.tsx(33,13): error TS2769: No overload matches this call. +- Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. +- Type 'boolean' is not assignable to type 'string'. +- Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +- Type 'boolean' is not assignable to type 'string'. +- Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error. +- Type 'string' is not assignable to type 'boolean'. +-file.tsx(34,13): error TS2769: No overload matches this call. +- Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. +- Type '{ y1: string; y2: number; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +- Property 'y3' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +- Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +- Type '{ y1: string; y2: number; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }'. +- Property 'y3' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }'. +- Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error. +- Type 'string' is not assignable to type 'boolean'. +-file.tsx(35,13): error TS2769: No overload matches this call. +- Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. +- Type '{ y1: string; y2: number; children: string; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +- Property 'children' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +- Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +- Type 'string' is not assignable to type 'Element'. +- Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error. +- Type 'string' is not assignable to type 'boolean'. +-file.tsx(36,13): error TS2769: No overload matches this call. +- Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. +- Type '{ y1: string; y2: number; children: string; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +- Property 'children' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +- Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +- 'TestingOptional' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element'. +- Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error. ++file.tsx(33,32): error TS2769: No overload matches this call. ++ The last overload gave the following error. ++ Type 'string' is not assignable to type 'boolean'. ++file.tsx(34,29): error TS2769: No overload matches this call. ++ The last overload gave the following error. ++ Type 'string' is not assignable to type 'boolean'. ++file.tsx(35,29): error TS2769: No overload matches this call. ++ The last overload gave the following error. ++ Type 'string' is not assignable to type 'boolean'. ++file.tsx(36,29): error TS2769: No overload matches this call. ++ The last overload gave the following error. + Type 'string' is not assignable to type 'boolean'. + + +@@= skipped -92, +51 lines =@@ + const c0 = ; // extra property; + ~~~~~~~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. +-!!! error TS2769: Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes'. +-!!! error TS2769: Property 'extraProp' does not exist on type 'IntrinsicAttributes'. +-!!! error TS2769: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + !!! error TS2769: Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. ++!!! related TS2771 file.tsx:3:18: The last overload is declared here. + const c1 = ; // missing property; + ~~~~~~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. +-!!! error TS2769: Type '{ yy: number; }' is not assignable to type 'IntrinsicAttributes'. +-!!! error TS2769: Property 'yy' does not exist on type 'IntrinsicAttributes'. +-!!! error TS2769: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'. + !!! related TS2728 file.tsx:3:43: 'yy1' is declared here. ++!!! related TS2771 file.tsx:3:18: The last overload is declared here. + const c2 = ; // type incompatible; + ~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. +-!!! error TS2769: Type '{ yy: number; yy1: true; }' is not assignable to type 'IntrinsicAttributes'. +-!!! error TS2769: Property 'yy1' does not exist on type 'IntrinsicAttributes'. +-!!! error TS2769: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type 'boolean' is not assignable to type 'string'. + !!! related TS6500 file.tsx:3:43: The expected type comes from property 'yy1' which is declared here on type 'IntrinsicAttributes & { yy: number; yy1: string; }' ++!!! related TS2771 file.tsx:3:18: The last overload is declared here. + const c3 = ; // This is OK because all attribute are spread + const c4 = ; // extra property; + ~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. +-!!! error TS2769: Type '{ yy: number; yy1: string; y1: number; }' is not assignable to type 'IntrinsicAttributes'. +-!!! error TS2769: Property 'y1' does not exist on type 'IntrinsicAttributes'. +-!!! error TS2769: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type '{ yy: number; yy1: string; y1: number; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + !!! error TS2769: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. ++!!! related TS2771 file.tsx:3:18: The last overload is declared here. + const c5 = ; // type incompatible; + ~~~~~~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. +-!!! error TS2769: Type '{ yy1: string; yy: boolean; }' has no properties in common with type 'IntrinsicAttributes'. +-!!! error TS2769: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type '{ yy1: string; yy: boolean; }' is not assignable to type '{ yy: number; yy1: string; }'. + !!! error TS2769: Types of property 'yy' are incompatible. + !!! error TS2769: Type 'boolean' is not assignable to type 'number'. ++!!! related TS2771 file.tsx:3:18: The last overload is declared here. + const c6 = ; // Should error as there is extra attribute that doesn't match any. Current it is not + const c7 = ; // Should error as there is extra attribute that doesn't match any. Current it is not + +@@= skipped -53, +44 lines =@@ + const d1 = + ~~~~~~~~~~~~~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 2, '(j: { "extra-data": string; }): Element', gave the following error. +-!!! error TS2769: Type '{ "extra-data": true; }' is not assignable to type '{ "extra-data": string; }'. +-!!! error TS2769: Types of property '"extra-data"' are incompatible. +-!!! error TS2769: Type 'boolean' is not assignable to type 'string'. +-!!! error TS2769: Overload 2 of 2, '(n: { yy: string; direction?: number; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Property 'yy' is missing in type '{ "extra-data": true; }' but required in type '{ yy: string; direction?: number; }'. + !!! related TS2728 file.tsx:22:38: 'yy' is declared here. ++!!! related TS2771 file.tsx:22:18: The last overload is declared here. + const d2 = +- ~~~~~~~~~~~~~~~ ++ ~~~~~~~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 2, '(j: { "extra-data": string; }): Element', gave the following error. +-!!! error TS2769: Type '{ yy: string; direction: string; }' is not assignable to type 'IntrinsicAttributes & { "extra-data": string; }'. +-!!! error TS2769: Property 'yy' does not exist on type 'IntrinsicAttributes & { "extra-data": string; }'. +-!!! error TS2769: Overload 2 of 2, '(n: { yy: string; direction?: number; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type 'string' is not assignable to type 'number'. + !!! related TS6500 file.tsx:22:50: The expected type comes from property 'direction' which is declared here on type 'IntrinsicAttributes & { yy: string; direction?: number; }' ++!!! related TS2771 file.tsx:22:18: The last overload is declared here. + + declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element; + declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element; +@@= skipped -23, +18 lines =@@ + + // Error + const e1 = +- ~~~~~~~~~~~~~~~ ++ ~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. +-!!! error TS2769: Type 'boolean' is not assignable to type 'string'. +-!!! error TS2769: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +-!!! error TS2769: Type 'boolean' is not assignable to type 'string'. +-!!! error TS2769: Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type 'string' is not assignable to type 'boolean'. +-!!! related TS6500 file.tsx:28:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1?: string; y2?: number; }' +-!!! related TS6500 file.tsx:29:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }' + !!! related TS6500 file.tsx:30:64: The expected type comes from property 'y3' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' ++!!! related TS2771 file.tsx:30:18: The last overload is declared here. + const e2 = +- ~~~~~~~~~~~~~~~ ++ ~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. +-!!! error TS2769: Type '{ y1: string; y2: number; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +-!!! error TS2769: Property 'y3' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +-!!! error TS2769: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +-!!! error TS2769: Type '{ y1: string; y2: number; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }'. +-!!! error TS2769: Property 'y3' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }'. +-!!! error TS2769: Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type 'string' is not assignable to type 'boolean'. + !!! related TS6500 file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' ++!!! related TS2771 file.tsx:30:18: The last overload is declared here. + const e3 = +- ~~~~~~~~~~~~~~~ ++ ~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. +-!!! error TS2769: Type '{ y1: string; y2: number; children: string; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +-!!! error TS2769: Property 'children' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +-!!! error TS2769: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +-!!! error TS2769: Type 'string' is not assignable to type 'Element'. +-!!! error TS2769: Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type 'string' is not assignable to type 'boolean'. +-!!! related TS6500 file.tsx:29:64: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }' + !!! related TS6500 file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' ++!!! related TS2771 file.tsx:30:18: The last overload is declared here. + const e4 = Hi +- ~~~~~~~~~~~~~~~ ++ ~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. +-!!! error TS2769: Type '{ y1: string; y2: number; children: string; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +-!!! error TS2769: Property 'children' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +-!!! error TS2769: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +-!!! error TS2769: 'TestingOptional' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element'. +-!!! error TS2769: Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type 'string' is not assignable to type 'boolean'. +-!!! related TS6500 file.tsx:29:64: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }' + !!! related TS6500 file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' ++!!! related TS2771 file.tsx:30:18: The last overload is declared here. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.js b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.js new file mode 100644 index 0000000000..d77bf94be3 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.js @@ -0,0 +1,67 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload4.tsx] //// + +//// [file.tsx] +import React = require('react') +declare function OneThing(): JSX.Element; +declare function OneThing(l: {yy: number, yy1: string}): JSX.Element; + +let obj = { + yy: 10, + yy1: "hello" +} +let obj2: any; + +// Error +const c0 = ; // extra property; +const c1 = ; // missing property; +const c2 = ; // type incompatible; +const c3 = ; // This is OK because all attribute are spread +const c4 = ; // extra property; +const c5 = ; // type incompatible; +const c6 = ; // Should error as there is extra attribute that doesn't match any. Current it is not +const c7 = ; // Should error as there is extra attribute that doesn't match any. Current it is not + +declare function TestingOneThing(j: {"extra-data": string}): JSX.Element; +declare function TestingOneThing(n: {yy: string, direction?: number}): JSX.Element; + +// Error +const d1 = +const d2 = + +declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element; +declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element; +declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element; + +// Error +const e1 = +const e2 = +const e3 = +const e4 = Hi + + +//// [file.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const React = require("react"); +let obj = { + yy: 10, + yy1: "hello" +}; +let obj2; +// Error +const c0 = ; // extra property; +const c1 = ; // missing property; +const c2 = ; // type incompatible; +const c3 = ; // This is OK because all attribute are spread +const c4 = ; // extra property; +const c5 = ; // type incompatible; +const c6 = ; // Should error as there is extra attribute that doesn't match any. Current it is not +const c7 = ; // Should error as there is extra attribute that doesn't match any. Current it is not +// Error +const d1 = ; +const d2 = ; +// Error +const e1 = ; +const e2 = ; +const e3 = ; +const e4 = Hi; diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.js.diff b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.js.diff new file mode 100644 index 0000000000..f973519b54 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.js.diff @@ -0,0 +1,11 @@ +--- old.tsxStatelessFunctionComponentOverload4.js ++++ new.tsxStatelessFunctionComponentOverload4.js +@@= skipped -41, +41 lines =@@ + //// [file.jsx] + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); +-var React = require("react"); ++const React = require("react"); + let obj = { + yy: 10, + yy1: "hello" \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.symbols b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.symbols new file mode 100644 index 0000000000..b2d468e69d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.symbols @@ -0,0 +1,161 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload4.tsx] //// + +=== file.tsx === +import React = require('react') +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +declare function OneThing(): JSX.Element; +>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +declare function OneThing(l: {yy: number, yy1: string}): JSX.Element; +>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41)) +>l : Symbol(l, Decl(file.tsx, 2, 26)) +>yy : Symbol(yy, Decl(file.tsx, 2, 30)) +>yy1 : Symbol(yy1, Decl(file.tsx, 2, 41)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +let obj = { +>obj : Symbol(obj, Decl(file.tsx, 4, 3)) + + yy: 10, +>yy : Symbol(yy, Decl(file.tsx, 4, 11)) + + yy1: "hello" +>yy1 : Symbol(yy1, Decl(file.tsx, 5, 11)) +} +let obj2: any; +>obj2 : Symbol(obj2, Decl(file.tsx, 8, 3)) + +// Error +const c0 = ; // extra property; +>c0 : Symbol(c0, Decl(file.tsx, 11, 5)) +>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41)) +>extraProp : Symbol(extraProp, Decl(file.tsx, 11, 20)) + +const c1 = ; // missing property; +>c1 : Symbol(c1, Decl(file.tsx, 12, 5)) +>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41)) +>yy : Symbol(yy, Decl(file.tsx, 12, 20)) + +const c2 = ; // type incompatible; +>c2 : Symbol(c2, Decl(file.tsx, 13, 5)) +>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41)) +>obj : Symbol(obj, Decl(file.tsx, 4, 3)) +>yy1 : Symbol(yy1, Decl(file.tsx, 13, 29)) + +const c3 = ; // This is OK because all attribute are spread +>c3 : Symbol(c3, Decl(file.tsx, 14, 5)) +>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41)) +>obj : Symbol(obj, Decl(file.tsx, 4, 3)) +>extra : Symbol(extra, Decl(file.tsx, 14, 35)) + +const c4 = ; // extra property; +>c4 : Symbol(c4, Decl(file.tsx, 15, 5)) +>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41)) +>obj : Symbol(obj, Decl(file.tsx, 4, 3)) +>y1 : Symbol(y1, Decl(file.tsx, 15, 29)) + +const c5 = ; // type incompatible; +>c5 : Symbol(c5, Decl(file.tsx, 16, 5)) +>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41)) +>obj : Symbol(obj, Decl(file.tsx, 4, 3)) +>yy : Symbol(yy, Decl(file.tsx, 16, 35)) + +const c6 = ; // Should error as there is extra attribute that doesn't match any. Current it is not +>c6 : Symbol(c6, Decl(file.tsx, 17, 5)) +>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41)) +>obj2 : Symbol(obj2, Decl(file.tsx, 8, 3)) +>extra : Symbol(extra, Decl(file.tsx, 17, 36)) + +const c7 = ; // Should error as there is extra attribute that doesn't match any. Current it is not +>c7 : Symbol(c7, Decl(file.tsx, 18, 5)) +>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 1, 41)) +>obj2 : Symbol(obj2, Decl(file.tsx, 8, 3)) +>yy : Symbol(yy, Decl(file.tsx, 18, 30)) + +declare function TestingOneThing(j: {"extra-data": string}): JSX.Element; +>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 18, 37), Decl(file.tsx, 20, 73)) +>j : Symbol(j, Decl(file.tsx, 20, 33)) +>"extra-data" : Symbol("extra-data", Decl(file.tsx, 20, 37)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +declare function TestingOneThing(n: {yy: string, direction?: number}): JSX.Element; +>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 18, 37), Decl(file.tsx, 20, 73)) +>n : Symbol(n, Decl(file.tsx, 21, 33)) +>yy : Symbol(yy, Decl(file.tsx, 21, 37)) +>direction : Symbol(direction, Decl(file.tsx, 21, 48)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +// Error +const d1 = +>d1 : Symbol(d1, Decl(file.tsx, 24, 5)) +>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 18, 37), Decl(file.tsx, 20, 73)) +>extra-data : Symbol(extra-data, Decl(file.tsx, 24, 27)) + +const d2 = +>d2 : Symbol(d2, Decl(file.tsx, 25, 5)) +>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 18, 37), Decl(file.tsx, 20, 73)) +>yy : Symbol(yy, Decl(file.tsx, 25, 27)) +>direction : Symbol(direction, Decl(file.tsx, 25, 38)) + +declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element; +>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 25, 58), Decl(file.tsx, 27, 77), Decl(file.tsx, 28, 100)) +>a : Symbol(a, Decl(file.tsx, 27, 33)) +>y1 : Symbol(y1, Decl(file.tsx, 27, 37)) +>y2 : Symbol(y2, Decl(file.tsx, 27, 49)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element; +>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 25, 58), Decl(file.tsx, 27, 77), Decl(file.tsx, 28, 100)) +>a : Symbol(a, Decl(file.tsx, 28, 33)) +>y1 : Symbol(y1, Decl(file.tsx, 28, 37)) +>y2 : Symbol(y2, Decl(file.tsx, 28, 49)) +>children : Symbol(children, Decl(file.tsx, 28, 62)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element; +>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 25, 58), Decl(file.tsx, 27, 77), Decl(file.tsx, 28, 100)) +>a : Symbol(a, Decl(file.tsx, 29, 33)) +>y1 : Symbol(y1, Decl(file.tsx, 29, 37)) +>y2 : Symbol(y2, Decl(file.tsx, 29, 49)) +>y3 : Symbol(y3, Decl(file.tsx, 29, 62)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +// Error +const e1 = +>e1 : Symbol(e1, Decl(file.tsx, 32, 5)) +>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 25, 58), Decl(file.tsx, 27, 77), Decl(file.tsx, 28, 100)) +>y1 : Symbol(y1, Decl(file.tsx, 32, 27)) +>y3 : Symbol(y3, Decl(file.tsx, 32, 30)) + +const e2 = +>e2 : Symbol(e2, Decl(file.tsx, 33, 5)) +>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 25, 58), Decl(file.tsx, 27, 77), Decl(file.tsx, 28, 100)) +>y1 : Symbol(y1, Decl(file.tsx, 33, 27)) +>y2 : Symbol(y2, Decl(file.tsx, 33, 38)) +>y3 : Symbol(y3, Decl(file.tsx, 33, 48)) + +const e3 = +>e3 : Symbol(e3, Decl(file.tsx, 34, 5)) +>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 25, 58), Decl(file.tsx, 27, 77), Decl(file.tsx, 28, 100)) +>y1 : Symbol(y1, Decl(file.tsx, 34, 27)) +>y2 : Symbol(y2, Decl(file.tsx, 34, 38)) +>children : Symbol(children, Decl(file.tsx, 34, 48)) + +const e4 = Hi +>e4 : Symbol(e4, Decl(file.tsx, 35, 5)) +>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 25, 58), Decl(file.tsx, 27, 77), Decl(file.tsx, 28, 100)) +>y1 : Symbol(y1, Decl(file.tsx, 35, 27)) +>y2 : Symbol(y2, Decl(file.tsx, 35, 38)) +>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 25, 58), Decl(file.tsx, 27, 77), Decl(file.tsx, 28, 100)) + diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.types b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.types new file mode 100644 index 0000000000..2a66538ede --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.types @@ -0,0 +1,181 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload4.tsx] //// + +=== file.tsx === +import React = require('react') +>React : typeof React + +declare function OneThing(): JSX.Element; +>OneThing : { (): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; } +>JSX : any + +declare function OneThing(l: {yy: number, yy1: string}): JSX.Element; +>OneThing : { (): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; } +>l : { yy: number; yy1: string; } +>yy : number +>yy1 : string +>JSX : any + +let obj = { +>obj : { yy: number; yy1: string; } +>{ yy: 10, yy1: "hello"} : { yy: number; yy1: string; } + + yy: 10, +>yy : number +>10 : 10 + + yy1: "hello" +>yy1 : string +>"hello" : "hello" +} +let obj2: any; +>obj2 : any + +// Error +const c0 = ; // extra property; +>c0 : JSX.Element +> : JSX.Element +>OneThing : { (): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; } +>extraProp : true + +const c1 = ; // missing property; +>c1 : JSX.Element +> : JSX.Element +>OneThing : { (): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; } +>yy : number +>10 : 10 + +const c2 = ; // type incompatible; +>c2 : JSX.Element +> : JSX.Element +>OneThing : { (): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; } +>obj : { yy: number; yy1: string; } +>yy1 : true + +const c3 = ; // This is OK because all attribute are spread +>c3 : JSX.Element +> : JSX.Element +>OneThing : { (): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; } +>obj : { yy: number; yy1: string; } +>{extra: "extra attr"} : { extra: string; } +>extra : string +>"extra attr" : "extra attr" + +const c4 = ; // extra property; +>c4 : JSX.Element +> : JSX.Element +>OneThing : { (): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; } +>obj : { yy: number; yy1: string; } +>y1 : number +>10000 : 10000 + +const c5 = ; // type incompatible; +>c5 : JSX.Element +> : JSX.Element +>OneThing : { (): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; } +>obj : { yy: number; yy1: string; } +>{yy: true} : { yy: boolean; } +>yy : boolean +>true : true + +const c6 = ; // Should error as there is extra attribute that doesn't match any. Current it is not +>c6 : JSX.Element +> : JSX.Element +>OneThing : { (): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; } +>obj2 : any +>{extra: "extra attr"} : { extra: string; } +>extra : string +>"extra attr" : "extra attr" + +const c7 = ; // Should error as there is extra attribute that doesn't match any. Current it is not +>c7 : JSX.Element +> : JSX.Element +>OneThing : { (): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; } +>obj2 : any +>yy : true + +declare function TestingOneThing(j: {"extra-data": string}): JSX.Element; +>TestingOneThing : { (j: { "extra-data": string; }): JSX.Element; (n: { yy: string; direction?: number; }): JSX.Element; } +>j : { "extra-data": string; } +>"extra-data" : string +>JSX : any + +declare function TestingOneThing(n: {yy: string, direction?: number}): JSX.Element; +>TestingOneThing : { (j: { "extra-data": string; }): JSX.Element; (n: { yy: string; direction?: number; }): JSX.Element; } +>n : { yy: string; direction?: number; } +>yy : string +>direction : number +>JSX : any + +// Error +const d1 = +>d1 : JSX.Element +> : JSX.Element +>TestingOneThing : { (j: { "extra-data": string; }): JSX.Element; (n: { yy: string; direction?: number; }): JSX.Element; } +>extra-data : true + +const d2 = +>d2 : JSX.Element +> : JSX.Element +>TestingOneThing : { (j: { "extra-data": string; }): JSX.Element; (n: { yy: string; direction?: number; }): JSX.Element; } +>yy : string +>direction : string + +declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element; +>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1?: string; y2?: number; children: JSX.Element; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; } +>a : { y1?: string; y2?: number; } +>y1 : string +>y2 : number +>JSX : any + +declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element; +>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1?: string; y2?: number; children: JSX.Element; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; } +>a : { y1?: string; y2?: number; children: JSX.Element; } +>y1 : string +>y2 : number +>children : JSX.Element +>JSX : any +>JSX : any + +declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element; +>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1?: string; y2?: number; children: JSX.Element; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; } +>a : { y1: boolean; y2?: number; y3: boolean; } +>y1 : boolean +>y2 : number +>y3 : boolean +>JSX : any + +// Error +const e1 = +>e1 : JSX.Element +> : JSX.Element +>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1?: string; y2?: number; children: JSX.Element; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; } +>y1 : true +>y3 : string + +const e2 = +>e2 : JSX.Element +> : JSX.Element +>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1?: string; y2?: number; children: JSX.Element; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; } +>y1 : string +>y2 : number +>1000 : 1000 +>y3 : true + +const e3 = +>e3 : JSX.Element +> : JSX.Element +>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1?: string; y2?: number; children: JSX.Element; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; } +>y1 : string +>y2 : number +>1000 : 1000 +>children : string + +const e4 = Hi +>e4 : JSX.Element +>Hi : JSX.Element +>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1?: string; y2?: number; children: JSX.Element; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; } +>y1 : string +>y2 : number +>1000 : 1000 +>TestingOptional : { (a: { y1?: string; y2?: number; }): JSX.Element; (a: { y1?: string; y2?: number; children: JSX.Element; }): JSX.Element; (a: { y1: boolean; y2?: number; y3: boolean; }): JSX.Element; } + diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.errors.txt b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.errors.txt new file mode 100644 index 0000000000..1ea47289a5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.errors.txt @@ -0,0 +1,100 @@ +file.tsx(48,24): error TS2769: No overload matches this call. + The last overload gave the following error. + Type '{ to: string; onClick: (e: MouseEvent) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. + Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. +file.tsx(54,51): error TS2769: No overload matches this call. + The last overload gave the following error. + Type 'number' is not assignable to type 'string'. +file.tsx(55,68): error TS2769: No overload matches this call. + The last overload gave the following error. + Type 'boolean' is not assignable to type 'string'. +file.tsx(56,13): error TS2769: No overload matches this call. + The last overload gave the following error. + Type '{ "data-format": true; }' is not assignable to type 'HyphenProps'. + Types of property '"data-format"' are incompatible. + Type 'boolean' is not assignable to type 'string'. + + +==== file.tsx (4 errors) ==== + import React = require('react') + + export interface ClickableProps { + children?: string; + className?: string; + } + + export interface ButtonProps extends ClickableProps { + onClick: React.MouseEventHandler; + } + + export interface LinkProps extends ClickableProps { + to: string; + } + + export interface HyphenProps extends ClickableProps { + "data-format": string; + } + + let obj0 = { + to: "world" + }; + + let obj1 = { + children: "hi", + to: "boo" + } + + let obj2 = { + onClick: ()=>{} + } + + let obj3: any; + + export function MainButton(buttonProps: ButtonProps): JSX.Element; + export function MainButton(linkProps: LinkProps): JSX.Element; + export function MainButton(hyphenProps: HyphenProps): JSX.Element; + export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element { + const linkProps = props as LinkProps; + if(linkProps.to) { + return this._buildMainLink(props); + } + + return this._buildMainButton(props); + } + + // Error + const b0 = {}}>GO; // extra property; + ~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type '{ to: string; onClick: (e: MouseEvent) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. +!!! error TS2769: Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. +!!! related TS2771 file.tsx:37:17: The last overload is declared here. +!!! related TS2793 file.tsx:38:17: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. + const b1 = {}} {...obj0}>Hello world; // extra property; + const b2 = ; // extra property + const b3 = {}}} />; // extra property + const b4 = ; // Should error because Incorrect type; but attributes are any so everything is allowed + const b5 = ; // Spread retain method declaration (see GitHub #13365), so now there is an extra attributes + const b6 = ; // incorrect type for optional attribute + ~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! related TS6500 file.tsx:4:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & HyphenProps' +!!! related TS2771 file.tsx:37:17: The last overload is declared here. + const b7 = ; // incorrect type for optional attribute + ~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. +!!! related TS6500 file.tsx:5:5: The expected type comes from property 'className' which is declared here on type 'IntrinsicAttributes & HyphenProps' +!!! related TS2771 file.tsx:37:17: The last overload is declared here. + const b8 = ; // incorrect type for specified hyphanated name + ~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type '{ "data-format": true; }' is not assignable to type 'HyphenProps'. +!!! error TS2769: Types of property '"data-format"' are incompatible. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. +!!! related TS2771 file.tsx:37:17: The last overload is declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.errors.txt.diff new file mode 100644 index 0000000000..bfe548a208 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.errors.txt.diff @@ -0,0 +1,108 @@ +--- old.tsxStatelessFunctionComponentOverload5.errors.txt ++++ new.tsxStatelessFunctionComponentOverload5.errors.txt +@@= skipped -0, +0 lines =@@ +-file.tsx(48,13): error TS2769: No overload matches this call. +- Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +- Type '{ to: string; onClick: (e: MouseEvent) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. +- Property 'to' does not exist on type 'IntrinsicAttributes & ButtonProps'. +- Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +- Type '{ to: string; onClick: (e: MouseEvent) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. +- Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. +- Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. ++file.tsx(48,24): error TS2769: No overload matches this call. ++ The last overload gave the following error. + Type '{ to: string; onClick: (e: MouseEvent) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. + Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. + file.tsx(54,51): error TS2769: No overload matches this call. +- Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +- Type 'number' is not assignable to type 'string'. +- Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +- Type 'number' is not assignable to type 'string'. +- Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. ++ The last overload gave the following error. + Type 'number' is not assignable to type 'string'. + file.tsx(55,68): error TS2769: No overload matches this call. +- Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +- Type 'boolean' is not assignable to type 'string'. +- Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +- Type 'boolean' is not assignable to type 'string'. +- Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. ++ The last overload gave the following error. + Type 'boolean' is not assignable to type 'string'. + file.tsx(56,13): error TS2769: No overload matches this call. +- Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +- Property 'onClick' is missing in type '{ "data-format": true; }' but required in type 'ButtonProps'. +- Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +- Property 'to' is missing in type '{ "data-format": true; }' but required in type 'LinkProps'. +- Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. ++ The last overload gave the following error. + Type '{ "data-format": true; }' is not assignable to type 'HyphenProps'. + Types of property '"data-format"' are incompatible. + Type 'boolean' is not assignable to type 'string'. +@@= skipped -81, +63 lines =@@ + + // Error + const b0 = {}}>GO; // extra property; +- ~~~~~~~~~~ ++ ~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +-!!! error TS2769: Type '{ to: string; onClick: (e: MouseEvent) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. +-!!! error TS2769: Property 'to' does not exist on type 'IntrinsicAttributes & ButtonProps'. +-!!! error TS2769: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +-!!! error TS2769: Type '{ to: string; onClick: (e: MouseEvent) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. +-!!! error TS2769: Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. +-!!! error TS2769: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type '{ to: string; onClick: (e: MouseEvent) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. + !!! error TS2769: Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. ++!!! related TS2771 file.tsx:37:17: The last overload is declared here. + !!! related TS2793 file.tsx:38:17: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. + const b1 = {}} {...obj0}>Hello world; // extra property; + const b2 = ; // extra property +@@= skipped -20, +15 lines =@@ + const b6 = ; // incorrect type for optional attribute + ~~~~~~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +-!!! error TS2769: Type 'number' is not assignable to type 'string'. +-!!! error TS2769: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +-!!! error TS2769: Type 'number' is not assignable to type 'string'. +-!!! error TS2769: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. +-!!! error TS2769: Type 'number' is not assignable to type 'string'. +-!!! related TS6500 file.tsx:4:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & ButtonProps' +-!!! related TS6500 file.tsx:4:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & LinkProps' ++!!! error TS2769: The last overload gave the following error. ++!!! error TS2769: Type 'number' is not assignable to type 'string'. + !!! related TS6500 file.tsx:4:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & HyphenProps' ++!!! related TS2771 file.tsx:37:17: The last overload is declared here. + const b7 = ; // incorrect type for optional attribute + ~~~~~~~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +-!!! error TS2769: Type 'boolean' is not assignable to type 'string'. +-!!! error TS2769: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +-!!! error TS2769: Type 'boolean' is not assignable to type 'string'. +-!!! error TS2769: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. +-!!! error TS2769: Type 'boolean' is not assignable to type 'string'. +-!!! related TS6500 file.tsx:5:5: The expected type comes from property 'className' which is declared here on type 'IntrinsicAttributes & ButtonProps' +-!!! related TS6500 file.tsx:5:5: The expected type comes from property 'className' which is declared here on type 'IntrinsicAttributes & LinkProps' ++!!! error TS2769: The last overload gave the following error. ++!!! error TS2769: Type 'boolean' is not assignable to type 'string'. + !!! related TS6500 file.tsx:5:5: The expected type comes from property 'className' which is declared here on type 'IntrinsicAttributes & HyphenProps' ++!!! related TS2771 file.tsx:37:17: The last overload is declared here. + const b8 = ; // incorrect type for specified hyphanated name + ~~~~~~~~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +-!!! error TS2769: Property 'onClick' is missing in type '{ "data-format": true; }' but required in type 'ButtonProps'. +-!!! error TS2769: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +-!!! error TS2769: Property 'to' is missing in type '{ "data-format": true; }' but required in type 'LinkProps'. +-!!! error TS2769: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type '{ "data-format": true; }' is not assignable to type 'HyphenProps'. + !!! error TS2769: Types of property '"data-format"' are incompatible. + !!! error TS2769: Type 'boolean' is not assignable to type 'string'. +-!!! related TS2728 file.tsx:9:5: 'onClick' is declared here. +-!!! related TS2728 file.tsx:13:5: 'to' is declared here. ++!!! related TS2771 file.tsx:37:17: The last overload is declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.js b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.js new file mode 100644 index 0000000000..2701ffdcbd --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.js @@ -0,0 +1,93 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload5.tsx] //// + +//// [file.tsx] +import React = require('react') + +export interface ClickableProps { + children?: string; + className?: string; +} + +export interface ButtonProps extends ClickableProps { + onClick: React.MouseEventHandler; +} + +export interface LinkProps extends ClickableProps { + to: string; +} + +export interface HyphenProps extends ClickableProps { + "data-format": string; +} + +let obj0 = { + to: "world" +}; + +let obj1 = { + children: "hi", + to: "boo" +} + +let obj2 = { + onClick: ()=>{} +} + +let obj3: any; + +export function MainButton(buttonProps: ButtonProps): JSX.Element; +export function MainButton(linkProps: LinkProps): JSX.Element; +export function MainButton(hyphenProps: HyphenProps): JSX.Element; +export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element { + const linkProps = props as LinkProps; + if(linkProps.to) { + return this._buildMainLink(props); + } + + return this._buildMainButton(props); +} + +// Error +const b0 = {}}>GO; // extra property; +const b1 = {}} {...obj0}>Hello world; // extra property; +const b2 = ; // extra property +const b3 = {}}} />; // extra property +const b4 = ; // Should error because Incorrect type; but attributes are any so everything is allowed +const b5 = ; // Spread retain method declaration (see GitHub #13365), so now there is an extra attributes +const b6 = ; // incorrect type for optional attribute +const b7 = ; // incorrect type for optional attribute +const b8 = ; // incorrect type for specified hyphanated name + +//// [file.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MainButton = MainButton; +const React = require("react"); +let obj0 = { + to: "world" +}; +let obj1 = { + children: "hi", + to: "boo" +}; +let obj2 = { + onClick: () => { } +}; +let obj3; +function MainButton(props) { + const linkProps = props; + if (linkProps.to) { + return this._buildMainLink(props); + } + return this._buildMainButton(props); +} +// Error +const b0 = { }}>GO; // extra property; +const b1 = { }} {...obj0}>Hello world; // extra property; +const b2 = ; // extra property +const b3 = { } }}/>; // extra property +const b4 = ; // Should error because Incorrect type; but attributes are any so everything is allowed +const b5 = ; // Spread retain method declaration (see GitHub #13365), so now there is an extra attributes +const b6 = ; // incorrect type for optional attribute +const b7 = ; // incorrect type for optional attribute +const b8 = ; // incorrect type for specified hyphanated name diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.js.diff b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.js.diff new file mode 100644 index 0000000000..304b84c8a1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.js.diff @@ -0,0 +1,11 @@ +--- old.tsxStatelessFunctionComponentOverload5.js ++++ new.tsxStatelessFunctionComponentOverload5.js +@@= skipped -61, +61 lines =@@ + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MainButton = MainButton; +-var React = require("react"); ++const React = require("react"); + let obj0 = { + to: "world" + }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.symbols b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.symbols new file mode 100644 index 0000000000..4d5d3e21e4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.symbols @@ -0,0 +1,181 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload5.tsx] //// + +=== file.tsx === +import React = require('react') +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +export interface ClickableProps { +>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 0, 31)) + + children?: string; +>children : Symbol(ClickableProps.children, Decl(file.tsx, 2, 33)) + + className?: string; +>className : Symbol(ClickableProps.className, Decl(file.tsx, 3, 22)) +} + +export interface ButtonProps extends ClickableProps { +>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 5, 1)) +>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 0, 31)) + + onClick: React.MouseEventHandler; +>onClick : Symbol(ButtonProps.onClick, Decl(file.tsx, 7, 53)) +>React : Symbol(React, Decl(file.tsx, 0, 0)) +>MouseEventHandler : Symbol(React.MouseEventHandler, Decl(react.d.ts, 389, 66)) +} + +export interface LinkProps extends ClickableProps { +>LinkProps : Symbol(LinkProps, Decl(file.tsx, 9, 1)) +>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 0, 31)) + + to: string; +>to : Symbol(LinkProps.to, Decl(file.tsx, 11, 51)) +} + +export interface HyphenProps extends ClickableProps { +>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 13, 1)) +>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 0, 31)) + + "data-format": string; +>"data-format" : Symbol(HyphenProps["data-format"], Decl(file.tsx, 15, 53)) +} + +let obj0 = { +>obj0 : Symbol(obj0, Decl(file.tsx, 19, 3)) + + to: "world" +>to : Symbol(to, Decl(file.tsx, 19, 12)) + +}; + +let obj1 = { +>obj1 : Symbol(obj1, Decl(file.tsx, 23, 3)) + + children: "hi", +>children : Symbol(children, Decl(file.tsx, 23, 12)) + + to: "boo" +>to : Symbol(to, Decl(file.tsx, 24, 19)) +} + +let obj2 = { +>obj2 : Symbol(obj2, Decl(file.tsx, 28, 3)) + + onClick: ()=>{} +>onClick : Symbol(onClick, Decl(file.tsx, 28, 12)) +} + +let obj3: any; +>obj3 : Symbol(obj3, Decl(file.tsx, 32, 3)) + +export function MainButton(buttonProps: ButtonProps): JSX.Element; +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>buttonProps : Symbol(buttonProps, Decl(file.tsx, 34, 27)) +>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 5, 1)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +export function MainButton(linkProps: LinkProps): JSX.Element; +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>linkProps : Symbol(linkProps, Decl(file.tsx, 35, 27)) +>LinkProps : Symbol(LinkProps, Decl(file.tsx, 9, 1)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +export function MainButton(hyphenProps: HyphenProps): JSX.Element; +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>hyphenProps : Symbol(hyphenProps, Decl(file.tsx, 36, 27)) +>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 13, 1)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element { +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>props : Symbol(props, Decl(file.tsx, 37, 27)) +>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 5, 1)) +>LinkProps : Symbol(LinkProps, Decl(file.tsx, 9, 1)) +>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 13, 1)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + + const linkProps = props as LinkProps; +>linkProps : Symbol(linkProps, Decl(file.tsx, 38, 9)) +>props : Symbol(props, Decl(file.tsx, 37, 27)) +>LinkProps : Symbol(LinkProps, Decl(file.tsx, 9, 1)) + + if(linkProps.to) { +>linkProps.to : Symbol(LinkProps.to, Decl(file.tsx, 11, 51)) +>linkProps : Symbol(linkProps, Decl(file.tsx, 38, 9)) +>to : Symbol(LinkProps.to, Decl(file.tsx, 11, 51)) + + return this._buildMainLink(props); +>props : Symbol(props, Decl(file.tsx, 37, 27)) + } + + return this._buildMainButton(props); +>props : Symbol(props, Decl(file.tsx, 37, 27)) +} + +// Error +const b0 = {}}>GO; // extra property; +>b0 : Symbol(b0, Decl(file.tsx, 47, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>to : Symbol(to, Decl(file.tsx, 47, 22)) +>onClick : Symbol(onClick, Decl(file.tsx, 47, 38)) +>e : Symbol(e, Decl(file.tsx, 47, 49)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) + +const b1 = {}} {...obj0}>Hello world; // extra property; +>b1 : Symbol(b1, Decl(file.tsx, 48, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>onClick : Symbol(onClick, Decl(file.tsx, 48, 22)) +>e : Symbol(e, Decl(file.tsx, 48, 33)) +>obj0 : Symbol(obj0, Decl(file.tsx, 19, 3)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) + +const b2 = ; // extra property +>b2 : Symbol(b2, Decl(file.tsx, 49, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>to : Symbol(to, Decl(file.tsx, 49, 28)) +>obj2 : Symbol(obj2, Decl(file.tsx, 28, 3)) + +const b3 = {}}} />; // extra property +>b3 : Symbol(b3, Decl(file.tsx, 50, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>to : Symbol(to, Decl(file.tsx, 50, 28)) +>onClick : Symbol(onClick, Decl(file.tsx, 50, 47)) +>k : Symbol(k, Decl(file.tsx, 50, 57)) + +const b4 = ; // Should error because Incorrect type; but attributes are any so everything is allowed +>b4 : Symbol(b4, Decl(file.tsx, 51, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>obj3 : Symbol(obj3, Decl(file.tsx, 32, 3)) +>to : Symbol(to, Decl(file.tsx, 51, 32)) + +const b5 = ; // Spread retain method declaration (see GitHub #13365), so now there is an extra attributes +>b5 : Symbol(b5, Decl(file.tsx, 52, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>onClick : Symbol(onClick, Decl(file.tsx, 52, 28)) +>e : Symbol(e, Decl(file.tsx, 52, 37)) +>obj0 : Symbol(obj0, Decl(file.tsx, 19, 3)) + +const b6 = ; // incorrect type for optional attribute +>b6 : Symbol(b6, Decl(file.tsx, 53, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>onClick : Symbol(onClick, Decl(file.tsx, 53, 28)) +>e : Symbol(e, Decl(file.tsx, 53, 37)) +>children : Symbol(children, Decl(file.tsx, 53, 49)) + +const b7 = ; // incorrect type for optional attribute +>b7 : Symbol(b7, Decl(file.tsx, 54, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>onClick : Symbol(onClick, Decl(file.tsx, 54, 28)) +>e : Symbol(e, Decl(file.tsx, 54, 37)) +>children : Symbol(children, Decl(file.tsx, 54, 49)) +>className : Symbol(className, Decl(file.tsx, 54, 66)) + +const b8 = ; // incorrect type for specified hyphanated name +>b8 : Symbol(b8, Decl(file.tsx, 55, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 32, 14), Decl(file.tsx, 34, 66), Decl(file.tsx, 35, 62), Decl(file.tsx, 36, 66)) +>data-format : Symbol(data-format, Decl(file.tsx, 55, 22)) + diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.types b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.types new file mode 100644 index 0000000000..de3315fb4a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.types @@ -0,0 +1,195 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload5.tsx] //// + +=== file.tsx === +import React = require('react') +>React : typeof React + +export interface ClickableProps { + children?: string; +>children : string + + className?: string; +>className : string +} + +export interface ButtonProps extends ClickableProps { + onClick: React.MouseEventHandler; +>onClick : React.MouseEventHandler +>React : any +} + +export interface LinkProps extends ClickableProps { + to: string; +>to : string +} + +export interface HyphenProps extends ClickableProps { + "data-format": string; +>"data-format" : string +} + +let obj0 = { +>obj0 : { to: string; } +>{ to: "world"} : { to: string; } + + to: "world" +>to : string +>"world" : "world" + +}; + +let obj1 = { +>obj1 : { children: string; to: string; } +>{ children: "hi", to: "boo"} : { children: string; to: string; } + + children: "hi", +>children : string +>"hi" : "hi" + + to: "boo" +>to : string +>"boo" : "boo" +} + +let obj2 = { +>obj2 : { onClick: () => void; } +>{ onClick: ()=>{}} : { onClick: () => void; } + + onClick: ()=>{} +>onClick : () => void +>()=>{} : () => void +} + +let obj3: any; +>obj3 : any + +export function MainButton(buttonProps: ButtonProps): JSX.Element; +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>buttonProps : ButtonProps +>JSX : any + +export function MainButton(linkProps: LinkProps): JSX.Element; +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>linkProps : LinkProps +>JSX : any + +export function MainButton(hyphenProps: HyphenProps): JSX.Element; +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>hyphenProps : HyphenProps +>JSX : any + +export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element { +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>props : ButtonProps | HyphenProps | LinkProps +>JSX : any + + const linkProps = props as LinkProps; +>linkProps : LinkProps +>props as LinkProps : LinkProps +>props : ButtonProps | HyphenProps | LinkProps + + if(linkProps.to) { +>linkProps.to : string +>linkProps : LinkProps +>to : string + + return this._buildMainLink(props); +>this._buildMainLink(props) : any +>this._buildMainLink : any +>this : any +>_buildMainLink : any +>props : ButtonProps | HyphenProps | LinkProps + } + + return this._buildMainButton(props); +>this._buildMainButton(props) : any +>this._buildMainButton : any +>this : any +>_buildMainButton : any +>props : ButtonProps | HyphenProps | LinkProps +} + +// Error +const b0 = {}}>GO; // extra property; +>b0 : JSX.Element +>{}}>GO : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>to : string +>onClick : (e: React.MouseEvent) => void +>(e)=>{} : (e: React.MouseEvent) => void +>e : React.MouseEvent +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } + +const b1 = {}} {...obj0}>Hello world; // extra property; +>b1 : JSX.Element +> {}} {...obj0}>Hello world : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>onClick : (e: any) => void +>(e: any)=> {} : (e: any) => void +>e : any +>obj0 : { to: string; } +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } + +const b2 = ; // extra property +>b2 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>{to: "10000"} : { to: string; } +>to : string +>"10000" : "10000" +>obj2 : { onClick: () => void; } + +const b3 = {}}} />; // extra property +>b3 : JSX.Element +> {}}} /> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>{to: "10000"} : { to: string; } +>to : string +>"10000" : "10000" +>{onClick: (k) => {}} : { onClick: (k: React.MouseEvent) => void; } +>onClick : (k: React.MouseEvent) => void +>(k) => {} : (k: React.MouseEvent) => void +>k : React.MouseEvent + +const b4 = ; // Should error because Incorrect type; but attributes are any so everything is allowed +>b4 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>obj3 : any +>to : true + +const b5 = ; // Spread retain method declaration (see GitHub #13365), so now there is an extra attributes +>b5 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>{ onClick(e: any) { } } : { onClick(e: any): void; } +>onClick : (e: any) => void +>e : any +>obj0 : { to: string; } + +const b6 = ; // incorrect type for optional attribute +>b6 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>{ onClick(e: any){} } : { onClick(e: any): void; } +>onClick : (e: any) => void +>e : any +>children : number +>10 : 10 + +const b7 = ; // incorrect type for optional attribute +>b7 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>{ onClick(e: any){} } : { onClick(e: any): void; } +>onClick : (e: any) => void +>e : any +>children : string +>className : true + +const b8 = ; // incorrect type for specified hyphanated name +>b8 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>data-format : true + diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.js b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.js new file mode 100644 index 0000000000..70290dc1cf --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.js @@ -0,0 +1,95 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload6.tsx] //// + +//// [file.tsx] +import React = require('react') + +export interface ClickableProps { + children?: string; + className?: string; +} + +export interface ButtonProps extends ClickableProps { + onClick: React.MouseEventHandler; +} + +export interface LinkProps extends ClickableProps { + to: string; +} + +export interface HyphenProps extends ClickableProps { + "data-format": string; +} + +let obj = { + children: "hi", + to: "boo" +} +let obj1: any; +let obj2 = { + onClick: () => {} +} + +export function MainButton(buttonProps: ButtonProps): JSX.Element; +export function MainButton(linkProps: LinkProps): JSX.Element; +export function MainButton(hyphenProps: HyphenProps): JSX.Element; +export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element { + const linkProps = props as LinkProps; + if(linkProps.to) { + return this._buildMainLink(props); + } + + return this._buildMainButton(props); +} + +// OK +const b0 = GO; +const b1 = {}}>Hello world; +const b2 = ; +const b3 = ; +const b4 = ; // any; just pick the first overload +const b5 = ; // should pick the second overload +const b6 = ; +const b7 = { console.log("hi") }}} />; +const b8 = ; // OK; method declaration get retained (See GitHub #13365) +const b9 = GO; +const b10 = ; +const b11 = {}} className="hello" data-format>Hello world; +const b12 = + + + + +//// [file.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MainButton = MainButton; +const React = require("react"); +let obj = { + children: "hi", + to: "boo" +}; +let obj1; +let obj2 = { + onClick: () => { } +}; +function MainButton(props) { + const linkProps = props; + if (linkProps.to) { + return this._buildMainLink(props); + } + return this._buildMainButton(props); +} +// OK +const b0 = GO; +const b1 = { }}>Hello world; +const b2 = ; +const b3 = ; +const b4 = ; // any; just pick the first overload +const b5 = ; // should pick the second overload +const b6 = ; +const b7 = { console.log("hi"); } }}/>; +const b8 = ; // OK; method declaration get retained (See GitHub #13365) +const b9 = GO; +const b10 = ; +const b11 = { }} className="hello" data-format>Hello world; +const b12 = ; diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.js.diff b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.js.diff new file mode 100644 index 0000000000..235ba3ed1e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.js.diff @@ -0,0 +1,11 @@ +--- old.tsxStatelessFunctionComponentOverload6.js ++++ new.tsxStatelessFunctionComponentOverload6.js +@@= skipped -62, +62 lines =@@ + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MainButton = MainButton; +-var React = require("react"); ++const React = require("react"); + let obj = { + children: "hi", + to: "boo" \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.symbols b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.symbols new file mode 100644 index 0000000000..0e0656495c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.symbols @@ -0,0 +1,193 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload6.tsx] //// + +=== file.tsx === +import React = require('react') +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +export interface ClickableProps { +>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 0, 31)) + + children?: string; +>children : Symbol(ClickableProps.children, Decl(file.tsx, 2, 33)) + + className?: string; +>className : Symbol(ClickableProps.className, Decl(file.tsx, 3, 22)) +} + +export interface ButtonProps extends ClickableProps { +>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 5, 1)) +>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 0, 31)) + + onClick: React.MouseEventHandler; +>onClick : Symbol(ButtonProps.onClick, Decl(file.tsx, 7, 53)) +>React : Symbol(React, Decl(file.tsx, 0, 0)) +>MouseEventHandler : Symbol(React.MouseEventHandler, Decl(react.d.ts, 389, 66)) +} + +export interface LinkProps extends ClickableProps { +>LinkProps : Symbol(LinkProps, Decl(file.tsx, 9, 1)) +>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 0, 31)) + + to: string; +>to : Symbol(LinkProps.to, Decl(file.tsx, 11, 51)) +} + +export interface HyphenProps extends ClickableProps { +>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 13, 1)) +>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 0, 31)) + + "data-format": string; +>"data-format" : Symbol(HyphenProps["data-format"], Decl(file.tsx, 15, 53)) +} + +let obj = { +>obj : Symbol(obj, Decl(file.tsx, 19, 3)) + + children: "hi", +>children : Symbol(children, Decl(file.tsx, 19, 11)) + + to: "boo" +>to : Symbol(to, Decl(file.tsx, 20, 19)) +} +let obj1: any; +>obj1 : Symbol(obj1, Decl(file.tsx, 23, 3)) + +let obj2 = { +>obj2 : Symbol(obj2, Decl(file.tsx, 24, 3)) + + onClick: () => {} +>onClick : Symbol(onClick, Decl(file.tsx, 24, 12)) +} + +export function MainButton(buttonProps: ButtonProps): JSX.Element; +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>buttonProps : Symbol(buttonProps, Decl(file.tsx, 28, 27)) +>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 5, 1)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +export function MainButton(linkProps: LinkProps): JSX.Element; +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>linkProps : Symbol(linkProps, Decl(file.tsx, 29, 27)) +>LinkProps : Symbol(LinkProps, Decl(file.tsx, 9, 1)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +export function MainButton(hyphenProps: HyphenProps): JSX.Element; +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>hyphenProps : Symbol(hyphenProps, Decl(file.tsx, 30, 27)) +>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 13, 1)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element { +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>props : Symbol(props, Decl(file.tsx, 31, 27)) +>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 5, 1)) +>LinkProps : Symbol(LinkProps, Decl(file.tsx, 9, 1)) +>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 13, 1)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + + const linkProps = props as LinkProps; +>linkProps : Symbol(linkProps, Decl(file.tsx, 32, 9)) +>props : Symbol(props, Decl(file.tsx, 31, 27)) +>LinkProps : Symbol(LinkProps, Decl(file.tsx, 9, 1)) + + if(linkProps.to) { +>linkProps.to : Symbol(LinkProps.to, Decl(file.tsx, 11, 51)) +>linkProps : Symbol(linkProps, Decl(file.tsx, 32, 9)) +>to : Symbol(LinkProps.to, Decl(file.tsx, 11, 51)) + + return this._buildMainLink(props); +>props : Symbol(props, Decl(file.tsx, 31, 27)) + } + + return this._buildMainButton(props); +>props : Symbol(props, Decl(file.tsx, 31, 27)) +} + +// OK +const b0 = GO; +>b0 : Symbol(b0, Decl(file.tsx, 41, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>to : Symbol(to, Decl(file.tsx, 41, 22)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) + +const b1 = {}}>Hello world; +>b1 : Symbol(b1, Decl(file.tsx, 42, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>onClick : Symbol(onClick, Decl(file.tsx, 42, 22)) +>e : Symbol(e, Decl(file.tsx, 42, 33)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) + +const b2 = ; +>b2 : Symbol(b2, Decl(file.tsx, 43, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>obj : Symbol(obj, Decl(file.tsx, 19, 3)) + +const b3 = ; +>b3 : Symbol(b3, Decl(file.tsx, 44, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>to : Symbol(to, Decl(file.tsx, 44, 28)) +>obj : Symbol(obj, Decl(file.tsx, 19, 3)) + +const b4 = ; // any; just pick the first overload +>b4 : Symbol(b4, Decl(file.tsx, 45, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>obj1 : Symbol(obj1, Decl(file.tsx, 23, 3)) + +const b5 = ; // should pick the second overload +>b5 : Symbol(b5, Decl(file.tsx, 46, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>obj1 : Symbol(obj1, Decl(file.tsx, 23, 3)) +>to : Symbol(to, Decl(file.tsx, 46, 32)) + +const b6 = ; +>b6 : Symbol(b6, Decl(file.tsx, 47, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>obj2 : Symbol(obj2, Decl(file.tsx, 24, 3)) + +const b7 = { console.log("hi") }}} />; +>b7 : Symbol(b7, Decl(file.tsx, 48, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>onClick : Symbol(onClick, Decl(file.tsx, 48, 28)) +>console.log : Symbol(Console.log, Decl(lib.d.ts, --, --)) +>console : Symbol(console, Decl(lib.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.d.ts, --, --)) + +const b8 = ; // OK; method declaration get retained (See GitHub #13365) +>b8 : Symbol(b8, Decl(file.tsx, 49, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>onClick : Symbol(onClick, Decl(file.tsx, 49, 28)) + +const b9 = GO; +>b9 : Symbol(b9, Decl(file.tsx, 50, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>to : Symbol(to, Decl(file.tsx, 50, 22)) +>extra-prop : Symbol(extra-prop, Decl(file.tsx, 50, 38)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) + +const b10 = ; +>b10 : Symbol(b10, Decl(file.tsx, 51, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>to : Symbol(to, Decl(file.tsx, 51, 23)) +>children : Symbol(children, Decl(file.tsx, 51, 39)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) + +const b11 = {}} className="hello" data-format>Hello world; +>b11 : Symbol(b11, Decl(file.tsx, 52, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>onClick : Symbol(onClick, Decl(file.tsx, 52, 23)) +>e : Symbol(e, Decl(file.tsx, 52, 34)) +>className : Symbol(className, Decl(file.tsx, 52, 43)) +>data-format : Symbol(data-format, Decl(file.tsx, 52, 61)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) + +const b12 = +>b12 : Symbol(b12, Decl(file.tsx, 53, 5)) +>MainButton : Symbol(MainButton, Decl(file.tsx, 26, 1), Decl(file.tsx, 28, 66), Decl(file.tsx, 29, 62), Decl(file.tsx, 30, 66)) +>data-format : Symbol(data-format, Decl(file.tsx, 53, 23)) + + + diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.types b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.types new file mode 100644 index 0000000000..07faa2d101 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.types @@ -0,0 +1,206 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload6.tsx] //// + +=== file.tsx === +import React = require('react') +>React : typeof React + +export interface ClickableProps { + children?: string; +>children : string + + className?: string; +>className : string +} + +export interface ButtonProps extends ClickableProps { + onClick: React.MouseEventHandler; +>onClick : React.MouseEventHandler +>React : any +} + +export interface LinkProps extends ClickableProps { + to: string; +>to : string +} + +export interface HyphenProps extends ClickableProps { + "data-format": string; +>"data-format" : string +} + +let obj = { +>obj : { children: string; to: string; } +>{ children: "hi", to: "boo"} : { children: string; to: string; } + + children: "hi", +>children : string +>"hi" : "hi" + + to: "boo" +>to : string +>"boo" : "boo" +} +let obj1: any; +>obj1 : any + +let obj2 = { +>obj2 : { onClick: () => void; } +>{ onClick: () => {}} : { onClick: () => void; } + + onClick: () => {} +>onClick : () => void +>() => {} : () => void +} + +export function MainButton(buttonProps: ButtonProps): JSX.Element; +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>buttonProps : ButtonProps +>JSX : any + +export function MainButton(linkProps: LinkProps): JSX.Element; +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>linkProps : LinkProps +>JSX : any + +export function MainButton(hyphenProps: HyphenProps): JSX.Element; +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>hyphenProps : HyphenProps +>JSX : any + +export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element { +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>props : ButtonProps | HyphenProps | LinkProps +>JSX : any + + const linkProps = props as LinkProps; +>linkProps : LinkProps +>props as LinkProps : LinkProps +>props : ButtonProps | HyphenProps | LinkProps + + if(linkProps.to) { +>linkProps.to : string +>linkProps : LinkProps +>to : string + + return this._buildMainLink(props); +>this._buildMainLink(props) : any +>this._buildMainLink : any +>this : any +>_buildMainLink : any +>props : ButtonProps | HyphenProps | LinkProps + } + + return this._buildMainButton(props); +>this._buildMainButton(props) : any +>this._buildMainButton : any +>this : any +>_buildMainButton : any +>props : ButtonProps | HyphenProps | LinkProps +} + +// OK +const b0 = GO; +>b0 : JSX.Element +>GO : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>to : string +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } + +const b1 = {}}>Hello world; +>b1 : JSX.Element +> {}}>Hello world : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>onClick : (e: React.MouseEvent) => void +>(e) => {} : (e: React.MouseEvent) => void +>e : React.MouseEvent +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } + +const b2 = ; +>b2 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>obj : { children: string; to: string; } + +const b3 = ; +>b3 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>{to: 10000} : { to: number; } +>to : number +>10000 : 10000 +>obj : { children: string; to: string; } + +const b4 = ; // any; just pick the first overload +>b4 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>obj1 : any + +const b5 = ; // should pick the second overload +>b5 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>obj1 : any +>to : string + +const b6 = ; +>b6 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>obj2 : { onClick: () => void; } + +const b7 = { console.log("hi") }}} />; +>b7 : JSX.Element +> { console.log("hi") }}} /> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>{onClick: () => { console.log("hi") }} : { onClick: () => void; } +>onClick : () => void +>() => { console.log("hi") } : () => void +>console.log("hi") : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>"hi" : "hi" + +const b8 = ; // OK; method declaration get retained (See GitHub #13365) +>b8 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>{onClick() {}} : { onClick(): void; } +>onClick : () => void + +const b9 = GO; +>b9 : JSX.Element +>GO : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>to : string +>extra-prop : true +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } + +const b10 = ; +>b10 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>to : string +>children : string +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } + +const b11 = {}} className="hello" data-format>Hello world; +>b11 : JSX.Element +> {}} className="hello" data-format>Hello world : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>onClick : (e: React.MouseEvent) => void +>(e) => {} : (e: React.MouseEvent) => void +>e : React.MouseEvent +>className : string +>data-format : true +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } + +const b12 = +>b12 : JSX.Element +> : JSX.Element +>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } +>data-format : string + + + diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt new file mode 100644 index 0000000000..7c45fd97a1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt @@ -0,0 +1,36 @@ +file.tsx(9,15): error TS2769: No overload matches this call. + The last overload gave the following error. + Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'. +file.tsx(10,15): error TS2769: No overload matches this call. + The last overload gave the following error. + Type 'T & { "ignore-prop": true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'. + Type 'T & { "ignore-prop": true; }' is not assignable to type '{ b: unknown; a: unknown; }'. + Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: unknown; a: unknown; }'. + + +==== file.tsx (2 errors) ==== + import React = require('react') + + declare function OverloadComponent(): JSX.Element; + declare function OverloadComponent(attr: {b: U, a: string, "ignore-prop": boolean}): JSX.Element; + declare function OverloadComponent(attr: {b: U, a: T}): JSX.Element; + + // Error + function Baz(arg1: T, arg2: U) { + let a0 = + ~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'. +!!! related TS2728 file.tsx:5:49: 'b' is declared here. +!!! related TS2771 file.tsx:5:18: The last overload is declared here. + let a2 = // missing a + ~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Type 'T & { "ignore-prop": true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'. +!!! error TS2769: Type 'T & { "ignore-prop": true; }' is not assignable to type '{ b: unknown; a: unknown; }'. +!!! error TS2769: Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: unknown; a: unknown; }'. +!!! related TS2728 file.tsx:5:55: 'a' is declared here. +!!! related TS2771 file.tsx:5:18: The last overload is declared here. + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt.diff new file mode 100644 index 0000000000..853fdcd4c6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt.diff @@ -0,0 +1,60 @@ +--- old.tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt ++++ new.tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt +@@= skipped -0, +0 lines =@@ + file.tsx(9,15): error TS2769: No overload matches this call. +- Overload 1 of 3, '(): Element', gave the following error. +- Type '{ a: number; }' is not assignable to type 'IntrinsicAttributes'. +- Property 'a' does not exist on type 'IntrinsicAttributes'. +- Overload 2 of 3, '(attr: { b: unknown; a: string; "ignore-prop": boolean; }): Element', gave the following error. +- Type 'number' is not assignable to type 'string'. +- Overload 3 of 3, '(attr: { b: unknown; a: number; }): Element', gave the following error. ++ The last overload gave the following error. + Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'. + file.tsx(10,15): error TS2769: No overload matches this call. +- Overload 1 of 3, '(): Element', gave the following error. +- Type 'T & { "ignore-prop": true; }' has no properties in common with type 'IntrinsicAttributes'. +- Overload 2 of 3, '(attr: { b: number; a: string; "ignore-prop": boolean; }): Element', gave the following error. +- Type 'T & { "ignore-prop": true; }' is not assignable to type 'IntrinsicAttributes & { b: number; a: string; "ignore-prop": boolean; }'. +- Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: number; a: string; "ignore-prop": boolean; }'. +- Overload 3 of 3, '(attr: { b: unknown; a: unknown; }): Element', gave the following error. ++ The last overload gave the following error. + Type 'T & { "ignore-prop": true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'. +- Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: unknown; a: unknown; }'. ++ Type 'T & { "ignore-prop": true; }' is not assignable to type '{ b: unknown; a: unknown; }'. ++ Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: unknown; a: unknown; }'. + + + ==== file.tsx (2 errors) ==== +@@= skipped -28, +19 lines =@@ + let a0 = + ~~~~~~~~~~~~~~~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 3, '(): Element', gave the following error. +-!!! error TS2769: Type '{ a: number; }' is not assignable to type 'IntrinsicAttributes'. +-!!! error TS2769: Property 'a' does not exist on type 'IntrinsicAttributes'. +-!!! error TS2769: Overload 2 of 3, '(attr: { b: unknown; a: string; "ignore-prop": boolean; }): Element', gave the following error. +-!!! error TS2769: Type 'number' is not assignable to type 'string'. +-!!! error TS2769: Overload 3 of 3, '(attr: { b: unknown; a: number; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'. +-!!! related TS6500 file.tsx:4:52: The expected type comes from property 'a' which is declared here on type 'IntrinsicAttributes & { b: unknown; a: string; "ignore-prop": boolean; }' + !!! related TS2728 file.tsx:5:49: 'b' is declared here. ++!!! related TS2771 file.tsx:5:18: The last overload is declared here. + let a2 = // missing a + ~~~~~~~~~~~~~~~~~ + !!! error TS2769: No overload matches this call. +-!!! error TS2769: Overload 1 of 3, '(): Element', gave the following error. +-!!! error TS2769: Type 'T & { "ignore-prop": true; }' has no properties in common with type 'IntrinsicAttributes'. +-!!! error TS2769: Overload 2 of 3, '(attr: { b: number; a: string; "ignore-prop": boolean; }): Element', gave the following error. +-!!! error TS2769: Type 'T & { "ignore-prop": true; }' is not assignable to type 'IntrinsicAttributes & { b: number; a: string; "ignore-prop": boolean; }'. +-!!! error TS2769: Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: number; a: string; "ignore-prop": boolean; }'. +-!!! error TS2769: Overload 3 of 3, '(attr: { b: unknown; a: unknown; }): Element', gave the following error. ++!!! error TS2769: The last overload gave the following error. + !!! error TS2769: Type 'T & { "ignore-prop": true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'. +-!!! error TS2769: Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: unknown; a: unknown; }'. +-!!! related TS2728 file.tsx:4:52: 'a' is declared here. ++!!! error TS2769: Type 'T & { "ignore-prop": true; }' is not assignable to type '{ b: unknown; a: unknown; }'. ++!!! error TS2769: Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: unknown; a: unknown; }'. + !!! related TS2728 file.tsx:5:55: 'a' is declared here. ++!!! related TS2771 file.tsx:5:18: The last overload is declared here. + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.js b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.js new file mode 100644 index 0000000000..2805f76ef4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.js @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentsWithTypeArguments4.tsx] //// + +//// [file.tsx] +import React = require('react') + +declare function OverloadComponent(): JSX.Element; +declare function OverloadComponent(attr: {b: U, a: string, "ignore-prop": boolean}): JSX.Element; +declare function OverloadComponent(attr: {b: U, a: T}): JSX.Element; + +// Error +function Baz(arg1: T, arg2: U) { + let a0 = + let a2 = // missing a +} + +//// [file.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const React = require("react"); +// Error +function Baz(arg1, arg2) { + let a0 = ; + let a2 = ; // missing a +} diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.js.diff b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.js.diff new file mode 100644 index 0000000000..8b19422631 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.js.diff @@ -0,0 +1,11 @@ +--- old.tsxStatelessFunctionComponentsWithTypeArguments4.js ++++ new.tsxStatelessFunctionComponentsWithTypeArguments4.js +@@= skipped -15, +15 lines =@@ + //// [file.jsx] + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); +-var React = require("react"); ++const React = require("react"); + // Error + function Baz(arg1, arg2) { + let a0 = ; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.symbols b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.symbols new file mode 100644 index 0000000000..df279c9333 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.symbols @@ -0,0 +1,62 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentsWithTypeArguments4.tsx] //// + +=== file.tsx === +import React = require('react') +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +declare function OverloadComponent(): JSX.Element; +>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 100)) +>U : Symbol(U, Decl(file.tsx, 2, 35)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +declare function OverloadComponent(attr: {b: U, a: string, "ignore-prop": boolean}): JSX.Element; +>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 100)) +>U : Symbol(U, Decl(file.tsx, 3, 35)) +>attr : Symbol(attr, Decl(file.tsx, 3, 38)) +>b : Symbol(b, Decl(file.tsx, 3, 45)) +>U : Symbol(U, Decl(file.tsx, 3, 35)) +>a : Symbol(a, Decl(file.tsx, 3, 50)) +>"ignore-prop" : Symbol("ignore-prop", Decl(file.tsx, 3, 61)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +declare function OverloadComponent(attr: {b: U, a: T}): JSX.Element; +>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 100)) +>T : Symbol(T, Decl(file.tsx, 4, 35)) +>U : Symbol(U, Decl(file.tsx, 4, 37)) +>attr : Symbol(attr, Decl(file.tsx, 4, 41)) +>b : Symbol(b, Decl(file.tsx, 4, 48)) +>U : Symbol(U, Decl(file.tsx, 4, 37)) +>a : Symbol(a, Decl(file.tsx, 4, 53)) +>T : Symbol(T, Decl(file.tsx, 4, 35)) +>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1)) +>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27)) + +// Error +function Baz(arg1: T, arg2: U) { +>Baz : Symbol(Baz, Decl(file.tsx, 4, 74)) +>T : Symbol(T, Decl(file.tsx, 7, 13)) +>b : Symbol(b, Decl(file.tsx, 7, 24)) +>U : Symbol(U, Decl(file.tsx, 7, 35)) +>a : Symbol(a, Decl(file.tsx, 7, 47)) +>b : Symbol(b, Decl(file.tsx, 7, 58)) +>arg1 : Symbol(arg1, Decl(file.tsx, 7, 70)) +>T : Symbol(T, Decl(file.tsx, 7, 13)) +>arg2 : Symbol(arg2, Decl(file.tsx, 7, 78)) +>U : Symbol(U, Decl(file.tsx, 7, 35)) + + let a0 = +>a0 : Symbol(a0, Decl(file.tsx, 8, 7)) +>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 100)) +>a : Symbol(a, Decl(file.tsx, 8, 31)) +>arg1.b : Symbol(b, Decl(file.tsx, 7, 24)) +>arg1 : Symbol(arg1, Decl(file.tsx, 7, 70)) +>b : Symbol(b, Decl(file.tsx, 7, 24)) + + let a2 = // missing a +>a2 : Symbol(a2, Decl(file.tsx, 9, 7)) +>OverloadComponent : Symbol(OverloadComponent, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 53), Decl(file.tsx, 3, 100)) +>arg1 : Symbol(arg1, Decl(file.tsx, 7, 70)) +>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 9, 41)) +} diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.types b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.types new file mode 100644 index 0000000000..e1d8928ca2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.types @@ -0,0 +1,50 @@ +//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentsWithTypeArguments4.tsx] //// + +=== file.tsx === +import React = require('react') +>React : typeof React + +declare function OverloadComponent(): JSX.Element; +>OverloadComponent : { (): JSX.Element; (attr: { b: U; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U; a: T; }): JSX.Element; } +>JSX : any + +declare function OverloadComponent(attr: {b: U, a: string, "ignore-prop": boolean}): JSX.Element; +>OverloadComponent : { (): JSX.Element; (attr: { b: U; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U; a: T; }): JSX.Element; } +>attr : { b: U; a: string; "ignore-prop": boolean; } +>b : U +>a : string +>"ignore-prop" : boolean +>JSX : any + +declare function OverloadComponent(attr: {b: U, a: T}): JSX.Element; +>OverloadComponent : { (): JSX.Element; (attr: { b: U; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U; a: T; }): JSX.Element; } +>attr : { b: U; a: T; } +>b : U +>a : T +>JSX : any + +// Error +function Baz(arg1: T, arg2: U) { +>Baz : (arg1: T, arg2: U) => void +>b : number +>a : boolean +>b : string +>arg1 : T +>arg2 : U + + let a0 = +>a0 : JSX.Element +> : JSX.Element +>OverloadComponent : { (): JSX.Element; (attr: { b: U_1; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U_1; a: T_1; }): JSX.Element; } +>a : number +>arg1.b : number +>arg1 : T +>b : number + + let a2 = // missing a +>a2 : JSX.Element +> : JSX.Element +>OverloadComponent : { (): JSX.Element; (attr: { b: U_1; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U_1; a: T_1; }): JSX.Element; } +>arg1 : T +>ignore-prop : true +} diff --git a/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.types.diff b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.types.diff new file mode 100644 index 0000000000..3ec9d95e6b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.types.diff @@ -0,0 +1,25 @@ +--- old.tsxStatelessFunctionComponentsWithTypeArguments4.types ++++ new.tsxStatelessFunctionComponentsWithTypeArguments4.types +@@= skipped -4, +4 lines =@@ + >React : typeof React + + declare function OverloadComponent(): JSX.Element; +->OverloadComponent : { (): JSX.Element; (attr: { b: U_1; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U_1; a: T; }): JSX.Element; } ++>OverloadComponent : { (): JSX.Element; (attr: { b: U; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U; a: T; }): JSX.Element; } + >JSX : any + + declare function OverloadComponent(attr: {b: U, a: string, "ignore-prop": boolean}): JSX.Element; +->OverloadComponent : { (): JSX.Element; (attr: { b: U; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U_1; a: T; }): JSX.Element; } ++>OverloadComponent : { (): JSX.Element; (attr: { b: U; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U; a: T; }): JSX.Element; } + >attr : { b: U; a: string; "ignore-prop": boolean; } + >b : U + >a : string +@@= skipped -12, +12 lines =@@ + >JSX : any + + declare function OverloadComponent(attr: {b: U, a: T}): JSX.Element; +->OverloadComponent : { (): JSX.Element; (attr: { b: U_1; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U; a: T; }): JSX.Element; } ++>OverloadComponent : { (): JSX.Element; (attr: { b: U; a: string; "ignore-prop": boolean; }): JSX.Element; (attr: { b: U; a: T; }): JSX.Element; } + >attr : { b: U; a: T; } + >b : U + >a : T \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeAndNamespaceExportMerge.js b/testdata/baselines/reference/submodule/conformance/typeAndNamespaceExportMerge.js index d385a8b188..c093929c68 100644 --- a/testdata/baselines/reference/submodule/conformance/typeAndNamespaceExportMerge.js +++ b/testdata/baselines/reference/submodule/conformance/typeAndNamespaceExportMerge.js @@ -24,9 +24,42 @@ exports.COFFEE = 0; exports.TEA = 1; //// [drink.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Drink = void 0; -exports.Drink = require("./constants"); +exports.Drink = __importStar(require("./constants")); //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/typeAndNamespaceExportMerge.js.diff b/testdata/baselines/reference/submodule/conformance/typeAndNamespaceExportMerge.js.diff index bac5c4b29d..d87ccb44d9 100644 --- a/testdata/baselines/reference/submodule/conformance/typeAndNamespaceExportMerge.js.diff +++ b/testdata/baselines/reference/submodule/conformance/typeAndNamespaceExportMerge.js.diff @@ -1,6 +1,6 @@ --- old.typeAndNamespaceExportMerge.js +++ new.typeAndNamespaceExportMerge.js -@@= skipped -29, +29 lines =@@ +@@= skipped -62, +62 lines =@@ //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt new file mode 100644 index 0000000000..c367fd4d66 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt @@ -0,0 +1,35 @@ +use.js(3,8): error TS2554: Expected 1 arguments, but got 0. + + +==== use.js (1 errors) ==== + /// + var mini = require('./minimatch') + mini.M.defaults() + ~~~~~~~~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 minimatch.js:10:24: An argument for 'def' was not provided. + var m = new mini.M() + m.m() + mini.filter() + +==== types.d.ts (0 errors) ==== + declare var require: any; + declare var module: any; +==== minimatch.js (0 errors) ==== + /// + module.exports = minimatch + minimatch.M = M + minimatch.filter = filter + function filter() { + return minimatch() + } + function minimatch() { + } + M.defaults = function (def) { + return def + } + M.prototype.m = function () { + } + function M() { + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment7.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment7.errors.txt new file mode 100644 index 0000000000..f9855e7386 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment7.errors.txt @@ -0,0 +1,13 @@ +a.js(5,13): error TS2554: Expected 1 arguments, but got 0. + + +==== a.js (1 errors) ==== + var obj = {}; + obj.method = function (hunch) { + return true; + } + var b = obj.method(); + ~~~~~~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 a.js:2:24: An argument for 'hunch' was not provided. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeSatisfaction_js.errors.txt b/testdata/baselines/reference/submodule/conformance/typeSatisfaction_js.errors.txt deleted file mode 100644 index 20288daecd..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeSatisfaction_js.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -error TS5055: Cannot write file '/src/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -/src/a.js(1,29): error TS8037: Type satisfaction expressions can only be used in TypeScript files. - - -!!! error TS5055: Cannot write file '/src/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -==== /src/a.js (1 errors) ==== - var v = undefined satisfies 1; - ~ -!!! error TS8037: Type satisfaction expressions can only be used in TypeScript files. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeSatisfaction_js.symbols b/testdata/baselines/reference/submodule/conformance/typeSatisfaction_js.symbols deleted file mode 100644 index bde82c0a88..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeSatisfaction_js.symbols +++ /dev/null @@ -1,7 +0,0 @@ -//// [tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction_js.ts] //// - -=== /src/a.js === -var v = undefined satisfies 1; ->v : Symbol(v, Decl(a.js, 0, 3)) ->undefined : Symbol(undefined) - diff --git a/testdata/baselines/reference/submodule/conformance/typeSatisfaction_js.types b/testdata/baselines/reference/submodule/conformance/typeSatisfaction_js.types deleted file mode 100644 index 664a071c0b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeSatisfaction_js.types +++ /dev/null @@ -1,8 +0,0 @@ -//// [tests/cases/conformance/expressions/typeSatisfaction/typeSatisfaction_js.ts] //// - -=== /src/a.js === -var v = undefined satisfies 1; ->v : any ->undefined satisfies 1 : undefined ->undefined : undefined - diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types index 66450f41d4..73284b3c14 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types @@ -7,7 +7,7 @@ /**@type {IFn}*/ export function inJs(l) { ->inJs : (m: T) => T +>inJs : (l: T) => T >l : T return l; @@ -15,7 +15,7 @@ export function inJs(l) { } inJs(1); // lints error. Why? >inJs(1) : 1 ->inJs : (m: T) => T +>inJs : (l: T) => T >1 : 1 /**@type {IFn}*/ diff --git a/testdata/baselines/reference/submodule/conformance/typeTagWithGenericSignature.types b/testdata/baselines/reference/submodule/conformance/typeTagWithGenericSignature.types index 9f9358c9b0..f914e5dd2e 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagWithGenericSignature.types +++ b/testdata/baselines/reference/submodule/conformance/typeTagWithGenericSignature.types @@ -3,7 +3,7 @@ === bug25618.js === /** @type {(param?: T) => T | undefined} */ function typed(param) { ->typed : (param?: T | undefined) => T | undefined +>typed : (param: T | undefined) => T | undefined >param : T | undefined return param; @@ -13,7 +13,7 @@ function typed(param) { var n = typed(1); >n : number | undefined >typed(1) : 1 | undefined ->typed : (param?: T | undefined) => T | undefined +>typed : (param: T | undefined) => T | undefined >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.errors.txt deleted file mode 100644 index 5215c848c1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -/b/user.ts(1,19): error TS2307: Cannot find module 'a' or its corresponding type declarations. - - -!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -==== /a/package.json (0 errors) ==== - { - "types": "", - "typesVersions": { - ">=3.1.0-0": { "*" : ["ts3.1/*"] } - } - } - -==== /a/ts3.1/index.d.ts (0 errors) ==== - export const a = 0; - -==== /b/user.ts (1 errors) ==== - import { a } from "a"; - ~~~ -!!! error TS2307: Cannot find module 'a' or its corresponding type declarations. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.js b/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.js deleted file mode 100644 index 0bcc27d7a6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.js +++ /dev/null @@ -1,20 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts] //// - -//// [package.json] -{ - "types": "", - "typesVersions": { - ">=3.1.0-0": { "*" : ["ts3.1/*"] } - } -} - -//// [index.d.ts] -export const a = 0; - -//// [user.ts] -import { a } from "a"; - - -//// [user.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.symbols b/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.symbols deleted file mode 100644 index a07fb6cc18..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.symbols +++ /dev/null @@ -1,10 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts] //// - -=== /a/ts3.1/index.d.ts === -export const a = 0; ->a : Symbol(a, Decl(index.d.ts, 0, 12)) - -=== /b/user.ts === -import { a } from "a"; ->a : Symbol(a, Decl(user.ts, 0, 8)) - diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.trace.json b/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.trace.json deleted file mode 100644 index f7084a863a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.trace.json +++ /dev/null @@ -1,15 +0,0 @@ -======== Resolving module 'a' from '/b/user.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. -File '/b/package.json' does not exist. -File '/package.json' does not exist. -Loading module 'a' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. -Directory '/b/node_modules' does not exist, skipping all lookups in it. -Directory '/b/node_modules/@types' does not exist, skipping all lookups in it. -Directory '/node_modules' does not exist, skipping all lookups in it. -Directory '/node_modules/@types' does not exist, skipping all lookups in it. -Searching all ancestor node_modules directories for fallback extensions: JavaScript, JSON. -Directory '/b/node_modules' does not exist, skipping all lookups in it. -Directory '/node_modules' does not exist, skipping all lookups in it. -======== Module name 'a' was not resolved. ======== diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.types b/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.types deleted file mode 100644 index a0adfb4e56..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.types +++ /dev/null @@ -1,11 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts] //// - -=== /a/ts3.1/index.d.ts === -export const a = 0; ->a : 0 ->0 : 0 - -=== /b/user.ts === -import { a } from "a"; ->a : any - diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.types.diff b/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.types.diff deleted file mode 100644 index 0a3baf3dac..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.emptyTypes.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.typesVersions.emptyTypes.types -+++ new.typesVersions.emptyTypes.types -@@= skipped -6, +6 lines =@@ - - === /b/user.ts === - import { a } from "a"; -->a : 0 -+>a : any diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.errors.txt b/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.errors.txt deleted file mode 100644 index 805162ff97..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -/b/user.ts(1,19): error TS2307: Cannot find module 'a' or its corresponding type declarations. - - -!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -==== /a/package.json (0 errors) ==== - { - "typesVersions": { - ">=3.1.0-0": { "*" : ["ts3.1/*"] } - } - } - -==== /a/ts3.1/index.d.ts (0 errors) ==== - export const a = 0; - -==== /b/user.ts (1 errors) ==== - import { a } from "a"; - ~~~ -!!! error TS2307: Cannot find module 'a' or its corresponding type declarations. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.js b/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.js deleted file mode 100644 index 094376c7d0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.js +++ /dev/null @@ -1,19 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/typesVersions.justIndex.ts] //// - -//// [package.json] -{ - "typesVersions": { - ">=3.1.0-0": { "*" : ["ts3.1/*"] } - } -} - -//// [index.d.ts] -export const a = 0; - -//// [user.ts] -import { a } from "a"; - - -//// [user.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.symbols b/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.symbols deleted file mode 100644 index 6d8301a63a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.symbols +++ /dev/null @@ -1,10 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/typesVersions.justIndex.ts] //// - -=== /a/ts3.1/index.d.ts === -export const a = 0; ->a : Symbol(a, Decl(index.d.ts, 0, 12)) - -=== /b/user.ts === -import { a } from "a"; ->a : Symbol(a, Decl(user.ts, 0, 8)) - diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.trace.json b/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.trace.json deleted file mode 100644 index f7084a863a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.trace.json +++ /dev/null @@ -1,15 +0,0 @@ -======== Resolving module 'a' from '/b/user.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. -File '/b/package.json' does not exist. -File '/package.json' does not exist. -Loading module 'a' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. -Directory '/b/node_modules' does not exist, skipping all lookups in it. -Directory '/b/node_modules/@types' does not exist, skipping all lookups in it. -Directory '/node_modules' does not exist, skipping all lookups in it. -Directory '/node_modules/@types' does not exist, skipping all lookups in it. -Searching all ancestor node_modules directories for fallback extensions: JavaScript, JSON. -Directory '/b/node_modules' does not exist, skipping all lookups in it. -Directory '/node_modules' does not exist, skipping all lookups in it. -======== Module name 'a' was not resolved. ======== diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.types b/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.types deleted file mode 100644 index 6a09ed3804..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.types +++ /dev/null @@ -1,11 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/typesVersions.justIndex.ts] //// - -=== /a/ts3.1/index.d.ts === -export const a = 0; ->a : 0 ->0 : 0 - -=== /b/user.ts === -import { a } from "a"; ->a : any - diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.types.diff b/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.types.diff deleted file mode 100644 index f8f88f9949..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typesVersions.justIndex.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.typesVersions.justIndex.types -+++ new.typesVersions.justIndex.types -@@= skipped -6, +6 lines =@@ - - === /b/user.ts === - import { a } from "a"; -->a : 0 -+>a : any diff --git a/testdata/baselines/reference/submodule/conformance/umd-augmentation-1.js b/testdata/baselines/reference/submodule/conformance/umd-augmentation-1.js index 1f4f1971f0..feee836a2c 100644 --- a/testdata/baselines/reference/submodule/conformance/umd-augmentation-1.js +++ b/testdata/baselines/reference/submodule/conformance/umd-augmentation-1.js @@ -40,9 +40,42 @@ var t = p.x; //// [b.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); /// -const m = require("math2d"); +const m = __importStar(require("math2d")); let v = new m.Vector(3, 2); let magnitude = m.getLength(v); let p = v.translate(5, 5); diff --git a/testdata/baselines/reference/submodule/conformance/umd-augmentation-1.js.diff b/testdata/baselines/reference/submodule/conformance/umd-augmentation-1.js.diff index e2be0d238c..d455221ddf 100644 --- a/testdata/baselines/reference/submodule/conformance/umd-augmentation-1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/umd-augmentation-1.js.diff @@ -1,11 +1,11 @@ --- old.umd-augmentation-1.js +++ new.umd-augmentation-1.js -@@= skipped -41, +41 lines =@@ - "use strict"; +@@= skipped -74, +74 lines =@@ + })(); Object.defineProperty(exports, "__esModule", { value: true }); /// --var m = require("math2d"); -+const m = require("math2d"); +-var m = __importStar(require("math2d")); ++const m = __importStar(require("math2d")); let v = new m.Vector(3, 2); let magnitude = m.getLength(v); let p = v.translate(5, 5); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/umd-augmentation-3.js b/testdata/baselines/reference/submodule/conformance/umd-augmentation-3.js index d75e2ddee3..d23484175c 100644 --- a/testdata/baselines/reference/submodule/conformance/umd-augmentation-3.js +++ b/testdata/baselines/reference/submodule/conformance/umd-augmentation-3.js @@ -46,9 +46,42 @@ var t = p.x; //// [b.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); /// -const m = require("math2d"); +const m = __importStar(require("math2d")); let v = new m.Vector(3, 2); let magnitude = m.getLength(v); let p = v.translate(5, 5); diff --git a/testdata/baselines/reference/submodule/conformance/umd-augmentation-3.js.diff b/testdata/baselines/reference/submodule/conformance/umd-augmentation-3.js.diff index 3a66b71e3e..01caf46c18 100644 --- a/testdata/baselines/reference/submodule/conformance/umd-augmentation-3.js.diff +++ b/testdata/baselines/reference/submodule/conformance/umd-augmentation-3.js.diff @@ -1,11 +1,11 @@ --- old.umd-augmentation-3.js +++ new.umd-augmentation-3.js -@@= skipped -47, +47 lines =@@ - "use strict"; +@@= skipped -80, +80 lines =@@ + })(); Object.defineProperty(exports, "__esModule", { value: true }); /// --var m = require("math2d"); -+const m = require("math2d"); +-var m = __importStar(require("math2d")); ++const m = __importStar(require("math2d")); let v = new m.Vector(3, 2); let magnitude = m.getLength(v); let p = v.translate(5, 5); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/umd3.js b/testdata/baselines/reference/submodule/conformance/umd3.js index 927ea391c6..9e4f2a863d 100644 --- a/testdata/baselines/reference/submodule/conformance/umd3.js +++ b/testdata/baselines/reference/submodule/conformance/umd3.js @@ -15,8 +15,41 @@ let y: number = x.n; //// [a.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const Foo = require("./foo"); +const Foo = __importStar(require("./foo")); Foo.fn(); let x; let y = x.n; diff --git a/testdata/baselines/reference/submodule/conformance/umd3.js.diff b/testdata/baselines/reference/submodule/conformance/umd3.js.diff index dd6be58e39..c4b1270cf4 100644 --- a/testdata/baselines/reference/submodule/conformance/umd3.js.diff +++ b/testdata/baselines/reference/submodule/conformance/umd3.js.diff @@ -1,11 +1,11 @@ --- old.umd3.js +++ new.umd3.js -@@= skipped -15, +15 lines =@@ - //// [a.js] - "use strict"; +@@= skipped -48, +48 lines =@@ + }; + })(); Object.defineProperty(exports, "__esModule", { value: true }); --var Foo = require("./foo"); -+const Foo = require("./foo"); +-var Foo = __importStar(require("./foo")); ++const Foo = __importStar(require("./foo")); Foo.fn(); let x; let y = x.n; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/umd4.js b/testdata/baselines/reference/submodule/conformance/umd4.js index 32d4f9360a..153fddf07d 100644 --- a/testdata/baselines/reference/submodule/conformance/umd4.js +++ b/testdata/baselines/reference/submodule/conformance/umd4.js @@ -15,8 +15,41 @@ let y: number = x.n; //// [a.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const Bar = require("./foo"); +const Bar = __importStar(require("./foo")); Bar.fn(); let x; let y = x.n; diff --git a/testdata/baselines/reference/submodule/conformance/umd4.js.diff b/testdata/baselines/reference/submodule/conformance/umd4.js.diff index ba9be7048f..e2d3876661 100644 --- a/testdata/baselines/reference/submodule/conformance/umd4.js.diff +++ b/testdata/baselines/reference/submodule/conformance/umd4.js.diff @@ -1,11 +1,11 @@ --- old.umd4.js +++ new.umd4.js -@@= skipped -15, +15 lines =@@ - //// [a.js] - "use strict"; +@@= skipped -48, +48 lines =@@ + }; + })(); Object.defineProperty(exports, "__esModule", { value: true }); --var Bar = require("./foo"); -+const Bar = require("./foo"); +-var Bar = __importStar(require("./foo")); ++const Bar = __importStar(require("./foo")); Bar.fn(); let x; let y = x.n; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/umd5.js b/testdata/baselines/reference/submodule/conformance/umd5.js index 0ee9c2d420..781ac917b6 100644 --- a/testdata/baselines/reference/submodule/conformance/umd5.js +++ b/testdata/baselines/reference/submodule/conformance/umd5.js @@ -17,8 +17,41 @@ let z = Foo; //// [a.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const Bar = require("./foo"); +const Bar = __importStar(require("./foo")); Bar.fn(); let x; let y = x.n; diff --git a/testdata/baselines/reference/submodule/conformance/umd5.js.diff b/testdata/baselines/reference/submodule/conformance/umd5.js.diff index 0746600b2a..22cc2dfa8c 100644 --- a/testdata/baselines/reference/submodule/conformance/umd5.js.diff +++ b/testdata/baselines/reference/submodule/conformance/umd5.js.diff @@ -1,11 +1,11 @@ --- old.umd5.js +++ new.umd5.js -@@= skipped -17, +17 lines =@@ - //// [a.js] - "use strict"; +@@= skipped -50, +50 lines =@@ + }; + })(); Object.defineProperty(exports, "__esModule", { value: true }); --var Bar = require("./foo"); -+const Bar = require("./foo"); +-var Bar = __importStar(require("./foo")); ++const Bar = __importStar(require("./foo")); Bar.fn(); let x; let y = x.n; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/umd8.symbols b/testdata/baselines/reference/submodule/conformance/umd8.symbols index 7809a99f8f..0cb5bdf2f2 100644 --- a/testdata/baselines/reference/submodule/conformance/umd8.symbols +++ b/testdata/baselines/reference/submodule/conformance/umd8.symbols @@ -10,9 +10,9 @@ let y: Foo; // OK in type position >Foo : Symbol(Foo, Decl(foo.d.ts, 6, 15)) y.foo(); ->y.foo : Symbol(ff.foo, Decl(foo.d.ts, 0, 21)) +>y.foo : Symbol(Thing.foo, Decl(foo.d.ts, 0, 21)) >y : Symbol(y, Decl(a.ts, 3, 3)) ->foo : Symbol(ff.foo, Decl(foo.d.ts, 0, 21)) +>foo : Symbol(Thing.foo, Decl(foo.d.ts, 0, 21)) let z: Foo.SubThing; // OK in ns position >z : Symbol(z, Decl(a.ts, 5, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/umd8.types b/testdata/baselines/reference/submodule/conformance/umd8.types index 7b24d2532b..41ad295eab 100644 --- a/testdata/baselines/reference/submodule/conformance/umd8.types +++ b/testdata/baselines/reference/submodule/conformance/umd8.types @@ -6,12 +6,12 @@ import * as ff from './foo'; >ff : typeof ff let y: Foo; // OK in type position ->y : ff +>y : import("foo") y.foo(); >y.foo() : number >y.foo : () => number ->y : ff +>y : import("foo") >foo : () => number let z: Foo.SubThing; // OK in ns position @@ -20,7 +20,7 @@ let z: Foo.SubThing; // OK in ns position let x: any = Foo; // Not OK in value position >x : any ->Foo : typeof ff +>Foo : typeof import("foo") === foo.d.ts === declare class Thing { diff --git a/testdata/baselines/reference/submodule/conformance/unannotatedParametersAreOptional.errors.txt b/testdata/baselines/reference/submodule/conformance/unannotatedParametersAreOptional.errors.txt new file mode 100644 index 0000000000..a9378e3b62 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/unannotatedParametersAreOptional.errors.txt @@ -0,0 +1,48 @@ +test.js(2,1): error TS2554: Expected 1 arguments, but got 0. +test.js(10,3): error TS2554: Expected 1 arguments, but got 0. +test.js(11,9): error TS2554: Expected 1 arguments, but got 0. +test.js(12,9): error TS2554: Expected 1 arguments, but got 0. +test.js(19,5): error TS2554: Expected 1 arguments, but got 0. +test.js(20,5): error TS2554: Expected 1 arguments, but got 0. + + +==== test.js (6 errors) ==== + function f(x) {} + f(); // Always been ok + ~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 test.js:1:12: An argument for 'x' was not provided. + + class C { + static m(x) {} + p = x => {} + m(x) {} + } + + C.m(); // Always been ok + ~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 test.js:5:12: An argument for 'x' was not provided. + new C().m(); // Regression #39261 + ~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 test.js:7:5: An argument for 'x' was not provided. + new C().p(); // Regression #39261 + ~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 test.js:6:7: An argument for 'x' was not provided. + + const obj = { + m(x) {}, + p: x => {} + }; + + obj.m(); // Always been ok + ~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 test.js:15:5: An argument for 'x' was not provided. + obj.p(); // Always been ok + ~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 test.js:16:6: An argument for 'x' was not provided. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt deleted file mode 100644 index 4610ce0280..0000000000 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -error TS5055: Cannot write file 'uniqueSymbolsDeclarationsInJs.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - - -!!! error TS5055: Cannot write file 'uniqueSymbolsDeclarationsInJs.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -==== uniqueSymbolsDeclarationsInJs.js (0 errors) ==== - // classes - class C { - /** - * @readonly - */ - static readonlyStaticCall = Symbol(); - /** - * @type {unique symbol} - * @readonly - */ - static readonlyStaticType; - /** - * @type {unique symbol} - * @readonly - */ - static readonlyStaticTypeAndCall = Symbol(); - static readwriteStaticCall = Symbol(); - - /** - * @readonly - */ - readonlyCall = Symbol(); - readwriteCall = Symbol(); - } - - /** @type {unique symbol} */ - const a = Symbol(); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.symbols b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.symbols deleted file mode 100644 index 0c2db05922..0000000000 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.symbols +++ /dev/null @@ -1,50 +0,0 @@ -//// [tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJs.ts] //// - -=== uniqueSymbolsDeclarationsInJs.js === -// classes -class C { ->C : Symbol(C, Decl(uniqueSymbolsDeclarationsInJs.js, 0, 0)) - - /** - * @readonly - */ - static readonlyStaticCall = Symbol(); ->readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbolsDeclarationsInJs.js, 1, 9)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) - - /** - * @type {unique symbol} - * @readonly - */ - static readonlyStaticType; ->readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbolsDeclarationsInJs.js, 5, 41)) - - /** - * @type {unique symbol} - * @readonly - */ - static readonlyStaticTypeAndCall = Symbol(); ->readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarationsInJs.js, 10, 30)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) - - static readwriteStaticCall = Symbol(); ->readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbolsDeclarationsInJs.js, 15, 48)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) - - /** - * @readonly - */ - readonlyCall = Symbol(); ->readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarationsInJs.js, 16, 42)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) - - readwriteCall = Symbol(); ->readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarationsInJs.js, 21, 28)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) -} - -/** @type {unique symbol} */ -const a = Symbol(); ->a : Symbol(a, Decl(uniqueSymbolsDeclarationsInJs.js, 26, 5)) ->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) - diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types deleted file mode 100644 index e812b448aa..0000000000 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types +++ /dev/null @@ -1,56 +0,0 @@ -//// [tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJs.ts] //// - -=== uniqueSymbolsDeclarationsInJs.js === -// classes -class C { ->C : C - - /** - * @readonly - */ - static readonlyStaticCall = Symbol(); ->readonlyStaticCall : unique symbol ->Symbol() : unique symbol ->Symbol : SymbolConstructor - - /** - * @type {unique symbol} - * @readonly - */ - static readonlyStaticType; ->readonlyStaticType : unique symbol - - /** - * @type {unique symbol} - * @readonly - */ - static readonlyStaticTypeAndCall = Symbol(); ->readonlyStaticTypeAndCall : unique symbol ->Symbol() : unique symbol ->Symbol : SymbolConstructor - - static readwriteStaticCall = Symbol(); ->readwriteStaticCall : symbol ->Symbol() : symbol ->Symbol : SymbolConstructor - - /** - * @readonly - */ - readonlyCall = Symbol(); ->readonlyCall : symbol ->Symbol() : symbol ->Symbol : SymbolConstructor - - readwriteCall = Symbol(); ->readwriteCall : symbol ->Symbol() : symbol ->Symbol : SymbolConstructor -} - -/** @type {unique symbol} */ -const a = Symbol(); ->a : unique symbol ->Symbol() : unique symbol ->Symbol : SymbolConstructor - diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt deleted file mode 100644 index d5f7425d9b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -error TS5055: Cannot write file 'uniqueSymbolsDeclarationsInJsErrors.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -uniqueSymbolsDeclarationsInJsErrors.js(5,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -uniqueSymbolsDeclarationsInJsErrors.js(14,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - - -!!! error TS5055: Cannot write file 'uniqueSymbolsDeclarationsInJsErrors.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -==== uniqueSymbolsDeclarationsInJsErrors.js (2 errors) ==== - class C { - /** - * @type {unique symbol} - */ - static readwriteStaticType; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - /** - * @type {unique symbol} - * @readonly - */ - static readonlyType; - /** - * @type {unique symbol} - */ - static readwriteType; - ~~~~~~~~~~~~~ -!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.symbols b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.symbols deleted file mode 100644 index 44e440f38b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.symbols +++ /dev/null @@ -1,26 +0,0 @@ -//// [tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJsErrors.ts] //// - -=== uniqueSymbolsDeclarationsInJsErrors.js === -class C { ->C : Symbol(C, Decl(uniqueSymbolsDeclarationsInJsErrors.js, 0, 0)) - - /** - * @type {unique symbol} - */ - static readwriteStaticType; ->readwriteStaticType : Symbol(C.readwriteStaticType, Decl(uniqueSymbolsDeclarationsInJsErrors.js, 0, 9)) - - /** - * @type {unique symbol} - * @readonly - */ - static readonlyType; ->readonlyType : Symbol(C.readonlyType, Decl(uniqueSymbolsDeclarationsInJsErrors.js, 4, 31)) - - /** - * @type {unique symbol} - */ - static readwriteType; ->readwriteType : Symbol(C.readwriteType, Decl(uniqueSymbolsDeclarationsInJsErrors.js, 9, 24)) -} - diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types deleted file mode 100644 index 8efd009a30..0000000000 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types +++ /dev/null @@ -1,26 +0,0 @@ -//// [tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsInJsErrors.ts] //// - -=== uniqueSymbolsDeclarationsInJsErrors.js === -class C { ->C : C - - /** - * @type {unique symbol} - */ - static readwriteStaticType; ->readwriteStaticType : symbol - - /** - * @type {unique symbol} - * @readonly - */ - static readonlyType; ->readonlyType : unique symbol - - /** - * @type {unique symbol} - */ - static readwriteType; ->readwriteType : symbol -} - diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport.js b/testdata/baselines/reference/submodule/conformance/untypedModuleImport.js index e32444357a..2a1373f9f6 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport.js +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport.js @@ -20,8 +20,41 @@ foo(bar()); //// [a.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const foo = require("foo"); +const foo = __importStar(require("foo")); foo.bar(); //// [b.js] "use strict"; @@ -30,8 +63,41 @@ const foo = require("foo"); foo(); //// [c.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const foo_1 = require("foo"); +const foo_1 = __importStar(require("foo")); require("./a"); require("./b"); (0, foo_1.default)((0, foo_1.bar)()); diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport.js.diff b/testdata/baselines/reference/submodule/conformance/untypedModuleImport.js.diff index 3ce5e42a63..84164e61eb 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport.js.diff +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport.js.diff @@ -1,11 +1,11 @@ --- old.untypedModuleImport.js +++ new.untypedModuleImport.js -@@= skipped -20, +20 lines =@@ - //// [a.js] - "use strict"; +@@= skipped -53, +53 lines =@@ + }; + })(); Object.defineProperty(exports, "__esModule", { value: true }); --var foo = require("foo"); -+const foo = require("foo"); +-var foo = __importStar(require("foo")); ++const foo = __importStar(require("foo")); foo.bar(); //// [b.js] "use strict"; @@ -15,9 +15,12 @@ foo(); //// [c.js] "use strict"; +@@= skipped -43, +43 lines =@@ + }; + })(); Object.defineProperty(exports, "__esModule", { value: true }); --var foo_1 = require("foo"); -+const foo_1 = require("foo"); +-var foo_1 = __importStar(require("foo")); ++const foo_1 = __importStar(require("foo")); require("./a"); require("./b"); (0, foo_1.default)((0, foo_1.bar)()); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.js b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.js index a85b8d66ea..cf974a2ca6 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.js +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.js @@ -10,6 +10,9 @@ foo.bar(); //// [a.js] "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const foo_1 = require("foo"); +const foo_1 = __importDefault(require("foo")); foo_1.default.bar(); diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.js.diff b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.js.diff index a755437f9d..b780930711 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.js.diff +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.js.diff @@ -1,9 +1,9 @@ --- old.untypedModuleImport_allowJs.js +++ new.untypedModuleImport_allowJs.js -@@= skipped -10, +10 lines =@@ - //// [a.js] - "use strict"; +@@= skipped -13, +13 lines =@@ + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; Object.defineProperty(exports, "__esModule", { value: true }); --var foo_1 = require("foo"); -+const foo_1 = require("foo"); +-var foo_1 = __importDefault(require("foo")); ++const foo_1 = __importDefault(require("foo")); foo_1.default.bar(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).errors.txt b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).errors.txt deleted file mode 100644 index 906193198a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -/main.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. - - -==== /decl.d.ts (0 errors) ==== - declare class CJSy {} - export = CJSy; - -==== /ambient.d.ts (0 errors) ==== - declare module "ambient" { - const _export: number; - export = _export; - } - -==== /types.ts (0 errors) ==== - interface Typey {} - export type { Typey }; - -==== /main.ts (1 errors) ==== - import CJSy = require("./decl"); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. - import type CJSy2 = require("./decl"); // ok I guess? - import CJSy3 from "./decl"; // ok in esModuleInterop - import * as types from "./types"; // ok - CJSy; - -==== /ns.ts (0 errors) ==== - export namespace ns { - export enum A {} - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).js b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).js deleted file mode 100644 index 57efd689b0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).js +++ /dev/null @@ -1,43 +0,0 @@ -//// [tests/cases/conformance/externalModules/verbatimModuleSyntaxRestrictionsESM.ts] //// - -//// [decl.d.ts] -declare class CJSy {} -export = CJSy; - -//// [ambient.d.ts] -declare module "ambient" { - const _export: number; - export = _export; -} - -//// [types.ts] -interface Typey {} -export type { Typey }; - -//// [main.ts] -import CJSy = require("./decl"); // error -import type CJSy2 = require("./decl"); // ok I guess? -import CJSy3 from "./decl"; // ok in esModuleInterop -import * as types from "./types"; // ok -CJSy; - -//// [ns.ts] -export namespace ns { - export enum A {} -} - - -//// [types.js] -export {}; -//// [main.js] -import CJSy3 from "./decl"; // ok in esModuleInterop -import * as types from "./types"; // ok -CJSy; -//// [ns.js] -export { ns }; -var ns; -(function (ns) { - let A; - (function (A) { - })(A = ns.A || (ns.A = {})); -})(ns || (ns = {})); diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).js.diff b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).js.diff deleted file mode 100644 index 6c56f68a9b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).js -+++ new.verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).js -@@= skipped -33, +33 lines =@@ - import * as types from "./types"; // ok - CJSy; - //// [ns.js] --export var ns; -+export { ns }; -+var ns; - (function (ns) { - let A; - (function (A) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).symbols b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).symbols deleted file mode 100644 index e270b023b7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).symbols +++ /dev/null @@ -1,51 +0,0 @@ -//// [tests/cases/conformance/externalModules/verbatimModuleSyntaxRestrictionsESM.ts] //// - -=== /decl.d.ts === -declare class CJSy {} ->CJSy : Symbol(CJSy, Decl(decl.d.ts, 0, 0)) - -export = CJSy; ->CJSy : Symbol(CJSy, Decl(decl.d.ts, 0, 0)) - -=== /ambient.d.ts === -declare module "ambient" { ->"ambient" : Symbol("ambient", Decl(ambient.d.ts, 0, 0)) - - const _export: number; ->_export : Symbol(_export, Decl(ambient.d.ts, 1, 9)) - - export = _export; ->_export : Symbol(_export, Decl(ambient.d.ts, 1, 9)) -} - -=== /types.ts === -interface Typey {} ->Typey : Symbol(Typey, Decl(types.ts, 0, 0)) - -export type { Typey }; ->Typey : Symbol(Typey, Decl(types.ts, 1, 13)) - -=== /main.ts === -import CJSy = require("./decl"); // error ->CJSy : Symbol(CJSy, Decl(main.ts, 0, 0)) - -import type CJSy2 = require("./decl"); // ok I guess? ->CJSy2 : Symbol(CJSy2, Decl(main.ts, 0, 32)) - -import CJSy3 from "./decl"; // ok in esModuleInterop ->CJSy3 : Symbol(CJSy3, Decl(main.ts, 2, 6)) - -import * as types from "./types"; // ok ->types : Symbol(types, Decl(main.ts, 3, 6)) - -CJSy; ->CJSy : Symbol(CJSy, Decl(main.ts, 0, 0)) - -=== /ns.ts === -export namespace ns { ->ns : Symbol(ns, Decl(ns.ts, 0, 0)) - - export enum A {} ->A : Symbol(A, Decl(ns.ts, 0, 21)) -} - diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).types b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).types deleted file mode 100644 index 5099017f15..0000000000 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsESM(esmoduleinterop=false).types +++ /dev/null @@ -1,49 +0,0 @@ -//// [tests/cases/conformance/externalModules/verbatimModuleSyntaxRestrictionsESM.ts] //// - -=== /decl.d.ts === -declare class CJSy {} ->CJSy : CJSy - -export = CJSy; ->CJSy : CJSy - -=== /ambient.d.ts === -declare module "ambient" { ->"ambient" : typeof import("ambient") - - const _export: number; ->_export : number - - export = _export; ->_export : number -} - -=== /types.ts === -interface Typey {} -export type { Typey }; ->Typey : Typey - -=== /main.ts === -import CJSy = require("./decl"); // error ->CJSy : typeof CJSy - -import type CJSy2 = require("./decl"); // ok I guess? ->CJSy2 : typeof CJSy - -import CJSy3 from "./decl"; // ok in esModuleInterop ->CJSy3 : typeof CJSy - -import * as types from "./types"; // ok ->types : typeof types - -CJSy; ->CJSy : typeof CJSy - -=== /ns.ts === -export namespace ns { ->ns : typeof ns - - export enum A {} ->A : A -} - diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/alwaysStrictModule2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/alwaysStrictModule2.errors.txt.diff deleted file mode 100644 index 5aa82f0160..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/alwaysStrictModule2.errors.txt.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.alwaysStrictModule2.errors.txt -+++ new.alwaysStrictModule2.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - a.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode. - b.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode. - - -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== a.ts (1 errors) ==== - module M { - export function f() { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.errors.txt.diff index 13e92bf5ea..a310bbe6cb 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.errors.txt.diff @@ -3,10 +3,11 @@ @@= skipped -0, +0 lines =@@ - +main.js(3,9): error TS2554: Expected 0 arguments, but got 3. -+main.js(6,16): error TS2554: Expected 0-2 arguments, but got 3. ++main.js(5,1): error TS2554: Expected 2 arguments, but got 0. ++main.js(6,16): error TS2554: Expected 2 arguments, but got 3. + + -+==== main.js (2 errors) ==== ++==== main.js (3 errors) ==== + function allRest() { arguments; } + allRest(); + allRest(1, 2, 3); @@ -14,9 +15,12 @@ +!!! error TS2554: Expected 0 arguments, but got 3. + function someRest(x, y) { arguments; } + someRest(); // x and y are still optional because they are in a JS file ++ ~~~~~~~~ ++!!! error TS2554: Expected 2 arguments, but got 0. ++!!! related TS6210 main.js:4:19: An argument for 'x' was not provided. + someRest(1, 2, 3); + ~ -+!!! error TS2554: Expected 0-2 arguments, but got 3. ++!!! error TS2554: Expected 2 arguments, but got 3. + + /** + * @param {number} x - a thing diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode1.errors.txt.diff new file mode 100644 index 0000000000..74f3c2eccd --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode1.errors.txt.diff @@ -0,0 +1,15 @@ +--- old.argumentsPropertyNameInJsMode1.errors.txt ++++ new.argumentsPropertyNameInJsMode1.errors.txt +@@= skipped -0, +0 lines =@@ +-a.js(9,7): error TS2554: Expected 0-1 arguments, but got 3. ++a.js(9,7): error TS2554: Expected 1 arguments, but got 3. + + + ==== a.js (1 errors) ==== +@@= skipped -11, +11 lines =@@ + + f2(1, 2, 3); + ~~~~ +-!!! error TS2554: Expected 0-1 arguments, but got 3. ++!!! error TS2554: Expected 1 arguments, but got 3. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode2.errors.txt.diff index 3a8c657d10..4b482bf1ad 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode2.errors.txt.diff @@ -2,7 +2,7 @@ +++ new.argumentsPropertyNameInJsMode2.errors.txt @@= skipped -0, +0 lines =@@ - -+a.js(5,6): error TS2554: Expected 0-1 arguments, but got 3. ++a.js(5,6): error TS2554: Expected 1 arguments, but got 3. + + +==== a.js (1 errors) ==== @@ -12,5 +12,5 @@ + + f(1, 2, 3); + ~~~~ -+!!! error TS2554: Expected 0-1 arguments, but got 3. ++!!! error TS2554: Expected 1 arguments, but got 3. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInFunction1_Js.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInFunction1_Js.errors.txt.diff index 2d9239a61e..fd91514e04 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInFunction1_Js.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInFunction1_Js.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +0 lines =@@ index.js(1,25): error TS7006: Parameter 'f' implicitly has an 'any' type. -index.js(13,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f?: any, ...any[]]'. -+index.js(13,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f?: any]'. ++index.js(13,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f: any]'. ==== index.js (2 errors) ==== @@ -12,6 +12,6 @@ return format.apply(null, arguments); ~~~~~~~~~ -!!! error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f?: any, ...any[]]'. -+!!! error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f?: any]'. ++!!! error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f: any]'. }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/blockScopedClassDeclarationAcrossFiles.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/blockScopedClassDeclarationAcrossFiles.errors.txt.diff deleted file mode 100644 index b1a20b8669..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/blockScopedClassDeclarationAcrossFiles.errors.txt.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.blockScopedClassDeclarationAcrossFiles.errors.txt -+++ new.blockScopedClassDeclarationAcrossFiles.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== c.ts (0 errors) ==== -+ let foo: typeof C; -+==== b.ts (0 errors) ==== -+ class C { } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/bundledDtsLateExportRenaming.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/bundledDtsLateExportRenaming.errors.txt.diff deleted file mode 100644 index 3342101d79..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/bundledDtsLateExportRenaming.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.bundledDtsLateExportRenaming.errors.txt -+++ new.bundledDtsLateExportRenaming.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== index.ts (0 errors) ==== -+ export * from "./nested"; -+ -+==== nested/base.ts (0 errors) ==== -+ import { B } from "./shared"; -+ -+ export function f() { -+ return new B(); -+ } -+ -+==== nested/derived.ts (0 errors) ==== -+ import { f } from "./base"; -+ -+ export function g() { -+ return f(); -+ } -+ -+==== nested/index.ts (0 errors) ==== -+ export * from "./base"; -+ -+ export * from "./derived"; -+ export * from "./shared"; -+ -+==== nested/shared.ts (0 errors) ==== -+ export class B {} -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkIndexConstraintOfJavascriptClassExpression.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkIndexConstraintOfJavascriptClassExpression.errors.txt.diff deleted file mode 100644 index 09726f841b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkIndexConstraintOfJavascriptClassExpression.errors.txt.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.checkIndexConstraintOfJavascriptClassExpression.errors.txt -+++ new.checkIndexConstraintOfJavascriptClassExpression.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - weird.js(1,1): error TS2552: Cannot find name 'someFunction'. Did you mean 'Function'? - weird.js(1,23): error TS7006: Parameter 'BaseClass' implicitly has an 'any' type. - weird.js(9,17): error TS7006: Parameter 'error' implicitly has an 'any' type. - - -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== weird.js (3 errors) ==== - someFunction(function(BaseClass) { - ~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/compilerOptionsOutAndNoEmit.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/compilerOptionsOutAndNoEmit.errors.txt.diff deleted file mode 100644 index 6cb4262746..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/compilerOptionsOutAndNoEmit.errors.txt.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.compilerOptionsOutAndNoEmit.errors.txt -+++ new.compilerOptionsOutAndNoEmit.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ class c { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/compilerOptionsOutFileAndNoEmit.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/compilerOptionsOutFileAndNoEmit.errors.txt.diff deleted file mode 100644 index c210d371cc..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/compilerOptionsOutFileAndNoEmit.errors.txt.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.compilerOptionsOutFileAndNoEmit.errors.txt -+++ new.compilerOptionsOutFileAndNoEmit.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ class c { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/constDeclarations-useBeforeDefinition2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/constDeclarations-useBeforeDefinition2.errors.txt.diff deleted file mode 100644 index 3dc83ed037..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/constDeclarations-useBeforeDefinition2.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.constDeclarations-useBeforeDefinition2.errors.txt -+++ new.constDeclarations-useBeforeDefinition2.errors.txt -@@= skipped -0, +0 lines =@@ --file1.ts(1,1): error TS2448: Block-scoped variable 'c' used before its declaration. -- -- --==== file1.ts (1 errors) ==== -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== file1.ts (0 errors) ==== - c; -- ~ --!!! error TS2448: Block-scoped variable 'c' used before its declaration. --!!! related TS2728 file2.ts:1:7: 'c' is declared here. - - ==== file2.ts (0 errors) ==== - const c = 0; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/controlFlowJavascript.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/controlFlowJavascript.errors.txt.diff deleted file mode 100644 index 8e5ff57b1c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/controlFlowJavascript.errors.txt.diff +++ /dev/null @@ -1,117 +0,0 @@ ---- old.controlFlowJavascript.errors.txt -+++ new.controlFlowJavascript.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'controlFlowJavascript.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'controlFlowJavascript.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== controlFlowJavascript.js (0 errors) ==== -+ let cond = true; -+ -+ // CFA for 'let' and no initializer -+ function f1() { -+ let x; -+ if (cond) { -+ x = 1; -+ } -+ if (cond) { -+ x = "hello"; -+ } -+ const y = x; // string | number | undefined -+ } -+ -+ // CFA for 'let' and 'undefined' initializer -+ function f2() { -+ let x = undefined; -+ if (cond) { -+ x = 1; -+ } -+ if (cond) { -+ x = "hello"; -+ } -+ const y = x; // string | number | undefined -+ } -+ -+ // CFA for 'let' and 'null' initializer -+ function f3() { -+ let x = null; -+ if (cond) { -+ x = 1; -+ } -+ if (cond) { -+ x = "hello"; -+ } -+ const y = x; // string | number | null -+ } -+ -+ // CFA for 'var' with no initializer -+ function f5() { -+ var x; -+ if (cond) { -+ x = 1; -+ } -+ if (cond) { -+ x = "hello"; -+ } -+ const y = x; // string | number | undefined -+ } -+ -+ // CFA for 'var' with 'undefined' initializer -+ function f6() { -+ var x = undefined; -+ if (cond) { -+ x = 1; -+ } -+ if (cond) { -+ x = "hello"; -+ } -+ const y = x; // string | number | undefined -+ } -+ -+ // CFA for 'var' with 'null' initializer -+ function f7() { -+ var x = null; -+ if (cond) { -+ x = 1; -+ } -+ if (cond) { -+ x = "hello"; -+ } -+ const y = x; // string | number | null -+ } -+ -+ // No CFA for captured outer variables -+ function f9() { -+ let x; -+ if (cond) { -+ x = 1; -+ } -+ if (cond) { -+ x = "hello"; -+ } -+ const y = x; // string | number | undefined -+ function f() { -+ const z = x; // any -+ } -+ } -+ -+ // No CFA for captured outer variables -+ function f10() { -+ let x; -+ if (cond) { -+ x = 1; -+ } -+ if (cond) { -+ x = "hello"; -+ } -+ const y = x; // string | number | undefined -+ const f = () => { -+ const z = x; // any -+ }; -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/controlFlowJavascript.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/controlFlowJavascript.types.diff deleted file mode 100644 index 57b32f848e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/controlFlowJavascript.types.diff +++ /dev/null @@ -1,90 +0,0 @@ ---- old.controlFlowJavascript.types -+++ new.controlFlowJavascript.types -@@= skipped -28, +28 lines =@@ - >"hello" : "hello" - } - const y = x; // string | number | undefined -->y : string | number -->x : string | number -+>y : any -+>x : any - } - - // CFA for 'let' and 'undefined' initializer -@@= skipped -29, +29 lines =@@ - >"hello" : "hello" - } - const y = x; // string | number | undefined -->y : string | number -->x : string | number -+>y : any -+>x : any - } - - // CFA for 'let' and 'null' initializer -@@= skipped -28, +28 lines =@@ - >"hello" : "hello" - } - const y = x; // string | number | null -->y : string | number -->x : string | number -+>y : any -+>x : any - } - - // CFA for 'var' with no initializer -@@= skipped -28, +28 lines =@@ - >"hello" : "hello" - } - const y = x; // string | number | undefined -->y : string | number -->x : string | number -+>y : any -+>x : any - } - - // CFA for 'var' with 'undefined' initializer -@@= skipped -29, +29 lines =@@ - >"hello" : "hello" - } - const y = x; // string | number | undefined -->y : string | number -->x : string | number -+>y : any -+>x : any - } - - // CFA for 'var' with 'null' initializer -@@= skipped -28, +28 lines =@@ - >"hello" : "hello" - } - const y = x; // string | number | null -->y : string | number -->x : string | number -+>y : any -+>x : any - } - - // No CFA for captured outer variables -@@= skipped -28, +28 lines =@@ - >"hello" : "hello" - } - const y = x; // string | number | undefined -->y : string | number -->x : string | number -+>y : any -+>x : any - - function f() { - >f : () => void -@@= skipped -36, +36 lines =@@ - >"hello" : "hello" - } - const y = x; // string | number | undefined -->y : string | number -->x : string | number -+>y : any -+>x : any - - const f = () => { - >f : () => void \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declFileWithErrorsInInputDeclarationFileWithOut.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declFileWithErrorsInInputDeclarationFileWithOut.errors.txt.diff deleted file mode 100644 index e536c91604..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declFileWithErrorsInInputDeclarationFileWithOut.errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.declFileWithErrorsInInputDeclarationFileWithOut.errors.txt -+++ new.declFileWithErrorsInInputDeclarationFileWithOut.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - declFile.d.ts(2,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. - declFile.d.ts(3,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. - declFile.d.ts(5,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. - declFile.d.ts(7,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context. - - -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== client.ts (0 errors) ==== - /// - var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitBundlePreservesHasNoDefaultLibDirective.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitBundlePreservesHasNoDefaultLibDirective.errors.txt.diff deleted file mode 100644 index dd6432977f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitBundlePreservesHasNoDefaultLibDirective.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.declarationEmitBundlePreservesHasNoDefaultLibDirective.errors.txt -+++ new.declarationEmitBundlePreservesHasNoDefaultLibDirective.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== extensions.ts (0 errors) ==== -+ /// -+ class Foo { -+ public: string; -+ } -+==== core.ts (0 errors) ==== -+ interface Array {} -+ interface Boolean {} -+ interface Function {} -+ interface IArguments {} -+ interface Number {} -+ interface Object {} -+ interface RegExp {} -+ interface String {} -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCommonSourceDirectoryDoesNotContainAllFiles.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCommonSourceDirectoryDoesNotContainAllFiles.errors.txt.diff deleted file mode 100644 index 44b2b12e15..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitCommonSourceDirectoryDoesNotContainAllFiles.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.declarationEmitCommonSourceDirectoryDoesNotContainAllFiles.errors.txt -+++ new.declarationEmitCommonSourceDirectoryDoesNotContainAllFiles.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== /a/index.ts (0 errors) ==== -+ export * from "./src/" -+==== /b/index.ts (0 errors) ==== -+ export * from "./src/" -+==== /b/src/index.ts (0 errors) ==== -+ export class B {} -+==== /a/src/index.ts (0 errors) ==== -+ import { B } from "b"; -+ -+ export default function () { -+ return new B(); -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitMonorepoBaseUrl.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitMonorepoBaseUrl.errors.txt.diff deleted file mode 100644 index 1f0aa50e9a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitMonorepoBaseUrl.errors.txt.diff +++ /dev/null @@ -1,63 +0,0 @@ ---- old.declarationEmitMonorepoBaseUrl.errors.txt -+++ new.declarationEmitMonorepoBaseUrl.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/tsconfig.json(6,5): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+ -+ -+==== /tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "module": "nodenext", -+ "declaration": true, -+ "outDir": "temp", -+ "baseUrl": "." -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ } -+ } -+ -+==== /packages/compiler-core/src/index.ts (0 errors) ==== -+ import { PluginConfig } from "@babel/parser"; -+ -+==== /packages/compiler-sfc/src/index.ts (0 errors) ==== -+ import { createPlugin } from "@babel/parser"; -+ export function resolveParserPlugins() { -+ return [createPlugin()]; -+ } -+ -+==== /node_modules/.pnpm/@babel+parser@7.23.6/node_modules/@babel/parser/package.json (0 errors) ==== -+ { -+ "name": "@babel/parser", -+ "version": "7.23.6", -+ "main": "./lib/index.js", -+ "types": "./typings/babel-parser.d.ts" -+ } -+ -+==== /node_modules/.pnpm/@babel+parser@7.23.6/node_modules/@babel/parser/typings/babel-parser.d.ts (0 errors) ==== -+ export declare function createPlugin(): PluginConfig; -+ export declare class PluginConfig {} -+ -+==== /packages/compiler-core/package.json (0 errors) ==== -+ { -+ "name": "@vue/compiler-core", -+ "version": "3.0.0", -+ "main": "./src/index.ts", -+ "dependencies": { -+ "@babel/parser": "^7.0.0" -+ } -+ } -+ -+==== /packages/compiler-sfc/package.json (0 errors) ==== -+ { -+ "name": "@vue/compiler-sfc", -+ "version": "3.0.0", -+ "main": "./src/index.ts", -+ "dependencies": { -+ "@babel/parser": "^7.0.0", -+ "@vue/compiler-core": "^3.0.0" -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitOutFileBundlePaths.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitOutFileBundlePaths.errors.txt.diff deleted file mode 100644 index fd3212568d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitOutFileBundlePaths.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.declarationEmitOutFileBundlePaths.errors.txt -+++ new.declarationEmitOutFileBundlePaths.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== js/versions.static.js (0 errors) ==== -+ export default { -+ "@a/b": "1.0.0", -+ "@a/c": "1.2.3" -+ }; -+==== js/index.js (0 errors) ==== -+ import versions from './versions.static.js'; -+ -+ export { -+ versions -+ }; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitPathMappingMonorepo.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitPathMappingMonorepo.errors.txt.diff deleted file mode 100644 index a6688b68bc..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitPathMappingMonorepo.errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.declarationEmitPathMappingMonorepo.errors.txt -+++ new.declarationEmitPathMappingMonorepo.errors.txt -@@= skipped -0, +0 lines =@@ -- -+packages/b/tsconfig.json(5,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+ -+ -+==== packages/b/tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "outDir": "dist", -+ "declaration": true, -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "@ts-bug/a": ["../a"] -+ } -+ } -+ } -+ -+ -+==== packages/b/src/index.ts (0 errors) ==== -+ import { a } from "@ts-bug/a"; -+ -+ export function b(text: string) { -+ return a(text); -+ } -+==== packages/a/index.d.ts (0 errors) ==== -+ declare module "@ts-bug/a" { -+ export type AText = { -+ value: string; -+ }; -+ export function a(text: string): AText; -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitPathMappingMonorepo2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitPathMappingMonorepo2.errors.txt.diff deleted file mode 100644 index 9d40c1b7cf..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitPathMappingMonorepo2.errors.txt.diff +++ /dev/null @@ -1,58 +0,0 @@ ---- old.declarationEmitPathMappingMonorepo2.errors.txt -+++ new.declarationEmitPathMappingMonorepo2.errors.txt -@@= skipped -0, +0 lines =@@ -- -+packages/lab/src/index.ts(1,31): error TS2307: Cannot find module '@ts-bug/core/utils' or its corresponding type declarations. -+packages/lab/tsconfig.json(5,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./../*"]}' instead. -+ -+ -+==== packages/lab/tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "outDir": "dist", -+ "declaration": true, -+ "baseUrl": "../", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./../*"]}' instead. -+ "paths": { -+ "@ts-bug/core": ["./core/src"], -+ "@ts-bug/core/*": ["./core/src/*"], -+ "@ts-bug/lab": ["./lab/src"], -+ "@ts-bug/lab/*": ["./lab/src/*"], -+ "@ts-bug/styles": ["./styles/src"], -+ "@ts-bug/styles/*": ["./styles/src/*"] -+ } -+ } -+ } -+==== packages/lab/src/index.ts (1 errors) ==== -+ import { createSvgIcon } from "@ts-bug/core/utils"; -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module '@ts-bug/core/utils' or its corresponding type declarations. -+ export default createSvgIcon("Hello", "ArrowLeft"); -+ -+==== packages/core/src/index.d.ts (0 errors) ==== -+ export * from "./utils"; -+ export { default as SvgIcon } from "./SvgIcon"; -+ -+==== packages/core/src/SvgIcon.d.ts (0 errors) ==== -+ import { StyledComponentProps } from "@ts-bug/styles"; -+ export interface SvgIconProps extends StyledComponentProps<"root"> { -+ children?: string[]; -+ } -+ export interface SomeInterface { -+ myProp: string; -+ } -+ declare const SvgIcon: SomeInterface; -+ export default SvgIcon; -+ -+==== packages/core/src/utils.d.ts (0 errors) ==== -+ import SvgIcon from "./SvgIcon"; -+ export function createSvgIcon(path: string, displayName: string): typeof SvgIcon; -+ -+==== packages/styles/src/index.d.ts (0 errors) ==== -+ export interface StyledComponentProps { -+ classes?: Record; -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitPrefersPathKindBasedOnBundling.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitPrefersPathKindBasedOnBundling.errors.txt.diff deleted file mode 100644 index 0f33e1d9f5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitPrefersPathKindBasedOnBundling.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.declarationEmitPrefersPathKindBasedOnBundling.errors.txt -+++ new.declarationEmitPrefersPathKindBasedOnBundling.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+==== src/lib/operators/scalar.ts (0 errors) ==== -+ export interface Scalar { -+ (): string; -+ value: number; -+ } -+ -+ export function scalar(value: string): Scalar { -+ return null as any; -+ } -+==== src/settings/spacing.ts (0 errors) ==== -+ import { scalar } from '../lib/operators/scalar'; -+ -+ export default { -+ get xs() { -+ return scalar("14px"); -+ } -+ }; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationFileOverwriteErrorWithOut.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationFileOverwriteErrorWithOut.errors.txt.diff deleted file mode 100644 index 906e105f99..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationFileOverwriteErrorWithOut.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.declarationFileOverwriteErrorWithOut.errors.txt -+++ new.declarationFileOverwriteErrorWithOut.errors.txt -@@= skipped -0, +0 lines =@@ --error TS5055: Cannot write file '/out.d.ts' because it would overwrite input file. -- Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -- -- --!!! error TS5055: Cannot write file '/out.d.ts' because it would overwrite input file. --!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== /out.d.ts (0 errors) ==== - declare class c { - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationFilesGeneratingTypeReferences.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationFilesGeneratingTypeReferences.errors.txt.diff deleted file mode 100644 index 97e8bb6ee0..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationFilesGeneratingTypeReferences.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.declarationFilesGeneratingTypeReferences.errors.txt -+++ new.declarationFilesGeneratingTypeReferences.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== /a/node_modules/@types/jquery/index.d.ts (0 errors) ==== -+ interface JQuery { -+ -+ } -+ -+==== /a/app.ts (0 errors) ==== -+ /// -+ namespace Test { -+ export var x: JQuery; -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationMapsOutFile2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationMapsOutFile2.errors.txt.diff deleted file mode 100644 index 2068ff05ce..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationMapsOutFile2.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.declarationMapsOutFile2.errors.txt -+++ new.declarationMapsOutFile2.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ class Foo { -+ doThing(x: {a: number}) { -+ return {b: x.a}; -+ } -+ static make() { -+ return new Foo(); -+ } -+ } -+==== index.ts (0 errors) ==== -+ const c = new Foo(); -+ c.doThing({a: 42}); -+ -+ let x = c.doThing({a: 12}); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationMapsWithSourceMap.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationMapsWithSourceMap.errors.txt.diff deleted file mode 100644 index 3c2e0e39e8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationMapsWithSourceMap.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.declarationMapsWithSourceMap.errors.txt -+++ new.declarationMapsWithSourceMap.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ class Foo { -+ doThing(x: {a: number}) { -+ return {b: x.a}; -+ } -+ static make() { -+ return new Foo(); -+ } -+ } -+==== index.ts (0 errors) ==== -+ const c = new Foo(); -+ c.doThing({a: 42}); -+ -+ let x = c.doThing({a: 12}); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/importNonExportedMember8.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/importNonExportedMember8.errors.txt.diff deleted file mode 100644 index b3b6668e75..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/importNonExportedMember8.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.importNonExportedMember8.errors.txt -+++ new.importNonExportedMember8.errors.txt -@@= skipped -0, +0 lines =@@ --b.js(1,10): error TS2598: 'Foo' can only be imported by using a 'require' call or by turning on the 'esModuleInterop' flag and using a default import. -+b.js(1,10): error TS2617: 'Foo' can only be imported by using 'import Foo = require("./a")' or by turning on the 'esModuleInterop' flag and using a default import. - b.js(1,21): error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export. - - -@@= skipped -8, +8 lines =@@ - ==== b.js (2 errors) ==== - import { Foo } from './a'; - ~~~ --!!! error TS2598: 'Foo' can only be imported by using a 'require' call or by turning on the 'esModuleInterop' flag and using a default import. -+!!! error TS2617: 'Foo' can only be imported by using 'import Foo = require("./a")' or by turning on the 'esModuleInterop' flag and using a default import. - ~~~~~ - !!! error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export. - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/incrementalOut.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/incrementalOut.errors.txt.diff deleted file mode 100644 index b5cd0c5543..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/incrementalOut.errors.txt.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.incrementalOut.errors.txt -+++ new.incrementalOut.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== incrementalOut.ts (0 errors) ==== -+ const x = 10; -+ -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/inlineSourceMap2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/inlineSourceMap2.errors.txt.diff deleted file mode 100644 index f072172c64..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/inlineSourceMap2.errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.inlineSourceMap2.errors.txt -+++ new.inlineSourceMap2.errors.txt -@@= skipped -0, +0 lines =@@ - error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. - error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - - - !!! error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. - !!! error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== inlineSourceMap2.ts (0 errors) ==== - // configuration errors - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/inlineSources.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/inlineSources.errors.txt.diff deleted file mode 100644 index 9078ab82cc..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/inlineSources.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.inlineSources.errors.txt -+++ new.inlineSources.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ var a = 0; -+ console.log(a); -+ -+==== b.ts (0 errors) ==== -+ var b = 0; -+ console.log(b); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/inlineSources2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/inlineSources2.errors.txt.diff deleted file mode 100644 index ea85eccc64..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/inlineSources2.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.inlineSources2.errors.txt -+++ new.inlineSources2.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ var a = 0; -+ console.log(a); -+ -+==== b.ts (0 errors) ==== -+ var b = 0; -+ console.log(b); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationClassMethodContainingArrowFunction.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationClassMethodContainingArrowFunction.errors.txt.diff deleted file mode 100644 index 801e55a5b0..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationClassMethodContainingArrowFunction.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.jsFileCompilationClassMethodContainingArrowFunction.errors.txt -+++ new.jsFileCompilationClassMethodContainingArrowFunction.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.js (0 errors) ==== -+ class c { -+ method(a) { -+ let x = a => this.method(a); -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateFunctionImplementation.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateFunctionImplementation.errors.txt.diff deleted file mode 100644 index 0e0a30a8b4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateFunctionImplementation.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.jsFileCompilationDuplicateFunctionImplementation.errors.txt -+++ new.jsFileCompilationDuplicateFunctionImplementation.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - a.ts(1,10): error TS2393: Duplicate function implementation. - - -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== b.js (0 errors) ==== - function foo() { - return 10; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateFunctionImplementationFileOrderReversed.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateFunctionImplementationFileOrderReversed.errors.txt.diff deleted file mode 100644 index 70265e7427..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateFunctionImplementationFileOrderReversed.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.jsFileCompilationDuplicateFunctionImplementationFileOrderReversed.errors.txt -+++ new.jsFileCompilationDuplicateFunctionImplementationFileOrderReversed.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - a.ts(1,10): error TS2393: Duplicate function implementation. - - -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== a.ts (1 errors) ==== - function foo() { - ~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateVariable.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateVariable.errors.txt.diff deleted file mode 100644 index fbe44be830..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateVariable.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.jsFileCompilationDuplicateVariable.errors.txt -+++ new.jsFileCompilationDuplicateVariable.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ var x = 10; -+ -+==== b.js (0 errors) ==== -+ var x = "hello"; // Error is recorded here, but suppressed because the js file isn't checked -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateVariableErrorReported.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateVariableErrorReported.errors.txt.diff deleted file mode 100644 index 50718c6410..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationDuplicateVariableErrorReported.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.jsFileCompilationDuplicateVariableErrorReported.errors.txt -+++ new.jsFileCompilationDuplicateVariableErrorReported.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - a.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'. - - -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== b.js (0 errors) ==== - var x = "hello"; - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationEmitDeclarations.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationEmitDeclarations.errors.txt.diff deleted file mode 100644 index a5e1e98ecb..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationEmitDeclarations.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.jsFileCompilationEmitDeclarations.errors.txt -+++ new.jsFileCompilationEmitDeclarations.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ class c { -+ } -+ -+==== b.js (0 errors) ==== -+ function foo() { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationEmitTrippleSlashReference.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationEmitTrippleSlashReference.errors.txt.diff deleted file mode 100644 index bd80e773b1..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationEmitTrippleSlashReference.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.jsFileCompilationEmitTrippleSlashReference.errors.txt -+++ new.jsFileCompilationEmitTrippleSlashReference.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5055: Cannot write file 'c.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5055: Cannot write file 'c.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ class c { -+ } -+ -+==== b.js (0 errors) ==== -+ /// -+ function foo() { -+ } -+ -+==== c.js (0 errors) ==== -+ function bar() { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithOut.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithOut.errors.txt.diff deleted file mode 100644 index dcdb165e16..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithOut.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithOut.errors.txt -+++ new.jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithOut.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'c.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'c.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ class c { -+ } -+ -+==== b.ts (0 errors) ==== -+ /// -+ function foo() { -+ } -+ -+==== c.js (0 errors) ==== -+ function bar() { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationLetBeingRenamed.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationLetBeingRenamed.errors.txt.diff deleted file mode 100644 index 207a2ba312..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationLetBeingRenamed.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.jsFileCompilationLetBeingRenamed.errors.txt -+++ new.jsFileCompilationLetBeingRenamed.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.js (0 errors) ==== -+ function foo(a) { -+ for (let a = 0; a < 10; a++) { -+ // do something -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationLetDeclarationOrder.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationLetDeclarationOrder.errors.txt.diff deleted file mode 100644 index 07628a3880..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationLetDeclarationOrder.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.jsFileCompilationLetDeclarationOrder.errors.txt -+++ new.jsFileCompilationLetDeclarationOrder.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== b.js (0 errors) ==== -+ let a = 10; -+ b = 30; -+ -+==== a.ts (0 errors) ==== -+ let b = 30; -+ a = 10; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationLetDeclarationOrder2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationLetDeclarationOrder2.errors.txt.diff deleted file mode 100644 index a33f3984a1..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationLetDeclarationOrder2.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.jsFileCompilationLetDeclarationOrder2.errors.txt -+++ new.jsFileCompilationLetDeclarationOrder2.errors.txt -@@= skipped -0, +0 lines =@@ --a.ts(2,1): error TS2448: Block-scoped variable 'a' used before its declaration. -- -- --==== a.ts (1 errors) ==== -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== - let b = 30; - a = 10; -- ~ --!!! error TS2448: Block-scoped variable 'a' used before its declaration. --!!! related TS2728 b.js:1:5: 'a' is declared here. - ==== b.js (0 errors) ==== - let a = 10; - b = 30; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationNoErrorWithoutDeclarationsWithJsFileReferenceWithOut.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationNoErrorWithoutDeclarationsWithJsFileReferenceWithOut.errors.txt.diff deleted file mode 100644 index c8679c9130..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationNoErrorWithoutDeclarationsWithJsFileReferenceWithOut.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.jsFileCompilationNoErrorWithoutDeclarationsWithJsFileReferenceWithOut.errors.txt -+++ new.jsFileCompilationNoErrorWithoutDeclarationsWithJsFileReferenceWithOut.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'c.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'c.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ class c { -+ } -+ -+==== b.ts (0 errors) ==== -+ /// -+ //no error on above reference since not emitting declarations -+ function foo() { -+ } -+ -+==== c.js (0 errors) ==== -+ function bar() { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationNonNullAssertion.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationNonNullAssertion.errors.txt.diff deleted file mode 100644 index 774688f7f7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationNonNullAssertion.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.jsFileCompilationNonNullAssertion.errors.txt -+++ new.jsFileCompilationNonNullAssertion.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file '/src/a.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - /src/a.js(1,1): error TS8013: Non-null assertions can only be used in TypeScript files. - - -+!!! error TS5055: Cannot write file '/src/a.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== /src/a.js (1 errors) ==== - 0! - ~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationRestParameter.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationRestParameter.errors.txt.diff deleted file mode 100644 index ef86de6a95..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationRestParameter.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.jsFileCompilationRestParameter.errors.txt -+++ new.jsFileCompilationRestParameter.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.js (0 errors) ==== -+ function foo(...a) { } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationShortHandProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationShortHandProperty.errors.txt.diff deleted file mode 100644 index 214cb808a0..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationShortHandProperty.errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.jsFileCompilationShortHandProperty.errors.txt -+++ new.jsFileCompilationShortHandProperty.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.js (0 errors) ==== -+ function foo() { -+ var a = 10; -+ var b = "Hello"; -+ return { -+ a, -+ b -+ }; -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationTypeAssertions.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationTypeAssertions.errors.txt.diff deleted file mode 100644 index c859e79ebe..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationTypeAssertions.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.jsFileCompilationTypeAssertions.errors.txt -+++ new.jsFileCompilationTypeAssertions.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file '/src/a.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - /src/a.js(1,6): error TS8016: Type assertion expressions can only be used in TypeScript files. - /src/a.js(2,10): error TS17008: JSX element 'string' has no corresponding closing tag. - /src/a.js(3,1): error TS1005: ' -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ class c { -+ } -+ -+==== b.js (0 errors) ==== -+ function foo() { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationWithOut.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationWithOut.errors.txt.diff deleted file mode 100644 index 6a293d71f6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationWithOut.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.jsFileCompilationWithOut.errors.txt -+++ new.jsFileCompilationWithOut.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ class c { -+ } -+ -+==== b.js (0 errors) ==== -+ function foo() { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.errors.txt.diff deleted file mode 100644 index 1f86bc14cf..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.errors.txt -+++ new.jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.errors.txt -@@= skipped -0, +0 lines =@@ --error TS5055: Cannot write file '/b.d.ts' because it would overwrite input file. -- Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -- -- --!!! error TS5055: Cannot write file '/b.d.ts' because it would overwrite input file. --!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== /a.ts (0 errors) ==== - class c { - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationWithOutFileNameSameAsInputJsFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationWithOutFileNameSameAsInputJsFile.errors.txt.diff deleted file mode 100644 index 0d0626696c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileCompilationWithOutFileNameSameAsInputJsFile.errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.jsFileCompilationWithOutFileNameSameAsInputJsFile.errors.txt -+++ new.jsFileCompilationWithOutFileNameSameAsInputJsFile.errors.txt -@@= skipped -0, +0 lines =@@ - error TS5055: Cannot write file '/b.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - - - !!! error TS5055: Cannot write file '/b.js' because it would overwrite input file. - !!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== /a.ts (0 errors) ==== - class c { - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional.errors.txt.diff new file mode 100644 index 0000000000..a47690fc80 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional.errors.txt.diff @@ -0,0 +1,28 @@ +--- old.jsFileFunctionParametersAsOptional.errors.txt ++++ new.jsFileFunctionParametersAsOptional.errors.txt +@@= skipped -0, +0 lines =@@ +- ++bar.ts(1,1): error TS2554: Expected 3 arguments, but got 0. ++bar.ts(2,1): error TS2554: Expected 3 arguments, but got 1. ++bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2. ++ ++ ++==== foo.js (0 errors) ==== ++ function f(a, b, c) { } ++ ++ ++==== bar.ts (3 errors) ==== ++ f(); ++ ~ ++!!! error TS2554: Expected 3 arguments, but got 0. ++!!! related TS6210 foo.js:1:12: An argument for 'a' was not provided. ++ f(1); ++ ~ ++!!! error TS2554: Expected 3 arguments, but got 1. ++!!! related TS6210 foo.js:1:15: An argument for 'b' was not provided. ++ f(1, 2); ++ ~ ++!!! error TS2554: Expected 3 arguments, but got 2. ++!!! related TS6210 foo.js:1:18: An argument for 'c' was not provided. ++ f(1, 2, 3); ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional2.errors.txt.diff deleted file mode 100644 index 7502dd5e15..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional2.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.jsFileFunctionParametersAsOptional2.errors.txt -+++ new.jsFileFunctionParametersAsOptional2.errors.txt -@@= skipped -0, +0 lines =@@ --bar.ts(1,1): error TS2554: Expected 3 arguments, but got 0. --bar.ts(2,1): error TS2554: Expected 3 arguments, but got 1. --bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2. -- -- --==== foo.js (0 errors) ==== -- /** -- * @param a -- * @param b -- * @param c -- */ -- function f(a, b, c) { } -- -- --==== bar.ts (3 errors) ==== -- f(); // Error -- ~ --!!! error TS2554: Expected 3 arguments, but got 0. --!!! related TS6210 foo.js:6:12: An argument for 'a' was not provided. -- f(1); // Error -- ~ --!!! error TS2554: Expected 3 arguments, but got 1. --!!! related TS6210 foo.js:6:15: An argument for 'b' was not provided. -- f(1, 2); // Error -- ~ --!!! error TS2554: Expected 3 arguments, but got 2. --!!! related TS6210 foo.js:6:18: An argument for 'c' was not provided. -- -- f(1, 2, 3); // OK -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/letDeclarations-useBeforeDefinition2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/letDeclarations-useBeforeDefinition2.errors.txt.diff deleted file mode 100644 index c2d271b455..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/letDeclarations-useBeforeDefinition2.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.letDeclarations-useBeforeDefinition2.errors.txt -+++ new.letDeclarations-useBeforeDefinition2.errors.txt -@@= skipped -0, +0 lines =@@ --file1.ts(1,1): error TS2448: Block-scoped variable 'l' used before its declaration. -- -- --==== file1.ts (1 errors) ==== -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== file1.ts (0 errors) ==== - l; -- ~ --!!! error TS2448: Block-scoped variable 'l' used before its declaration. --!!! related TS2728 file2.ts:1:7: 'l' is declared here. - - ==== file2.ts (0 errors) ==== - const l = 0; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleNoneDynamicImport(target=es2015).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleNoneDynamicImport(target=es2015).errors.txt.diff deleted file mode 100644 index a159e1bb64..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleNoneDynamicImport(target=es2015).errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.moduleNoneDynamicImport(target=es2015).errors.txt -+++ new.moduleNoneDynamicImport(target=es2015).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file '/b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+/a.ts(1,13): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. -+ -+ -+!!! error TS5055: Cannot write file '/b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== /a.ts (1 errors) ==== -+ const foo = import("./b"); -+ ~~~~~~~~~~~~~ -+!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. -+ -+==== /b.js (0 errors) ==== -+ export default 1; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleNoneDynamicImport(target=es2020).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleNoneDynamicImport(target=es2020).errors.txt.diff deleted file mode 100644 index 7edc394d3a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleNoneDynamicImport(target=es2020).errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.moduleNoneDynamicImport(target=es2020).errors.txt -+++ new.moduleNoneDynamicImport(target=es2020).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file '/b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+/a.ts(1,13): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. -+ -+ -+!!! error TS5055: Cannot write file '/b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== /a.ts (1 errors) ==== -+ const foo = import("./b"); -+ ~~~~~~~~~~~~~ -+!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. -+ -+==== /b.js (0 errors) ==== -+ export default 1; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleNoneOutFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleNoneOutFile.errors.txt.diff deleted file mode 100644 index 828328de17..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleNoneOutFile.errors.txt.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.moduleNoneOutFile.errors.txt -+++ new.moduleNoneOutFile.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== first.ts (0 errors) ==== -+ class Foo {} -+==== second.ts (0 errors) ==== -+ class Bar extends Foo {} \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.errors.txt.diff deleted file mode 100644 index e7a547ed5b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.errors.txt.diff +++ /dev/null @@ -1,59 +0,0 @@ ---- old.moduleResolutionPackageIdWithRelativeAndAbsolutePath.errors.txt -+++ new.moduleResolutionPackageIdWithRelativeAndAbsolutePath.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/project/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+ -+ -+==== /project/tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "@shared/*": ["../shared/*"] -+ } -+ }, -+ //"files": ["src/app.ts"] -+ } -+==== /project/src/app.ts (0 errors) ==== -+ import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory -+ import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder -+ -+==== /shared/node_modules/troublesome-lib/package.json (0 errors) ==== -+ { -+ "name": "troublesome-lib", -+ "version": "1.17.1" -+ } -+==== /shared/node_modules/troublesome-lib/lib/Compactable.d.ts (0 errors) ==== -+ import { Option } from './Option'; -+ export class Compactable { -+ option: Option; -+ } -+==== /shared/node_modules/troublesome-lib/lib/Option.d.ts (0 errors) ==== -+ export class Option { -+ someProperty: string; -+ } -+==== /shared/lib/app.d.ts (0 errors) ==== -+ import { Option } from "troublesome-lib/lib/Option"; -+ export class SharedOption extends Option { } -+ export const makeSharedOption: () => SharedOption; -+==== /project/node_modules/anotherLib/index.d.ts (0 errors) ==== -+ import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable -+==== /project/node_modules/troublesome-lib/package.json (0 errors) ==== -+ { -+ "name": "troublesome-lib", -+ "version": "1.17.1" -+ } -+==== /project/node_modules/troublesome-lib/lib/Compactable.d.ts (0 errors) ==== -+ import { Option } from './Option'; -+ export class Compactable { -+ option: Option; -+ } -+==== /project/node_modules/troublesome-lib/lib/Option.d.ts (0 errors) ==== -+ export class Option { -+ someProperty: string; -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithExtensions_withPaths.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithExtensions_withPaths.errors.txt.diff deleted file mode 100644 index eabb80cb29..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithExtensions_withPaths.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.moduleResolutionWithExtensions_withPaths.errors.txt -+++ new.moduleResolutionWithExtensions_withPaths.errors.txt -@@= skipped -0, +0 lines =@@ --/tsconfig.json(7,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -- -- --==== /tsconfig.json (1 errors) ==== -+/tsconfig.json(6,3): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+/tsconfig.json(11,14): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== /tsconfig.json (2 errors) ==== - { - "compilerOptions": { - "outDir": "lib", - "target": "ES6", - "module": "ES6", - "baseUrl": "/", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. - "moduleResolution": "Node", -- ~~~~~~ --!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. - "noImplicitAny": true, - "traceResolution": true, - "paths": { - "foo/*": ["node_modules/foo/lib/*"] -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? - } - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt.diff deleted file mode 100644 index 1dc67f7b32..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt -+++ new.moduleResolutionWithSuffixes_one_externalModule_withPaths.errors.txt -@@= skipped -0, +0 lines =@@ --/tsconfig.json(6,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -- -- --==== /tsconfig.json (1 errors) ==== -+/tsconfig.json(9,3): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+/tsconfig.json(11,21): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+/tsconfig.json(12,23): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== /tsconfig.json (3 errors) ==== - { - "compilerOptions": { - "allowJs": true, - "checkJs": false, - "outDir": "bin", - "moduleResolution": "node", -- ~~~~~~ --!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. - "traceResolution": true, - "moduleSuffixes": [".ios"], - "baseUrl": "/", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. - "paths": { - "some-library": ["node_modules/some-library/lib"], -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? - "some-library/*": ["node_modules/some-library/lib/*"] -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? - } - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_jsModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_jsModule.errors.txt.diff deleted file mode 100644 index 80d11e391b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithSuffixes_one_jsModule.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.moduleResolutionWithSuffixes_one_jsModule.errors.txt -+++ new.moduleResolutionWithSuffixes_one_jsModule.errors.txt -@@= skipped -0, +0 lines =@@ --/tsconfig.json(6,23): error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -- -- --==== /tsconfig.json (1 errors) ==== -- { -- "compilerOptions": { -- "allowJs": true, -- "checkJs": false, -- "outDir": "bin", -- "moduleResolution": "node", -- ~~~~~~ --!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -- "traceResolution": true, -- "moduleSuffixes": [".ios"] -- } -- } -- --==== /index.ts (0 errors) ==== -- import { ios } from "./foo.js"; --==== /foo.ios.js (0 errors) ==== -- "use strict"; -- exports.__esModule = true; -- function ios() {} -- exports.ios = ios; --==== /foo.js (0 errors) ==== -- "use strict"; -- exports.__esModule = true; -- function base() {} -- exports.base = base; -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_classicPrefersTs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_classicPrefersTs.errors.txt.diff deleted file mode 100644 index 28b2798b5c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_classicPrefersTs.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.moduleResolution_classicPrefersTs.errors.txt -+++ new.moduleResolution_classicPrefersTs.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/dir1/dir2/dir3/index.ts(1,15): error TS2307: Cannot find module 'a' or its corresponding type declarations. -+ -+ -+==== /dir1/dir2/dir3/a.js (0 errors) ==== -+ export default "dir1/dir2/dir3/a.js"; -+ -+==== /dir1/dir2/a.ts (0 errors) ==== -+ export default "dir1/dir2/a.ts"; -+ -+==== /dir1/dir2/dir3/index.ts (1 errors) ==== -+ import a from "a"; -+ ~~~ -+!!! error TS2307: Cannot find module 'a' or its corresponding type declarations. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_classicPrefersTs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_classicPrefersTs.types.diff deleted file mode 100644 index acd47180f8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_classicPrefersTs.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.moduleResolution_classicPrefersTs.types -+++ new.moduleResolution_classicPrefersTs.types -@@= skipped -9, +9 lines =@@ - - === /dir1/dir2/dir3/index.ts === - import a from "a"; -->a : "dir1/dir2/a.ts" -+>a : any diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/optionsOutAndNoModuleGen.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/optionsOutAndNoModuleGen.errors.txt.diff deleted file mode 100644 index 50dc55f52f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/optionsOutAndNoModuleGen.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.optionsOutAndNoModuleGen.errors.txt -+++ new.optionsOutAndNoModuleGen.errors.txt -@@= skipped -0, +0 lines =@@ --optionsOutAndNoModuleGen.ts(1,1): error TS6131: Cannot compile modules using option 'outFile' unless the '--module' flag is 'amd' or 'system'. -- -- --==== optionsOutAndNoModuleGen.ts (1 errors) ==== -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== optionsOutAndNoModuleGen.ts (0 errors) ==== - export var x = 10; -- ~~~~~~~~~~~~~~~~~~ --!!! error TS6131: Cannot compile modules using option 'outFile' unless the '--module' flag is 'amd' or 'system'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/out-flag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/out-flag2.errors.txt.diff deleted file mode 100644 index bc4be59555..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/out-flag2.errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.out-flag2.errors.txt -+++ new.out-flag2.errors.txt -@@= skipped -0, +0 lines =@@ --error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -- -- --!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== a.ts (0 errors) ==== - class A { } - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/out-flag3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/out-flag3.errors.txt.diff deleted file mode 100644 index 4d0cf1ba57..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/out-flag3.errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.out-flag3.errors.txt -+++ new.out-flag3.errors.txt -@@= skipped -0, +0 lines =@@ --error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -- -- --!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== a.ts (0 errors) ==== - class A { } - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatCommonjs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatCommonjs.errors.txt.diff deleted file mode 100644 index fdb2458a5e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatCommonjs.errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.outModuleConcatCommonjs.errors.txt -+++ new.outModuleConcatCommonjs.errors.txt -@@= skipped -0, +0 lines =@@ --error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -- -- --!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== ref/a.ts (0 errors) ==== - export class A { } - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatCommonjsDeclarationOnly.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatCommonjsDeclarationOnly.errors.txt.diff deleted file mode 100644 index 5139b34766..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatCommonjsDeclarationOnly.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.outModuleConcatCommonjsDeclarationOnly.errors.txt -+++ new.outModuleConcatCommonjsDeclarationOnly.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== ref/a.ts (0 errors) ==== -+ export class A { } -+ -+==== b.ts (0 errors) ==== -+ import {A} from "./ref/a"; -+ export class B extends A { } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatES6.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatES6.errors.txt.diff deleted file mode 100644 index 7956c71daf..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatES6.errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.outModuleConcatES6.errors.txt -+++ new.outModuleConcatES6.errors.txt -@@= skipped -0, +0 lines =@@ --error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -- -- --!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== ref/a.ts (0 errors) ==== - export class A { } - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatUnspecifiedModuleKind.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatUnspecifiedModuleKind.errors.txt.diff deleted file mode 100644 index 99b0bfea42..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatUnspecifiedModuleKind.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.outModuleConcatUnspecifiedModuleKind.errors.txt -+++ new.outModuleConcatUnspecifiedModuleKind.errors.txt -@@= skipped -0, +0 lines =@@ --a.ts(1,14): error TS6131: Cannot compile modules using option 'outFile' unless the '--module' flag is 'amd' or 'system'. -- -- --==== a.ts (1 errors) ==== -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== - export class A { } // module -- ~ --!!! error TS6131: Cannot compile modules using option 'outFile' unless the '--module' flag is 'amd' or 'system'. - - ==== b.ts (0 errors) ==== - var x = 0; // global \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatUnspecifiedModuleKindDeclarationOnly.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatUnspecifiedModuleKindDeclarationOnly.errors.txt.diff deleted file mode 100644 index 79a662f7aa..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/outModuleConcatUnspecifiedModuleKindDeclarationOnly.errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.outModuleConcatUnspecifiedModuleKindDeclarationOnly.errors.txt -+++ new.outModuleConcatUnspecifiedModuleKindDeclarationOnly.errors.txt -@@= skipped -0, +0 lines =@@ --error TS5069: Option 'emitDeclarationOnly' cannot be specified without specifying option 'declaration' or option 'composite'. -- -- --!!! error TS5069: Option 'emitDeclarationOnly' cannot be specified without specifying option 'declaration' or option 'composite'. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== a.ts (0 errors) ==== - export class A { } // module - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution2_node.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution2_node.errors.txt.diff deleted file mode 100644 index b47c2daec0..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution2_node.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.pathMappingBasedModuleResolution2_node.errors.txt -+++ new.pathMappingBasedModuleResolution2_node.errors.txt -@@= skipped -0, +0 lines =@@ -+root/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./src/*"]}' instead. - root/tsconfig.json(5,13): error TS5061: Pattern '*1*' can have at most one '*' character. - root/tsconfig.json(5,22): error TS5062: Substitution '*2*' in pattern '*1*' can have at most one '*' character. -- -- --==== root/tsconfig.json (2 errors) ==== -+root/tsconfig.json(5,22): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== root/tsconfig.json (4 errors) ==== - { - "compilerOptions": { - "baseUrl": "./src", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./src/*"]}' instead. - "paths": { - "*1*": [ "*2*" ] - ~~~~~ - !!! error TS5061: Pattern '*1*' can have at most one '*' character. - ~~~~~ - !!! error TS5062: Substitution '*2*' in pattern '*1*' can have at most one '*' character. -+ ~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? - } - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution3_node.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution3_node.errors.txt.diff deleted file mode 100644 index 79c920ad8a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution3_node.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.pathMappingBasedModuleResolution3_node.errors.txt -+++ new.pathMappingBasedModuleResolution3_node.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+c:/root/folder1/file1.ts(1,17): error TS2307: Cannot find module 'folder2/file2' or its corresponding type declarations. -+ -+ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+==== c:/root/folder1/file1.ts (1 errors) ==== -+ import {x} from "folder2/file2" -+ ~~~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'folder2/file2' or its corresponding type declarations. -+ declare function use(a: any): void; -+ use(x.toExponential()); -+ -+==== c:/root/folder2/file2.ts (0 errors) ==== -+ import {x as a} from "./file3" // found with baseurl -+ import {y as b} from "file4" // found with fallback -+ export var x = a + b; -+ -+==== c:/root/folder2/file3.ts (0 errors) ==== -+ export var x = 1; -+ -+==== c:/node_modules/file4/index.d.ts (0 errors) ==== -+ export var y: number; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution4_node.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution4_node.errors.txt.diff deleted file mode 100644 index 6ced85a8db..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution4_node.errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.pathMappingBasedModuleResolution4_node.errors.txt -+++ new.pathMappingBasedModuleResolution4_node.errors.txt -@@= skipped -0, +0 lines =@@ -- -+c:/root/folder1/file1.ts(1,17): error TS2307: Cannot find module 'folder2/file2' or its corresponding type declarations. -+c:/root/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+ -+ -+==== c:/root/tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": "." -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ } -+ } -+ -+==== c:/root/folder1/file1.ts (1 errors) ==== -+ import {x} from "folder2/file2" -+ ~~~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'folder2/file2' or its corresponding type declarations. -+ declare function use(a: any): void; -+ use(x.toExponential()); -+ -+==== c:/root/folder2/file2.ts (0 errors) ==== -+ import {x as a} from "./file3" // found with baseurl -+ import {y as b} from "file4" // found with fallback -+ export var x = a + b; -+ -+==== c:/root/folder2/file3.ts (0 errors) ==== -+ export var x = 1; -+ -+==== c:/node_modules/file4/index.d.ts (0 errors) ==== -+ export var y: number; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution5_node.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution5_node.errors.txt.diff deleted file mode 100644 index 0903cc081b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution5_node.errors.txt.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.pathMappingBasedModuleResolution5_node.errors.txt -+++ new.pathMappingBasedModuleResolution5_node.errors.txt -@@= skipped -0, +0 lines =@@ -- -+c:/root/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+c:/root/tsconfig.json(6,17): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+c:/root/tsconfig.json(7,17): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+c:/root/tsconfig.json(10,21): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== c:/root/tsconfig.json (4 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "*": [ -+ "*", -+ ~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ "generated/*" -+ ~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ ], -+ "components/*": [ -+ "shared/components/*" -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ ] -+ } -+ } -+ } -+==== c:/root/folder1/file1.ts (0 errors) ==== -+ import {x} from "folder2/file1" -+ import {y} from "folder3/file2" -+ import {z} from "components/file3" -+ import {z1} from "file4" -+ -+ declare function use(a: any): void; -+ -+ use(x.toExponential()); -+ use(y.toExponential()); -+ use(z.toExponential()); -+ use(z1.toExponential()); -+ -+==== c:/root/folder2/file1.ts (0 errors) ==== -+ export var x = 1; -+ -+==== c:/root/generated/folder3/file2.ts (0 errors) ==== -+ export var y = 1; -+ -+==== c:/root/shared/components/file3/index.d.ts (0 errors) ==== -+ export var z: number; -+ -+==== c:/node_modules/file4.ts (0 errors) ==== -+ export var z1 = 1; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution7_node.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution7_node.errors.txt.diff deleted file mode 100644 index d6c0f18e2d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution7_node.errors.txt.diff +++ /dev/null @@ -1,67 +0,0 @@ ---- old.pathMappingBasedModuleResolution7_node.errors.txt -+++ new.pathMappingBasedModuleResolution7_node.errors.txt -@@= skipped -0, +0 lines =@@ -- -+c:/root/generated/src/project/file2.ts(2,17): error TS2307: Cannot find module 'templates/module2' or its corresponding type declarations. -+c:/root/src/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./../*"]}' instead. -+c:/root/src/tsconfig.json(6,17): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+c:/root/src/tsconfig.json(10,17): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== c:/root/src/tsconfig.json (3 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": "../", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./../*"]}' instead. -+ "paths": { -+ "*": [ -+ "*", -+ ~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ "c:/shared/*" -+ ], -+ "templates/*": [ -+ "generated/src/templates/*" -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ ] -+ }, -+ "rootDirs": [ -+ ".", -+ "../generated/src" -+ ] -+ } -+ } -+ -+==== c:/root/src/file1.ts (0 errors) ==== -+ import {x} from "./project/file2"; -+ import {y} from "module3"; -+ -+ declare function use(x: string); -+ use(x.toFixed()); -+ use(y.toFixed()); -+ -+==== c:/root/src/file3/index.d.ts (0 errors) ==== -+ export let x: number; -+ -+==== c:/root/generated/src/project/file2.ts (1 errors) ==== -+ import {a} from "module1"; -+ import {b} from "templates/module2"; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'templates/module2' or its corresponding type declarations. -+ import {x as c} from "../file3"; -+ export let x = a + b + c; -+ -+==== c:/shared/module1/index.d.ts (0 errors) ==== -+ export let a: number -+ -+==== c:/root/generated/src/templates/module2.ts (0 errors) ==== -+ export let b: number; -+ -+==== c:/node_modules/module3.d.ts (0 errors) ==== -+ export let y: number; -+ -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution8_node.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution8_node.errors.txt.diff deleted file mode 100644 index 3a52be5f78..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution8_node.errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.pathMappingBasedModuleResolution8_node.errors.txt -+++ new.pathMappingBasedModuleResolution8_node.errors.txt -@@= skipped -0, +0 lines =@@ -- -+c:/root/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+c:/root/tsconfig.json(6,16): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== c:/root/tsconfig.json (2 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "@speedy/*/testing": [ -+ "*/dist/index.ts" -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ ] -+ } -+ } -+ } -+ -+==== c:/root/index.ts (0 errors) ==== -+ import {x} from "@speedy/folder1/testing" -+ -+==== c:/root/folder1/dist/index.ts (0 errors) ==== -+ export const x = 1 + 2; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot.errors.txt.diff deleted file mode 100644 index e38e848398..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_aliasWithRoot.errors.txt -+++ new.pathMappingBasedModuleResolution_rootImport_aliasWithRoot.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/root/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+ -+ -+==== /root/tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "/*": ["./src/*"] -+ }, -+ "allowJs": true, -+ "outDir": "bin" -+ } -+ } -+ -+==== /root/src/foo.ts (0 errors) ==== -+ export function foo() {} -+ -+==== /root/src/bar.js (0 errors) ==== -+ export function bar() {} -+ -+==== /root/a.ts (0 errors) ==== -+ import { foo } from "/foo"; -+ import { bar } from "/bar"; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.errors.txt.diff deleted file mode 100644 index 15c3dae0fe..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.errors.txt.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.errors.txt -+++ new.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_differentRootTypes.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/root/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+ -+ -+==== /root/tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "/*": ["./src/*"], -+ "c:/*": ["./src/*"], -+ "c:\\*": ["./src/*"], -+ "//server/*": ["./src/*"], -+ "\\\\server\\*": ["./src/*"], -+ "file:///*": ["./src/*"], -+ "file://c:/*": ["./src/*"], -+ "file://server/*": ["./src/*"], -+ "http://server/*": ["./src/*"] -+ }, -+ "allowJs": true, -+ "outDir": "bin" -+ } -+ } -+ -+==== /root/src/foo.ts (0 errors) ==== -+ export function foo() {} -+ -+==== /root/src/bar.js (0 errors) ==== -+ export function bar() {} -+ -+==== /root/a.ts (0 errors) ==== -+ import { foo as foo1 } from "/foo"; -+ import { bar as bar1 } from "/bar"; -+ import { foo as foo2 } from "c:/foo"; -+ import { bar as bar2 } from "c:/bar"; -+ import { foo as foo3 } from "c:\\foo"; -+ import { bar as bar3 } from "c:\\bar"; -+ import { foo as foo4 } from "//server/foo"; -+ import { bar as bar4 } from "//server/bar"; -+ import { foo as foo5 } from "\\\\server\\foo"; -+ import { bar as bar5 } from "\\\\server\\bar"; -+ import { foo as foo6 } from "file:///foo"; -+ import { bar as bar6 } from "file:///bar"; -+ import { foo as foo7 } from "file://c:/foo"; -+ import { bar as bar7 } from "file://c:/bar"; -+ import { foo as foo8 } from "file://server/foo"; -+ import { bar as bar8 } from "file://server/bar"; -+ import { foo as foo9 } from "http://server/foo"; -+ import { bar as bar9 } from "http://server/bar"; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_multipleAliases.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_multipleAliases.errors.txt.diff deleted file mode 100644 index e3f58fe616..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_multipleAliases.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_multipleAliases.errors.txt -+++ new.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_multipleAliases.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/root/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+ -+ -+==== /root/tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "/client/*": ["./client/*"], -+ "/import/*": ["./import/*"] -+ }, -+ "allowJs": true, -+ "outDir": "bin" -+ } -+ } -+ -+==== /root/import/foo.ts (0 errors) ==== -+ export function foo() {} -+ -+==== /root/client/bar.js (0 errors) ==== -+ export function bar() {} -+ -+==== /root/src/a.ts (0 errors) ==== -+ import { foo } from "/import/foo"; -+ import { bar } from "/client/bar"; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.errors.txt.diff deleted file mode 100644 index 5acbf7d5af..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.errors.txt -+++ new.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/root/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+ -+ -+==== /root/tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "/*": ["./src/*"] -+ }, -+ "allowJs": true, -+ "outDir": "bin" -+ } -+ } -+ -+==== /root/a.ts (0 errors) ==== -+ import { foo } from "/foo"; -+ import { bar } from "/bar"; -+ -+==== /foo.ts (0 errors) ==== -+ export function foo() {} -+ -+==== /bar.js (0 errors) ==== -+ export function bar() {} -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.errors.txt.diff deleted file mode 100644 index b00565c3b1..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.errors.txt -+++ new.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/root/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+ -+ -+==== /root/tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "*": ["./src/*"] -+ }, -+ "allowJs": true, -+ "outDir": "bin" -+ } -+ } -+ -+==== /root/src/foo.ts (0 errors) ==== -+ export function foo() {} -+ -+==== /root/src/bar.js (0 errors) ==== -+ export function bar() {} -+ -+==== /root/a.ts (0 errors) ==== -+ import { foo } from "/foo"; -+ import { bar } from "/bar"; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.errors.txt.diff deleted file mode 100644 index 56b4e579f6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.errors.txt -+++ new.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/root/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+ -+ -+==== /root/tsconfig.json (1 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "*": ["./src/*"] -+ }, -+ "allowJs": true, -+ "outDir": "bin" -+ } -+ } -+ -+==== /root/a.ts (0 errors) ==== -+ import { foo } from "/foo"; -+ import { bar } from "/bar"; -+ -+==== /foo.ts (0 errors) ==== -+ export function foo() {} -+ -+==== /bar.js (0 errors) ==== -+ export function bar() {} -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtension.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtension.errors.txt.diff deleted file mode 100644 index 9c8f8a2b53..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtension.errors.txt.diff +++ /dev/null @@ -1,40 +0,0 @@ ---- old.pathMappingBasedModuleResolution_withExtension.errors.txt -+++ new.pathMappingBasedModuleResolution_withExtension.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+/tsconfig.json(5,21): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+/tsconfig.json(6,21): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== /tsconfig.json (3 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "foo": ["foo/foo.ts"], -+ ~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ "bar": ["bar/bar.js"] -+ ~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ }, -+ "allowJs": true, -+ "outDir": "bin" -+ } -+ } -+ -+==== /foo/foo.ts (0 errors) ==== -+ export function foo() {} -+ -+==== /bar/bar.js (0 errors) ==== -+ export function bar() {} -+ -+==== /a.ts (0 errors) ==== -+ import { foo } from "foo"; -+ import { bar } from "bar"; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtensionInName.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtensionInName.errors.txt.diff deleted file mode 100644 index 4ec6f8d156..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtensionInName.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.pathMappingBasedModuleResolution_withExtensionInName.errors.txt -+++ new.pathMappingBasedModuleResolution_withExtensionInName.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+/tsconfig.json(5,19): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== /tsconfig.json (2 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "*": ["foo/*"] -+ ~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ } -+ } -+ } -+ -+==== /foo/zone.js/index.d.ts (0 errors) ==== -+ export const x: number; -+ -+==== /foo/zone.tsx/index.d.ts (0 errors) ==== -+ export const y: number; -+ -+==== /a.ts (0 errors) ==== -+ import { x } from "zone.js"; -+ import { y } from "zone.tsx"; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.errors.txt.diff deleted file mode 100644 index 6b1cb2a5bb..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.errors.txt -+++ new.pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+/tsconfig.json(5,19): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+/tsconfig.json(5,37): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== /tsconfig.json (3 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "*": ["node_modules/*", "src/types"] -+ ~~~~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ ~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ }, -+ "allowJs": true, -+ "outDir": "bin" -+ } -+ } -+ -+==== /a.ts (0 errors) ==== -+ import foobar from "foo/bar/foobar.js"; -+ -+==== /node_modules/foo/bar/foobar.js (0 errors) ==== -+ module.exports = { a: 10 }; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtension_failedLookup.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtension_failedLookup.errors.txt.diff deleted file mode 100644 index 1a50f6a10c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingBasedModuleResolution_withExtension_failedLookup.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.pathMappingBasedModuleResolution_withExtension_failedLookup.errors.txt -+++ new.pathMappingBasedModuleResolution_withExtension_failedLookup.errors.txt -@@= skipped -0, +0 lines =@@ - /a.ts(1,21): error TS2307: Cannot find module 'foo' or its corresponding type declarations. -- -- --==== /tsconfig.json (0 errors) ==== -+/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+/tsconfig.json(5,21): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== /tsconfig.json (2 errors) ==== - { - "compilerOptions": { - "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. - "paths": { - "foo": ["foo/foo.ts"] -+ ~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? - } - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingInheritedBaseUrl.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingInheritedBaseUrl.errors.txt.diff deleted file mode 100644 index 5b5d21ca65..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathMappingInheritedBaseUrl.errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.pathMappingInheritedBaseUrl.errors.txt -+++ new.pathMappingInheritedBaseUrl.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/project/index.ts(1,20): error TS2307: Cannot find module 'p1' or its corresponding type declarations. -+/project/tsconfig.json(3,3): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["../other/*"]}' instead. -+ -+ -+==== /project/tsconfig.json (1 errors) ==== -+ { -+ "extends": "../other/tsconfig.base.json", -+ "compilerOptions": { -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["../other/*"]}' instead. -+ "module": "commonjs", -+ "paths": { -+ "p1": ["./lib/p1"] -+ } -+ } -+ } -+ -+==== /project/index.ts (1 errors) ==== -+ import { p1 } from "p1"; -+ ~~~~ -+!!! error TS2307: Cannot find module 'p1' or its corresponding type declarations. -+ -+==== /other/tsconfig.base.json (0 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": "." -+ } -+ } -+ -+==== /other/lib/p1/index.ts (0 errors) ==== -+ export const p1 = 0; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation1.errors.txt.diff deleted file mode 100644 index de8b8e95cd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation1.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.pathsValidation1.errors.txt -+++ new.pathsValidation1.errors.txt -@@= skipped -0, +0 lines =@@ -+tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. - tsconfig.json(5,18): error TS5063: Substitutions for pattern '*' should be an array. - - --==== tsconfig.json (1 errors) ==== -+==== tsconfig.json (2 errors) ==== - { - "compilerOptions": { - "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. - "paths": { - "*": "*" - ~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation2.errors.txt.diff deleted file mode 100644 index e8ba70de21..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation2.errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.pathsValidation2.errors.txt -+++ new.pathsValidation2.errors.txt -@@= skipped -0, +0 lines =@@ --tsconfig.json(5,19): error TS5064: Substitution '1' for pattern '*' has incorrect type, expected 'string', got 'number'. -- -- --==== tsconfig.json (1 errors) ==== -+tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+tsconfig.json(5,18): error TS5066: Substitutions for pattern '*' shouldn't be an empty array. -+ -+ -+==== tsconfig.json (2 errors) ==== - { - "compilerOptions": { - "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. - "paths": { - "*": [1] -- ~ --!!! error TS5064: Substitution '1' for pattern '*' has incorrect type, expected 'string', got 'number'. -+ ~~~ -+!!! error TS5066: Substitutions for pattern '*' shouldn't be an empty array. - } - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation3.errors.txt.diff deleted file mode 100644 index 7b2223c0f4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation3.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.pathsValidation3.errors.txt -+++ new.pathsValidation3.errors.txt -@@= skipped -0, +0 lines =@@ -+tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. - tsconfig.json(5,20): error TS5066: Substitutions for pattern 'foo' shouldn't be an empty array. - - --==== tsconfig.json (1 errors) ==== -+==== tsconfig.json (2 errors) ==== - { - "compilerOptions": { - "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. - "paths": { - "foo": [] - ~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation4.errors.txt.diff deleted file mode 100644 index 051c66adff..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pathsValidation4.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.pathsValidation4.errors.txt -+++ new.pathsValidation4.errors.txt -@@= skipped -0, +0 lines =@@ -+tsconfig.json(4,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./src/*"]}' instead. - tsconfig.json(6,11): error TS5061: Pattern '@interface/**/*' can have at most one '*' character. - tsconfig.json(7,11): error TS5061: Pattern '@service/**/*' can have at most one '*' character. - tsconfig.json(7,29): error TS5062: Substitution './src/service/**/*' in pattern '@service/**/*' can have at most one '*' character. -- -- --==== tsconfig.json (3 errors) ==== -+tsconfig.json(8,29): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== tsconfig.json (5 errors) ==== - { - "compilerOptions": { - "traceResolution": true, - "baseUrl": "./src", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./src/*"]}' instead. - "paths": { - "@interface/**/*" : ["./src/interface/*"], - ~~~~~~~~~~~~~~~~~ -@@= skipped -17, +23 lines =@@ - ~~~~~~~~~~~~~~~~~~~~ - !!! error TS5062: Substitution './src/service/**/*' in pattern '@service/**/*' can have at most one '*' character. - "@controller/*": ["controller/*"], -+ ~~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? - } - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileWithoutResolveJsonModuleAndPathMapping.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileWithoutResolveJsonModuleAndPathMapping.errors.txt.diff deleted file mode 100644 index 707620b72a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileWithoutResolveJsonModuleAndPathMapping.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.requireOfJsonFileWithoutResolveJsonModuleAndPathMapping.errors.txt -+++ new.requireOfJsonFileWithoutResolveJsonModuleAndPathMapping.errors.txt -@@= skipped -0, +0 lines =@@ - /a.ts(1,20): error TS2732: Cannot find module 'foo/bar/foobar.json'. Consider using '--resolveJsonModule' to import module with '.json' extension. -- -- --==== /tsconfig.json (0 errors) ==== -+/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+/tsconfig.json(5,19): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+/tsconfig.json(5,37): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== /tsconfig.json (3 errors) ==== - { - "compilerOptions": { - "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. - "paths": { - "*": ["node_modules/*", "src/types"] -+ ~~~~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ ~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? - }, - "allowJs": true, - "outDir": "bin" \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFile_PathMapping.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFile_PathMapping.errors.txt.diff deleted file mode 100644 index f309207447..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFile_PathMapping.errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.requireOfJsonFile_PathMapping.errors.txt -+++ new.requireOfJsonFile_PathMapping.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/tsconfig.json(3,9): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+ Use '"paths": {"*": ["./*"]}' instead. -+/tsconfig.json(5,19): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+/tsconfig.json(5,37): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ -+ -+==== /tsconfig.json (3 errors) ==== -+ { -+ "compilerOptions": { -+ "baseUrl": ".", -+ ~~~~~~~~~ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+!!! error TS5102: Use '"paths": {"*": ["./*"]}' instead. -+ "paths": { -+ "*": ["node_modules/*", "src/types"] -+ ~~~~~~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ ~~~~~~~~~~~ -+!!! error TS5090: Non-relative paths are not allowed. Did you forget a leading './'? -+ }, -+ "allowJs": true, -+ "outDir": "bin" -+ } -+ } -+ -+==== /a.ts (0 errors) ==== -+ import foobar from "foo/bar/foobar.json"; -+ -+==== /node_modules/foo/bar/foobar.json (0 errors) ==== -+ { "a": 10 } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/signaturesUseJSDocForOptionalParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/signaturesUseJSDocForOptionalParameters.errors.txt.diff deleted file mode 100644 index 43e74e3959..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/signaturesUseJSDocForOptionalParameters.errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.signaturesUseJSDocForOptionalParameters.errors.txt -+++ new.signaturesUseJSDocForOptionalParameters.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'jsDocOptionality.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'jsDocOptionality.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== jsDocOptionality.js (0 errors) ==== -+ function MyClass() { -+ this.prop = null; -+ } -+ /** -+ * @param {string} required -+ * @param {string} [notRequired] -+ * @returns {MyClass} -+ */ -+ MyClass.prototype.optionalParam = function(required, notRequired) { -+ return this; -+ }; -+ let pInst = new MyClass(); -+ let c1 = pInst.optionalParam('hello') -+ let c2 = pInst.optionalParam('hello', null) -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/signaturesUseJSDocForOptionalParameters.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/signaturesUseJSDocForOptionalParameters.types.diff deleted file mode 100644 index e1ae4ab9cd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/signaturesUseJSDocForOptionalParameters.types.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.signaturesUseJSDocForOptionalParameters.types -+++ new.signaturesUseJSDocForOptionalParameters.types -@@= skipped -1, +1 lines =@@ - - === jsDocOptionality.js === - function MyClass() { -->MyClass : typeof MyClass -+>MyClass : () => void - - this.prop = null; - >this.prop = null : null - >this.prop : any -->this : this -+>this : any - >prop : any - } - /** -@@= skipped -14, +14 lines =@@ - * @returns {MyClass} - */ - MyClass.prototype.optionalParam = function(required, notRequired) { -->MyClass.prototype.optionalParam = function(required, notRequired) { return this;} : (required: string, notRequired?: string) => MyClass -+>MyClass.prototype.optionalParam = function(required, notRequired) { return this;} : (required: any, notRequired: any) => any - >MyClass.prototype.optionalParam : any - >MyClass.prototype : any -->MyClass : typeof MyClass -+>MyClass : () => void - >prototype : any - >optionalParam : any -->function(required, notRequired) { return this;} : (required: string, notRequired?: string) => MyClass -->required : string -->notRequired : string -+>function(required, notRequired) { return this;} : (required: any, notRequired: any) => any -+>required : any -+>notRequired : any - - return this; -->this : this -+>this : any - - }; - let pInst = new MyClass(); -->pInst : MyClass -->new MyClass() : MyClass -->MyClass : typeof MyClass -+>pInst : any -+>new MyClass() : any -+>MyClass : () => void - - let c1 = pInst.optionalParam('hello') -->c1 : MyClass -->pInst.optionalParam('hello') : MyClass -->pInst.optionalParam : (required: string, notRequired?: string) => MyClass -->pInst : MyClass -->optionalParam : (required: string, notRequired?: string) => MyClass -+>c1 : any -+>pInst.optionalParam('hello') : any -+>pInst.optionalParam : any -+>pInst : any -+>optionalParam : any - >'hello' : "hello" - - let c2 = pInst.optionalParam('hello', null) -->c2 : MyClass -->pInst.optionalParam('hello', null) : MyClass -->pInst.optionalParam : (required: string, notRequired?: string) => MyClass -->pInst : MyClass -->optionalParam : (required: string, notRequired?: string) => MyClass -+>c2 : any -+>pInst.optionalParam('hello', null) : any -+>pInst.optionalParam : any -+>pInst : any -+>optionalParam : any - >'hello' : "hello" diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithCaseSensitiveFileNames.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithCaseSensitiveFileNames.errors.txt.diff deleted file mode 100644 index d0b34de703..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithCaseSensitiveFileNames.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.sourceMapWithCaseSensitiveFileNames.errors.txt -+++ new.sourceMapWithCaseSensitiveFileNames.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== testFiles/app.ts (0 errors) ==== -+ // Note in the out result we are using same folder name only different in casing -+ // Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts -+ class c { -+ } -+ -+==== testFiles/app2.ts (0 errors) ==== -+ class d { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithMultipleFilesWithCopyright.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithMultipleFilesWithCopyright.errors.txt.diff deleted file mode 100644 index 6ceaccc98e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithMultipleFilesWithCopyright.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.sourceMapWithMultipleFilesWithCopyright.errors.txt -+++ new.sourceMapWithMultipleFilesWithCopyright.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== b.ts (0 errors) ==== -+ /*-------------------------------------------------------------------------- -+ Copyright -+ ---------------------------------------------------------------------------*/ -+ -+ /// -+ var y = x; -+ -+==== a.ts (0 errors) ==== -+ /*-------------------------------------------------------------------------- -+ Copyright -+ ---------------------------------------------------------------------------*/ -+ -+ var x = { -+ a: 10, -+ b: 20 -+ }; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithMultipleFilesWithFileEndingWithInterface.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithMultipleFilesWithFileEndingWithInterface.errors.txt.diff deleted file mode 100644 index 84ea7d8cb0..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithMultipleFilesWithFileEndingWithInterface.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.sourceMapWithMultipleFilesWithFileEndingWithInterface.errors.txt -+++ new.sourceMapWithMultipleFilesWithFileEndingWithInterface.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.ts (0 errors) ==== -+ module M { -+ export var X = 1; -+ } -+ interface Navigator { -+ getGamepads(func?: any): any; -+ webkitGetGamepads(func?: any): any -+ msGetGamepads(func?: any): any; -+ webkitGamepads(func?: any): any; -+ } -+ -+==== b.ts (0 errors) ==== -+ module m1 { -+ export class c1 { -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithNonCaseSensitiveFileNames.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithNonCaseSensitiveFileNames.errors.txt.diff deleted file mode 100644 index d7d018245c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/sourceMapWithNonCaseSensitiveFileNames.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.sourceMapWithNonCaseSensitiveFileNames.errors.txt -+++ new.sourceMapWithNonCaseSensitiveFileNames.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== testFiles/app.ts (0 errors) ==== -+ // Note in the out result we are using same folder name only different in casing -+ // Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap -+ class c { -+ } -+ -+==== testFiles/app2.ts (0 errors) ==== -+ class d { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/typeReferenceDirectives11.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/typeReferenceDirectives11.errors.txt.diff deleted file mode 100644 index e459e50393..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/typeReferenceDirectives11.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.typeReferenceDirectives11.errors.txt -+++ new.typeReferenceDirectives11.errors.txt -@@= skipped -0, +0 lines =@@ --/mod1.ts(1,17): error TS6131: Cannot compile modules using option 'outFile' unless the '--module' flag is 'amd' or 'system'. -- -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== /mod2.ts (0 errors) ==== - import {foo} from "./mod1"; - export const bar = foo(); -@@= skipped -7, +8 lines =@@ - ==== /types/lib/index.d.ts (0 errors) ==== - interface Lib { x } - --==== /mod1.ts (1 errors) ==== -+==== /mod1.ts (0 errors) ==== - export function foo(): Lib { return {x: 1} } -- ~~~ --!!! error TS6131: Cannot compile modules using option 'outFile' unless the '--module' flag is 'amd' or 'system'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/typeReferenceDirectives12.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/typeReferenceDirectives12.errors.txt.diff deleted file mode 100644 index 2494304a93..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/typeReferenceDirectives12.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.typeReferenceDirectives12.errors.txt -+++ new.typeReferenceDirectives12.errors.txt -@@= skipped -0, +0 lines =@@ --/main.ts(1,14): error TS6131: Cannot compile modules using option 'outFile' unless the '--module' flag is 'amd' or 'system'. -- -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== /mod2.ts (0 errors) ==== - import { Cls } from "./main"; - import "./mod1"; -@@= skipped -11, +12 lines =@@ - ==== /types/lib/index.d.ts (0 errors) ==== - interface Lib { x } - --==== /main.ts (1 errors) ==== -+==== /main.ts (0 errors) ==== - export class Cls { -- ~~~ --!!! error TS6131: Cannot compile modules using option 'outFile' unless the '--module' flag is 'amd' or 'system'. - x - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/useBeforeDeclaration.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/useBeforeDeclaration.errors.txt.diff deleted file mode 100644 index 2f107b6c10..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/useBeforeDeclaration.errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.useBeforeDeclaration.errors.txt -+++ new.useBeforeDeclaration.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== A.ts (0 errors) ==== -+ namespace ts { -+ export function printVersion():void { -+ log("Version: " + sys.version); // the call of sys.version is deferred, should not report an error. -+ } -+ -+ export function log(info:string):void { -+ -+ } -+ } -+ -+==== B.ts (0 errors) ==== -+ namespace ts { -+ -+ export let sys:{version:string} = {version: "2.0.5"}; -+ -+ } -+ -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOnEndOfFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOnEndOfFile.errors.txt.diff deleted file mode 100644 index bdd99a963b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocOnEndOfFile.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.checkJsdocOnEndOfFile.errors.txt -+++ new.checkJsdocOnEndOfFile.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file 'eof.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - eof.js(2,20): error TS2304: Cannot find name 'bad'. - - -+!!! error TS5055: Cannot write file 'eof.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== eof.js (1 errors) ==== - /** - * @typedef {Array} Should have error here \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag1.errors.txt.diff deleted file mode 100644 index 78b346a05f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag1.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.checkJsdocReturnTag1.errors.txt -+++ new.checkJsdocReturnTag1.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file 'returns.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - returns.js(20,12): error TS2872: This kind of expression is always truthy. - - -+!!! error TS5055: Cannot write file 'returns.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== returns.js (1 errors) ==== - // @ts-check - /** \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag1.types.diff deleted file mode 100644 index 6ae67dd6b8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag1.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.checkJsdocReturnTag1.types -+++ new.checkJsdocReturnTag1.types -@@= skipped -15, +15 lines =@@ - * @returns {string=} This comment is not currently exposed - */ - function f1() { -->f1 : () => string | undefined -+>f1 : () => string - - return "hello world"; - >"hello world" : "hello world" \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.errors.txt.diff deleted file mode 100644 index 62dc9ab029..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocReturnTag2.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.checkJsdocReturnTag2.errors.txt -+++ new.checkJsdocReturnTag2.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file 'returns.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. - returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'string | number'. - returns.js(13,12): error TS2872: This kind of expression is always truthy. - - -+!!! error TS5055: Cannot write file 'returns.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== returns.js (3 errors) ==== - // @ts-check - /** \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff index 5657510b06..cb18606f8c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff @@ -39,7 +39,7 @@ /** @type {Argle} */ function blargle(s) { ->blargle : (x: "hi" | "bye") => 0 | 1 | 2 -+>blargle : (x: "bye" | "hi") => 0 | 1 | 2 ++>blargle : (s: "bye" | "hi") => 0 | 1 | 2 >s : "bye" | "hi" return 0; @@ -48,7 +48,7 @@ >zeroonetwo : 0 | 1 | 2 >blargle('hi') : 0 | 1 | 2 ->blargle : (x: "hi" | "bye") => 0 | 1 | 2 -+>blargle : (x: "bye" | "hi") => 0 | 1 | 2 ++>blargle : (s: "bye" | "hi") => 0 | 1 | 2 >'hi' : "hi" /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff index 3ae6aeb4b8..18a4844033 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff @@ -1,6 +1,33 @@ --- old.checkJsdocTypeTag6.types +++ new.checkJsdocTypeTag6.types -@@= skipped -69, +69 lines =@@ +@@= skipped -17, +17 lines =@@ + + /** @type {(a: number) => number} */ + function add1(a, b) { return a + b; } +->add1 : (a: number) => number ++>add1 : (a: number, b: any) => number + >a : number + >b : any + >a + b : any +@@= skipped -19, +19 lines =@@ + // TODO: Should be an error since signature doesn't match. + /** @type {(a: number, b: number, c: number) => number} */ + function add3(a, b) { return a + b; } +->add3 : (a: number, b: number, c: number) => number ++>add3 : (a: number, b: number) => number + >a : number + >b : number + >a + b : number +@@= skipped -12, +12 lines =@@ + + /** @type {() => void} */ + function funcWithMoreParameters(more) {} // error +->funcWithMoreParameters : () => void ++>funcWithMoreParameters : (more: any) => void + >more : any + + /** @type {() => void} */ +@@= skipped -21, +21 lines =@@ /** @type {() => void} */ methodWithMoreParameters(more) {}, // error diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff new file mode 100644 index 0000000000..bb0fb6f28f --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff @@ -0,0 +1,9 @@ +--- old.checkJsdocTypeTag7.types ++++ new.checkJsdocTypeTag7.types +@@= skipped -15, +15 lines =@@ + + /** @type {(optional?) => void} */ + methodWithOptionalParameters() {} +->methodWithOptionalParameters : (optional?: any) => void ++>methodWithOptionalParameters : () => void + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/computedPropertyNames52(target=es2015).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/computedPropertyNames52(target=es2015).errors.txt.diff deleted file mode 100644 index 47ab0f7e0a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/computedPropertyNames52(target=es2015).errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.computedPropertyNames52(target=es2015).errors.txt -+++ new.computedPropertyNames52(target=es2015).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'computedPropertyNames52.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'computedPropertyNames52.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== computedPropertyNames52.js (0 errors) ==== -+ const array = []; -+ for (let i = 0; i < 10; ++i) { -+ array.push(class C { -+ [i] = () => C; -+ static [i] = 100; -+ }) -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/computedPropertyNames52(target=es5).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/computedPropertyNames52(target=es5).errors.txt.diff deleted file mode 100644 index c24cbe73ee..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/computedPropertyNames52(target=es5).errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.computedPropertyNames52(target=es5).errors.txt -+++ new.computedPropertyNames52(target=es5).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'computedPropertyNames52.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'computedPropertyNames52.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== computedPropertyNames52.js (0 errors) ==== -+ const array = []; -+ for (let i = 0; i < 10; ++i) { -+ array.push(class C { -+ [i] = () => C; -+ static [i] = 100; -+ }) -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff deleted file mode 100644 index a36e8c01e6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/genericSetterInClassTypeJsDoc.errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.genericSetterInClassTypeJsDoc.errors.txt -+++ new.genericSetterInClassTypeJsDoc.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'genericSetterInClassTypeJsDoc.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'genericSetterInClassTypeJsDoc.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== genericSetterInClassTypeJsDoc.js (0 errors) ==== -+ /** -+ * @template T -+ */ -+ class Box { -+ #value; -+ -+ /** @param {T} initialValue */ -+ constructor(initialValue) { -+ this.#value = initialValue; -+ } -+ -+ /** @type {T} */ -+ get value() { -+ return this.#value; -+ } -+ -+ set value(value) { -+ this.#value = value; -+ } -+ } -+ -+ new Box(3).value = 3; -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/genericSetterInClassTypeJsDoc.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/genericSetterInClassTypeJsDoc.types.diff deleted file mode 100644 index dc8973c43c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/genericSetterInClassTypeJsDoc.types.diff +++ /dev/null @@ -1,59 +0,0 @@ ---- old.genericSetterInClassTypeJsDoc.types -+++ new.genericSetterInClassTypeJsDoc.types -@@= skipped -7, +7 lines =@@ - >Box : Box - - #value; -->#value : T -+>#value : any - - /** @param {T} initialValue */ - constructor(initialValue) { -@@= skipped -8, +8 lines =@@ - - this.#value = initialValue; - >this.#value = initialValue : T -->this.#value : T -+>this.#value : any - >this : this - >initialValue : T - } - - /** @type {T} */ - get value() { -->value : T -+>value : any - - return this.#value; -->this.#value : T -+>this.#value : any - >this : this - } - - set value(value) { -->value : T -->value : T -+>value : any -+>value : any - - this.#value = value; -->this.#value = value : T -->this.#value : T -+>this.#value = value : any -+>this.#value : any - >this : this -->value : T -+>value : any - } - } - - new Box(3).value = 3; - >new Box(3).value = 3 : 3 -->new Box(3).value : number -+>new Box(3).value : any - >new Box(3) : Box - >Box : typeof Box - >3 : 3 -->value : number -+>value : any - >3 : 3 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/globalThisVarDeclaration.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/globalThisVarDeclaration.errors.txt.diff deleted file mode 100644 index 6bcae3f222..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/globalThisVarDeclaration.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.globalThisVarDeclaration.errors.txt -+++ new.globalThisVarDeclaration.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - actual.ts(12,5): error TS2339: Property 'a' does not exist on type 'Window'. - actual.ts(13,5): error TS2339: Property 'b' does not exist on type 'Window'. - b.js(12,5): error TS2339: Property 'a' does not exist on type 'Window'. - b.js(13,5): error TS2339: Property 'b' does not exist on type 'Window'. - - -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== b.js (2 errors) ==== - var a = 10; - this.a; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/inferringClassMembersFromAssignments.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/inferringClassMembersFromAssignments.errors.txt.diff deleted file mode 100644 index 2970225a26..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/inferringClassMembersFromAssignments.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.inferringClassMembersFromAssignments.errors.txt -+++ new.inferringClassMembersFromAssignments.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - a.js(14,13): error TS7008: Member 'inMethodNullable' implicitly has an 'any' type. - a.js(20,9): error TS2322: Type 'string' is not assignable to type 'number'. - a.js(39,9): error TS2322: Type 'boolean' is not assignable to type 'number'. - - -+!!! error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== a.js (3 errors) ==== - class C { - constructor() { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsObjectsMarkedAsOpenEnded.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsObjectsMarkedAsOpenEnded.errors.txt.diff deleted file mode 100644 index fe64e53f34..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsObjectsMarkedAsOpenEnded.errors.txt.diff +++ /dev/null @@ -1,58 +0,0 @@ ---- old.jsObjectsMarkedAsOpenEnded.errors.txt -+++ new.jsObjectsMarkedAsOpenEnded.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+b.ts(3,29): error TS2339: Property 'a' does not exist on type '{}'. -+b.ts(4,14): error TS2339: Property 'a' does not exist on type '{}'. -+b.ts(5,8): error TS2339: Property 'a' does not exist on type '{}'. -+b.ts(6,10): error TS2339: Property 'a' does not exist on type '{}'. -+ -+ -+!!! error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.js (0 errors) ==== -+ var variable = {}; -+ variable.a = 0; -+ -+ class C { -+ initializedMember = {}; -+ constructor() { -+ this.member = {}; -+ this.member.a = 0; -+ } -+ } -+ -+ var obj = { -+ property: {} -+ }; -+ -+ obj.property.a = 0; -+ -+ var arr = [{}]; -+ -+ function getObj() { -+ return {}; -+ } -+ -+ -+==== b.ts (4 errors) ==== -+ variable.a = 1; -+ (new C()).member.a = 1; -+ (new C()).initializedMember.a = 1; -+ ~ -+!!! error TS2339: Property 'a' does not exist on type '{}'. -+ obj.property.a = 1; -+ ~ -+!!! error TS2339: Property 'a' does not exist on type '{}'. -+ arr[0].a = 1; -+ ~ -+!!! error TS2339: Property 'a' does not exist on type '{}'. -+ getObj().a = 1; -+ ~ -+!!! error TS2339: Property 'a' does not exist on type '{}'. -+ -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsObjectsMarkedAsOpenEnded.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsObjectsMarkedAsOpenEnded.types.diff deleted file mode 100644 index 186ceb1a55..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsObjectsMarkedAsOpenEnded.types.diff +++ /dev/null @@ -1,79 +0,0 @@ ---- old.jsObjectsMarkedAsOpenEnded.types -+++ new.jsObjectsMarkedAsOpenEnded.types -@@= skipped -1, +1 lines =@@ - - === a.js === - var variable = {}; -->variable : typeof variable -->{} : {} -+>variable : { a: number; } -+>{} : { a: number; } - - variable.a = 0; - >variable.a = 0 : 0 - >variable.a : number -->variable : typeof variable -+>variable : { a: number; } - >a : number - >0 : 0 - -@@= skipped -19, +19 lines =@@ - - constructor() { - this.member = {}; -->this.member = {} : {} -+>this.member = {} : { a: number; } - >this.member : any - >this : this - >member : any -->{} : {} -+>{} : { a: number; } - - this.member.a = 0; - >this.member.a = 0 : 0 -->this.member.a : error -->this.member : {} -+>this.member.a : number -+>this.member : { a: number; } - >this : this -->member : {} -->a : any -+>member : { a: number; } -+>a : number - >0 : 0 - } - } -@@= skipped -29, +29 lines =@@ - - obj.property.a = 0; - >obj.property.a = 0 : 0 -->obj.property.a : error -+>obj.property.a : any - >obj.property : {} - >obj : { property: {}; } - >property : {} -@@= skipped -24, +24 lines =@@ - variable.a = 1; - >variable.a = 1 : 1 - >variable.a : number -->variable : typeof variable -+>variable : { a: number; } - >a : number - >1 : 1 - - (new C()).member.a = 1; - >(new C()).member.a = 1 : 1 -->(new C()).member.a : any -->(new C()).member : {} -+>(new C()).member.a : number -+>(new C()).member : { a: number; } - >(new C()) : C - >new C() : C - >C : typeof C -->member : {} -->a : any -+>member : { a: number; } -+>a : number - >1 : 1 - - (new C()).initializedMember.a = 1; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTagsDeclarations.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTagsDeclarations.errors.txt.diff deleted file mode 100644 index 1813c006bb..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTagsDeclarations.errors.txt.diff +++ /dev/null @@ -1,51 +0,0 @@ ---- old.jsdocAccessibilityTagsDeclarations.errors.txt -+++ new.jsdocAccessibilityTagsDeclarations.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'jsdocAccessibilityTagDeclarations.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'jsdocAccessibilityTagDeclarations.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== jsdocAccessibilityTagDeclarations.js (0 errors) ==== -+ class Protected { -+ /** @protected */ -+ constructor(c) { -+ /** @protected */ -+ this.c = c -+ } -+ /** @protected */ -+ m() { -+ return this.c -+ } -+ /** @protected */ -+ get p() { return this.c } -+ /** @protected */ -+ set p(value) { this.c = value } -+ } -+ -+ class Private { -+ /** @private */ -+ constructor(c) { -+ /** @private */ -+ this.c = c -+ } -+ /** @private */ -+ m() { -+ return this.c -+ } -+ /** @private */ -+ get p() { return this.c } -+ /** @private */ -+ set p(value) { this.c = value } -+ } -+ -+ // https://github.com/microsoft/TypeScript/issues/38401 -+ class C { -+ constructor(/** @public */ x, /** @protected */ y, /** @private */ z) { -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocLiteral.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocLiteral.errors.txt.diff deleted file mode 100644 index d22e40ecc7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocLiteral.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.jsdocLiteral.errors.txt -+++ new.jsdocLiteral.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'in.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'in.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== in.js (0 errors) ==== -+ /** -+ * @param {'literal'} p1 -+ * @param {"literal"} p2 -+ * @param {'literal' | 'other'} p3 -+ * @param {'literal' | number} p4 -+ * @param {12 | true | 'str'} p5 -+ */ -+ function f(p1, p2, p3, p4, p5) { -+ return p1 + p2 + p3 + p4 + p5 + '.'; -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocLiteral.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocLiteral.types.diff deleted file mode 100644 index 1419b46639..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocLiteral.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocLiteral.types -+++ new.jsdocLiteral.types -@@= skipped -8, +8 lines =@@ - * @param {12 | true | 'str'} p5 - */ - function f(p1, p2, p3, p4, p5) { -->f : (p1: "literal", p2: "literal", p3: "literal" | "other", p4: "literal" | number, p5: 12 | true | "str") => string -+>f : (p1: "literal", p2: "literal", p3: "literal" | "other", p4: number | "literal", p5: "str" | 12 | true) => string - >p1 : "literal" - >p2 : "literal" - >p3 : "literal" | "other" \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocNeverUndefinedNull.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocNeverUndefinedNull.errors.txt.diff deleted file mode 100644 index 4bf87aedf5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocNeverUndefinedNull.errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.jsdocNeverUndefinedNull.errors.txt -+++ new.jsdocNeverUndefinedNull.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'in.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'in.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== in.js (0 errors) ==== -+ /** -+ * @param {never} p1 -+ * @param {undefined} p2 -+ * @param {null} p3 -+ * @returns {void} nothing -+ */ -+ function f(p1, p2, p3) { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.errors.txt.diff deleted file mode 100644 index c6b91f0be7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.jsdocReadonlyDeclarations.errors.txt -+++ new.jsdocReadonlyDeclarations.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'jsdocReadonlyDeclarations.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'jsdocReadonlyDeclarations.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== jsdocReadonlyDeclarations.js (0 errors) ==== -+ class C { -+ /** @readonly */ -+ x = 6 -+ /** @readonly */ -+ constructor(n) { -+ this.x = n -+ /** -+ * @readonly -+ * @type {number} -+ */ -+ this.y = n -+ } -+ } -+ new C().x -+ -+ function F() { -+ /** @readonly */ -+ this.z = 1 -+ } -+ -+ // https://github.com/microsoft/TypeScript/issues/38401 -+ class D { -+ constructor(/** @readonly */ x) {} -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff deleted file mode 100644 index e2067902d4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.jsdocReadonlyDeclarations.types -+++ new.jsdocReadonlyDeclarations.types -@@= skipped -38, +38 lines =@@ - >x : 6 - - function F() { -->F : typeof F -+>F : () => void - - /** @readonly */ - this.z = 1 - >this.z = 1 : 1 - >this.z : any -->this : this -+>this : any - >z : any - >1 : 1 - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.errors.txt.diff deleted file mode 100644 index 10985f75b2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.jsdocReturnTag1.errors.txt -+++ new.jsdocReturnTag1.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'returns.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'returns.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== returns.js (0 errors) ==== -+ /** -+ * @returns {string} This comment is not currently exposed -+ */ -+ function f() { -+ return 5; -+ } -+ -+ /** -+ * @returns {string=} This comment is not currently exposed -+ */ -+ function f1() { -+ return 5; -+ } -+ -+ /** -+ * @returns {string|number} This comment is not currently exposed -+ */ -+ function f2() { -+ return 5 || "hello"; -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.types.diff deleted file mode 100644 index 355cf8c74a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReturnTag1.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsdocReturnTag1.types -+++ new.jsdocReturnTag1.types -@@= skipped -14, +14 lines =@@ - * @returns {string=} This comment is not currently exposed - */ - function f1() { -->f1 : () => string | undefined -+>f1 : () => string - - return 5; - >5 : 5 \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff index d4cb3a18d4..1a8ac7b8a7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff @@ -1,6 +1,15 @@ --- old.jsdocThisType.types +++ new.jsdocThisType.types -@@= skipped -35, +35 lines =@@ +@@= skipped -24, +24 lines =@@ + + /** @type {import('./types').M} */ + export function f2() { +->f2 : (this: import("/types").Foo) => void ++>f2 : () => void + + this.test(); + >this.test() : any +@@= skipped -11, +11 lines =@@ /** @type {(this: import('./types').Foo) => void} */ export const f3 = function() { @@ -16,7 +25,7 @@ /** @type {(this: import('./types').Foo) => void} */ export function f4() { ->f4 : (this: import("./types").Foo) => void -+>f4 : (this: import("/types").Foo) => void ++>f4 : () => void this.test(); >this.test() : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff index 0e12a93ad7..efc34c532f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff @@ -32,4 +32,12 @@ -!!! related TS6210 a.js:1:21: An argument for '0' was not provided. g() // should error ~ - !!! error TS2554: Expected 1 arguments, but got 0. \ No newline at end of file + !!! error TS2554: Expected 1 arguments, but got 0. +-!!! related TS6210 a.js:4:13: An argument for 's' was not provided. ++!!! related TS6210 a.js:5:12: An argument for 's' was not provided. + h() + ~ + !!! error TS2554: Expected 1 arguments, but got 0. +-!!! related TS6210 a.js:7:14: An argument for 's' was not provided. ++!!! related TS6210 a.js:8:12: An argument for 's' was not provided. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/methodsReturningThis.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/methodsReturningThis.errors.txt.diff deleted file mode 100644 index 2aa9ea3027..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/methodsReturningThis.errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.methodsReturningThis.errors.txt -+++ new.methodsReturningThis.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'input.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'input.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== input.js (0 errors) ==== -+ function Class() -+ { -+ } -+ -+ // error: 'Class' doesn't have property 'notPresent' -+ Class.prototype.containsError = function () { return this.notPresent; }; -+ -+ // lots of methods that return this, which caused out-of-memory in #9527 -+ Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; }; -+ Class.prototype.m2 = function (x, y) { return this; }; -+ Class.prototype.m3 = function (x, y) { return this; }; -+ Class.prototype.m4 = function (angle) { return this; }; -+ Class.prototype.m5 = function (matrix) { return this; }; -+ Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; }; -+ Class.prototype.m7 = function(matrix) { return this; }; -+ Class.prototype.m8 = function() { return this; }; -+ Class.prototype.m9 = function () { return this; }; -+ -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/methodsReturningThis.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/methodsReturningThis.types.diff deleted file mode 100644 index b1563c3a44..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/methodsReturningThis.types.diff +++ /dev/null @@ -1,173 +0,0 @@ ---- old.methodsReturningThis.types -+++ new.methodsReturningThis.types -@@= skipped -1, +1 lines =@@ - - === input.js === - function Class() -->Class : typeof Class -+>Class : () => void - { - } - -@@= skipped -9, +9 lines =@@ - >Class.prototype.containsError = function () { return this.notPresent; } : () => any - >Class.prototype.containsError : any - >Class.prototype : any -->Class : typeof Class -+>Class : () => void - >prototype : any - >containsError : any - >function () { return this.notPresent; } : () => any -->this.notPresent : error -->this : this -+>this.notPresent : any -+>this : any - >notPresent : any - - // lots of methods that return this, which caused out-of-memory in #9527 - Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; }; -->Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; } : (a: any, b: any, c: any, d: any, tx: any, ty: any) => this -+>Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; } : (a: any, b: any, c: any, d: any, tx: any, ty: any) => any - >Class.prototype.m1 : any - >Class.prototype : any -->Class : typeof Class -+>Class : () => void - >prototype : any - >m1 : any -->function (a, b, c, d, tx, ty) { return this; } : (a: any, b: any, c: any, d: any, tx: any, ty: any) => this -+>function (a, b, c, d, tx, ty) { return this; } : (a: any, b: any, c: any, d: any, tx: any, ty: any) => any - >a : any - >b : any - >c : any - >d : any - >tx : any - >ty : any -->this : this -+>this : any - - Class.prototype.m2 = function (x, y) { return this; }; -->Class.prototype.m2 = function (x, y) { return this; } : (x: any, y: any) => this -+>Class.prototype.m2 = function (x, y) { return this; } : (x: any, y: any) => any - >Class.prototype.m2 : any - >Class.prototype : any -->Class : typeof Class -+>Class : () => void - >prototype : any - >m2 : any -->function (x, y) { return this; } : (x: any, y: any) => this -+>function (x, y) { return this; } : (x: any, y: any) => any - >x : any - >y : any -->this : this -+>this : any - - Class.prototype.m3 = function (x, y) { return this; }; -->Class.prototype.m3 = function (x, y) { return this; } : (x: any, y: any) => this -+>Class.prototype.m3 = function (x, y) { return this; } : (x: any, y: any) => any - >Class.prototype.m3 : any - >Class.prototype : any -->Class : typeof Class -+>Class : () => void - >prototype : any - >m3 : any -->function (x, y) { return this; } : (x: any, y: any) => this -+>function (x, y) { return this; } : (x: any, y: any) => any - >x : any - >y : any -->this : this -+>this : any - - Class.prototype.m4 = function (angle) { return this; }; -->Class.prototype.m4 = function (angle) { return this; } : (angle: any) => this -+>Class.prototype.m4 = function (angle) { return this; } : (angle: any) => any - >Class.prototype.m4 : any - >Class.prototype : any -->Class : typeof Class -+>Class : () => void - >prototype : any - >m4 : any -->function (angle) { return this; } : (angle: any) => this -+>function (angle) { return this; } : (angle: any) => any - >angle : any -->this : this -+>this : any - - Class.prototype.m5 = function (matrix) { return this; }; -->Class.prototype.m5 = function (matrix) { return this; } : (matrix: any) => this -+>Class.prototype.m5 = function (matrix) { return this; } : (matrix: any) => any - >Class.prototype.m5 : any - >Class.prototype : any -->Class : typeof Class -+>Class : () => void - >prototype : any - >m5 : any -->function (matrix) { return this; } : (matrix: any) => this -+>function (matrix) { return this; } : (matrix: any) => any - >matrix : any -->this : this -+>this : any - - Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; }; -->Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; } : (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => this -+>Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; } : (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => any - >Class.prototype.m6 : any - >Class.prototype : any -->Class : typeof Class -+>Class : () => void - >prototype : any - >m6 : any -->function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; } : (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => this -+>function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; } : (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => any - >x : any - >y : any - >pivotX : any -@@= skipped -88, +88 lines =@@ - >rotation : any - >skewX : any - >skewY : any -->this : this -+>this : any - - Class.prototype.m7 = function(matrix) { return this; }; -->Class.prototype.m7 = function(matrix) { return this; } : (matrix: any) => this -+>Class.prototype.m7 = function(matrix) { return this; } : (matrix: any) => any - >Class.prototype.m7 : any - >Class.prototype : any -->Class : typeof Class -+>Class : () => void - >prototype : any - >m7 : any -->function(matrix) { return this; } : (matrix: any) => this -+>function(matrix) { return this; } : (matrix: any) => any - >matrix : any -->this : this -+>this : any - - Class.prototype.m8 = function() { return this; }; -->Class.prototype.m8 = function() { return this; } : () => this -+>Class.prototype.m8 = function() { return this; } : () => any - >Class.prototype.m8 : any - >Class.prototype : any -->Class : typeof Class -+>Class : () => void - >prototype : any - >m8 : any -->function() { return this; } : () => this -->this : this -+>function() { return this; } : () => any -+>this : any - - Class.prototype.m9 = function () { return this; }; -->Class.prototype.m9 = function () { return this; } : () => this -+>Class.prototype.m9 = function () { return this; } : () => any - >Class.prototype.m9 : any - >Class.prototype : any -->Class : typeof Class -+>Class : () => void - >prototype : any - >m9 : any -->function () { return this; } : () => this -->this : this -+>function () { return this; } : () => any -+>this : any - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff index e7111af3a3..23aa34c07b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff @@ -30,6 +30,6 @@ === importer.js === import('./bug28014') -->import('./bug28014') : Promise<{ (): void; version: 1; }> +->import('./bug28014') : Promise<{ version: 1; default: { (): void; version: 1; }; }> +>import('./bug28014') : Promise<() => void> >'./bug28014' : "./bug28014" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/multipleDeclarations.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/multipleDeclarations.errors.txt.diff deleted file mode 100644 index e0b3dd7b2b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/multipleDeclarations.errors.txt.diff +++ /dev/null @@ -1,48 +0,0 @@ ---- old.multipleDeclarations.errors.txt -+++ new.multipleDeclarations.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'input.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'input.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== input.js (0 errors) ==== -+ function C() { -+ this.m = null; -+ } -+ C.prototype.m = function() { -+ this.nothing(); -+ } -+ class X { -+ constructor() { -+ this.m = this.m.bind(this); -+ this.mistake = 'frankly, complete nonsense'; -+ } -+ m() { -+ } -+ mistake() { -+ } -+ } -+ let x = new X(); -+ X.prototype.mistake = false; -+ x.m(); -+ x.mistake; -+ class Y { -+ mistake() { -+ } -+ m() { -+ } -+ constructor() { -+ this.m = this.m.bind(this); -+ this.mistake = 'even more nonsense'; -+ } -+ } -+ Y.prototype.mistake = true; -+ let y = new Y(); -+ y.m(); -+ y.mistake(); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/multipleDeclarations.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/multipleDeclarations.types.diff deleted file mode 100644 index d714127fa7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/multipleDeclarations.types.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.multipleDeclarations.types -+++ new.multipleDeclarations.types -@@= skipped -1, +1 lines =@@ - - === input.js === - function C() { -->C : typeof C -+>C : () => void - - this.m = null; - >this.m = null : null - >this.m : any -->this : this -+>this : any - >m : any - } - C.prototype.m = function() { - >C.prototype.m = function() { this.nothing();} : () => void - >C.prototype.m : any - >C.prototype : any -->C : typeof C -+>C : () => void - >prototype : any - >m : any - >function() { this.nothing();} : () => void - - this.nothing(); -->this.nothing() : error -->this.nothing : error -->this : this -+>this.nothing() : any -+>this.nothing : any -+>this : any - >nothing : any - } - class X { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff deleted file mode 100644 index a6775022ac..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.node10AlternateResult_noResolution.errors.txt -+++ new.node10AlternateResult_noResolution.errors.txt -@@= skipped -0, +0 lines =@@ --error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. --/index.ts(1,21): error TS2307: Cannot find module 'pkg' or its corresponding type declarations. -- There are types at '/node_modules/pkg/definitely-not-index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. -- -- --!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -+/index.ts(1,10): error TS2305: Module '"pkg"' has no exported member 'pkg'. -+ -+ - ==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", -@@= skipped -17, +14 lines =@@ - - ==== /index.ts (1 errors) ==== - import { pkg } from "pkg"; -- ~~~~~ --!!! error TS2307: Cannot find module 'pkg' or its corresponding type declarations. --!!! error TS2307: There are types at '/node_modules/pkg/definitely-not-index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. -+ ~~~ -+!!! error TS2305: Module '"pkg"' has no exported member 'pkg'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff deleted file mode 100644 index 7a0400b9f7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.node10Alternateresult_noTypes.errors.txt -+++ new.node10Alternateresult_noTypes.errors.txt -@@= skipped -0, +0 lines =@@ --error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. --error TS6504: File '/node_modules/pkg/untyped.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? -- The file is in the program because: -- Root file specified for compilation --/index.ts(1,21): error TS7016: Could not find a declaration file for module 'pkg'. '/node_modules/pkg/untyped.js' implicitly has an 'any' type. -- There are types at '/node_modules/pkg/definitely-not-index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. -- -- --!!! error TS5107: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. --!!! error TS6504: File '/node_modules/pkg/untyped.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? --!!! error TS6504: The file is in the program because: --!!! error TS6504: Root file specified for compilation -+/index.ts(1,10): error TS2305: Module '"pkg"' has no exported member 'pkg'. -+ -+ - ==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", -@@= skipped -27, +18 lines =@@ - - ==== /index.ts (1 errors) ==== - import { pkg } from "pkg"; -- ~~~~~ --!!! error TS7016: Could not find a declaration file for module 'pkg'. '/node_modules/pkg/untyped.js' implicitly has an 'any' type. --!!! error TS7016: There are types at '/node_modules/pkg/definitely-not-index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. -+ ~~~ -+!!! error TS2305: Module '"pkg"' has no exported member 'pkg'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/topLevelThisAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/topLevelThisAssignment.errors.txt.diff deleted file mode 100644 index 938aa0e9c2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/topLevelThisAssignment.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.topLevelThisAssignment.errors.txt -+++ new.topLevelThisAssignment.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+a.js(3,1): error TS2304: Cannot find name 'a'. -+b.js(2,1): error TS2304: Cannot find name 'a'. -+ -+ -+!!! error TS5055: Cannot write file 'a.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5055: Cannot write file 'b.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== a.js (1 errors) ==== -+ this.a = 10; -+ this.a; -+ a; -+ ~ -+!!! error TS2304: Cannot find name 'a'. -+ -+==== b.js (1 errors) ==== -+ this.a; -+ a; -+ ~ -+!!! error TS2304: Cannot find name 'a'. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/topLevelThisAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/topLevelThisAssignment.types.diff deleted file mode 100644 index 6f0038f894..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/topLevelThisAssignment.types.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.topLevelThisAssignment.types -+++ new.topLevelThisAssignment.types -@@= skipped -2, +2 lines =@@ - === a.js === - this.a = 10; - >this.a = 10 : 10 -->this.a : number -+>this.a : any - >this : typeof globalThis -->a : number -+>a : any - >10 : 10 - - this.a; -->this.a : number -+>this.a : any - >this : typeof globalThis -->a : number -+>a : any - - a; -->a : number -+>a : any - - === b.js === - this.a; -->this.a : number -+>this.a : any - >this : typeof globalThis -->a : number -+>a : any - - a; -->a : number -+>a : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff new file mode 100644 index 0000000000..5f966384cc --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff @@ -0,0 +1,39 @@ +--- old.typeFromPropertyAssignment17.errors.txt ++++ new.typeFromPropertyAssignment17.errors.txt +@@= skipped -0, +0 lines =@@ +- ++use.js(3,8): error TS2554: Expected 1 arguments, but got 0. ++ ++ ++==== use.js (1 errors) ==== ++ /// ++ var mini = require('./minimatch') ++ mini.M.defaults() ++ ~~~~~~~~ ++!!! error TS2554: Expected 1 arguments, but got 0. ++!!! related TS6210 minimatch.js:10:24: An argument for 'def' was not provided. ++ var m = new mini.M() ++ m.m() ++ mini.filter() ++ ++==== types.d.ts (0 errors) ==== ++ declare var require: any; ++ declare var module: any; ++==== minimatch.js (0 errors) ==== ++ /// ++ module.exports = minimatch ++ minimatch.M = M ++ minimatch.filter = filter ++ function filter() { ++ return minimatch() ++ } ++ function minimatch() { ++ } ++ M.defaults = function (def) { ++ return def ++ } ++ M.prototype.m = function () { ++ } ++ function M() { ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment7.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment7.errors.txt.diff new file mode 100644 index 0000000000..3ee1f1f7e3 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment7.errors.txt.diff @@ -0,0 +1,17 @@ +--- old.typeFromPropertyAssignment7.errors.txt ++++ new.typeFromPropertyAssignment7.errors.txt +@@= skipped -0, +0 lines =@@ +- ++a.js(5,13): error TS2554: Expected 1 arguments, but got 0. ++ ++ ++==== a.js (1 errors) ==== ++ var obj = {}; ++ obj.method = function (hunch) { ++ return true; ++ } ++ var b = obj.method(); ++ ~~~~~~ ++!!! error TS2554: Expected 1 arguments, but got 0. ++!!! related TS6210 a.js:2:24: An argument for 'hunch' was not provided. ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeSatisfaction_js.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeSatisfaction_js.errors.txt.diff deleted file mode 100644 index 8dce7333c0..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeSatisfaction_js.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.typeSatisfaction_js.errors.txt -+++ new.typeSatisfaction_js.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file '/src/a.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - /src/a.js(1,29): error TS8037: Type satisfaction expressions can only be used in TypeScript files. - - -+!!! error TS5055: Cannot write file '/src/a.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== /src/a.js (1 errors) ==== - var v = undefined satisfies 1; - ~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff new file mode 100644 index 0000000000..80d3d366a0 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff @@ -0,0 +1,20 @@ +--- old.typeTagOnFunctionReferencesGeneric.types ++++ new.typeTagOnFunctionReferencesGeneric.types +@@= skipped -6, +6 lines =@@ + + /**@type {IFn}*/ + export function inJs(l) { +->inJs : (m: T) => T ++>inJs : (l: T) => T + >l : T + + return l; +@@= skipped -8, +8 lines =@@ + } + inJs(1); // lints error. Why? + >inJs(1) : 1 +->inJs : (m: T) => T ++>inJs : (l: T) => T + >1 : 1 + + /**@type {IFn}*/ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagWithGenericSignature.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagWithGenericSignature.types.diff index 02313972c3..d5a2254495 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagWithGenericSignature.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagWithGenericSignature.types.diff @@ -5,7 +5,7 @@ /** @type {(param?: T) => T | undefined} */ function typed(param) { ->typed : (param?: T) => T | undefined -+>typed : (param?: T | undefined) => T | undefined ++>typed : (param: T | undefined) => T | undefined >param : T | undefined return param; @@ -14,6 +14,6 @@ >n : number | undefined >typed(1) : 1 | undefined ->typed : (param?: T) => T | undefined -+>typed : (param?: T | undefined) => T | undefined ++>typed : (param: T | undefined) => T | undefined >1 : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typesVersions.emptyTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typesVersions.emptyTypes.errors.txt.diff deleted file mode 100644 index d98c7e28e9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typesVersions.emptyTypes.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.typesVersions.emptyTypes.errors.txt -+++ new.typesVersions.emptyTypes.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+/b/user.ts(1,19): error TS2307: Cannot find module 'a' or its corresponding type declarations. -+ -+ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+==== /a/package.json (0 errors) ==== -+ { -+ "types": "", -+ "typesVersions": { -+ ">=3.1.0-0": { "*" : ["ts3.1/*"] } -+ } -+ } -+ -+==== /a/ts3.1/index.d.ts (0 errors) ==== -+ export const a = 0; -+ -+==== /b/user.ts (1 errors) ==== -+ import { a } from "a"; -+ ~~~ -+!!! error TS2307: Cannot find module 'a' or its corresponding type declarations. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typesVersions.justIndex.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typesVersions.justIndex.errors.txt.diff deleted file mode 100644 index f743bc2658..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typesVersions.justIndex.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.typesVersions.justIndex.errors.txt -+++ new.typesVersions.justIndex.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+/b/user.ts(1,19): error TS2307: Cannot find module 'a' or its corresponding type declarations. -+ -+ -+!!! error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration. -+==== /a/package.json (0 errors) ==== -+ { -+ "typesVersions": { -+ ">=3.1.0-0": { "*" : ["ts3.1/*"] } -+ } -+ } -+ -+==== /a/ts3.1/index.d.ts (0 errors) ==== -+ export const a = 0; -+ -+==== /b/user.ts (1 errors) ==== -+ import { a } from "a"; -+ ~~~ -+!!! error TS2307: Cannot find module 'a' or its corresponding type declarations. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/unannotatedParametersAreOptional.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/unannotatedParametersAreOptional.errors.txt.diff new file mode 100644 index 0000000000..ff90a5833b --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/unannotatedParametersAreOptional.errors.txt.diff @@ -0,0 +1,52 @@ +--- old.unannotatedParametersAreOptional.errors.txt ++++ new.unannotatedParametersAreOptional.errors.txt +@@= skipped -0, +0 lines =@@ +- ++test.js(2,1): error TS2554: Expected 1 arguments, but got 0. ++test.js(10,3): error TS2554: Expected 1 arguments, but got 0. ++test.js(11,9): error TS2554: Expected 1 arguments, but got 0. ++test.js(12,9): error TS2554: Expected 1 arguments, but got 0. ++test.js(19,5): error TS2554: Expected 1 arguments, but got 0. ++test.js(20,5): error TS2554: Expected 1 arguments, but got 0. ++ ++ ++==== test.js (6 errors) ==== ++ function f(x) {} ++ f(); // Always been ok ++ ~ ++!!! error TS2554: Expected 1 arguments, but got 0. ++!!! related TS6210 test.js:1:12: An argument for 'x' was not provided. ++ ++ class C { ++ static m(x) {} ++ p = x => {} ++ m(x) {} ++ } ++ ++ C.m(); // Always been ok ++ ~ ++!!! error TS2554: Expected 1 arguments, but got 0. ++!!! related TS6210 test.js:5:12: An argument for 'x' was not provided. ++ new C().m(); // Regression #39261 ++ ~ ++!!! error TS2554: Expected 1 arguments, but got 0. ++!!! related TS6210 test.js:7:5: An argument for 'x' was not provided. ++ new C().p(); // Regression #39261 ++ ~ ++!!! error TS2554: Expected 1 arguments, but got 0. ++!!! related TS6210 test.js:6:7: An argument for 'x' was not provided. ++ ++ const obj = { ++ m(x) {}, ++ p: x => {} ++ }; ++ ++ obj.m(); // Always been ok ++ ~ ++!!! error TS2554: Expected 1 arguments, but got 0. ++!!! related TS6210 test.js:15:5: An argument for 'x' was not provided. ++ obj.p(); // Always been ok ++ ~ ++!!! error TS2554: Expected 1 arguments, but got 0. ++!!! related TS6210 test.js:16:6: An argument for 'x' was not provided. ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff deleted file mode 100644 index ec745b980a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.uniqueSymbolsDeclarationsInJs.errors.txt -+++ new.uniqueSymbolsDeclarationsInJs.errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5055: Cannot write file 'uniqueSymbolsDeclarationsInJs.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+ -+ -+!!! error TS5055: Cannot write file 'uniqueSymbolsDeclarationsInJs.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. -+==== uniqueSymbolsDeclarationsInJs.js (0 errors) ==== -+ // classes -+ class C { -+ /** -+ * @readonly -+ */ -+ static readonlyStaticCall = Symbol(); -+ /** -+ * @type {unique symbol} -+ * @readonly -+ */ -+ static readonlyStaticType; -+ /** -+ * @type {unique symbol} -+ * @readonly -+ */ -+ static readonlyStaticTypeAndCall = Symbol(); -+ static readwriteStaticCall = Symbol(); -+ -+ /** -+ * @readonly -+ */ -+ readonlyCall = Symbol(); -+ readwriteCall = Symbol(); -+ } -+ -+ /** @type {unique symbol} */ -+ const a = Symbol(); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff deleted file mode 100644 index 7896e7b1e6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.uniqueSymbolsDeclarationsInJsErrors.errors.txt -+++ new.uniqueSymbolsDeclarationsInJsErrors.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5055: Cannot write file 'uniqueSymbolsDeclarationsInJsErrors.js' because it would overwrite input file. -+ Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - uniqueSymbolsDeclarationsInJsErrors.js(5,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - uniqueSymbolsDeclarationsInJsErrors.js(14,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - - -+!!! error TS5055: Cannot write file 'uniqueSymbolsDeclarationsInJsErrors.js' because it would overwrite input file. -+!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. -+!!! error TS5102: Option 'outFile' has been removed. Please remove it from your configuration. - ==== uniqueSymbolsDeclarationsInJsErrors.js (2 errors) ==== - class C { - /** \ No newline at end of file diff --git a/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/inferred-type-from-transitive-module-with-isolatedModules.js b/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/inferred-type-from-transitive-module-with-isolatedModules.js index 7b909938d8..32bc36e59d 100644 --- a/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/inferred-type-from-transitive-module-with-isolatedModules.js +++ b/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/inferred-type-from-transitive-module-with-isolatedModules.js @@ -124,10 +124,43 @@ export declare const lazyBar: LazyAction<(param: string) => void, typeof import( //// [/home/src/workspaces/project/obj/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.lazyBar = void 0; const bundling_1 = require("./bundling"); -const lazyModule = new bundling_1.LazyModule(() => Promise.resolve().then(() => require('./lazyIndex'))); +const lazyModule = new bundling_1.LazyModule(() => Promise.resolve().then(() => __importStar(require('./lazyIndex')))); exports.lazyBar = new bundling_1.LazyAction(lazyModule, m => m.bar); //// [/home/src/workspaces/project/obj/lazyIndex.d.ts] *new* @@ -135,10 +168,13 @@ export { default as bar } from './bar'; //// [/home/src/workspaces/project/obj/lazyIndex.js] *new* "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.bar = void 0; const bar_1 = require("./bar"); -Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return bar_1.default; } }); +Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return __importDefault(bar_1).default; } }); //// [/home/src/workspaces/project/obj/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[[2,6]],"fileNames":["lib.d.ts","../bar.ts","../bundling.ts","../global.d.ts","../lazyIndex.ts","../index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"76a83326d4e197789f8362e994577f53-interface RawAction {\n (...args: any[]): Promise | void;\n}\ninterface ActionFactory {\n (target: T): T;\n}\ndeclare function foo(): ActionFactory;\nexport default foo()(function foobar(param: string): void {\n});","signature":"16f73d7e0c200fed165b8fa7d55fefbf-declare const _default: (param: string) => void;\nexport default _default;\n","impliedNodeFormat":1},{"version":"16bf1b870d8b21533eda3b1f1b87cd77-export class LazyModule {\n constructor(private importCallback: () => Promise) {}\n}\n\nexport class LazyAction<\n TAction extends (...args: any[]) => any,\n TModule\n> {\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction) {\n }\n}","signature":"5e4757586f6f5d494b6763f1e808313a-export declare class LazyModule {\n private importCallback;\n constructor(importCallback: () => Promise);\n}\nexport declare class LazyAction any, TModule> {\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction);\n}\n","impliedNodeFormat":1},{"version":"9c9274fd70d574f2b4b68a2891bd4c47-interface PromiseConstructor {\n new (): Promise;\n}\ndeclare var Promise: PromiseConstructor;\ninterface Promise {\n}","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7c5cf52aadc65791601164da964e3110-export { default as bar } from './bar';","signature":"3a848e147ba2aebbd888c3c7bbab715b-export { default as bar } from './bar';\n","impliedNodeFormat":1},{"version":"d552d2a19fa05b15aa33018233d09810-import { LazyAction, LazyModule } from './bundling';\nconst lazyModule = new LazyModule(() =>\n import('./lazyIndex')\n);\nexport const lazyBar = new LazyAction(lazyModule, m => m.bar);","signature":"421664a6306d66498ea4a2e3065214b1-import { LazyAction } from './bundling';\nexport declare const lazyBar: LazyAction<(param: string) => void, typeof import(\"./lazyIndex\")>;\n","impliedNodeFormat":1}],"fileIdsList":[[3,5],[2]],"options":{"declaration":true,"outDir":"./","target":1},"referencedMap":[[6,1],[5,2]]} diff --git a/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/inferred-type-from-transitive-module.js b/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/inferred-type-from-transitive-module.js index d6c921c3f2..e00ab7efaa 100644 --- a/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/inferred-type-from-transitive-module.js +++ b/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/inferred-type-from-transitive-module.js @@ -124,10 +124,43 @@ export declare const lazyBar: LazyAction<(param: string) => void, typeof import( //// [/home/src/workspaces/project/obj/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.lazyBar = void 0; const bundling_1 = require("./bundling"); -const lazyModule = new bundling_1.LazyModule(() => Promise.resolve().then(() => require('./lazyIndex'))); +const lazyModule = new bundling_1.LazyModule(() => Promise.resolve().then(() => __importStar(require('./lazyIndex')))); exports.lazyBar = new bundling_1.LazyAction(lazyModule, m => m.bar); //// [/home/src/workspaces/project/obj/lazyIndex.d.ts] *new* @@ -135,10 +168,13 @@ export { default as bar } from './bar'; //// [/home/src/workspaces/project/obj/lazyIndex.js] *new* "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.bar = void 0; const bar_1 = require("./bar"); -Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return bar_1.default; } }); +Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return __importDefault(bar_1).default; } }); //// [/home/src/workspaces/project/obj/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[[2,6]],"fileNames":["lib.d.ts","../bar.ts","../bundling.ts","../global.d.ts","../lazyIndex.ts","../index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"76a83326d4e197789f8362e994577f53-interface RawAction {\n (...args: any[]): Promise | void;\n}\ninterface ActionFactory {\n (target: T): T;\n}\ndeclare function foo(): ActionFactory;\nexport default foo()(function foobar(param: string): void {\n});","signature":"16f73d7e0c200fed165b8fa7d55fefbf-declare const _default: (param: string) => void;\nexport default _default;\n","impliedNodeFormat":1},{"version":"16bf1b870d8b21533eda3b1f1b87cd77-export class LazyModule {\n constructor(private importCallback: () => Promise) {}\n}\n\nexport class LazyAction<\n TAction extends (...args: any[]) => any,\n TModule\n> {\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction) {\n }\n}","signature":"5e4757586f6f5d494b6763f1e808313a-export declare class LazyModule {\n private importCallback;\n constructor(importCallback: () => Promise);\n}\nexport declare class LazyAction any, TModule> {\n constructor(_lazyModule: LazyModule, _getter: (module: TModule) => TAction);\n}\n","impliedNodeFormat":1},{"version":"9c9274fd70d574f2b4b68a2891bd4c47-interface PromiseConstructor {\n new (): Promise;\n}\ndeclare var Promise: PromiseConstructor;\ninterface Promise {\n}","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7c5cf52aadc65791601164da964e3110-export { default as bar } from './bar';","signature":"3a848e147ba2aebbd888c3c7bbab715b-export { default as bar } from './bar';\n","impliedNodeFormat":1},{"version":"d552d2a19fa05b15aa33018233d09810-import { LazyAction, LazyModule } from './bundling';\nconst lazyModule = new LazyModule(() =>\n import('./lazyIndex')\n);\nexport const lazyBar = new LazyAction(lazyModule, m => m.bar);","signature":"421664a6306d66498ea4a2e3065214b1-import { LazyAction } from './bundling';\nexport declare const lazyBar: LazyAction<(param: string) => void, typeof import(\"./lazyIndex\")>;\n","impliedNodeFormat":1}],"fileIdsList":[[3,5],[2]],"options":{"declaration":true,"outDir":"./","target":1},"referencedMap":[[6,1],[5,2]]} diff --git a/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js b/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js index bf8bfe4284..b58b23c468 100644 --- a/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js +++ b/testdata/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/reports-errors-in-files-affected-by-change-in-signature-with-isolatedModules.js @@ -125,10 +125,43 @@ export declare const lazyBar: LazyAction<(param: string) => void, typeof import( //// [/home/src/workspaces/project/obj/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.lazyBar = void 0; const bundling_1 = require("./bundling"); -const lazyModule = new bundling_1.LazyModule(() => Promise.resolve().then(() => require('./lazyIndex'))); +const lazyModule = new bundling_1.LazyModule(() => Promise.resolve().then(() => __importStar(require('./lazyIndex')))); exports.lazyBar = new bundling_1.LazyAction(lazyModule, m => m.bar); //// [/home/src/workspaces/project/obj/lazyIndex.d.ts] *new* @@ -136,11 +169,14 @@ export { default as bar } from './bar'; //// [/home/src/workspaces/project/obj/lazyIndex.js] *new* "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.bar = void 0; const bar_1 = require("./bar"); -Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return bar_1.default; } }); -const bar_2 = require("./bar"); +Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return __importDefault(bar_1).default; } }); +const bar_2 = __importDefault(require("./bar")); (0, bar_2.default)("hello"); //// [/home/src/workspaces/project/obj/tsconfig.tsbuildinfo] *new* @@ -860,11 +896,14 @@ Output:: //// [/home/src/workspaces/project/obj/lazyIndex.d.ts] *rewrite with same content* //// [/home/src/workspaces/project/obj/lazyIndex.js] *modified* "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.bar = void 0; const bar_1 = require("./bar"); -Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return bar_1.default; } }); -const bar_2 = require("./bar"); +Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return __importDefault(bar_1).default; } }); +const bar_2 = __importDefault(require("./bar")); (0, bar_2.default)(); //// [/home/src/workspaces/project/obj/tsconfig.tsbuildinfo] *modified* diff --git a/testdata/baselines/reference/tsbuild/sample/always-builds-under-with-force-option.js b/testdata/baselines/reference/tsbuild/sample/always-builds-under-with-force-option.js index f8ea0d9f23..d2e0c62018 100644 --- a/testdata/baselines/reference/tsbuild/sample/always-builds-under-with-force-option.js +++ b/testdata/baselines/reference/tsbuild/sample/always-builds-under-with-force-option.js @@ -202,18 +202,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -297,13 +330,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/builds-correctly-when-declarationDir-is-specified.js b/testdata/baselines/reference/tsbuild/sample/builds-correctly-when-declarationDir-is-specified.js index c3265da6f8..93e1df01d3 100644 --- a/testdata/baselines/reference/tsbuild/sample/builds-correctly-when-declarationDir-is-specified.js +++ b/testdata/baselines/reference/tsbuild/sample/builds-correctly-when-declarationDir-is-specified.js @@ -197,18 +197,51 @@ function multiply(a, b) { return a * b; } } //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/out/decls/index.d.ts] *new* export declare function getSecondsInDay(): number; import * as mod from '../core/anotherModule'; @@ -297,13 +330,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/builds-correctly-when-outDir-is-specified.js b/testdata/baselines/reference/tsbuild/sample/builds-correctly-when-outDir-is-specified.js index 2e36adda35..05794d55ab 100644 --- a/testdata/baselines/reference/tsbuild/sample/builds-correctly-when-outDir-is-specified.js +++ b/testdata/baselines/reference/tsbuild/sample/builds-correctly-when-outDir-is-specified.js @@ -202,18 +202,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/outDir/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/outDir/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/outDir/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../../core/index.d.ts","../../core/anotherModule.d.ts","../index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"outDir":"./","sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/outDir/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -297,13 +330,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/builds-downstream-projects-even-if-upstream-projects-have-errors.js b/testdata/baselines/reference/tsbuild/sample/builds-downstream-projects-even-if-upstream-projects-have-errors.js index fc975d6e23..0e42fc149c 100644 --- a/testdata/baselines/reference/tsbuild/sample/builds-downstream-projects-even-if-upstream-projects-have-errors.js +++ b/testdata/baselines/reference/tsbuild/sample/builds-downstream-projects-even-if-upstream-projects-have-errors.js @@ -227,18 +227,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.muitply(); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;AAAA,CACtB;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;AAAA,CACtB;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"4da0a6ee7d4a662685afc8fe143c994d-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.muitply();\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"07587a8dc02fb971c487c21dd8f4849b-export declare function getSecondsInDay(): any;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":85,"end":92,"code":2339,"category":1,"message":"Property 'muitply' does not exist on type 'typeof import(\"/user/username/projects/sample1/core/index\")'."}]]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -336,13 +369,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/can-detect-when-and-what-to-rebuild.js b/testdata/baselines/reference/tsbuild/sample/can-detect-when-and-what-to-rebuild.js index 4de6163398..4a8ea4fa3d 100644 --- a/testdata/baselines/reference/tsbuild/sample/can-detect-when-and-what-to-rebuild.js +++ b/testdata/baselines/reference/tsbuild/sample/can-detect-when-and-what-to-rebuild.js @@ -219,18 +219,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -314,13 +347,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/explainFiles.js b/testdata/baselines/reference/tsbuild/sample/explainFiles.js index 34f858c988..40d59adb7e 100644 --- a/testdata/baselines/reference/tsbuild/sample/explainFiles.js +++ b/testdata/baselines/reference/tsbuild/sample/explainFiles.js @@ -251,18 +251,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -346,13 +379,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/indicates-that-it-would-skip-builds-during-a-dry-build.js b/testdata/baselines/reference/tsbuild/sample/indicates-that-it-would-skip-builds-during-a-dry-build.js index 0f87cbd2cf..07231b8451 100644 --- a/testdata/baselines/reference/tsbuild/sample/indicates-that-it-would-skip-builds-during-a-dry-build.js +++ b/testdata/baselines/reference/tsbuild/sample/indicates-that-it-would-skip-builds-during-a-dry-build.js @@ -202,18 +202,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -297,13 +330,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/listEmittedFiles.js b/testdata/baselines/reference/tsbuild/sample/listEmittedFiles.js index e714739a80..f25e16ba07 100644 --- a/testdata/baselines/reference/tsbuild/sample/listEmittedFiles.js +++ b/testdata/baselines/reference/tsbuild/sample/listEmittedFiles.js @@ -216,18 +216,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -311,13 +344,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/listFiles.js b/testdata/baselines/reference/tsbuild/sample/listFiles.js index 3f6d7f9965..8b6a194fa6 100644 --- a/testdata/baselines/reference/tsbuild/sample/listFiles.js +++ b/testdata/baselines/reference/tsbuild/sample/listFiles.js @@ -215,18 +215,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -310,13 +343,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js b/testdata/baselines/reference/tsbuild/sample/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js index 0a3b7949b0..f04de74af2 100644 --- a/testdata/baselines/reference/tsbuild/sample/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js +++ b/testdata/baselines/reference/tsbuild/sample/rebuilds-completely-when-version-in-tsbuildinfo-doesnt-match-ts-version.js @@ -219,18 +219,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -314,13 +347,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/rebuilds-from-start-if-force-option-is-set.js b/testdata/baselines/reference/tsbuild/sample/rebuilds-from-start-if-force-option-is-set.js index fe5b8a8b51..cd96dbdec9 100644 --- a/testdata/baselines/reference/tsbuild/sample/rebuilds-from-start-if-force-option-is-set.js +++ b/testdata/baselines/reference/tsbuild/sample/rebuilds-from-start-if-force-option-is-set.js @@ -202,18 +202,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -297,13 +330,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/rebuilds-when-extended-config-file-changes.js b/testdata/baselines/reference/tsbuild/sample/rebuilds-when-extended-config-file-changes.js index 529bf18c46..eadc874d41 100644 --- a/testdata/baselines/reference/tsbuild/sample/rebuilds-when-extended-config-file-changes.js +++ b/testdata/baselines/reference/tsbuild/sample/rebuilds-when-extended-config-file-changes.js @@ -225,18 +225,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -320,13 +353,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/removes-all-files-it-built.js b/testdata/baselines/reference/tsbuild/sample/removes-all-files-it-built.js index 4dbbe4597f..7d62a90c41 100644 --- a/testdata/baselines/reference/tsbuild/sample/removes-all-files-it-built.js +++ b/testdata/baselines/reference/tsbuild/sample/removes-all-files-it-built.js @@ -202,18 +202,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -297,13 +330,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/reports-error-if-input-file-is-missing-with-force.js b/testdata/baselines/reference/tsbuild/sample/reports-error-if-input-file-is-missing-with-force.js index 11c9af0739..69a3eed6d1 100644 --- a/testdata/baselines/reference/tsbuild/sample/reports-error-if-input-file-is-missing-with-force.js +++ b/testdata/baselines/reference/tsbuild/sample/reports-error-if-input-file-is-missing-with-force.js @@ -200,18 +200,51 @@ export declare const m: any; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[3],"fileNames":["lib.d.ts","../core/index.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"da642d80443e7ccd327091080a82a43c-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"40bb9a18ac3dbfd340fea197221fa9dd-export declare function getSecondsInDay(): number;\nexport declare const m: any;\n","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":126,"end":149,"code":2307,"category":1,"message":"Cannot find module '../core/anotherModule' or its corresponding type declarations."}]]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -299,13 +332,46 @@ export declare const m: any; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/reports-error-if-input-file-is-missing.js b/testdata/baselines/reference/tsbuild/sample/reports-error-if-input-file-is-missing.js index 7a726b775a..d546837a27 100644 --- a/testdata/baselines/reference/tsbuild/sample/reports-error-if-input-file-is-missing.js +++ b/testdata/baselines/reference/tsbuild/sample/reports-error-if-input-file-is-missing.js @@ -200,18 +200,51 @@ export declare const m: any; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[3],"fileNames":["lib.d.ts","../core/index.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"da642d80443e7ccd327091080a82a43c-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"40bb9a18ac3dbfd340fea197221fa9dd-export declare function getSecondsInDay(): number;\nexport declare const m: any;\n","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":126,"end":149,"code":2307,"category":1,"message":"Cannot find module '../core/anotherModule' or its corresponding type declarations."}]]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -299,13 +332,46 @@ export declare const m: any; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/sample.js b/testdata/baselines/reference/tsbuild/sample/sample.js index 2adc9789dc..4b7809803b 100644 --- a/testdata/baselines/reference/tsbuild/sample/sample.js +++ b/testdata/baselines/reference/tsbuild/sample/sample.js @@ -219,18 +219,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -314,13 +347,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors-when-test-does-not-reference-core.js b/testdata/baselines/reference/tsbuild/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors-when-test-does-not-reference-core.js index e356660329..2a9339f273 100644 --- a/testdata/baselines/reference/tsbuild/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors-when-test-does-not-reference-core.js +++ b/testdata/baselines/reference/tsbuild/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors-when-test-does-not-reference-core.js @@ -424,18 +424,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -519,13 +552,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors.js b/testdata/baselines/reference/tsbuild/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors.js index c498d0fbe7..065dec9b3d 100644 --- a/testdata/baselines/reference/tsbuild/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors.js +++ b/testdata/baselines/reference/tsbuild/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors.js @@ -425,18 +425,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -520,13 +553,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/when-declarationMap-changes.js b/testdata/baselines/reference/tsbuild/sample/when-declarationMap-changes.js index 19114f67c1..35545fdb50 100644 --- a/testdata/baselines/reference/tsbuild/sample/when-declarationMap-changes.js +++ b/testdata/baselines/reference/tsbuild/sample/when-declarationMap-changes.js @@ -219,18 +219,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -314,13 +347,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/when-esModuleInterop-option-changes.js b/testdata/baselines/reference/tsbuild/sample/when-esModuleInterop-option-changes.js index ad887c9a82..58604381f2 100644 --- a/testdata/baselines/reference/tsbuild/sample/when-esModuleInterop-option-changes.js +++ b/testdata/baselines/reference/tsbuild/sample/when-esModuleInterop-option-changes.js @@ -220,18 +220,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -315,13 +348,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* @@ -479,50 +545,7 @@ Output:: [HH:MM:SS AM] Building project 'tests/tsconfig.json'... -//// [/user/username/projects/sample1/tests/index.js] *modified* -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.m = void 0; -const c = __importStar(require("../core/index")); -const logic = __importStar(require("../logic/index")); -c.leftPad("", 10); -logic.getSecondsInDay(); -const mod = __importStar(require("../core/anotherModule")); -exports.m = mod; - +//// [/user/username/projects/sample1/tests/index.js] *rewrite with same content* //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","root":[5],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map","487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n",{"version":"7fa4162f733e6b9e7f7d9d9410e62f61-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"4b3c99afe665034856f74c660f74d6fd-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[3],[2,3,4]],"options":{"composite":true,"declaration":true,"esModuleInterop":true,"skipDefaultLibCheck":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* diff --git a/testdata/baselines/reference/tsbuild/sample/when-input-file-text-does-not-change-but-its-modified-time-changes.js b/testdata/baselines/reference/tsbuild/sample/when-input-file-text-does-not-change-but-its-modified-time-changes.js index c0fbf9ee98..9f96ac80dd 100644 --- a/testdata/baselines/reference/tsbuild/sample/when-input-file-text-does-not-change-but-its-modified-time-changes.js +++ b/testdata/baselines/reference/tsbuild/sample/when-input-file-text-does-not-change-but-its-modified-time-changes.js @@ -219,18 +219,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -314,13 +347,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuild/sample/when-logic-specifies-tsBuildInfoFile.js b/testdata/baselines/reference/tsbuild/sample/when-logic-specifies-tsBuildInfoFile.js index b00d0590df..503139c150 100644 --- a/testdata/baselines/reference/tsbuild/sample/when-logic-specifies-tsBuildInfoFile.js +++ b/testdata/baselines/reference/tsbuild/sample/when-logic-specifies-tsBuildInfoFile.js @@ -220,18 +220,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/ownFile.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true,"tsBuildInfoFile":"./ownFile.tsbuildinfo"},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/ownFile.tsbuildinfo.readable.baseline.txt] *new* @@ -316,13 +349,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/builds-when-new-file-is-added,-and-its-subsequent-updates-with-circular-references.js b/testdata/baselines/reference/tsbuildWatch/sample/builds-when-new-file-is-added,-and-its-subsequent-updates-with-circular-references.js index 4ecab36d83..d84e11bb2f 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/builds-when-new-file-is-added,-and-its-subsequent-updates-with-circular-references.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/builds-when-new-file-is-added,-and-its-subsequent-updates-with-circular-references.js @@ -201,18 +201,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"da642d80443e7ccd327091080a82a43c-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","5aad0de3e7b08bb6e110c7b97361b89e-export declare const World = \"hello\";\n",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -296,13 +329,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/builds-when-new-file-is-added,-and-its-subsequent-updates.js b/testdata/baselines/reference/tsbuildWatch/sample/builds-when-new-file-is-added,-and-its-subsequent-updates.js index 16f7da7a0d..e292b3ce77 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/builds-when-new-file-is-added,-and-its-subsequent-updates.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/builds-when-new-file-is-added,-and-its-subsequent-updates.js @@ -206,18 +206,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -301,13 +334,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/change-builds-changes-and-reports-found-errors-message-with-circular-references.js b/testdata/baselines/reference/tsbuildWatch/sample/change-builds-changes-and-reports-found-errors-message-with-circular-references.js index c3368f7f8f..437f589cf9 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/change-builds-changes-and-reports-found-errors-message-with-circular-references.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/change-builds-changes-and-reports-found-errors-message-with-circular-references.js @@ -201,18 +201,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"da642d80443e7ccd327091080a82a43c-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","5aad0de3e7b08bb6e110c7b97361b89e-export declare const World = \"hello\";\n",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -296,13 +329,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/change-builds-changes-and-reports-found-errors-message.js b/testdata/baselines/reference/tsbuildWatch/sample/change-builds-changes-and-reports-found-errors-message.js index ef0e973e10..11af883cbe 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/change-builds-changes-and-reports-found-errors-message.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/change-builds-changes-and-reports-found-errors-message.js @@ -206,18 +206,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -301,13 +334,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/incremental-updates-in-verbose-mode.js b/testdata/baselines/reference/tsbuildWatch/sample/incremental-updates-in-verbose-mode.js index 9eb820ff03..3c5b6ae149 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/incremental-updates-in-verbose-mode.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/incremental-updates-in-verbose-mode.js @@ -223,18 +223,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -318,13 +351,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* @@ -480,19 +546,52 @@ Output:: //// [/user/username/projects/sample1/logic/index.js] *modified* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; function someFn() { } //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *modified* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,SAAS,MAAM,GAAG,EAAC,CAAE"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,SAAS,MAAM,GAAG,EAAC,CAAE"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"56bc284b087dd9cc90ffa4704740b86c-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nfunction someFn() { }","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* @@ -616,20 +715,53 @@ export declare function someFn(): void; //// [/user/username/projects/sample1/logic/index.js] *modified* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; exports.someFn = someFn; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; function someFn() { } //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *modified* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,kBAAyB,EAAC,CAAE"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,kBAAyB,EAAC,CAAE"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"d749596c6d4d5a27ed436fc0d564335c-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nexport function someFn() { }","signature":"2e576d48e524436cd9a1f5da08ccc740-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function someFn(): void;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/non-local-change-does-not-start-build-of-referencing-projects-with-circular-references.js b/testdata/baselines/reference/tsbuildWatch/sample/non-local-change-does-not-start-build-of-referencing-projects-with-circular-references.js index 5c7569ea6b..0690e8f202 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/non-local-change-does-not-start-build-of-referencing-projects-with-circular-references.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/non-local-change-does-not-start-build-of-referencing-projects-with-circular-references.js @@ -201,18 +201,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"da642d80443e7ccd327091080a82a43c-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","5aad0de3e7b08bb6e110c7b97361b89e-export declare const World = \"hello\";\n",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -296,13 +329,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/non-local-change-does-not-start-build-of-referencing-projects.js b/testdata/baselines/reference/tsbuildWatch/sample/non-local-change-does-not-start-build-of-referencing-projects.js index 89d76bca33..03ba286123 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/non-local-change-does-not-start-build-of-referencing-projects.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/non-local-change-does-not-start-build-of-referencing-projects.js @@ -206,18 +206,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -301,13 +334,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-preserveWatchOutput-is-not-used.js b/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-preserveWatchOutput-is-not-used.js index 1597a6769e..52aaf107d3 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-preserveWatchOutput-is-not-used.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-preserveWatchOutput-is-not-used.js @@ -206,18 +206,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -301,13 +334,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* @@ -455,19 +521,52 @@ Output:: //// [/user/username/projects/sample1/logic/index.js] *modified* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; let y = 10; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *modified* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,IAAI,CAAC,GAAW,EAAE,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,IAAI,CAAC,GAAW,EAAE,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"3abed61bf6897ffa70a069303f7ee37f-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nlet y: string = 10;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":177,"end":178,"code":2322,"category":1,"message":"Type 'number' is not assignable to type 'string'."}]]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* @@ -734,18 +833,51 @@ Output:: //// [/user/username/projects/sample1/logic/index.js] *modified* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *modified* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-preserveWatchOutput-is-passed-on-command-line.js b/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-preserveWatchOutput-is-passed-on-command-line.js index 7f1d0027b3..34661be266 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-preserveWatchOutput-is-passed-on-command-line.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-preserveWatchOutput-is-passed-on-command-line.js @@ -206,18 +206,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -301,13 +334,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* @@ -455,19 +521,52 @@ Output:: //// [/user/username/projects/sample1/logic/index.js] *modified* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; let y = 10; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *modified* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,IAAI,CAAC,GAAW,EAAE,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,IAAI,CAAC,GAAW,EAAE,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"3abed61bf6897ffa70a069303f7ee37f-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nlet y: string = 10;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":177,"end":178,"code":2322,"category":1,"message":"Type 'number' is not assignable to type 'string'."}]]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* @@ -734,18 +833,51 @@ Output:: //// [/user/username/projects/sample1/logic/index.js] *modified* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *modified* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-stopBuildOnErrors-is-passed-on-command-line.js b/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-stopBuildOnErrors-is-passed-on-command-line.js index bb6fe8e3ae..f39b616388 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-stopBuildOnErrors-is-passed-on-command-line.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-stopBuildOnErrors-is-passed-on-command-line.js @@ -206,18 +206,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -301,13 +334,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* @@ -455,19 +521,52 @@ Output:: //// [/user/username/projects/sample1/logic/index.js] *modified* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; let y = 10; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *modified* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,IAAI,CAAC,GAAW,EAAE,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,IAAI,CAAC,GAAW,EAAE,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"3abed61bf6897ffa70a069303f7ee37f-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nlet y: string = 10;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":177,"end":178,"code":2322,"category":1,"message":"Type 'number' is not assignable to type 'string'."}]]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors-when-test-does-not-reference-core.js b/testdata/baselines/reference/tsbuildWatch/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors-when-test-does-not-reference-core.js index 080b2d9e4e..30362fa24d 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors-when-test-does-not-reference-core.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors-when-test-does-not-reference-core.js @@ -388,18 +388,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -483,13 +516,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors.js b/testdata/baselines/reference/tsbuildWatch/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors.js index b9b4ba3e5e..508c861c24 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors.js @@ -389,18 +389,51 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* @@ -484,13 +517,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* diff --git a/testdata/baselines/reference/tsbuildWatch/sample/watches-config-files-that-are-not-present.js b/testdata/baselines/reference/tsbuildWatch/sample/watches-config-files-that-are-not-present.js index d33181dc37..0a6a51a5c1 100644 --- a/testdata/baselines/reference/tsbuildWatch/sample/watches-config-files-that-are-not-present.js +++ b/testdata/baselines/reference/tsbuildWatch/sample/watches-config-files-that-are-not-present.js @@ -200,14 +200,47 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/logic/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/index.d.ts] *new* @@ -216,13 +249,46 @@ export declare const m: typeof mod; //// [/user/username/projects/sample1/tests/index.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; -const c = require("../core/index"); -const logic = require("../logic/index"); +const c = __importStar(require("../core/index")); +const logic = __importStar(require("../logic/index")); c.leftPad("", 10); logic.getSecondsInDay(); -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new* @@ -377,18 +443,51 @@ Output:: //// [/user/username/projects/sample1/logic/index.d.ts] *rewrite with same content* //// [/user/username/projects/sample1/logic/index.js] *modified* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.m = void 0; exports.getSecondsInDay = getSecondsInDay; -const c = require("../core/index"); +const c = __importStar(require("../core/index")); function getSecondsInDay() { return c.multiply(10, 15); } -const mod = require("../core/anotherModule"); +const mod = __importStar(require("../core/anotherModule")); exports.m = mod; //# sourceMappingURL=index.js.map //// [/user/username/projects/sample1/logic/index.js.map] *new* -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,MAAY,CAAC,4BAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,oCAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,0CAAsB;AACnC,2BAAkC;IAC9B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAAA,CAC7B;AACD,MAAY,GAAG,kDAA8B;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map",{"version":"590556060bc156a64834010df8cda255-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true,"sourceMap":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] *new* diff --git a/testdata/baselines/reference/tsc/commandLine/help-all.js b/testdata/baselines/reference/tsc/commandLine/help-all.js index 7739fc641c..a43fd20900 100644 --- a/testdata/baselines/reference/tsc/commandLine/help-all.js +++ b/testdata/baselines/reference/tsc/commandLine/help-all.js @@ -84,7 +84,7 @@ default: undefined --moduleResolution Specify how TypeScript looks up a file from a given module specifier. one of: node16, nodenext, bundler -default: module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node` +default: `nodenext` if `module` is `nodenext`; `node16` if `module` is `node16` or `node18`; otherwise, `bundler`. --moduleSuffixes List of file name suffixes to search when resolving a module. diff --git a/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js b/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js index 14d135d72d..05c6212fe0 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js @@ -64,10 +64,13 @@ export { default as ConstantNumber } from "./constants"; //// [/home/src/workspaces/project/reexport.js] *new* "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConstantNumber = void 0; const constants_1 = require("./constants"); -Object.defineProperty(exports, "ConstantNumber", { enumerable: true, get: function () { return constants_1.default; } }); +Object.defineProperty(exports, "ConstantNumber", { enumerable: true, get: function () { return __importDefault(constants_1).default; } }); //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* {"version":"FakeTSVersion","root":[[2,5]],"fileNames":["lib.d.ts","./class1.ts","./constants.ts","./reexport.ts","./types.d.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"881068d51dfd24d338a5f3706ee1097f-const a: MagicNumber = 1;\nconsole.log(a);","signature":"f59d1a67db5f979e23689dc09b68c628-declare const a = 1;\n","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c93bc8f54a24dc311538894cf3d7ac17-export default 1;","signature":"18ae69a2c0b372747b9973ad9c14a1e0-declare const _default: number;\nexport default _default;\n","impliedNodeFormat":1},{"version":"75c0647a66f2f74c4448b4b393e889d1-export { default as ConstantNumber } from \"./constants\"","signature":"3c986fce7f0f21b6b269681962fc7feb-export { default as ConstantNumber } from \"./constants\";\n","impliedNodeFormat":1},{"version":"d84f446b9b1fc3f56545f03793b7992c-type MagicNumber = typeof import('./reexport').ConstantNumber","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[3],[4]],"options":{"composite":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./reexport.d.ts"} diff --git a/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js b/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js index a8471af0bb..4c07451cdf 100644 --- a/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js +++ b/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js @@ -82,10 +82,43 @@ export declare const bug: W.Wrap<{ //// [/home/src/workspaces/project/outDir/src/bug.js] *new* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.bug = void 0; -const B = require("./box.js"); -const W = require("./wrap.js"); +const B = __importStar(require("./box.js")); +const W = __importStar(require("./wrap.js")); /** * @template {object} C * @param {C} source @@ -249,10 +282,43 @@ export declare const something = 1; //// [/home/src/workspaces/project/outDir/src/bug.js] *modified* "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.something = exports.bug = void 0; -const B = require("./box.js"); -const W = require("./wrap.js"); +const B = __importStar(require("./box.js")); +const W = __importStar(require("./wrap.js")); /** * @template {object} C * @param {C} source diff --git a/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js b/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js index 15244da570..01e668625c 100644 --- a/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js +++ b/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js @@ -114,7 +114,7 @@ tsgo --traceResolution --explainFiles ExitStatus:: Success Output:: ======== Resolving module '@component-type-checker/sdk' from '/home/src/projects/component-type-checker/packages/app/src/app.tsx'. ======== -Explicitly specified module resolution kind: 'Bundler'. +Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'import', 'types'. File '/home/src/projects/component-type-checker/packages/app/src/package.json' does not exist. Found 'package.json' at '/home/src/projects/component-type-checker/packages/app/package.json'. @@ -136,7 +136,7 @@ File '/home/src/projects/component-type-checker/packages/app/node_modules/@compo Resolving real path for '/home/src/projects/component-type-checker/packages/app/node_modules/@component-type-checker/sdk/src/index.ts', result '/home/src/projects/component-type-checker/packages/sdk/src/index.ts'. ======== Module name '@component-type-checker/sdk' was successfully resolved to '/home/src/projects/component-type-checker/packages/sdk/src/index.ts' with Package ID '@component-type-checker/sdk1@0.0.2'. ======== ======== Resolving module '@component-type-checker/components' from '/home/src/projects/component-type-checker/packages/app/src/app.tsx'. ======== -Explicitly specified module resolution kind: 'Bundler'. +Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'import', 'types'. File '/home/src/projects/component-type-checker/packages/app/src/package.json' does not exist according to earlier cached lookups. File '/home/src/projects/component-type-checker/packages/app/package.json' exists according to earlier cached lookups. @@ -161,7 +161,7 @@ Found peerDependency '@component-type-checker/button' with '0.0.2' version. Resolving real path for '/home/src/projects/component-type-checker/packages/app/node_modules/@component-type-checker/components/src/index.ts', result '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/index.ts'. ======== Module name '@component-type-checker/components' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/index.ts' with Package ID '@component-type-checker/components@0.0.1+@component-type-checker/button@0.0.2'. ======== ======== Resolving module '@component-type-checker/button' from '/home/src/projects/component-type-checker/packages/app/src/app.tsx'. ======== -Explicitly specified module resolution kind: 'Bundler'. +Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'import', 'types'. File '/home/src/projects/component-type-checker/packages/app/src/package.json' does not exist according to earlier cached lookups. File '/home/src/projects/component-type-checker/packages/app/package.json' exists according to earlier cached lookups. @@ -183,7 +183,7 @@ File '/home/src/projects/component-type-checker/packages/app/node_modules/@compo Resolving real path for '/home/src/projects/component-type-checker/packages/app/node_modules/@component-type-checker/button/src/index.ts', result '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts'. ======== Module name '@component-type-checker/button' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts' with Package ID '@component-type-checker/button@0.0.2'. ======== ======== Resolving module '@component-type-checker/components' from '/home/src/projects/component-type-checker/packages/sdk/src/index.ts'. ======== -Explicitly specified module resolution kind: 'Bundler'. +Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'import', 'types'. File '/home/src/projects/component-type-checker/packages/sdk/src/package.json' does not exist. Found 'package.json' at '/home/src/projects/component-type-checker/packages/sdk/package.json'. @@ -208,7 +208,7 @@ Found peerDependency '@component-type-checker/button' with '0.0.1' version. Resolving real path for '/home/src/projects/component-type-checker/packages/sdk/node_modules/@component-type-checker/components/src/index.ts', result '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/index.ts'. ======== Module name '@component-type-checker/components' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/index.ts' with Package ID '@component-type-checker/components@0.0.1+@component-type-checker/button@0.0.1'. ======== ======== Resolving module '@component-type-checker/button' from '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/index.ts'. ======== -Explicitly specified module resolution kind: 'Bundler'. +Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'import', 'types'. File '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/package.json' does not exist. Found 'package.json' at '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/package.json'. @@ -236,7 +236,7 @@ File '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-ty Resolving real path for '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/src/index.ts', result '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/src/index.ts'. ======== Module name '@component-type-checker/button' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/src/index.ts' with Package ID '@component-type-checker/button@0.0.1'. ======== ======== Resolving module '@component-type-checker/button' from '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/index.ts'. ======== -Explicitly specified module resolution kind: 'Bundler'. +Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'import', 'types'. File '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/package.json' does not exist. Found 'package.json' at '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/package.json'. From 4874e98ad8e816864867347f11b0c44c8fba4953 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 27 Oct 2025 18:34:05 -0700 Subject: [PATCH 043/152] Reapply #1951 and #1960 after bad merge (#1964) Co-authored-by: Anders Hejlsberg Co-authored-by: John Favret <64748847+johnfav03@users.noreply.github.com> --- internal/ast/ast.go | 6 ++- internal/ast/utilities.go | 4 +- internal/checker/checker.go | 18 ++++--- internal/checker/emitresolver.go | 21 +++++--- ...ocumentHighlightReferenceDirective_test.go | 24 +++++++++ internal/ls/documenthighlights.go | 9 ++-- internal/ls/findallreferences.go | 17 +++--- .../jsdocTypeParameterTagConflict.types | 6 +-- ...HighlightReferenceDirective.baseline.jsonc | 6 +++ ...argumentsObjectCreatesRestForJs.errors.txt | 10 ++-- .../argumentsPropertyNameInJsMode1.errors.txt | 4 +- .../argumentsPropertyNameInJsMode2.errors.txt | 4 +- ...rgumentsReferenceInFunction1_Js.errors.txt | 4 +- ...ileFunctionParametersAsOptional.errors.txt | 24 --------- ...leFunctionParametersAsOptional2.errors.txt | 30 ----------- .../conformance/checkJsdocTypeTag5.types | 4 +- .../conformance/checkJsdocTypeTag6.types | 6 +-- .../conformance/checkJsdocTypeTag7.types | 2 +- .../submodule/conformance/jsdocThisType.types | 4 +- .../jsdocTypeTagRequiredParameters.errors.txt | 4 +- .../typeFromPropertyAssignment17.errors.txt | 35 ------------- .../typeFromPropertyAssignment7.errors.txt | 13 ----- .../typeTagOnFunctionReferencesGeneric.types | 4 +- .../typeTagWithGenericSignature.types | 4 +- ...nannotatedParametersAreOptional.errors.txt | 48 ----------------- ...entsObjectCreatesRestForJs.errors.txt.diff | 10 ++-- ...mentsPropertyNameInJsMode1.errors.txt.diff | 15 ------ ...mentsPropertyNameInJsMode2.errors.txt.diff | 4 +- ...ntsReferenceInFunction1_Js.errors.txt.diff | 4 +- ...nctionParametersAsOptional.errors.txt.diff | 28 ---------- ...ctionParametersAsOptional2.errors.txt.diff | 34 ++++++++++++ .../conformance/checkJsdocTypeTag5.types.diff | 4 +- .../conformance/checkJsdocTypeTag6.types.diff | 29 +---------- .../conformance/checkJsdocTypeTag7.types.diff | 9 ---- .../conformance/jsdocThisType.types.diff | 13 +---- ...cTypeTagRequiredParameters.errors.txt.diff | 10 +--- ...peFromPropertyAssignment17.errors.txt.diff | 39 -------------- ...ypeFromPropertyAssignment7.errors.txt.diff | 17 ------ ...eTagOnFunctionReferencesGeneric.types.diff | 20 ------- .../typeTagWithGenericSignature.types.diff | 4 +- ...tatedParametersAreOptional.errors.txt.diff | 52 ------------------- 41 files changed, 151 insertions(+), 452 deletions(-) create mode 100644 internal/fourslash/tests/documentHighlightReferenceDirective_test.go create mode 100644 testdata/baselines/reference/fourslash/documentHighlights/documentHighlightReferenceDirective.baseline.jsonc delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionParametersAsOptional.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/jsFileFunctionParametersAsOptional2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment7.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/unannotatedParametersAreOptional.errors.txt delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional.errors.txt.diff create mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment7.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/unannotatedParametersAreOptional.errors.txt.diff diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 4c15abd4fe..2971ef562d 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -2353,6 +2353,9 @@ func IsArrayLiteralOrObjectLiteralDestructuringPattern(node *Node) bool { func accessKind(node *Node) AccessKind { parent := node.Parent + if parent == nil { + return AccessKindRead + } switch parent.Kind { case KindParenthesizedExpression: return accessKind(parent) @@ -2404,8 +2407,9 @@ func accessKind(node *Node) AccessKind { return AccessKindWrite } return AccessKindRead + default: + return AccessKindRead } - return AccessKindRead } func reverseAccessKind(a AccessKind) AccessKind { diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index f491127d22..7c9471b73a 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -571,7 +571,7 @@ func IsClassElement(node *Node) bool { return false } -func isMethodOrAccessor(node *Node) bool { +func IsMethodOrAccessor(node *Node) bool { switch node.Kind { case KindMethodDeclaration, KindGetAccessor, KindSetAccessor: return true @@ -580,7 +580,7 @@ func isMethodOrAccessor(node *Node) bool { } func IsPrivateIdentifierClassElementDeclaration(node *Node) bool { - return (IsPropertyDeclaration(node) || isMethodOrAccessor(node)) && IsPrivateIdentifier(node.Name()) + return (IsPropertyDeclaration(node) || IsMethodOrAccessor(node)) && IsPrivateIdentifier(node.Name()) } func IsObjectLiteralOrClassExpressionMethodOrAccessor(node *Node) bool { diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 8c68eafb19..4def9ddbc6 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -19101,11 +19101,9 @@ func (c *Checker) getSignaturesOfSymbol(symbol *ast.Symbol) []*Signature { } // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would suppress checks that the two are compatible. - if ast.IsFunctionExpressionOrArrowFunction(decl) || ast.IsObjectLiteralMethod(decl) { - if sig := c.getSignatureOfFullSignatureType(decl); sig != nil { - result = append(result, sig) - continue - } + if sig := c.getSignatureOfFullSignatureType(decl); sig != nil { + result = append(result, sig) + continue } result = append(result, c.getSignatureFromDeclaration(decl)) } @@ -19123,6 +19121,14 @@ func (c *Checker) getSignatureFromDeclaration(declaration *ast.Node) *Signature minArgumentCount := 0 hasThisParameter := false iife := ast.GetImmediatelyInvokedFunctionExpression(declaration) + isUntypedSignatureInJSFile := iife == nil && + ast.IsInJSFile(declaration) && + (ast.IsFunctionExpression(declaration) || ast.IsArrowFunction(declaration) || ast.IsMethodOrAccessor(declaration) || ast.IsFunctionDeclaration(declaration) || ast.IsConstructorDeclaration(declaration)) && + core.Every(declaration.Parameters(), func(param *ast.Node) bool { return param.Type() == nil }) && + c.getContextualType(declaration, ContextFlagsSignature) == nil + if isUntypedSignatureInJSFile { + flags |= SignatureFlagsIsUntypedSignatureInJSFile + } for i, param := range declaration.Parameters() { paramSymbol := param.Symbol() typeNode := param.Type() @@ -19343,7 +19349,7 @@ func (c *Checker) getReturnTypeFromAnnotation(declaration *ast.Node) *Type { } func (c *Checker) getSignatureOfFullSignatureType(node *ast.Node) *Signature { - if ast.IsInJSFile(node) && ast.IsFunctionLike(node) && node.FunctionLikeData().FullSignature != nil { + if ast.IsInJSFile(node) && (ast.IsFunctionDeclaration(node) || ast.IsMethodDeclaration(node) || ast.IsFunctionExpressionOrArrowFunction(node)) && node.FunctionLikeData().FullSignature != nil { return c.getSingleCallSignature(c.getTypeFromTypeNode(node.FunctionLikeData().FullSignature)) } return nil diff --git a/internal/checker/emitresolver.go b/internal/checker/emitresolver.go index 71c1a60955..14d9ecd2bc 100644 --- a/internal/checker/emitresolver.go +++ b/internal/checker/emitresolver.go @@ -458,13 +458,20 @@ func (r *emitResolver) IsImplementationOfOverload(node *ast.SignatureDeclaration // function foo(a: any) { // This is implementation of the overloads // return a; // } - return len(signaturesOfSymbol) > 1 || - // If there is single signature for the symbol, it is overload if that signature isn't coming from the node - // e.g.: function foo(a: string): string; - // function foo(a: any) { // This is implementation of the overloads - // return a; - // } - (len(signaturesOfSymbol) == 1 && signaturesOfSymbol[0].declaration != node) + if len(signaturesOfSymbol) > 1 { + return true + } + // If there is single signature for the symbol, it is overload if that signature isn't coming from the node + // e.g.: function foo(a: string): string; + // function foo(a: any) { // This is implementation of the overloads + // return a; + // } + if len(signaturesOfSymbol) == 1 { + declaration := signaturesOfSymbol[0].declaration + if declaration != node && declaration.Flags&ast.NodeFlagsJSDoc == 0 { + return true + } + } } return false } diff --git a/internal/fourslash/tests/documentHighlightReferenceDirective_test.go b/internal/fourslash/tests/documentHighlightReferenceDirective_test.go new file mode 100644 index 0000000000..c6ac898aa4 --- /dev/null +++ b/internal/fourslash/tests/documentHighlightReferenceDirective_test.go @@ -0,0 +1,24 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestDocumentHighlightReferenceDirective(t *testing.T) { + t.Parallel() + + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @Filename: /a.ts +/// + +const x = 1; + +// @filename: b.ts +export type Foo = number; +` + f := fourslash.NewFourslash(t, nil /*capabilities*/, content) + f.VerifyBaselineDocumentHighlights(t, nil /*preferences*/, f.Ranges()[0]) +} diff --git a/internal/ls/documenthighlights.go b/internal/ls/documenthighlights.go index bab0f63b61..65d7039666 100644 --- a/internal/ls/documenthighlights.go +++ b/internal/ls/documenthighlights.go @@ -56,14 +56,13 @@ func (l *LanguageService) getSemanticDocumentHighlights(ctx context.Context, pos if referenceEntries == nil { return nil } + var highlights []*lsproto.DocumentHighlight for _, entry := range referenceEntries { for _, ref := range entry.references { - if ref.node != nil { - fileName, highlight := l.toDocumentHighlight(ref) - if fileName == sourceFile.FileName() { - highlights = append(highlights, highlight) - } + fileName, highlight := l.toDocumentHighlight(ref) + if fileName == sourceFile.FileName() { + highlights = append(highlights, highlight) } } } diff --git a/internal/ls/findallreferences.go b/internal/ls/findallreferences.go index 4b937d094e..e5df1d9d9d 100644 --- a/internal/ls/findallreferences.go +++ b/internal/ls/findallreferences.go @@ -625,7 +625,7 @@ func (l *LanguageService) getReferencedSymbolsForNode(ctx context.Context, posit } if moduleSymbol := checker.GetMergedSymbol(resolvedRef.file.Symbol); moduleSymbol != nil { - return getReferencedSymbolsForModule(ctx, program, moduleSymbol /*excludeImportTypeOfExportEquals*/, false, sourceFiles, sourceFilesSet) + return l.getReferencedSymbolsForModule(ctx, program, moduleSymbol /*excludeImportTypeOfExportEquals*/, false, sourceFiles, sourceFilesSet) } // !!! not implemented @@ -673,7 +673,7 @@ func (l *LanguageService) getReferencedSymbolsForNode(ctx context.Context, posit } if symbol.Name == ast.InternalSymbolNameExportEquals { - return getReferencedSymbolsForModule(ctx, program, symbol.Parent, false /*excludeImportTypeOfExportEquals*/, sourceFiles, sourceFilesSet) + return l.getReferencedSymbolsForModule(ctx, program, symbol.Parent, false /*excludeImportTypeOfExportEquals*/, sourceFiles, sourceFilesSet) } moduleReferences := l.getReferencedSymbolsForModuleIfDeclaredBySourceFile(ctx, symbol, program, sourceFiles, checker, options, sourceFilesSet) // !!! cancellationToken @@ -700,7 +700,7 @@ func (l *LanguageService) getReferencedSymbolsForModuleIfDeclaredBySourceFile(ct } exportEquals := symbol.Exports[ast.InternalSymbolNameExportEquals] // If exportEquals != nil, we're about to add references to `import("mod")` anyway, so don't double-count them. - moduleReferences := getReferencedSymbolsForModule(ctx, program, symbol, exportEquals != nil, sourceFiles, sourceFilesSet) + moduleReferences := l.getReferencedSymbolsForModule(ctx, program, symbol, exportEquals != nil, sourceFiles, sourceFilesSet) if exportEquals == nil || !sourceFilesSet.Has(moduleSourceFileName) { return moduleReferences } @@ -1021,7 +1021,7 @@ func getMergedAliasedSymbolOfNamespaceExportDeclaration(node *ast.Node, symbol * return nil } -func getReferencedSymbolsForModule(ctx context.Context, program *compiler.Program, symbol *ast.Symbol, excludeImportTypeOfExportEquals bool, sourceFiles []*ast.SourceFile, sourceFilesSet *collections.Set[string]) []*SymbolAndEntries { +func (l *LanguageService) getReferencedSymbolsForModule(ctx context.Context, program *compiler.Program, symbol *ast.Symbol, excludeImportTypeOfExportEquals bool, sourceFiles []*ast.SourceFile, sourceFilesSet *collections.Set[string]) []*SymbolAndEntries { debug.Assert(symbol.ValueDeclaration != nil) checker, done := program.GetTypeChecker(ctx) @@ -1062,10 +1062,11 @@ func getReferencedSymbolsForModule(ctx context.Context, program *compiler.Progra } return newNodeEntry(rangeNode) case ModuleReferenceKindReference: - // or - // We can't easily create a proper range entry here without access to LanguageService, - // but we can create a node-based entry pointing to the source file which will be resolved later - return newNodeEntry(reference.referencingFile.AsNode()) + return &referenceEntry{ + kind: entryKindRange, + fileName: reference.referencingFile.FileName(), + textRange: l.createLspRangeFromBounds(reference.ref.Pos(), reference.ref.End(), reference.referencingFile), + } } return nil }) diff --git a/testdata/baselines/reference/conformance/jsdocTypeParameterTagConflict.types b/testdata/baselines/reference/conformance/jsdocTypeParameterTagConflict.types index c011a7682c..181028247a 100644 --- a/testdata/baselines/reference/conformance/jsdocTypeParameterTagConflict.types +++ b/testdata/baselines/reference/conformance/jsdocTypeParameterTagConflict.types @@ -6,7 +6,7 @@ * @param {2} a */ export function conflictingParam(a) { return true } ->conflictingParam : (a: 2) => true +>conflictingParam : (a: 1) => true >a : 2 >true : true @@ -15,7 +15,7 @@ export function conflictingParam(a) { return true } * @return {false} */ export function conflictingReturn(b) { return false } ->conflictingReturn : (b: 3) => false +>conflictingReturn : (b: 3) => true >b : 3 >false : false @@ -26,7 +26,7 @@ export function conflictingReturn(b) { return false } * @return {false} */ export function conflictingBoth(d) { return false } ->conflictingBoth : (d: 5) => false +>conflictingBoth : (c: 4) => true >d : 5 >false : false diff --git a/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightReferenceDirective.baseline.jsonc b/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightReferenceDirective.baseline.jsonc new file mode 100644 index 0000000000..affad0dae7 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentHighlights/documentHighlightReferenceDirective.baseline.jsonc @@ -0,0 +1,6 @@ +// === documentHighlights === +// === /a.ts === +// /// +// +// const x = 1; +// \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/argumentsObjectCreatesRestForJs.errors.txt b/testdata/baselines/reference/submodule/compiler/argumentsObjectCreatesRestForJs.errors.txt index d0da78af1a..9728abd151 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsObjectCreatesRestForJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/argumentsObjectCreatesRestForJs.errors.txt @@ -1,9 +1,8 @@ main.js(3,9): error TS2554: Expected 0 arguments, but got 3. -main.js(5,1): error TS2554: Expected 2 arguments, but got 0. -main.js(6,16): error TS2554: Expected 2 arguments, but got 3. +main.js(6,16): error TS2554: Expected 0-2 arguments, but got 3. -==== main.js (3 errors) ==== +==== main.js (2 errors) ==== function allRest() { arguments; } allRest(); allRest(1, 2, 3); @@ -11,12 +10,9 @@ main.js(6,16): error TS2554: Expected 2 arguments, but got 3. !!! error TS2554: Expected 0 arguments, but got 3. function someRest(x, y) { arguments; } someRest(); // x and y are still optional because they are in a JS file - ~~~~~~~~ -!!! error TS2554: Expected 2 arguments, but got 0. -!!! related TS6210 main.js:4:19: An argument for 'x' was not provided. someRest(1, 2, 3); ~ -!!! error TS2554: Expected 2 arguments, but got 3. +!!! error TS2554: Expected 0-2 arguments, but got 3. /** * @param {number} x - a thing diff --git a/testdata/baselines/reference/submodule/compiler/argumentsPropertyNameInJsMode1.errors.txt b/testdata/baselines/reference/submodule/compiler/argumentsPropertyNameInJsMode1.errors.txt index 9ff220110a..3bca806b62 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsPropertyNameInJsMode1.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/argumentsPropertyNameInJsMode1.errors.txt @@ -1,4 +1,4 @@ -a.js(9,7): error TS2554: Expected 1 arguments, but got 3. +a.js(9,7): error TS2554: Expected 0-1 arguments, but got 3. ==== a.js (1 errors) ==== @@ -12,5 +12,5 @@ a.js(9,7): error TS2554: Expected 1 arguments, but got 3. f2(1, 2, 3); ~~~~ -!!! error TS2554: Expected 1 arguments, but got 3. +!!! error TS2554: Expected 0-1 arguments, but got 3. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/argumentsPropertyNameInJsMode2.errors.txt b/testdata/baselines/reference/submodule/compiler/argumentsPropertyNameInJsMode2.errors.txt index c887f9f9bf..6f3d779512 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsPropertyNameInJsMode2.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/argumentsPropertyNameInJsMode2.errors.txt @@ -1,4 +1,4 @@ -a.js(5,6): error TS2554: Expected 1 arguments, but got 3. +a.js(5,6): error TS2554: Expected 0-1 arguments, but got 3. ==== a.js (1 errors) ==== @@ -8,5 +8,5 @@ a.js(5,6): error TS2554: Expected 1 arguments, but got 3. f(1, 2, 3); ~~~~ -!!! error TS2554: Expected 1 arguments, but got 3. +!!! error TS2554: Expected 0-1 arguments, but got 3. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInFunction1_Js.errors.txt b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInFunction1_Js.errors.txt index fecdd50367..21fcf854a8 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsReferenceInFunction1_Js.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/argumentsReferenceInFunction1_Js.errors.txt @@ -1,5 +1,5 @@ index.js(1,25): error TS7006: Parameter 'f' implicitly has an 'any' type. -index.js(13,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f: any]'. +index.js(13,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f?: any]'. ==== index.js (2 errors) ==== @@ -19,6 +19,6 @@ index.js(13,29): error TS2345: Argument of type 'IArguments' is not assignable t const debuglog = function() { return format.apply(null, arguments); ~~~~~~~~~ -!!! error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f: any]'. +!!! error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f?: any]'. }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionParametersAsOptional.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionParametersAsOptional.errors.txt deleted file mode 100644 index 8e0c4dc746..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionParametersAsOptional.errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -bar.ts(1,1): error TS2554: Expected 3 arguments, but got 0. -bar.ts(2,1): error TS2554: Expected 3 arguments, but got 1. -bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2. - - -==== foo.js (0 errors) ==== - function f(a, b, c) { } - - -==== bar.ts (3 errors) ==== - f(); - ~ -!!! error TS2554: Expected 3 arguments, but got 0. -!!! related TS6210 foo.js:1:12: An argument for 'a' was not provided. - f(1); - ~ -!!! error TS2554: Expected 3 arguments, but got 1. -!!! related TS6210 foo.js:1:15: An argument for 'b' was not provided. - f(1, 2); - ~ -!!! error TS2554: Expected 3 arguments, but got 2. -!!! related TS6210 foo.js:1:18: An argument for 'c' was not provided. - f(1, 2, 3); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsFileFunctionParametersAsOptional2.errors.txt b/testdata/baselines/reference/submodule/compiler/jsFileFunctionParametersAsOptional2.errors.txt deleted file mode 100644 index 83cde6079b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsFileFunctionParametersAsOptional2.errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -bar.ts(1,1): error TS2554: Expected 3 arguments, but got 0. -bar.ts(2,1): error TS2554: Expected 3 arguments, but got 1. -bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2. - - -==== foo.js (0 errors) ==== - /** - * @param a - * @param b - * @param c - */ - function f(a, b, c) { } - - -==== bar.ts (3 errors) ==== - f(); // Error - ~ -!!! error TS2554: Expected 3 arguments, but got 0. -!!! related TS6210 foo.js:6:12: An argument for 'a' was not provided. - f(1); // Error - ~ -!!! error TS2554: Expected 3 arguments, but got 1. -!!! related TS6210 foo.js:6:15: An argument for 'b' was not provided. - f(1, 2); // Error - ~ -!!! error TS2554: Expected 3 arguments, but got 2. -!!! related TS6210 foo.js:6:18: An argument for 'c' was not provided. - - f(1, 2, 3); // OK - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types index c71a45abee..d1b3e48372 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag5.types @@ -46,7 +46,7 @@ var k = function (x) { return x } /** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */ /** @type {Argle} */ function blargle(s) { ->blargle : (s: "bye" | "hi") => 0 | 1 | 2 +>blargle : (x: "bye" | "hi") => 0 | 1 | 2 >s : "bye" | "hi" return 0; @@ -57,7 +57,7 @@ function blargle(s) { var zeroonetwo = blargle('hi') >zeroonetwo : 0 | 1 | 2 >blargle('hi') : 0 | 1 | 2 ->blargle : (s: "bye" | "hi") => 0 | 1 | 2 +>blargle : (x: "bye" | "hi") => 0 | 1 | 2 >'hi' : "hi" /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types index 0d78ca717a..016eaa98db 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag6.types @@ -18,7 +18,7 @@ var g = function (prop) { /** @type {(a: number) => number} */ function add1(a, b) { return a + b; } ->add1 : (a: number, b: any) => number +>add1 : (a: number) => number >a : number >b : any >a + b : any @@ -37,7 +37,7 @@ function add2(a, b) { return a + b; } // TODO: Should be an error since signature doesn't match. /** @type {(a: number, b: number, c: number) => number} */ function add3(a, b) { return a + b; } ->add3 : (a: number, b: number) => number +>add3 : (a: number, b: number, c: number) => number >a : number >b : number >a + b : number @@ -49,7 +49,7 @@ function add3(a, b) { return a + b; } /** @type {() => void} */ function funcWithMoreParameters(more) {} // error ->funcWithMoreParameters : (more: any) => void +>funcWithMoreParameters : () => void >more : any /** @type {() => void} */ diff --git a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types index 25ffbdd7c0..6899db3795 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types +++ b/testdata/baselines/reference/submodule/conformance/checkJsdocTypeTag7.types @@ -16,6 +16,6 @@ class C { /** @type {(optional?) => void} */ methodWithOptionalParameters() {} ->methodWithOptionalParameters : () => void +>methodWithOptionalParameters : (optional?: any) => void } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocThisType.types b/testdata/baselines/reference/submodule/conformance/jsdocThisType.types index c1972827c9..ae97d83b72 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocThisType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocThisType.types @@ -25,7 +25,7 @@ export const f1 = function() { /** @type {import('./types').M} */ export function f2() { ->f2 : () => void +>f2 : (this: import("/types").Foo) => void this.test(); >this.test() : any @@ -48,7 +48,7 @@ export const f3 = function() { /** @type {(this: import('./types').Foo) => void} */ export function f4() { ->f4 : () => void +>f4 : (this: import("/types").Foo) => void this.test(); >this.test() : any diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt index 39e940dd64..22e99daab8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTagRequiredParameters.errors.txt @@ -27,9 +27,9 @@ a.js(13,1): error TS2554: Expected 1 arguments, but got 0. g() // should error ~ !!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 a.js:5:12: An argument for 's' was not provided. +!!! related TS6210 a.js:4:13: An argument for 's' was not provided. h() ~ !!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 a.js:8:12: An argument for 's' was not provided. +!!! related TS6210 a.js:7:14: An argument for 's' was not provided. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt deleted file mode 100644 index c367fd4d66..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt +++ /dev/null @@ -1,35 +0,0 @@ -use.js(3,8): error TS2554: Expected 1 arguments, but got 0. - - -==== use.js (1 errors) ==== - /// - var mini = require('./minimatch') - mini.M.defaults() - ~~~~~~~~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 minimatch.js:10:24: An argument for 'def' was not provided. - var m = new mini.M() - m.m() - mini.filter() - -==== types.d.ts (0 errors) ==== - declare var require: any; - declare var module: any; -==== minimatch.js (0 errors) ==== - /// - module.exports = minimatch - minimatch.M = M - minimatch.filter = filter - function filter() { - return minimatch() - } - function minimatch() { - } - M.defaults = function (def) { - return def - } - M.prototype.m = function () { - } - function M() { - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment7.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment7.errors.txt deleted file mode 100644 index f9855e7386..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment7.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -a.js(5,13): error TS2554: Expected 1 arguments, but got 0. - - -==== a.js (1 errors) ==== - var obj = {}; - obj.method = function (hunch) { - return true; - } - var b = obj.method(); - ~~~~~~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 a.js:2:24: An argument for 'hunch' was not provided. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types index 73284b3c14..66450f41d4 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types +++ b/testdata/baselines/reference/submodule/conformance/typeTagOnFunctionReferencesGeneric.types @@ -7,7 +7,7 @@ /**@type {IFn}*/ export function inJs(l) { ->inJs : (l: T) => T +>inJs : (m: T) => T >l : T return l; @@ -15,7 +15,7 @@ export function inJs(l) { } inJs(1); // lints error. Why? >inJs(1) : 1 ->inJs : (l: T) => T +>inJs : (m: T) => T >1 : 1 /**@type {IFn}*/ diff --git a/testdata/baselines/reference/submodule/conformance/typeTagWithGenericSignature.types b/testdata/baselines/reference/submodule/conformance/typeTagWithGenericSignature.types index f914e5dd2e..9f9358c9b0 100644 --- a/testdata/baselines/reference/submodule/conformance/typeTagWithGenericSignature.types +++ b/testdata/baselines/reference/submodule/conformance/typeTagWithGenericSignature.types @@ -3,7 +3,7 @@ === bug25618.js === /** @type {(param?: T) => T | undefined} */ function typed(param) { ->typed : (param: T | undefined) => T | undefined +>typed : (param?: T | undefined) => T | undefined >param : T | undefined return param; @@ -13,7 +13,7 @@ function typed(param) { var n = typed(1); >n : number | undefined >typed(1) : 1 | undefined ->typed : (param: T | undefined) => T | undefined +>typed : (param?: T | undefined) => T | undefined >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/unannotatedParametersAreOptional.errors.txt b/testdata/baselines/reference/submodule/conformance/unannotatedParametersAreOptional.errors.txt deleted file mode 100644 index a9378e3b62..0000000000 --- a/testdata/baselines/reference/submodule/conformance/unannotatedParametersAreOptional.errors.txt +++ /dev/null @@ -1,48 +0,0 @@ -test.js(2,1): error TS2554: Expected 1 arguments, but got 0. -test.js(10,3): error TS2554: Expected 1 arguments, but got 0. -test.js(11,9): error TS2554: Expected 1 arguments, but got 0. -test.js(12,9): error TS2554: Expected 1 arguments, but got 0. -test.js(19,5): error TS2554: Expected 1 arguments, but got 0. -test.js(20,5): error TS2554: Expected 1 arguments, but got 0. - - -==== test.js (6 errors) ==== - function f(x) {} - f(); // Always been ok - ~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 test.js:1:12: An argument for 'x' was not provided. - - class C { - static m(x) {} - p = x => {} - m(x) {} - } - - C.m(); // Always been ok - ~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 test.js:5:12: An argument for 'x' was not provided. - new C().m(); // Regression #39261 - ~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 test.js:7:5: An argument for 'x' was not provided. - new C().p(); // Regression #39261 - ~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 test.js:6:7: An argument for 'x' was not provided. - - const obj = { - m(x) {}, - p: x => {} - }; - - obj.m(); // Always been ok - ~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 test.js:15:5: An argument for 'x' was not provided. - obj.p(); // Always been ok - ~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 test.js:16:6: An argument for 'x' was not provided. - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.errors.txt.diff index a310bbe6cb..13e92bf5ea 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsObjectCreatesRestForJs.errors.txt.diff @@ -3,11 +3,10 @@ @@= skipped -0, +0 lines =@@ - +main.js(3,9): error TS2554: Expected 0 arguments, but got 3. -+main.js(5,1): error TS2554: Expected 2 arguments, but got 0. -+main.js(6,16): error TS2554: Expected 2 arguments, but got 3. ++main.js(6,16): error TS2554: Expected 0-2 arguments, but got 3. + + -+==== main.js (3 errors) ==== ++==== main.js (2 errors) ==== + function allRest() { arguments; } + allRest(); + allRest(1, 2, 3); @@ -15,12 +14,9 @@ +!!! error TS2554: Expected 0 arguments, but got 3. + function someRest(x, y) { arguments; } + someRest(); // x and y are still optional because they are in a JS file -+ ~~~~~~~~ -+!!! error TS2554: Expected 2 arguments, but got 0. -+!!! related TS6210 main.js:4:19: An argument for 'x' was not provided. + someRest(1, 2, 3); + ~ -+!!! error TS2554: Expected 2 arguments, but got 3. ++!!! error TS2554: Expected 0-2 arguments, but got 3. + + /** + * @param {number} x - a thing diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode1.errors.txt.diff deleted file mode 100644 index 74f3c2eccd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode1.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.argumentsPropertyNameInJsMode1.errors.txt -+++ new.argumentsPropertyNameInJsMode1.errors.txt -@@= skipped -0, +0 lines =@@ --a.js(9,7): error TS2554: Expected 0-1 arguments, but got 3. -+a.js(9,7): error TS2554: Expected 1 arguments, but got 3. - - - ==== a.js (1 errors) ==== -@@= skipped -11, +11 lines =@@ - - f2(1, 2, 3); - ~~~~ --!!! error TS2554: Expected 0-1 arguments, but got 3. -+!!! error TS2554: Expected 1 arguments, but got 3. - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode2.errors.txt.diff index 4b482bf1ad..3a8c657d10 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsPropertyNameInJsMode2.errors.txt.diff @@ -2,7 +2,7 @@ +++ new.argumentsPropertyNameInJsMode2.errors.txt @@= skipped -0, +0 lines =@@ - -+a.js(5,6): error TS2554: Expected 1 arguments, but got 3. ++a.js(5,6): error TS2554: Expected 0-1 arguments, but got 3. + + +==== a.js (1 errors) ==== @@ -12,5 +12,5 @@ + + f(1, 2, 3); + ~~~~ -+!!! error TS2554: Expected 1 arguments, but got 3. ++!!! error TS2554: Expected 0-1 arguments, but got 3. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInFunction1_Js.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInFunction1_Js.errors.txt.diff index fd91514e04..2d9239a61e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInFunction1_Js.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/argumentsReferenceInFunction1_Js.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +0 lines =@@ index.js(1,25): error TS7006: Parameter 'f' implicitly has an 'any' type. -index.js(13,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f?: any, ...any[]]'. -+index.js(13,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f: any]'. ++index.js(13,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f?: any]'. ==== index.js (2 errors) ==== @@ -12,6 +12,6 @@ return format.apply(null, arguments); ~~~~~~~~~ -!!! error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f?: any, ...any[]]'. -+!!! error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f: any]'. ++!!! error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[f?: any]'. }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional.errors.txt.diff deleted file mode 100644 index a47690fc80..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional.errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.jsFileFunctionParametersAsOptional.errors.txt -+++ new.jsFileFunctionParametersAsOptional.errors.txt -@@= skipped -0, +0 lines =@@ -- -+bar.ts(1,1): error TS2554: Expected 3 arguments, but got 0. -+bar.ts(2,1): error TS2554: Expected 3 arguments, but got 1. -+bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2. -+ -+ -+==== foo.js (0 errors) ==== -+ function f(a, b, c) { } -+ -+ -+==== bar.ts (3 errors) ==== -+ f(); -+ ~ -+!!! error TS2554: Expected 3 arguments, but got 0. -+!!! related TS6210 foo.js:1:12: An argument for 'a' was not provided. -+ f(1); -+ ~ -+!!! error TS2554: Expected 3 arguments, but got 1. -+!!! related TS6210 foo.js:1:15: An argument for 'b' was not provided. -+ f(1, 2); -+ ~ -+!!! error TS2554: Expected 3 arguments, but got 2. -+!!! related TS6210 foo.js:1:18: An argument for 'c' was not provided. -+ f(1, 2, 3); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional2.errors.txt.diff new file mode 100644 index 0000000000..7502dd5e15 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsFileFunctionParametersAsOptional2.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.jsFileFunctionParametersAsOptional2.errors.txt ++++ new.jsFileFunctionParametersAsOptional2.errors.txt +@@= skipped -0, +0 lines =@@ +-bar.ts(1,1): error TS2554: Expected 3 arguments, but got 0. +-bar.ts(2,1): error TS2554: Expected 3 arguments, but got 1. +-bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2. +- +- +-==== foo.js (0 errors) ==== +- /** +- * @param a +- * @param b +- * @param c +- */ +- function f(a, b, c) { } +- +- +-==== bar.ts (3 errors) ==== +- f(); // Error +- ~ +-!!! error TS2554: Expected 3 arguments, but got 0. +-!!! related TS6210 foo.js:6:12: An argument for 'a' was not provided. +- f(1); // Error +- ~ +-!!! error TS2554: Expected 3 arguments, but got 1. +-!!! related TS6210 foo.js:6:15: An argument for 'b' was not provided. +- f(1, 2); // Error +- ~ +-!!! error TS2554: Expected 3 arguments, but got 2. +-!!! related TS6210 foo.js:6:18: An argument for 'c' was not provided. +- +- f(1, 2, 3); // OK +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff index cb18606f8c..5657510b06 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag5.types.diff @@ -39,7 +39,7 @@ /** @type {Argle} */ function blargle(s) { ->blargle : (x: "hi" | "bye") => 0 | 1 | 2 -+>blargle : (s: "bye" | "hi") => 0 | 1 | 2 ++>blargle : (x: "bye" | "hi") => 0 | 1 | 2 >s : "bye" | "hi" return 0; @@ -48,7 +48,7 @@ >zeroonetwo : 0 | 1 | 2 >blargle('hi') : 0 | 1 | 2 ->blargle : (x: "hi" | "bye") => 0 | 1 | 2 -+>blargle : (s: "bye" | "hi") => 0 | 1 | 2 ++>blargle : (x: "bye" | "hi") => 0 | 1 | 2 >'hi' : "hi" /** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff index 18a4844033..3ae6aeb4b8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag6.types.diff @@ -1,33 +1,6 @@ --- old.checkJsdocTypeTag6.types +++ new.checkJsdocTypeTag6.types -@@= skipped -17, +17 lines =@@ - - /** @type {(a: number) => number} */ - function add1(a, b) { return a + b; } -->add1 : (a: number) => number -+>add1 : (a: number, b: any) => number - >a : number - >b : any - >a + b : any -@@= skipped -19, +19 lines =@@ - // TODO: Should be an error since signature doesn't match. - /** @type {(a: number, b: number, c: number) => number} */ - function add3(a, b) { return a + b; } -->add3 : (a: number, b: number, c: number) => number -+>add3 : (a: number, b: number) => number - >a : number - >b : number - >a + b : number -@@= skipped -12, +12 lines =@@ - - /** @type {() => void} */ - function funcWithMoreParameters(more) {} // error -->funcWithMoreParameters : () => void -+>funcWithMoreParameters : (more: any) => void - >more : any - - /** @type {() => void} */ -@@= skipped -21, +21 lines =@@ +@@= skipped -69, +69 lines =@@ /** @type {() => void} */ methodWithMoreParameters(more) {}, // error diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff deleted file mode 100644 index bb0fb6f28f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkJsdocTypeTag7.types.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.checkJsdocTypeTag7.types -+++ new.checkJsdocTypeTag7.types -@@= skipped -15, +15 lines =@@ - - /** @type {(optional?) => void} */ - methodWithOptionalParameters() {} -->methodWithOptionalParameters : (optional?: any) => void -+>methodWithOptionalParameters : () => void - } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff index 1a8ac7b8a7..d4cb3a18d4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocThisType.types.diff @@ -1,15 +1,6 @@ --- old.jsdocThisType.types +++ new.jsdocThisType.types -@@= skipped -24, +24 lines =@@ - - /** @type {import('./types').M} */ - export function f2() { -->f2 : (this: import("/types").Foo) => void -+>f2 : () => void - - this.test(); - >this.test() : any -@@= skipped -11, +11 lines =@@ +@@= skipped -35, +35 lines =@@ /** @type {(this: import('./types').Foo) => void} */ export const f3 = function() { @@ -25,7 +16,7 @@ /** @type {(this: import('./types').Foo) => void} */ export function f4() { ->f4 : (this: import("./types").Foo) => void -+>f4 : () => void ++>f4 : (this: import("/types").Foo) => void this.test(); >this.test() : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff index efc34c532f..0e12a93ad7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTagRequiredParameters.errors.txt.diff @@ -32,12 +32,4 @@ -!!! related TS6210 a.js:1:21: An argument for '0' was not provided. g() // should error ~ - !!! error TS2554: Expected 1 arguments, but got 0. --!!! related TS6210 a.js:4:13: An argument for 's' was not provided. -+!!! related TS6210 a.js:5:12: An argument for 's' was not provided. - h() - ~ - !!! error TS2554: Expected 1 arguments, but got 0. --!!! related TS6210 a.js:7:14: An argument for 's' was not provided. -+!!! related TS6210 a.js:8:12: An argument for 's' was not provided. - \ No newline at end of file + !!! error TS2554: Expected 1 arguments, but got 0. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff deleted file mode 100644 index 5f966384cc..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.typeFromPropertyAssignment17.errors.txt -+++ new.typeFromPropertyAssignment17.errors.txt -@@= skipped -0, +0 lines =@@ -- -+use.js(3,8): error TS2554: Expected 1 arguments, but got 0. -+ -+ -+==== use.js (1 errors) ==== -+ /// -+ var mini = require('./minimatch') -+ mini.M.defaults() -+ ~~~~~~~~ -+!!! error TS2554: Expected 1 arguments, but got 0. -+!!! related TS6210 minimatch.js:10:24: An argument for 'def' was not provided. -+ var m = new mini.M() -+ m.m() -+ mini.filter() -+ -+==== types.d.ts (0 errors) ==== -+ declare var require: any; -+ declare var module: any; -+==== minimatch.js (0 errors) ==== -+ /// -+ module.exports = minimatch -+ minimatch.M = M -+ minimatch.filter = filter -+ function filter() { -+ return minimatch() -+ } -+ function minimatch() { -+ } -+ M.defaults = function (def) { -+ return def -+ } -+ M.prototype.m = function () { -+ } -+ function M() { -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment7.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment7.errors.txt.diff deleted file mode 100644 index 3ee1f1f7e3..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment7.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.typeFromPropertyAssignment7.errors.txt -+++ new.typeFromPropertyAssignment7.errors.txt -@@= skipped -0, +0 lines =@@ -- -+a.js(5,13): error TS2554: Expected 1 arguments, but got 0. -+ -+ -+==== a.js (1 errors) ==== -+ var obj = {}; -+ obj.method = function (hunch) { -+ return true; -+ } -+ var b = obj.method(); -+ ~~~~~~ -+!!! error TS2554: Expected 1 arguments, but got 0. -+!!! related TS6210 a.js:2:24: An argument for 'hunch' was not provided. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff deleted file mode 100644 index 80d3d366a0..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagOnFunctionReferencesGeneric.types.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.typeTagOnFunctionReferencesGeneric.types -+++ new.typeTagOnFunctionReferencesGeneric.types -@@= skipped -6, +6 lines =@@ - - /**@type {IFn}*/ - export function inJs(l) { -->inJs : (m: T) => T -+>inJs : (l: T) => T - >l : T - - return l; -@@= skipped -8, +8 lines =@@ - } - inJs(1); // lints error. Why? - >inJs(1) : 1 -->inJs : (m: T) => T -+>inJs : (l: T) => T - >1 : 1 - - /**@type {IFn}*/ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagWithGenericSignature.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagWithGenericSignature.types.diff index d5a2254495..02313972c3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeTagWithGenericSignature.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeTagWithGenericSignature.types.diff @@ -5,7 +5,7 @@ /** @type {(param?: T) => T | undefined} */ function typed(param) { ->typed : (param?: T) => T | undefined -+>typed : (param: T | undefined) => T | undefined ++>typed : (param?: T | undefined) => T | undefined >param : T | undefined return param; @@ -14,6 +14,6 @@ >n : number | undefined >typed(1) : 1 | undefined ->typed : (param?: T) => T | undefined -+>typed : (param: T | undefined) => T | undefined ++>typed : (param?: T | undefined) => T | undefined >1 : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/unannotatedParametersAreOptional.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/unannotatedParametersAreOptional.errors.txt.diff deleted file mode 100644 index ff90a5833b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/unannotatedParametersAreOptional.errors.txt.diff +++ /dev/null @@ -1,52 +0,0 @@ ---- old.unannotatedParametersAreOptional.errors.txt -+++ new.unannotatedParametersAreOptional.errors.txt -@@= skipped -0, +0 lines =@@ -- -+test.js(2,1): error TS2554: Expected 1 arguments, but got 0. -+test.js(10,3): error TS2554: Expected 1 arguments, but got 0. -+test.js(11,9): error TS2554: Expected 1 arguments, but got 0. -+test.js(12,9): error TS2554: Expected 1 arguments, but got 0. -+test.js(19,5): error TS2554: Expected 1 arguments, but got 0. -+test.js(20,5): error TS2554: Expected 1 arguments, but got 0. -+ -+ -+==== test.js (6 errors) ==== -+ function f(x) {} -+ f(); // Always been ok -+ ~ -+!!! error TS2554: Expected 1 arguments, but got 0. -+!!! related TS6210 test.js:1:12: An argument for 'x' was not provided. -+ -+ class C { -+ static m(x) {} -+ p = x => {} -+ m(x) {} -+ } -+ -+ C.m(); // Always been ok -+ ~ -+!!! error TS2554: Expected 1 arguments, but got 0. -+!!! related TS6210 test.js:5:12: An argument for 'x' was not provided. -+ new C().m(); // Regression #39261 -+ ~ -+!!! error TS2554: Expected 1 arguments, but got 0. -+!!! related TS6210 test.js:7:5: An argument for 'x' was not provided. -+ new C().p(); // Regression #39261 -+ ~ -+!!! error TS2554: Expected 1 arguments, but got 0. -+!!! related TS6210 test.js:6:7: An argument for 'x' was not provided. -+ -+ const obj = { -+ m(x) {}, -+ p: x => {} -+ }; -+ -+ obj.m(); // Always been ok -+ ~ -+!!! error TS2554: Expected 1 arguments, but got 0. -+!!! related TS6210 test.js:15:5: An argument for 'x' was not provided. -+ obj.p(); // Always been ok -+ ~ -+!!! error TS2554: Expected 1 arguments, but got 0. -+!!! related TS6210 test.js:16:6: An argument for 'x' was not provided. -+ \ No newline at end of file From ca68e0b516740b04dcc25f30acf47241de3f1a34 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 28 Oct 2025 08:02:31 -0700 Subject: [PATCH 044/152] Update submodule with ES5 removals (#1963) --- _submodules/TypeScript | 2 +- internal/binder/nameresolver.go | 30 +- internal/checker/checker.go | 14 +- internal/checker/grammarchecks.go | 12 - internal/checker/types.go | 28 - internal/compiler/program.go | 10 - internal/fourslash/_scripts/failingTests.txt | 1 - ...pletionListStaticProtectedMembers2_test.go | 28 + .../tests/gen/findAllRefsForModule_test.go | 2 +- internal/printer/factory.go | 12 +- internal/printer/helpers.go | 17 - .../findAllRefsForModule.baseline.jsonc | 15 + .../findAllRefsForModule.baseline.jsonc | 33 + .../compiler/APISample_Watch.js.diff | 11 - .../APISample_WatchWithDefaults.js.diff | 11 - .../APISample_WatchWithOwnWatchHost.js.diff | 11 - .../compiler/APISample_compile.js.diff | 11 - .../compiler/APISample_jsdoc.js.diff | 11 - .../compiler/APISample_linter.js.diff | 11 - .../compiler/APISample_parseConfig.js.diff | 11 - .../compiler/APISample_transform.js.diff | 11 - .../compiler/APISample_watcher.js.diff | 11 - ...hInvalidConstOnPropertyDeclaration.js.diff | 14 +- .../accessorInAmbientContextES5.errors.txt | 32 - .../compiler/aliasAssignments.js.diff | 9 +- .../aliasDoesNotDuplicateSignatures.js.diff | 11 - .../aliasUsageInAccessorsOfClass.js.diff | 14 +- .../compiler/aliasUsageInArray.js.diff | 17 +- .../aliasUsageInFunctionExpression.js.diff | 17 +- .../aliasUsageInGenericFunction.js.diff | 18 +- .../aliasUsageInIndexerOfClass.js.diff | 14 +- .../aliasUsageInObjectLiteral.js.diff | 18 +- .../compiler/aliasUsageInOrExpression.js.diff | 18 +- ...UsageInTypeArgumentOfExtendsClause.js.diff | 14 +- .../aliasUsageInVarAssignment.js.diff | 10 +- .../compiler/aliasUsedAsNameValue.js.diff | 13 - ...allowImportClausesToMergeWithTypes.js.diff | 23 - ...allowJscheckJsTypeParameterNoCrash.js.diff | 11 - .../allowSyntheticDefaultImports1.js.diff | 9 - .../allowSyntheticDefaultImports10.js.diff | 10 - .../allowSyntheticDefaultImports4.js.diff | 9 - .../allowSyntheticDefaultImports9.js.diff | 10 - ...ortsCanPaintCrossModuleDeclaration.js.diff | 10 - ...ernalModuleInAnotherExternalModule.js.diff | 10 - .../compiler/amdDependencyComment1.js.diff | 9 - .../amdDependencyCommentName1.js.diff | 9 - .../anonClassDeclarationEmitIsAnon.js.diff | 6 +- .../anyAndUnknownHaveFalsyComponents.js | 15 +- .../assertionFunctionWildcardImport1.js.diff | 32 - .../assertionFunctionWildcardImport2.js.diff | 11 - .../compiler/asyncArrowInClassES5.js.diff | 15 +- ...ReturnExpressionErrorSpans.errors.txt.diff | 21 - .../compiler/asyncImportNestedYield.js.diff | 2 +- .../compiler/augmentExportEquals3.js.diff | 20 - .../compiler/augmentExportEquals4.js.diff | 20 - .../compiler/augmentExportEquals6.js.diff | 20 - .../submodule/compiler/autolift4.js.diff | 35 +- ...onDeclarationInStrictClass.errors.txt.diff | 18 - ...nctionDeclarationStrictES5.errors.txt.diff | 17 - ...nctionDeclarationStrictES5.errors.txt.diff | 31 - .../blockScopedVariablesUseBeforeDef.js.diff | 13 +- .../compiler/callsOnComplexSignatures.js.diff | 11 - .../capturedParametersInInitializers2.js.diff | 37 +- .../compiler/chainedImportAlias.js.diff | 6 +- ...eckJsdocTypeTagOnExportAssignment1.js.diff | 9 - ...eckJsdocTypeTagOnExportAssignment2.js.diff | 9 - ...eckJsdocTypeTagOnExportAssignment3.js.diff | 9 - ...eckJsdocTypeTagOnExportAssignment5.js.diff | 9 - ...eckJsdocTypeTagOnExportAssignment6.js.diff | 9 - ...eckJsdocTypeTagOnExportAssignment7.js.diff | 9 - .../compiler/checkJsxNotSetError.js.diff | 9 - .../submodule/compiler/class2.js.diff | 18 +- .../compiler/classBlockScoping.js.diff | 29 +- ...nShouldBeOutOfScopeInComputedNames.js.diff | 34 +- ...xpressionInClassStaticDeclarations.js.diff | 17 +- ...assExpressionWithStaticProperties3.js.diff | 6 +- .../compiler/classExtendsAcrossFiles.js.diff | 20 - .../compiler/classInConvertedLoopES5.js.diff | 18 +- .../classMemberInitializerScoping.js.diff | 22 +- ...sMemberInitializerWithLamdaScoping.js.diff | 70 +- ...zersUsePropertiesBeforeDeclaration.js.diff | 18 +- .../classStaticPropertyAccess.js.diff | 18 +- .../compiler/cloduleStaticMembers.js.diff | 16 +- ...ionArgumentsArrowFunctions.errors.txt.diff | 29 - ...nArgumentsClassConstructor.errors.txt.diff | 80 - ...lisionArgumentsClassMethod.errors.txt.diff | 63 - ...collisionArgumentsFunction.errors.txt.diff | 63 - ...gumentsFunctionExpressions.errors.txt.diff | 53 - .../collisionExportsRequireAndAlias.js.diff | 13 - ...commentOnDecoratedClassDeclaration.js.diff | 29 +- .../compiler/commentsExternalModules3.js.diff | 11 - ...ule=commonjs,moduledetection=auto).js.diff | 8 +- ...le=commonjs,moduledetection=force).js.diff | 8 +- ...ule=commonjs,moduledetection=auto).js.diff | 7 +- ...le=commonjs,moduledetection=force).js.diff | 7 +- .../compiler/commentsOnStaticMembers.js.diff | 34 +- .../compiler/commonSourceDirectory.js.diff | 12 - .../commonSourceDirectory.js.map.diff | 8 - .../commonSourceDirectory.sourcemap.txt.diff | 34 - .../compiler/commonjsSafeImport.js.diff | 10 - ...compositeWithNodeModulesSourceFile.js.diff | 10 - ...omputedPropertyNameWithImportedKey.js.diff | 11 - ...ngDeclarationsImportFromNamespace1.js.diff | 10 - ...ngDeclarationsImportFromNamespace2.js.diff | 10 - ...usesNoImport(isolatedmodules=true).js.diff | 11 - ...mNamespaceReferenceCausesNoImport2.js.diff | 11 - .../constEnumPreserveEmitReexport.js.diff | 9 +- .../contextualTypeObjectSpreadExpression.js | 13 +- .../compiler/copyrightWithNewLine1.js.diff | 11 - .../compiler/copyrightWithoutNewLine1.js.diff | 11 - .../compiler/ctsFileInEsnextHelpers.js.diff | 2 +- ...leImportModuleWithExportAssignment.js.diff | 10 - .../compiler/declFilePrivateStatic.js.diff | 34 +- .../declarationEmitAliasInlineing.js.diff | 13 +- ...tionEmitAnyComputedPropertyInClass.js.diff | 11 - ...onEmitCommonJsModuleReferencedType.js.diff | 10 +- ...omputedNameCausesImportToBePainted.js.diff | 11 - ...tionEmitComputedNameConstEnumAlias.js.diff | 11 - ...CrossFileCopiedGeneratedImportType.js.diff | 10 - ...CrossFileImportTypeOfAmbientModule.js.diff | 10 - ...tDefaultExportWithStaticAssignment.js.diff | 20 +- ...onEmitEnumReferenceViaImportEquals.js.diff | 16 +- ...tionEmitExpandoPropertyPrivateName.js.diff | 11 +- ...nEmitExportAliasVisibiilityMarking.js.diff | 10 - ...mespaceNoTripleSlashTypesReference.js.diff | 11 - .../declarationEmitExportAssignment.js.diff | 6 +- .../declarationEmitExportDeclaration.js.diff | 11 - ...eclarationEmitExpressionInExtends6.js.diff | 11 - ...ionWithNonlocalPrivateUniqueSymbol.js.diff | 11 +- ...onEmitForGlobalishSpecifierSymlink.js.diff | 10 - ...nEmitForGlobalishSpecifierSymlink2.js.diff | 10 - ...ingModuleAugmentationRetainsImport.js.diff | 11 - ...onEmitForTypesWhichNeedImportTypes.js.diff | 10 - ...EmitInlinedDistributiveConditional.js.diff | 20 - ...onErrorNotEmittedForNonEmittedFile.js.diff | 8 +- ...onEmitLocalClassHasRequiredDeclare.js.diff | 17 +- ...DistributivityPreservesConstraints.js.diff | 11 +- ...EmitMappedTypeTemplateTypeofSymbol.js.diff | 14 +- .../declarationEmitNameConflicts.js.diff | 11 +- ...clarationEmitOfTypeofAliasedExport.js.diff | 10 - ...ationEmitPreserveReferencedImports.js.diff | 10 - ...arationEmitPrivateReadonlyLiterals.js.diff | 22 +- ...ateSymbolCausesVarDeclarationEmit2.js.diff | 9 +- ...tionEmitQualifiedAliasTypeArgument.js.diff | 10 - ...declarationEmitReadonlyComputedProperty.js | 13 +- ...rationEmitReadonlyComputedProperty.js.diff | 11 +- ...tionEmitReexportedSymlinkReference.js.diff | 11 - ...ionEmitReexportedSymlinkReference2.js.diff | 11 +- ...ionEmitReexportedSymlinkReference3.js.diff | 11 +- ...nedAnnotationRetainsImportInOutput.js.diff | 10 - .../declarationEmitScopeConsistency.js.diff | 10 - .../declarationEmitSpreadStringlyKeyedEnum.js | 13 +- ...arationEmitSpreadStringlyKeyedEnum.js.diff | 2 +- ...ationEmitStringEnumUsedInNonlocalSpread.js | 13 +- ...EmitStringEnumUsedInNonlocalSpread.js.diff | 11 - .../declarationEmitSymlinkPaths.js.diff | 12 - ...ationEmitTopLevelNodeFromCrossFile.js.diff | 11 +- ...tionEmitTopLevelNodeFromCrossFile2.js.diff | 11 - ...nsitiveImportOfHtmlDeclarationItem.js.diff | 20 +- ...declarationEmitTypeofDefaultExport.js.diff | 10 - ...itUnnessesaryTypeReferenceNotAdded.js.diff | 13 - ...ationEmitWithDefaultAsComputedName.js.diff | 11 - ...tionEmitWithDefaultAsComputedName2.js.diff | 11 - .../compiler/declarationMapsMultifile.js.diff | 11 - .../declarationNoDanglingGenerics.js.diff | 18 +- ...ationsForInferredTypeFromOtherFile.js.diff | 11 - ...onsIndirectGeneratedAliasReference.js.diff | 10 - ...iveInternalTypesProduceUniqueTypeParams.js | 13 +- .../decoratorMetadataConditionalType.js.diff | 34 +- ...MethodWithNoReturnTypeAnnotation01.js.diff | 38 +- ...coratorMetadataGenericTypeVariable.js.diff | 19 +- ...MetadataGenericTypeVariableDefault.js.diff | 19 +- ...MetadataGenericTypeVariableInScope.js.diff | 19 +- ...rMetadataNoLibIsolatedModulesTypes.js.diff | 21 +- .../decoratorMetadataNoStrictNull.js.diff | 25 +- .../decoratorMetadataOnInferredType.js.diff | 26 +- ...adataRestParameterWithImportedType.js.diff | 48 +- .../decoratorMetadataTypeOnlyExport.js.diff | 18 +- .../decoratorMetadataTypeOnlyImport.js.diff | 17 +- ...coratorMetadataWithConstructorType.js.diff | 26 +- ...WithImportDeclarationNameCollision.js.diff | 31 +- ...ithImportDeclarationNameCollision2.js.diff | 31 +- ...ithImportDeclarationNameCollision3.js.diff | 31 +- ...ithImportDeclarationNameCollision4.js.diff | 37 +- ...ithImportDeclarationNameCollision5.js.diff | 31 +- ...ithImportDeclarationNameCollision6.js.diff | 31 +- ...ithImportDeclarationNameCollision7.js.diff | 37 +- ...ithImportDeclarationNameCollision8.js.diff | 31 +- .../decoratorReferenceOnOtherProperty.js.diff | 52 +- .../compiler/decoratorReferences.js.diff | 26 +- .../decoratorUsedBeforeDeclaration.js.diff | 198 +- ...atorWithNegativeLiteralTypeNoCrash.js.diff | 21 +- .../decoratorWithUnderscoreMethod.js.diff | 24 +- ...efaultDeclarationEmitDefaultImport.js.diff | 10 - ...faultDeclarationEmitNamedCorrectly.js.diff | 14 +- ...larationEmitShadowedNamedCorrectly.js.diff | 10 +- .../defaultKeywordWithoutExport1.js.diff | 13 +- ...aultPropsEmptyCurlyBecomesAnyForJs.js.diff | 17 +- .../destructuredDeclarationEmit.js.diff | 7 +- .../compiler/destructuringFromUnionSpread.js | 13 +- ...ingInitializerContextualTypeFromContext.js | 13 +- ...itializerContextualTypeFromContext.js.diff | 6 +- .../downlevelLetConst18.errors.txt.diff | 43 - .../downlevelLetConst19.errors.txt.diff | 29 - ...bjectLiteralProperty_computedName3.js.diff | 11 - .../compiler/duplicatePackage.js.diff | 14 - .../duplicatePackage_referenceTypes.js.diff | 9 - ...ackage_relativeImportWithinPackage.js.diff | 11 - ...relativeImportWithinPackage_scoped.js.diff | 11 - .../duplicatePackage_subModule.js.diff | 9 - ...micImportInDefaultExportExpression.js.diff | 10 - .../dynamicImportTrailingComma.js.diff | 8 - .../elidedJSImport2(module=commonjs).js.diff | 15 +- .../compiler/elidingImportNames.js.diff | 13 - ...sMergedWithConstNamespaceNotElided.js.diff | 9 - ...a_isolatedModules(module=commonjs).js.diff | 82 +- ...ata_isolatedModules(module=esnext).js.diff | 78 +- .../emitDecoratorMetadata_object.js.diff | 33 +- .../emitDecoratorMetadata_restArgs.js.diff | 62 +- .../compiler/emptyModuleName.js.diff | 10 - ...eclarationEmitInitializerHasImport.js.diff | 10 - .../compiler/enumFromExternalModule.js.diff | 9 - ...alizerFollowsNonLiteralInitializer.js.diff | 13 +- ...numWithNonLiteralStringInitializer.js.diff | 13 +- .../compiler/erasableSyntaxOnly.js.diff | 6 +- ...rorForConflictingExportEqualsValue.js.diff | 6 +- .../es5-importHelpersAsyncFunctions.js.diff | 2 +- .../submodule/compiler/es6ClassTest.js.diff | 41 +- .../submodule/compiler/es6ClassTest2.js.diff | 22 +- .../compiler/es6ExportEqualsInterop.js.diff | 79 +- .../es6ImportDefaultBindingDts.js.diff | 10 - ...ndingFollowedWithNamedImport1InEs5.js.diff | 25 - ...FollowedWithNamedImport1WithExport.js.diff | 25 - ...tBindingFollowedWithNamedImportDts.js.diff | 23 - ...BindingFollowedWithNamedImportDts1.js.diff | 25 - ...indingFollowedWithNamedImportInEs5.js.diff | 23 - ...gFollowedWithNamedImportWithExport.js.diff | 23 - ...FollowedWithNamespaceBinding1InEs5.js.diff | 10 - ...ingFollowedWithNamespaceBindingDts.js.diff | 10 - ...gFollowedWithNamespaceBindingInEs5.js.diff | 10 - ...owedWithNamespaceBindingWithExport.js.diff | 10 - ...es6ImportDefaultBindingMergeErrors.js.diff | 10 - .../es6ImportDefaultBindingWithExport.js.diff | 10 - ...ortEqualsExportModuleCommonJsError.js.diff | 9 - .../es6ImportNameSpaceImportDts.js.diff | 10 - .../es6ImportNameSpaceImportInEs5.js.diff | 10 - .../compiler/es6ImportNamedImportDts.js.diff | 37 - .../es6ImportNamedImportInEs5.js.diff | 37 - ...edImportInIndirectExportAssignment.js.diff | 6 +- .../es6ImportNamedImportWithExport.js.diff | 37 - ...mportNamedImportWithTypesAndValues.js.diff | 9 +- .../compiler/esModuleInterop.js.diff | 15 - .../esModuleInteropDefaultImports.js.diff | 25 +- ...erMustBeSyntacticallyDefaultExport.js.diff | 10 - .../esModuleInteropImportCall.js.diff | 10 - ...DefaultWhenAllNamedAreDefaultAlias.js.diff | 10 - .../esModuleInteropImportNamespace.js.diff | 9 - ...esModuleInteropNamedDefaultImports.js.diff | 15 - ...teropPrettyErrorRelatedInformation.js.diff | 10 - .../esModuleInteropTslibHelpers.js.diff | 45 - ...UsesExportStarWhenDefaultPlusNames.js.diff | 10 - .../esModuleInteropWithExportStar.js.diff | 8 +- .../esModuleIntersectionCrash.js.diff | 10 - .../compiler/excessPropertyCheckWithSpread.js | 15 +- .../compiler/excessPropertyCheckWithUnions.js | 13 +- .../excessPropertyCheckWithUnions.js.diff | 6 +- ...andoFunctionContextualTypesNoValue.js.diff | 10 - .../expandoFunctionSymbolPropertyJs.js.diff | 11 +- ...MetadataUnresolvedTypeObjectInEmit.js.diff | 26 +- ...xplicitAnyAfterSpreadNoImplicitAnyError.js | 13 +- .../exportAsNamespace_augment.js.diff | 10 - ...amespaceIsVisibleInDeclarationEmit.js.diff | 10 - .../compiler/exportAssignmentEnum.js.diff | 11 - ...exportAssignmentImportMergeNoCrash.js.diff | 9 - .../compiler/exportAssignmentVariable.js.diff | 9 - .../exportClassExtendingIntersection.js.diff | 20 +- .../exportDefaultAbstractClass.js.diff | 11 +- .../compiler/exportDefaultProperty.js.diff | 17 +- .../compiler/exportDefaultProperty2.js.diff | 9 +- .../exportDefaultQualifiedNameNoError.js.diff | 23 +- .../exportDefaultStripsFreshness.js.diff | 11 - .../compiler/exportEqualErrorType.js.diff | 9 - .../compiler/exportEqualMemberMissing.js.diff | 9 - .../exportEqualsDefaultProperty.js.diff | 9 - .../compiler/exportEqualsProperty.js.diff | 18 - .../compiler/exportEqualsProperty2.js.diff | 7 +- .../exportStarFromEmptyModule.js.diff | 11 +- .../compiler/exportStarNotElided.js.diff | 9 - ...nsForbiddenInParameterInitializers.js.diff | 2 +- .../submodule/compiler/extendFromAny.js.diff | 20 +- ...ingClassFromAliasAndUsageInIndexer.js.diff | 29 +- .../compiler/extendsUntypedModule.js.diff | 11 - ...xternalModuleExportingGenericClass.js.diff | 9 +- .../externalModuleImmutableBindings.js.diff | 11 - ...ResolutionOrderInImportDeclaration.js.diff | 10 - .../compiler/externalModuleResolution.js.diff | 9 - .../externalModuleResolution2.js.diff | 9 - .../forwardRefInClassProperties.js.diff | 33 +- ...RefInTypeDeclaration(strict=false).js.diff | 14 +- ...dRefInTypeDeclaration(strict=true).js.diff | 11 +- ...ctionLikeInParameterInitializer.errors.txt | 34 + ...functionLikeInParameterInitializer.symbols | 4 - .../functionLikeInParameterInitializer.types | 30 +- ...ClassWithStaticsUsingTypeArguments.js.diff | 26 +- ...erenceDefaultTypeParameterJsxReact.js.diff | 11 - .../compiler/genericIsNeverEmptyObject.js | 13 +- .../genericIsNeverEmptyObject.js.diff | 4 +- .../globalThisDeclarationEmit.js.diff | 9 +- .../globalThisDeclarationEmit2.js.diff | 10 - .../globalThisDeclarationEmit3.js.diff | 7 +- .../compiler/ignoredJsxAttributes.js.diff | 11 - ...ternalModuleInsideAnInternalModule.js.diff | 8 +- .../compiler/importAsBaseClass.js.diff | 10 - .../submodule/compiler/importDecl.js.diff | 42 +- .../submodule/compiler/importHelpers.js.diff | 64 +- .../importHelpersInIsolatedModules.js.diff | 64 +- .../submodule/compiler/importHelpersInTsx.js | 16 +- .../compiler/importHelpersInTsx.js.diff | 11 - ...tHelpersNoEmitHelpersExportDefault.js.diff | 10 +- .../importNotElidedWhenNotFound.js.diff | 22 - ...ShouldNotBeElidedInDeclarationEmit.js.diff | 10 - ...tTypeGenericArrowTypeParenthesized.js.diff | 11 +- .../compiler/importUsedInExtendsList1.js.diff | 10 +- .../compiler/importWithTrailingSlash.js.diff | 23 - .../inferredIndexerOnNamespaceImport.js.diff | 11 - ...eMappedTypeModifierDeclarationEmit.js.diff | 11 - .../instanceAndStaticDeclarations1.js.diff | 42 +- .../compiler/intersectionPropertyCheck.js | 13 +- .../intersectionPropertyCheck.js.diff | 6 +- .../compiler/invalidStaticField.js.diff | 14 +- ...olatedModulesExportDeclarationType.js.diff | 9 - .../isolatedModulesImportConstEnum.js.diff | 9 - ...isolatedModulesImportExportElision.js.diff | 12 +- .../isolatedModulesReExportType.js.diff | 4 +- ...ascriptThisAssignmentInStaticBlock.js.diff | 7 +- ...licitAnyNoCascadingReferenceErrors.js.diff | 11 - .../compiler/jsdocInTypeScript.js.diff | 8 +- ...FileImportChecksCallCorrectlyTwice.js.diff | 11 - .../jsxCallElaborationCheckNoCrash1.js.diff | 11 - ...hildrenIndividualErrorElaborations.js.diff | 11 - ...fusableWithMultipleChildrenNoError.js.diff | 11 - ...sxComplexSignatureHasApplicabilityError.js | 13 +- ...plexSignatureHasApplicabilityError.js.diff | 11 - .../submodule/compiler/jsxElementType.js.diff | 6 +- .../compiler/jsxElementTypeLiteral.js.diff | 11 - .../jsxElementTypeLiteralWithGeneric.js.diff | 11 - ...essionNotCountedAsChild(jsx=react).js.diff | 11 - ...onNotCountedAsChild(jsx=react-jsx).js.diff | 7 +- ...otCountedAsChild(jsx=react-jsxdev).js.diff | 8 +- .../jsxExcessPropsAndAssignability.js | 15 +- .../jsxExcessPropsAndAssignability.js.diff | 11 - ...ragmentAndFactoryUsedOnFragmentUse.js.diff | 9 - .../jsxFragmentFactoryNoUnusedLocals.js.diff | 11 - .../compiler/jsxHasLiteralType.js.diff | 11 - ...portForSideEffectsNonExtantNoError.js.diff | 10 - .../compiler/jsxImportInAttribute.js.diff | 10 - .../jsxImportSourceNonPragmaComment.js.diff | 11 - ...InferenceProducesLiteralAsExpected.js.diff | 7 +- .../jsxIntrinsicElementsCompatability.js.diff | 11 - ...ntrinsicElementsTypeArgumentErrors.js.diff | 11 - .../compiler/jsxIntrinsicUnions.js.diff | 10 - ...rrorWhenTagExpectsTooManyArguments.js.diff | 11 - ...IgnoredWhenReactJsx(jsx=react-jsx).js.diff | 6 +- ...oredWhenReactJsx(jsx=react-jsxdev).js.diff | 7 +- .../jsxNamespaceGlobalReexport.js.diff | 6 +- ...ceGlobalReexportMissingAliasTarget.js.diff | 6 +- ...amespaceImplicitImportJSXNamespace.js.diff | 6 +- ...PickedOverGlobalOne(jsx=react-jsx).js.diff | 6 +- ...spaceFromPragmaPickedOverGlobalOne.js.diff | 7 +- ...enAttributeReactJsx(jsx=react-jsx).js.diff | 6 +- ...ttributeReactJsx(jsx=react-jsxdev).js.diff | 7 +- .../compiler/jsxNamespacePrefixInNameReact.js | 15 +- .../compiler/jsxNamespaceReexports.js.diff | 9 - .../compiler/jsxPartialSpread.js.diff | 11 - .../jsxRuntimePragma(jsx=preserve).js.diff | 20 - .../jsxRuntimePragma(jsx=react).js.diff | 32 +- .../jsxRuntimePragma(jsx=react-jsx).js.diff | 32 +- ...jsxRuntimePragma(jsx=react-jsxdev).js.diff | 29 +- .../compiler/jsxSpreadFirstUnionNoErrors.js | 13 +- .../jsxSpreadFirstUnionNoErrors.js.diff | 11 - .../submodule/compiler/jsxViaImport.2.js.diff | 11 - .../submodule/compiler/jsxViaImport.js.diff | 11 - .../keyofModuleObjectHasCorrectKeys.js.diff | 9 - ...teralTypeNameAssertionNotTriggered.js.diff | 15 - .../localAliasExportAssignment.js.diff | 9 - ...InstantiationPreservesHomomorphism.js.diff | 10 - .../mergeSymbolRexportFunction.js.diff | 9 - .../compiler/mergedDeclarations7.js.diff | 9 - .../compiler/metadataImportType.js.diff | 19 +- .../compiler/metadataOfClassFromAlias.js.diff | 21 +- .../metadataOfClassFromAlias2.js.diff | 19 +- .../metadataOfClassFromModule.js.diff | 20 +- .../compiler/metadataOfEventAlias.js.diff | 19 +- .../compiler/metadataOfStringLiteral.js.diff | 17 +- .../compiler/metadataOfUnion.js.diff | 77 +- .../compiler/metadataOfUnionWithNull.js.diff | 105 +- ...adataReferencedWithinFilteredUnion.js.diff | 29 +- .../missingMemberErrorHasShortPath.js.diff | 9 - ...moduleAugmentationDeclarationEmit1.js.diff | 11 - ...moduleAugmentationDeclarationEmit2.js.diff | 17 - ...onDoesNamespaceEnumMergeOfReexport.js.diff | 10 - ...leAugmentationExtendAmbientModule1.js.diff | 11 - ...leAugmentationExtendAmbientModule2.js.diff | 18 - ...oduleAugmentationExtendFileModule1.js.diff | 11 - ...oduleAugmentationExtendFileModule2.js.diff | 17 - ...duleAugmentationImportsAndExports1.js.diff | 9 +- ...duleAugmentationImportsAndExports2.js.diff | 9 +- ...duleAugmentationImportsAndExports3.js.diff | 9 +- ...duleAugmentationImportsAndExports4.js.diff | 9 +- ...duleAugmentationImportsAndExports5.js.diff | 9 +- ...duleAugmentationImportsAndExports6.js.diff | 9 +- .../moduleAugmentationNoNewNames.js.diff | 11 - ...eNodeImportRequireEmit(target=es5).js.diff | 13 - .../compiler/moduleNoneErrors.errors.txt.diff | 5 +- ...=commonjs,moduleresolution=node16).js.diff | 9 - ...ommonjs,moduleresolution=nodenext).js.diff | 9 - .../moduleResolutionWithSymlinks.js.diff | 10 +- ...utionWithSymlinks_notInNodeModules.js.diff | 7 +- ...utionWithSymlinks_preserveSymlinks.js.diff | 13 - ...eResolutionWithSymlinks_withOutDir.js.diff | 10 +- ...odule_augmentUninstantiatedModule2.js.diff | 10 - .../compiler/multiImportExport.js.diff | 19 - .../namedImportNonExistentName.js.diff | 12 - ...rgedWithFunctionWithOverloadsUsage.js.diff | 9 - .../compiler/narrowedImports.js.diff | 15 - .../narrowedImports_assumeInitialized.js.diff | 9 - .../compiler/newAbstractInstance2.js.diff | 9 - .../compiler/noCrashOnImportShadowing.js.diff | 23 - .../submodule/compiler/noEmitHelpers2.js.diff | 23 +- ...entationInDeclarationFile2.errors.txt.diff | 5 +- ...entationInDeclarationFile3.errors.txt.diff | 5 +- .../nodeColonModuleResolution.js.diff | 9 - .../nodeColonModuleResolution2.js.diff | 9 - .../nodeModuleReexportFromDottedPath.js.diff | 10 - .../objectInstantiationFromUnionSpread.js | 15 +- .../objectLiteralFreshnessWithSpread.js | 13 +- ...preadWithinMethodWithinObjectWithSpread.js | 15 +- ...nalParamReferencingOtherParams2.errors.txt | 4 +- ...tionalParamReferencingOtherParams2.symbols | 1 - ...optionalParamReferencingOtherParams2.types | 8 +- .../parameterDecoratorsEmitCrash.js.diff | 37 +- ...MappingBasedModuleResolution6_node.js.diff | 6 +- .../privacyCannotNameAccessorDeclFile.js.diff | 22 +- .../privacyCannotNameVarTypeDeclFile.js.diff | 110 +- ...ionCannotNameParameterTypeDeclFile.js.diff | 20 +- ...nctionCannotNameReturnTypeDeclFile.js.diff | 22 +- .../compiler/privacyImportParseErrors.js.diff | 22 +- ...tExternalModuleImportWithoutExport.js.diff | 15 +- ...teFieldAssignabilityFromUnknown.errors.txt | 5 +- ...ldAssignabilityFromUnknown.errors.txt.diff | 5 +- .../propTypeValidatorInference.js.diff | 11 - .../compiler/propertyAccessibility2.js.diff | 14 +- ...kIntersectionCheckCorrectlyCachesErrors.js | 13 +- .../compiler/quotedPropertyName2.js.diff | 14 +- .../compiler/reExportUndefined2.js.diff | 9 - .../reactDefaultPropsInferenceSuccess.js.diff | 88 +- .../submodule/compiler/reactHOCSpreadprops.js | 13 +- .../compiler/reactHOCSpreadprops.js.diff | 11 - ...tUnusedInNewJSXEmit(jsx=react-jsx).js.diff | 7 +- ...usedInNewJSXEmit(jsx=react-jsxdev).js.diff | 8 +- .../reactNamespaceImportPresevation.js.diff | 9 - .../compiler/reactNamespaceJSXEmit.js | 17 +- .../reactReadonlyHOCAssignabilityReal.js | 13 +- .../reactReadonlyHOCAssignabilityReal.js.diff | 11 - .../reactSFCAndFunctionResolvable.js.diff | 11 - .../reactTagNameComponentWithPropsNoOOM.js | 13 +- ...eactTagNameComponentWithPropsNoOOM.js.diff | 11 - .../reactTagNameComponentWithPropsNoOOM2.js | 13 +- ...actTagNameComponentWithPropsNoOOM2.js.diff | 11 - ...ransitiveImportHasValidDeclaration.js.diff | 10 - .../compiler/reassignStaticProp.js.diff | 14 +- ...xportAssignmentAndFindAliasedType4.js.diff | 11 - ...xportAssignmentAndFindAliasedType5.js.diff | 16 - ...xportAssignmentAndFindAliasedType6.js.diff | 21 - ...xportAssignmentAndFindAliasedType7.js.diff | 21 - .../reexportDefaultIsCallable.js.diff | 11 - .../compiler/reexportedMissingAlias.js.diff | 10 - ...renceTypesPreferedToPathIfPossible.js.diff | 10 - ...ketInCharClass(target=es5).errors.txt.diff | 5 +- ...essionScanning(target=es5).errors.txt.diff | 23 +- ...ValueExpressionSuggestions.errors.txt.diff | 5 +- .../requireAsFunctionInExternalModule.js.diff | 18 - .../compiler/requireOfJsonFile.js.diff | 14 - .../requireOfJsonFileNonRelative.js.diff | 14 - ...lativeWithoutExtensionResolvesToTs.js.diff | 9 - .../compiler/requireOfJsonFileTypes.js.diff | 21 - ...nFileWithAlwaysStrictWithoutErrors.js.diff | 14 - ...OfJsonFileWithComputedPropertyName.js.diff | 14 - .../requireOfJsonFileWithDeclaration.js.diff | 14 - .../requireOfJsonFileWithEmptyObject.js.diff | 14 - ...fJsonFileWithEmptyObjectWithErrors.js.diff | 14 - .../requireOfJsonFileWithErrors.js.diff | 14 - ...JsonFileWithModuleEmitNone.errors.txt.diff | 5 +- ...duleNodeResolutionEmitNone.errors.txt.diff | 5 +- .../requireOfJsonFileWithNoContent.js.diff | 14 - .../requireOfJsonFileWithSourceMap.js.diff | 14 - ...requireOfJsonFileWithSourceMap.js.map.diff | 2 +- ...OfJsonFileWithSourceMap.sourcemap.txt.diff | 39 +- ...equireOfJsonFileWithTraillingComma.js.diff | 14 - .../requireOfJsonFileWithoutAllowJs.js.diff | 14 - .../requireOfJsonFileWithoutExtension.js.diff | 14 - ...onFileWithoutExtensionResolvesToTs.js.diff | 14 - .../requireOfJsonFileWithoutOutDir.js.diff | 14 - ...OfJsonFileWithoutResolveJsonModule.js.diff | 14 - ...cateIsInstantiateInContextOfTarget.js.diff | 36 +- ...reverseMappedTypeIntersectionConstraint.js | 13 +- ...seMappedTypeIntersectionConstraint.js.diff | 6 +- .../submodule/compiler/satisfiesEmit.js.diff | 9 - .../scopeCheckStaticInitializer.js.diff | 42 +- ...fReferentialDefaultNoStackOverflow.js.diff | 11 - .../compiler/shebangBeforeReferences.js.diff | 9 - .../sourceMap-FileWithComments.js.diff | 35 +- .../sourceMap-FileWithComments.js.map.diff | 4 +- ...rceMap-FileWithComments.sourcemap.txt.diff | 645 +++---- .../sourceMapValidationDecorators.js.diff | 114 +- .../sourceMapValidationDecorators.js.map.diff | 4 +- ...MapValidationDecorators.sourcemap.txt.diff | 1694 ++++++++--------- .../spellingSuggestionJSXAttribute.js.diff | 11 - .../spreadExpressionContextualType.js | 15 +- .../spreadExpressionContextualType.js.diff | 4 +- ...adExpressionContextualTypeWithNamespace.js | 13 +- ...ressionContextualTypeWithNamespace.js.diff | 11 - .../compiler/spreadIdenticalTypesRemoved.js | 15 +- .../spreadIdenticalTypesRemoved.js.diff | 6 +- .../submodule/compiler/spreadIntersection.js | 15 +- .../compiler/spreadIntersectionJsx.js | 13 +- .../compiler/spreadIntersectionJsx.js.diff | 6 +- .../compiler/spreadInvalidArgumentType.js | 49 +- ...tions(exactoptionalpropertytypes=false).js | 41 +- ...(exactoptionalpropertytypes=false).js.diff | 6 +- ...ations(exactoptionalpropertytypes=true).js | 41 +- ...s(exactoptionalpropertytypes=true).js.diff | 6 +- ...ithIndexDoesNotAddUndefinedToLocalIndex.js | 13 +- ...dexDoesNotAddUndefinedToLocalIndex.js.diff | 4 +- ...ObjectLiteralAssignableToIndexSignature.js | 23 +- ...tLiteralAssignableToIndexSignature.js.diff | 6 +- .../compiler/spreadTypeRemovesReadonly.js | 13 +- .../stackDepthLimitCastingType.js.diff | 10 - ...ousTypeNotReferencingTypeParameter.js.diff | 14 +- .../compiler/staticClassProps.js.diff | 19 +- .../staticFieldWithInterfaceContext.js.diff | 4 +- .../staticInstanceResolution3.js.diff | 9 - .../staticMemberAccessOffDerivedType1.js.diff | 14 +- ...aticMemberWithStringAndNumberNames.js.diff | 30 +- .../compiler/staticPropSuper.js.diff | 23 +- .../submodule/compiler/statics.js.diff | 45 +- .../staticsInConstructorBodies.js.diff | 22 +- .../staticsNotInScopeInClodule.js.diff | 14 +- .../compiler/strictModeInConstructor.js.diff | 81 +- .../compiler/strictOptionalProperties1.js | 15 +- .../strictOptionalProperties1.js.diff | 6 +- .../submodule/compiler/superAccess.errors.txt | 8 +- .../submodule/compiler/superAccess.js.diff | 20 +- .../submodule/compiler/superAccess2.js.diff | 57 +- .../compiler/superInLambdas.errors.txt | 8 +- .../superInObjectLiterals_ES5.errors.txt | 20 +- .../compiler/superPropertyAccess.errors.txt | 20 +- .../compiler/superPropertyAccess1.errors.txt | 39 - .../compiler/superPropertyAccess2.errors.txt | 5 +- .../superPropertyAccess_ES5.errors.txt | 37 - ...ect-literal-getters-and-setters.errors.txt | 11 +- ...mbolLinkDeclarationEmitModuleNames.js.diff | 10 +- ...eclarationEmitModuleNamesImportRef.js.diff | 11 - ...kDeclarationEmitModuleNamesRootDir.js.diff | 10 - ...DirectLinkGeneratesNonrelativeName.js.diff | 8 +- ...nkOptionalGeneratesNonrelativeName.js.diff | 8 +- ...ctLinkPeerGeneratesNonrelativeName.js.diff | 8 +- ...aggedTemplateStringsWithCurriedFunction.js | 21 +- ...plateWithoutDeclaredHelper.errors.txt.diff | 19 - ...s6DecoratorMetadataImportNotElided.js.diff | 26 +- ...mplateLiteralsAndDecoratorMetadata.js.diff | 23 +- ...nArrowFunctionInStaticInitializer1.js.diff | 26 +- .../thisInConstructorParameter2.js.diff | 32 +- .../compiler/thisInOuterClassBody.js.diff | 45 +- .../thisInPropertyBoundDeclarations.js.diff | 35 +- .../compiler/thisInStaticMethod1.js.diff | 20 +- ...ormNestedGeneratorsWithTry.errors.txt.diff | 39 - .../transformNestedGeneratorsWithTry.js.diff | 3 +- ...rivialSubtypeReductionNoStructuralCheck.js | 13 +- ...ivialSubtypeReductionNoStructuralCheck2.js | 13 +- ...tsxDeepAttributeAssignabilityError.js.diff | 22 - .../compiler/tsxDefaultImports.js.diff | 23 +- .../compiler/tsxFragmentChildrenCheck.js.diff | 13 - .../compiler/tsxInvokeComponentType.js.diff | 11 - .../compiler/tsxNoTypeAnnotatedSFC.js.diff | 11 - .../compiler/tsxNotUsingApparentTypeOfSFC.js | 15 +- .../tsxNotUsingApparentTypeOfSFC.js.diff | 11 - ...ctPropsInferenceSucceedsOnIntersections.js | 13 +- ...psInferenceSucceedsOnIntersections.js.diff | 9 - .../tsxSpreadDoesNotReportExcessProps.js | 13 +- .../tsxSpreadDoesNotReportExcessProps.js.diff | 11 - .../tsxStatelessComponentDefaultProps.js.diff | 11 - ...sxUnionMemberChecksFilterDataProps.js.diff | 10 - ...ionWithUndefinedCallResolutionData.js.diff | 10 - .../compiler/typeOfPrototype.js.diff | 18 +- .../compiler/typeReferenceDirectives8.js.diff | 10 - .../compiler/typeReferenceDirectives9.js.diff | 17 +- ...FromMultipleNodeModulesDirectories.js.diff | 13 - ...tsFromNodeModulesInParentDirectory.js.diff | 9 - .../typeofAmbientExternalModules.js.diff | 13 +- .../compiler/typeofExternalModules.js.diff | 13 - .../typeofUsedBeforeBlockScoped.js.diff | 14 +- .../compiler/undeclaredModuleError.js.diff | 11 - ...odeEscapesInNames01(target=es5).errors.txt | 134 -- .../unionExcessPropsWithPartialMember.js | 13 +- .../unionExcessPropsWithPartialMember.js.diff | 4 +- ...niqueSymbolPropertyDeclarationEmit.js.diff | 13 - .../unqualifiedCallToClassStatic1.js.diff | 23 +- ...arations(preserveconstenums=false).js.diff | 16 +- ...larations(preserveconstenums=true).js.diff | 16 +- .../compiler/unusedImports11.js.diff | 17 - .../compiler/unusedImports13.js.diff | 9 - .../compiler/unusedImports14.js.diff | 9 - .../compiler/unusedImports15.js.diff | 9 - .../compiler/unusedImports16.js.diff | 9 - .../submodule/compiler/unusedImports2.js.diff | 10 - .../submodule/compiler/unusedImports3.js.diff | 10 - .../submodule/compiler/unusedImports4.js.diff | 11 - .../submodule/compiler/unusedImports5.js.diff | 11 - .../submodule/compiler/unusedImports8.js.diff | 11 - ...sedImports_entireImportDeclaration.js.diff | 15 - .../unusedInvalidTypeArguments.js.diff | 26 - .../voidAsNonAmbiguousReturnType.js.diff | 11 - ...riableAndExportedVarThatShareAName.js.diff | 43 +- ...bleAndNonExportedVarThatShareAName.js.diff | 43 +- .../ambientDeclarationsExternal.js.diff | 10 - .../ambientDeclarationsPatterns.js.diff | 16 - .../conformance/ambientShorthand.js.diff | 13 - .../ambientShorthand_reExport.js.diff | 12 +- .../arraySpreadImportHelpers.errors.txt.diff | 20 - .../submodule/conformance/asOperator4.js.diff | 11 - .../conformance/assignmentToVoidZero2.js.diff | 8 +- .../asyncAliasReturnType_es5.errors.txt.diff | 14 - ...ctionCapturesArguments_es5.errors.txt.diff | 17 - .../asyncAwaitIsolatedModules_es5.js.diff | 15 +- .../asyncAwaitNestedClasses_es5.js.diff | 42 +- .../conformance/asyncAwait_es5.js.diff | 14 +- ...cFunctionDeclaration15_es5.errors.txt.diff | 53 - .../asyncFunctionDeclaration15_es5.js.diff | 2 +- ...ationCapturesArguments_es5.errors.txt.diff | 19 - .../asyncImportedPromise_es5.errors.txt.diff | 17 - .../asyncImportedPromise_es5.js.diff | 3 +- .../asyncMethodWithSuper_es5.js.diff | 38 +- ...yncQualifiedReturnType_es5.errors.txt.diff | 17 - .../asyncQualifiedReturnType_es5.js.diff | 2 +- .../autoAccessor1(target=es5).errors.txt | 22 - .../conformance/autoAccessor1(target=es5).js | 3 - .../autoAccessor1(target=es5).js.diff | 43 +- .../autoAccessor3(target=es5).errors.txt | 22 - .../conformance/autoAccessor3(target=es5).js | 3 - .../autoAccessor3(target=es5).js.diff | 43 +- .../autoAccessor4(target=es5).errors.txt | 22 - .../conformance/autoAccessor4(target=es5).js | 3 - .../autoAccessor4(target=es5).js.diff | 43 +- .../autoAccessor5(target=es5).errors.txt | 14 +- .../autoAccessor5(target=es5).js.diff | 46 +- .../conformance/bundlerCommonJS.js.diff | 17 - .../submodule/conformance/chained2.js.diff | 20 +- .../checkJsxChildrenCanBeTupleType.js.diff | 11 - .../checkJsxChildrenProperty1.js.diff | 11 - .../checkJsxChildrenProperty12.js.diff | 11 - .../checkJsxChildrenProperty13.js.diff | 11 - .../checkJsxChildrenProperty14.js.diff | 11 - .../checkJsxChildrenProperty15.js.diff | 11 - .../checkJsxChildrenProperty2.js.diff | 11 - .../checkJsxChildrenProperty3.js.diff | 11 - .../checkJsxChildrenProperty4.js.diff | 11 - .../checkJsxChildrenProperty5.js.diff | 11 - .../checkJsxChildrenProperty6.js.diff | 11 - .../checkJsxChildrenProperty7.js.diff | 11 - .../checkJsxChildrenProperty8.js.diff | 11 - .../checkJsxChildrenProperty9.js.diff | 11 - ...kJsxGenericTagHasCorrectInferences.js.diff | 11 - ...ckJsxSubtleSkipContextSensitiveBug.js.diff | 3 +- ...SFXContextualTypeInferredCorrectly.js.diff | 11 - .../conformance/circularReference.js.diff | 12 +- .../classStaticBlock5(target=es5).errors.txt | 28 - .../classStaticBlock5(target=es5).js.diff | 37 +- .../classStaticBlock6.errors.txt.diff | 27 - .../conformance/classStaticBlock6.js.diff | 98 +- .../classStaticBlock9(target=es5).js.diff | 23 +- .../classWithPrivateProperty.js.diff | 28 +- .../classWithProtectedProperty.js.diff | 28 +- .../classWithPublicProperty.js.diff | 28 +- ...arameterBindingPattern(target=es5).js.diff | 6 +- ...InParameterInitializer(target=es5).js.diff | 4 +- .../commentEmittingInPreserveJsx1.js.diff | 9 +- .../commonJSImportAsPrimaryExpression.js.diff | 25 +- ...mmonJSImportNotAsPrimaryExpression.js.diff | 21 +- .../computedPropertyNames12_ES5.js.diff | 28 +- .../constructableDecoratorOnClass01.js.diff | 13 +- ...pedStringLiteralsInJsxAttributes02.js.diff | 11 - ...sonImport(resolvejsonmodule=false).js.diff | 9 - ...JsonImport(resolvejsonmodule=true).js.diff | 9 - .../decoratedBlockScopedClass1.js.diff | 23 +- .../decoratedBlockScopedClass2.js.diff | 23 +- .../decoratedBlockScopedClass3.js.diff | 45 +- .../conformance/decoratorCallGeneric.js.diff | 16 +- .../decoratorChecksFunctionBodies.js.diff | 31 +- ...InstantiateModulesInFunctionBodies.js.diff | 27 +- .../decoratorMetadata-jsdoc.js.diff | 33 +- .../conformance/decoratorMetadata.js.diff | 44 +- ...ecoratorMetadataWithTypeOnlyImport.js.diff | 42 +- ...coratorMetadataWithTypeOnlyImport2.js.diff | 19 +- .../conformance/decoratorOnClass1.js.diff | 13 +- .../conformance/decoratorOnClass2.js.diff | 15 +- .../conformance/decoratorOnClass3.js.diff | 15 +- .../conformance/decoratorOnClass4.js.diff | 13 +- .../conformance/decoratorOnClass5.js.diff | 13 +- .../conformance/decoratorOnClass8.js.diff | 13 +- .../conformance/decoratorOnClass9.js.diff | 27 +- .../decoratorOnClassAccessor1.js.diff | 18 +- .../decoratorOnClassAccessor2.js.diff | 18 +- .../decoratorOnClassAccessor3.js.diff | 18 +- .../decoratorOnClassAccessor4.js.diff | 18 +- .../decoratorOnClassAccessor5.js.diff | 18 +- .../decoratorOnClassAccessor6.js.diff | 18 +- .../decoratorOnClassAccessor7.js.diff | 126 +- .../decoratorOnClassAccessor8.js.diff | 144 +- .../decoratorOnClassConstructor2.js.diff | 30 +- .../decoratorOnClassConstructor3.js.diff | 30 +- .../decoratorOnClassConstructor4.js.diff | 44 +- ...oratorOnClassConstructorParameter1.js.diff | 16 +- ...oratorOnClassConstructorParameter4.js.diff | 16 +- .../decoratorOnClassMethod1.js.diff | 18 +- .../decoratorOnClassMethod10.js.diff | 18 +- .../decoratorOnClassMethod11.js.diff | 21 +- .../decoratorOnClassMethod12.js.diff | 18 +- .../decoratorOnClassMethod2.js.diff | 18 +- .../decoratorOnClassMethod3.js.diff | 18 +- .../decoratorOnClassMethod8.js.diff | 18 +- .../decoratorOnClassMethodOverload2.js.diff | 18 +- .../decoratorOnClassMethodParameter1.js.diff | 18 +- .../decoratorOnClassMethodParameter2.js.diff | 18 +- ...ecoratorOnClassMethodThisParameter.js.diff | 18 +- .../decoratorOnClassProperty1.js.diff | 15 +- .../decoratorOnClassProperty10.js.diff | 15 +- .../decoratorOnClassProperty11.js.diff | 15 +- .../decoratorOnClassProperty12.js.diff | 17 +- .../decoratorOnClassProperty2.js.diff | 15 +- .../decoratorOnClassProperty3.js.diff | 15 +- .../decoratorOnClassProperty6.js.diff | 15 +- .../decoratorOnClassProperty7.js.diff | 15 +- .../defaultExportsCannotMerge01.js.diff | 11 - .../defaultExportsCannotMerge02.js.diff | 11 - .../defaultExportsCannotMerge03.js.diff | 11 - .../derivedClassSuperProperties.js.diff | 52 +- .../conformance/destructuringSpread.js | 19 +- ...rowFunctionWhenUsingArguments01.errors.txt | 40 + ...nctionWhenUsingArguments01.errors.txt.diff | 50 - ...tArrowFunctionWhenUsingArguments01.symbols | 2 - ...mitArrowFunctionWhenUsingArguments01.types | 4 +- ...rowFunctionWhenUsingArguments02.errors.txt | 7 + ...nctionWhenUsingArguments02.errors.txt.diff | 11 - ...tArrowFunctionWhenUsingArguments02.symbols | 1 - ...mitArrowFunctionWhenUsingArguments02.types | 6 +- ...nctionWhenUsingArguments03.errors.txt.diff | 12 - ...tArrowFunctionWhenUsingArguments03.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments03.types | 6 +- ...nctionWhenUsingArguments04.errors.txt.diff | 14 - ...tArrowFunctionWhenUsingArguments04.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments04.types | 6 +- ...nctionWhenUsingArguments05.errors.txt.diff | 13 - ...tArrowFunctionWhenUsingArguments05.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments05.types | 6 +- ...nctionWhenUsingArguments06.errors.txt.diff | 13 - ...tArrowFunctionWhenUsingArguments06.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments06.types | 8 +- ...nctionWhenUsingArguments07.errors.txt.diff | 13 - ...tArrowFunctionWhenUsingArguments07.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments07.types | 8 +- ...nctionWhenUsingArguments09.errors.txt.diff | 13 - ...nctionWhenUsingArguments10.errors.txt.diff | 14 - ...nctionWhenUsingArguments11.errors.txt.diff | 14 - ...tArrowFunctionWhenUsingArguments11.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments11.types | 8 +- ...nctionWhenUsingArguments12.errors.txt.diff | 20 - ...tArrowFunctionWhenUsingArguments12.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments12.types | 6 +- ...nctionWhenUsingArguments14.errors.txt.diff | 16 - ...tArrowFunctionWhenUsingArguments14.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments14.types | 6 +- ...nctionWhenUsingArguments15.errors.txt.diff | 17 - ...tArrowFunctionWhenUsingArguments15.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments15.types | 6 +- ...nctionWhenUsingArguments16.errors.txt.diff | 17 - ...tArrowFunctionWhenUsingArguments16.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments16.types | 8 +- ...nctionWhenUsingArguments17.errors.txt.diff | 17 - ...tArrowFunctionWhenUsingArguments17.symbols | 2 +- ...mitArrowFunctionWhenUsingArguments17.types | 8 +- ...nctionWhenUsingArguments18.errors.txt.diff | 16 - ...nctionWhenUsingArguments19.errors.txt.diff | 23 - ...r.asyncGenerators.classMethods.es5.js.diff | 5 +- .../conformance/errorSuperCalls.js.diff | 95 +- .../errorSuperPropertyAccess.errors.txt | 55 +- .../errorSuperPropertyAccess.js.diff | 34 +- .../es6modulekindWithES5Target.js.diff | 45 +- .../es6modulekindWithES5Target11.js.diff | 30 +- .../es6modulekindWithES5Target2.js.diff | 19 +- .../es6modulekindWithES5Target3.js.diff | 26 +- ...on-accessors-nonStatic(target=es5).js.diff | 65 +- ...ation-accessors-static(target=es5).js.diff | 61 +- ...Declaration-classThisReference.es5.js.diff | 47 +- ...es5,usedefineforclassfields=false).js.diff | 65 +- ...=es5,usedefineforclassfields=true).js.diff | 95 +- ...es5,usedefineforclassfields=false).js.diff | 65 +- ...=es5,usedefineforclassfields=true).js.diff | 95 +- ...n-fields-staticAmbient(target=es5).js.diff | 13 - ...tion-methods-nonStatic(target=es5).js.diff | 47 +- ...aration-methods-static(target=es5).js.diff | 43 +- ...ion-multipleDecorators(target=es5).js.diff | 31 +- ...es5,usedefineforclassfields=false).js.diff | 37 +- ...=es5,usedefineforclassfields=true).js.diff | 47 +- ...ration-setFunctionName(target=es5).js.diff | 97 +- ...n-simpleTransformation(target=es5).js.diff | 31 +- ...-emitDecoratorMetadata(target=es5).js.diff | 103 +- .../esnextmodulekindWithES5Target.js.diff | 45 +- .../esnextmodulekindWithES5Target11.js.diff | 30 +- .../esnextmodulekindWithES5Target2.js.diff | 19 +- .../esnextmodulekindWithES5Target3.js.diff | 26 +- .../conformance/exportAndImport-es5.js.diff | 11 - ...xportAsNamespace1(module=commonjs).js.diff | 10 - ...xportAsNamespace2(module=commonjs).js.diff | 10 - ...xportAsNamespace3(module=commonjs).js.diff | 10 - ...xportAsNamespace4(module=commonjs).js.diff | 22 - ...portAsNamespace_missingEmitHelpers.js.diff | 9 - .../exportAssignDottedName.js.diff | 9 - .../exportAssignImportedIdentifier.js.diff | 16 - .../conformance/exportAssignTypes.js.diff | 27 - ...rtAssignmentConstrainedGenericType.js.diff | 10 +- .../exportAssignmentGenericType.js.diff | 8 +- .../exportAssignmentMergedModule.js.diff | 11 - .../conformance/exportDeclaredModule.js.diff | 9 - .../conformance/exportDefault.js.diff | 29 - .../conformance/exportNamespace11.js.diff | 9 - .../conformance/exportNamespace12.js.diff | 10 - .../conformance/exportNamespace3.js.diff | 9 - .../conformance/exportNamespace5.js.diff | 17 +- .../conformance/exportNamespace7.js.diff | 11 - .../conformance/exportNamespace8.js.diff | 11 - .../conformance/exportNamespace9.js.diff | 18 - .../conformance/exportNamespace_js.js.diff | 8 +- .../submodule/conformance/exportStar.js.diff | 11 - ...ypeMergedWithExportStarAsNamespace.js.diff | 9 - .../conformance/exportsAndImports1.js.diff | 9 - .../conformance/exportsAndImports2.js.diff | 9 +- .../conformance/exportsAndImports3.js.diff | 9 - .../conformance/exportsAndImports4.js.diff | 33 - ...mportsWithContextualKeywordNames02.js.diff | 11 - .../exportsAndImportsWithUnderscores1.js.diff | 9 - .../exportsAndImportsWithUnderscores2.js.diff | 9 - .../exportsAndImportsWithUnderscores3.js.diff | 9 - .../exportsAndImportsWithUnderscores4.js.diff | 11 - .../extendClassExpressionFromModule.js.diff | 11 - .../functionImplementationErrors.errors.txt | 5 +- .../functionImplementationErrors.symbols | 2 +- .../functionImplementationErrors.types | 6 +- .../generatedContextualTyping.js.diff | 401 ++-- .../importCallExpressionAsyncES5CJS.js.diff | 10 +- .../importCallExpressionES5CJS.js.diff | 32 - .../importCallExpressionNestedCJS2.js.diff | 2 +- ...allExpressionNoModuleKindSpecified.js.diff | 7 +- .../importElisionConstEnumMerge1.js.diff | 9 - .../conformance/importEquals1.js.diff | 11 - .../conformance/importEquals2.js.diff | 15 - .../conformance/importEquals3.js.diff | 6 +- .../importEqualsDeclaration.js.diff | 11 +- .../importNonExternalModule.js.diff | 11 - .../conformance/importTsBeforeDTs.js.diff | 10 - .../importsImplicitlyReadonly.js.diff | 15 - .../inlineJsxAndJsxFragPragma.js.diff | 63 - ...FragPragmaOverridesCompilerOptions.js.diff | 39 - .../inlineJsxFactoryDeclarations.js.diff | 45 - ...neJsxFactoryDeclarationsLocalTypes.js.diff | 24 +- ...eJsxFactoryLocalTypeGlobalFallback.js.diff | 21 - ...eJsxFactoryOverridesCompilerOption.js.diff | 15 - ...nlineJsxFactoryWithFragmentIsError.js.diff | 18 - .../instantiationExpressionErrors.js.diff | 13 +- .../conformance/intraExpressionInferences.js | 13 +- .../intraExpressionInferences.js.diff | 6 +- .../conformance/invalidNewTarget.es5.js.diff | 42 +- ...dSyntaxNamespaceImportWithCommonjs.js.diff | 10 - .../conformance/jsDeclarationsClasses.js.diff | 146 +- .../jsDeclarationsComputedNames.js.diff | 40 +- .../conformance/jsDeclarationsDefault.js.diff | 9 +- .../jsDeclarationsDefaultsErr.js.diff | 20 +- ...ationsExportAssignedClassInstance2.js.diff | 18 +- ...ationsExportAssignedClassInstance3.js.diff | 17 +- .../jsDeclarationsExportForms.js.diff | 39 +- .../jsDeclarationsExportFormsErr.js.diff | 17 +- .../jsDeclarationsFunctionLikeClasses.js.diff | 11 +- ...jsDeclarationsFunctionLikeClasses2.js.diff | 11 +- .../jsDeclarationsReactComponents.js.diff | 51 +- .../jsDeclarationsReexportAliases.js.diff | 9 +- .../jsxCheckJsxNoTypeArgumentsAllowed.js.diff | 10 +- ...jsTransformChildren(jsx=react-jsx).js.diff | 7 +- ...ransformChildren(jsx=react-jsxdev).js.diff | 8 +- ...ansformCustomImport(jsx=react-jsx).js.diff | 7 +- ...formCustomImport(jsx=react-jsxdev).js.diff | 8 +- ...mCustomImportPragma(jsx=react-jsx).js.diff | 11 +- ...stomImportPragma(jsx=react-jsxdev).js.diff | 11 +- ...xJsxsCjsTransformKeyProp(jsx=react-jsx).js | 4 +- ...CjsTransformKeyProp(jsx=react-jsx).js.diff | 27 +- ...xsCjsTransformKeyProp(jsx=react-jsxdev).js | 4 +- ...TransformKeyProp(jsx=react-jsxdev).js.diff | 27 +- ...sformKeyPropCustomImport(jsx=react-jsx).js | 4 +- ...KeyPropCustomImport(jsx=react-jsx).js.diff | 27 +- ...rmKeyPropCustomImport(jsx=react-jsxdev).js | 4 +- ...PropCustomImport(jsx=react-jsxdev).js.diff | 27 +- ...eyPropCustomImportPragma(jsx=react-jsx).js | 8 +- ...pCustomImportPragma(jsx=react-jsx).js.diff | 51 +- ...ropCustomImportPragma(jsx=react-jsxdev).js | 8 +- ...stomImportPragma(jsx=react-jsxdev).js.diff | 51 +- ...tedSelfClosingChild(jsx=react-jsx).js.diff | 6 +- ...SelfClosingChild(jsx=react-jsxdev).js.diff | 7 +- ...ormSubstitutesNames(jsx=react-jsx).js.diff | 7 +- ...SubstitutesNames(jsx=react-jsxdev).js.diff | 8 +- ...itutesNamesFragment(jsx=react-jsx).js.diff | 7 +- ...tesNamesFragment(jsx=react-jsxdev).js.diff | 8 +- ...jsxSpreadOverwritesAttributeStrict.js.diff | 11 - ...larationListInLoopNoCrash1.errors.txt.diff | 17 - ...larationListInLoopNoCrash2.errors.txt.diff | 16 - ...larationListInLoopNoCrash3.errors.txt.diff | 28 - ...larationListInLoopNoCrash4.errors.txt.diff | 26 - ...nNoCrash1(module=commonjs).errors.txt.diff | 22 - ...ionNoCrash1(module=esnext).errors.txt.diff | 22 - ...portsSpecifierGenerationConditions.js.diff | 2 +- .../conformance/literalTypeWidening.js | 13 +- .../conformance/missingDecoratorType.js.diff | 18 +- .../conformance/moduleScoping.js.diff | 11 - .../submodule/conformance/multiline.js.diff | 11 - .../multipleDefaultExports01.js.diff | 9 - .../multipleDefaultExports02.js.diff | 9 - .../nameDelimitedBySlashes.js.diff | 9 - .../conformance/nameWithFileExtension.js.diff | 9 - .../conformance/nameWithRelativePaths.js.diff | 15 - .../conformance/namespaceMemberAccess.js.diff | 10 +- .../conformance/newTarget.es5.js.diff | 26 +- ...tHelpersCollisions3(module=node16).js.diff | 9 +- ...tHelpersCollisions3(module=node18).js.diff | 9 +- ...tHelpersCollisions3(module=node20).js.diff | 9 +- ...elpersCollisions3(module=nodenext).js.diff | 9 +- ...tHelpersCollisions3(module=node16).js.diff | 7 +- ...tHelpersCollisions3(module=node18).js.diff | 7 +- ...tHelpersCollisions3(module=node20).js.diff | 7 +- ...elpersCollisions3(module=nodenext).js.diff | 7 +- ...arameterBindingPattern(target=es5).js.diff | 8 - ...InParameterInitializer(target=es5).js.diff | 8 - .../conformance/objectLiteralNormalization.js | 15 +- .../objectLiteralNormalization.js.diff | 8 +- .../submodule/conformance/objectSpread.js | 105 +- .../conformance/objectSpread.js.diff | 4 +- .../objectSpreadComputedProperty.js | 17 +- .../conformance/objectSpreadIndexSignature.js | 19 +- .../objectSpreadIndexSignature.js.diff | 6 +- .../conformance/objectSpreadNegative.js | 51 +- .../conformance/objectSpreadNegative.js.diff | 4 +- .../conformance/objectSpreadNegativeParse.js | 19 +- .../objectSpreadRepeatedComplexity.js | 13 +- .../objectSpreadRepeatedComplexity.js.diff | 6 +- .../objectSpreadRepeatedNullCheckPerf.js | 13 +- .../objectSpreadRepeatedNullCheckPerf.js.diff | 6 +- .../conformance/objectSpreadStrictNull.js | 31 +- ...arameterBindingPattern(target=es5).js.diff | 8 - ...InParameterInitializer(target=es5).js.diff | 8 - .../conformance/packageJsonMain.js.diff | 13 - ...rInitializersForwardReferencing.errors.txt | 13 +- ...eterInitializersForwardReferencing.symbols | 4 +- ...InitializersForwardReferencing1.errors.txt | 13 +- ...terInitializersForwardReferencing1.symbols | 6 +- ...meterInitializersForwardReferencing1.types | 26 +- .../parserAccessibilityAfterStatic3.js.diff | 14 +- .../conformance/parserAstSpans1.errors.txt | 8 +- ...Recovery_IncompleteMemberVariable1.js.diff | 35 +- ...Recovery_IncompleteMemberVariable2.js.diff | 35 +- .../conformance/parserharness.js.diff | 169 +- ...vateInstanceMemberAccessibility.errors.txt | 8 +- .../privateNameBadDeclaration.errors.txt | 8 +- .../conformance/privateNameES5Ban.errors.txt | 40 - .../conformance/privateNameES5Ban.js.diff | 21 +- .../privateNameInObjectLiteral-3.errors.txt | 5 +- .../privateNameJsBadDeclaration.errors.txt | 8 +- .../privateStaticMemberAccessibility.js.diff | 22 +- ...opertyAccessibleWithinSubclass3.errors.txt | 4 +- ...ctedInstanceMemberAccessibility.errors.txt | 4 +- ...opertyAccessibleWithinSubclass2.errors.txt | 30 - .../conformance/reExportDefaultExport.js.diff | 12 - .../conformance/reExportJsFromTs.js.diff | 9 +- .../readonlyArraysAndTuples2.js.diff | 31 +- .../reexportClassDefinition.js.diff | 18 - .../relativePathMustResolve.js.diff | 9 - .../spreadContextualTypedBindingPattern.js | 13 +- .../submodule/conformance/spreadDuplicate.js | 27 +- .../conformance/spreadDuplicate.js.diff | 4 +- .../conformance/spreadDuplicateExact.js | 27 +- .../conformance/spreadDuplicateExact.js.diff | 4 +- .../conformance/spreadExcessProperty.js | 13 +- .../conformance/spreadNonPrimitive.js | 13 +- .../conformance/spreadObjectOrFalsy.js | 25 +- .../conformance/spreadObjectOrFalsy.js.diff | 10 +- .../conformance/spreadOverwritesProperty.js | 21 +- .../spreadOverwritesPropertyStrict.js | 37 +- .../spreadOverwritesPropertyStrict.js.diff | 6 +- .../conformance/spreadTypeVariable.js | 23 +- .../submodule/conformance/spreadUnion.js | 17 +- .../submodule/conformance/spreadUnion2.js | 23 +- .../submodule/conformance/spreadUnion3.js | 19 +- .../submodule/conformance/spreadUnion4.js | 13 +- .../conformance/staticIndexSignature7.js.diff | 11 +- .../staticMemberInitialization.js.diff | 14 +- ...StaticMembers1(target=es5).errors.txt.diff | 634 ++++++ .../superInStaticMembers1(target=es5).js.diff | 661 +++---- .../thisAndSuperInStaticMembers3.js.diff | 150 +- .../thisAndSuperInStaticMembers4.js.diff | 40 +- .../conformance/thisTypeAccessibility.js.diff | 26 +- .../conformance/thisTypeErrors.js.diff | 17 +- .../conformance/topLevelAmbientModule.js.diff | 9 - .../conformance/topLevelFileModule.js.diff | 11 - .../topLevelFileModuleMissing.js.diff | 9 - .../topLevelModuleDeclarationAndFile.js.diff | 10 - .../tsxAttributeResolution15.js.diff | 8 +- .../tsxAttributeResolution16.js.diff | 11 - .../tsxDefaultAttributesResolution1.js.diff | 11 - .../tsxDefaultAttributesResolution2.js.diff | 11 - .../tsxDefaultAttributesResolution3.js.diff | 11 - .../conformance/tsxDynamicTagName5.js.diff | 7 +- .../conformance/tsxDynamicTagName7.js.diff | 7 +- .../conformance/tsxDynamicTagName8.js.diff | 7 +- .../conformance/tsxDynamicTagName9.js.diff | 7 +- .../tsxElementResolution19.js.diff | 11 - .../tsxExternalModuleEmit1.js.diff | 23 - .../conformance/tsxExternalModuleEmit2.js | 13 +- .../tsxExternalModuleEmit2.js.diff | 11 - .../tsxGenericAttributesType1.js.diff | 11 - .../tsxGenericAttributesType2.js.diff | 11 - .../tsxGenericAttributesType3.js.diff | 11 - .../tsxGenericAttributesType4.js.diff | 11 - .../tsxGenericAttributesType5.js.diff | 10 +- .../tsxGenericAttributesType6.js.diff | 10 +- .../tsxGenericAttributesType7.js.diff | 11 - .../tsxGenericAttributesType8.js.diff | 11 - .../tsxGenericAttributesType9.js.diff | 11 - .../tsxLibraryManagedAttributes.js.diff | 140 +- ...ComponentWithDefaultTypeParameter1.js.diff | 9 - ...ComponentWithDefaultTypeParameter2.js.diff | 10 - ...ComponentWithDefaultTypeParameter3.js.diff | 11 - .../submodule/conformance/tsxReactEmit2.js | 21 +- .../submodule/conformance/tsxReactEmit4.js | 13 +- .../submodule/conformance/tsxReactEmit5.js | 13 +- .../conformance/tsxReactEmit5.js.diff | 11 +- .../submodule/conformance/tsxReactEmit6.js | 13 +- .../conformance/tsxReactEmit6.js.diff | 6 +- ...SfcReturnUndefinedStrictNullChecks.js.diff | 11 - .../tsxSpreadAttributesResolution1.js.diff | 11 - .../tsxSpreadAttributesResolution10.js.diff | 11 - .../tsxSpreadAttributesResolution11.js.diff | 11 - .../tsxSpreadAttributesResolution12.js.diff | 11 - .../tsxSpreadAttributesResolution13.js.diff | 11 - .../tsxSpreadAttributesResolution14.js.diff | 11 - .../tsxSpreadAttributesResolution15.js.diff | 11 - .../tsxSpreadAttributesResolution16.js.diff | 11 - .../tsxSpreadAttributesResolution2.js.diff | 11 - .../tsxSpreadAttributesResolution3.js.diff | 11 - .../tsxSpreadAttributesResolution4.js.diff | 11 - .../tsxSpreadAttributesResolution5.js.diff | 11 +- .../tsxSpreadAttributesResolution6.js.diff | 11 - .../tsxSpreadAttributesResolution7.js.diff | 11 - .../tsxSpreadAttributesResolution8.js.diff | 11 - .../tsxSpreadAttributesResolution9.js.diff | 11 - ...ildrenInvalidType(jsx=react,target=es5).js | 13 +- ...enInvalidType(jsx=react-jsx,target=es5).js | 2 +- ...alidType(jsx=react-jsx,target=es5).js.diff | 23 +- ...tatelessFunctionComponentOverload4.js.diff | 11 - ...tatelessFunctionComponentOverload5.js.diff | 11 - ...tatelessFunctionComponentOverload6.js.diff | 11 - .../tsxStatelessFunctionComponents2.js.diff | 11 +- ...nctionComponentsWithTypeArguments4.js.diff | 11 - .../tsxTypeArgumentResolution.js.diff | 11 - .../tsxTypeArgumentsJsxPreserveOutput.js.diff | 10 +- .../conformance/tsxUnionElementType1.js.diff | 11 - .../conformance/tsxUnionElementType2.js.diff | 11 - .../conformance/tsxUnionElementType3.js.diff | 11 - .../conformance/tsxUnionElementType4.js.diff | 11 - .../conformance/tsxUnionElementType5.js.diff | 11 - .../conformance/tsxUnionElementType6.js.diff | 11 - .../tsxUnionTypeComponent1.js.diff | 11 - .../tsxUnionTypeComponent2.js.diff | 10 - .../typeAndNamespaceExportMerge.js.diff | 10 - ...isInStaticMembers10(target=es5).errors.txt | 8 +- ...fThisInStaticMembers10(target=es5).js.diff | 127 +- ...isInStaticMembers11(target=es5).errors.txt | 8 +- ...fThisInStaticMembers11(target=es5).js.diff | 267 ++- ...fThisInStaticMembers12(target=es5).js.diff | 33 +- ...fThisInStaticMembers13(target=es5).js.diff | 73 +- .../typeOfThisInStaticMembers2.js.diff | 29 +- ...hisInStaticMembers3(target=es5).errors.txt | 17 - ...OfThisInStaticMembers3(target=es5).js.diff | 32 +- ...hisInStaticMembers4(target=es5).errors.txt | 17 - ...OfThisInStaticMembers4(target=es5).js.diff | 82 +- ...OfThisInStaticMembers5(target=es5).js.diff | 21 +- .../typeOfThisInStaticMembers6.js.diff | 21 +- ...hisInStaticMembers7(target=es5).errors.txt | 17 - ...OfThisInStaticMembers7(target=es5).js.diff | 32 +- ...OfThisInStaticMembers8(target=es5).js.diff | 65 +- ...hisInStaticMembers9(target=es5).errors.txt | 5 +- ...OfThisInStaticMembers9(target=es5).js.diff | 61 +- .../conformance/typeOnlyMerge1.js.diff | 9 - .../conformance/typeQueryOnClass.js.diff | 82 +- .../typeofImportTypeOnlyExport.js.diff | 10 - ...OnlyExternalModuleStillHasInstance.js.diff | 11 - .../conformance/typingsLookup4.js.diff | 15 - .../conformance/umd-augmentation-1.js.diff | 11 - .../conformance/umd-augmentation-3.js.diff | 11 - .../submodule/conformance/umd3.js.diff | 11 - .../submodule/conformance/umd4.js.diff | 11 - .../submodule/conformance/umd5.js.diff | 11 - ...rExpressions01(target=es5).errors.txt.diff | 12 - ...rExpressions02(target=es5).errors.txt.diff | 12 - ...rExpressions03(target=es5).errors.txt.diff | 12 - ...rExpressions04(target=es5).errors.txt.diff | 12 - ...rExpressions05(target=es5).errors.txt.diff | 12 - ...rExpressions06(target=es5).errors.txt.diff | 14 - ...rExpressions07(target=es5).errors.txt.diff | 5 +- ...rExpressions08(target=es5).errors.txt.diff | 15 - ...rExpressions09(target=es5).errors.txt.diff | 15 - ...rExpressions10(target=es5).errors.txt.diff | 16 - ...rExpressions11(target=es5).errors.txt.diff | 16 - ...rExpressions12(target=es5).errors.txt.diff | 5 +- ...rExpressions13(target=es5).errors.txt.diff | 12 - ...rExpressions14(target=es5).errors.txt.diff | 5 +- ...rExpressions15(target=es5).errors.txt.diff | 12 - ...rExpressions16(target=es5).errors.txt.diff | 12 - ...rExpressions17(target=es5).errors.txt.diff | 5 +- ...rExpressions18(target=es5).errors.txt.diff | 12 - ...rExpressions19(target=es5).errors.txt.diff | 5 +- .../submodule/conformance/unknownType1.js | 19 +- .../conformance/unknownType1.js.diff | 6 +- .../conformance/untypedModuleImport.js.diff | 26 - .../untypedModuleImport_allowJs.js.diff | 9 - .../untypedModuleImport_vsAmbient.js.diff | 9 - ...typedModuleImport_withAugmentation.js.diff | 9 - ...tors.1(module=commonjs,target=es5).js.diff | 31 +- ...rators.1(module=esnext,target=es5).js.diff | 31 +- ...ors.10(module=commonjs,target=es5).js.diff | 41 +- ...ators.10(module=esnext,target=es5).js.diff | 34 +- ...ors.11(module=commonjs,target=es5).js.diff | 31 +- ...ators.11(module=esnext,target=es5).js.diff | 31 +- ...ors.12(module=commonjs,target=es5).js.diff | 31 +- ...ators.12(module=esnext,target=es5).js.diff | 31 +- ...tors.2(module=commonjs,target=es5).js.diff | 31 +- ...rators.2(module=esnext,target=es5).js.diff | 31 +- ...tors.3(module=commonjs,target=es5).js.diff | 34 +- ...rators.3(module=esnext,target=es5).js.diff | 34 +- ...tors.4(module=commonjs,target=es5).js.diff | 36 +- ...rators.4(module=esnext,target=es5).js.diff | 40 +- ...tors.5(module=commonjs,target=es5).js.diff | 31 +- ...rators.5(module=esnext,target=es5).js.diff | 31 +- ...tors.6(module=commonjs,target=es5).js.diff | 31 +- ...rators.6(module=esnext,target=es5).js.diff | 31 +- ...tors.7(module=commonjs,target=es5).js.diff | 31 +- ...rators.7(module=esnext,target=es5).js.diff | 31 +- ...tors.8(module=commonjs,target=es5).js.diff | 31 +- ...rators.8(module=esnext,target=es5).js.diff | 31 +- ...tors.9(module=commonjs,target=es5).js.diff | 31 +- ...rators.9(module=esnext,target=es5).js.diff | 31 +- ...tors.1(module=commonjs,target=es5).js.diff | 14 +- ...rators.1(module=esnext,target=es5).js.diff | 14 +- ...ors.10(module=commonjs,target=es5).js.diff | 13 +- ...ators.10(module=esnext,target=es5).js.diff | 13 +- ...ors.11(module=commonjs,target=es5).js.diff | 13 +- ...ators.11(module=esnext,target=es5).js.diff | 13 +- ...ors.12(module=commonjs,target=es5).js.diff | 13 +- ...ators.12(module=esnext,target=es5).js.diff | 13 +- ...tors.2(module=commonjs,target=es5).js.diff | 14 +- ...rators.2(module=esnext,target=es5).js.diff | 14 +- ...tors.3(module=commonjs,target=es5).js.diff | 16 +- ...rators.3(module=esnext,target=es5).js.diff | 16 +- ...tors.4(module=commonjs,target=es5).js.diff | 16 +- ...rators.4(module=esnext,target=es5).js.diff | 16 +- ...tors.5(module=commonjs,target=es5).js.diff | 14 +- ...rators.5(module=esnext,target=es5).js.diff | 14 +- ...tors.6(module=commonjs,target=es5).js.diff | 14 +- ...rators.6(module=esnext,target=es5).js.diff | 14 +- ...tors.7(module=commonjs,target=es5).js.diff | 13 +- ...rators.7(module=esnext,target=es5).js.diff | 13 +- ...tors.8(module=commonjs,target=es5).js.diff | 13 +- ...rators.8(module=esnext,target=es5).js.diff | 13 +- ...tors.9(module=commonjs,target=es5).js.diff | 13 +- ...rators.9(module=esnext,target=es5).js.diff | 13 +- .../valuesMergingAcrossModules.js.diff | 11 - .../submodule/conformance/variance.js.diff | 22 +- .../submodule/conformance/witness.js.diff | 11 +- ...cFunctionDeclaration16_es5.errors.txt.diff | 26 +- .../errorOnFunctionReturnType.errors.txt.diff | 13 +- 1195 files changed, 7199 insertions(+), 18740 deletions(-) create mode 100644 testdata/baselines/reference/fourslash/documentHighlights/findAllRefsForModule.baseline.jsonc create mode 100644 testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForModule.baseline.jsonc delete mode 100644 testdata/baselines/reference/submodule/compiler/APISample_Watch.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/APISample_WatchWithDefaults.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/APISample_WatchWithOwnWatchHost.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/APISample_compile.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/APISample_jsdoc.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/APISample_linter.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/APISample_parseConfig.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/APISample_transform.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/APISample_watcher.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/accessorInAmbientContextES5.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/aliasDoesNotDuplicateSignatures.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/aliasUsedAsNameValue.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/allowImportClausesToMergeWithTypes.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/allowJscheckJsTypeParameterNoCrash.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports10.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports4.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports9.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/ambientExternalModuleInAnotherExternalModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/amdDependencyComment1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/amdDependencyCommentName1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/assertionFunctionWildcardImport1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/assertionFunctionWildcardImport2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/asyncFunctionReturnExpressionErrorSpans.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/augmentExportEquals3.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/augmentExportEquals4.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/augmentExportEquals6.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/callsOnComplexSignatures.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsxNotSetError.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/classExtendsAcrossFiles.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/collisionArgumentsArrowFunctions.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/collisionArgumentsClassConstructor.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/collisionArgumentsClassMethod.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/collisionArgumentsFunction.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/collisionArgumentsFunctionExpressions.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/collisionExportsRequireAndAlias.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/commentsExternalModules3.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.map.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/commonSourceDirectory.sourcemap.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/commonjsSafeImport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/compositeWithNodeModulesSourceFile.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/computedPropertyNameWithImportedKey.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/conflictingDeclarationsImportFromNamespace1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/conflictingDeclarationsImportFromNamespace2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=true).js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/copyrightWithNewLine1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/copyrightWithoutNewLine1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declFileImportModuleWithExportAssignment.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameCausesImportToBePainted.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameConstEnumAlias.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitCrossFileCopiedGeneratedImportType.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitCrossFileImportTypeOfAmbientModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitExportAliasVisibiilityMarking.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitExportDeclaration.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitExpressionInExtends6.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitForModuleImportingModuleAugmentationRetainsImport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitForTypesWhichNeedImportTypes.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitInlinedDistributiveConditional.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitOfTypeofAliasedExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitPreserveReferencedImports.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitQualifiedAliasTypeArgument.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitRetainedAnnotationRetainsImportInOutput.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitScopeConsistency.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitSymlinkPaths.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitTopLevelNodeFromCrossFile2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitTypeofDefaultExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitUnnessesaryTypeReferenceNotAdded.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitWithDefaultAsComputedName.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationEmitWithDefaultAsComputedName2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationMapsMultifile.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationsForInferredTypeFromOtherFile.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitDefaultImport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/downlevelLetConst18.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/downlevelLetConst19.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/duplicateObjectLiteralProperty_computedName3.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/duplicatePackage.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/dynamicImportInDefaultExportExpression.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/dynamicImportTrailingComma.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/elidingImportNames.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/emitClassMergedWithConstNamespaceNotElided.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/emptyModuleName.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/enumDeclarationEmitInitializerHasImport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/enumFromExternalModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingDts.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportWithExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingMergeErrors.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingWithExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportEqualsExportModuleCommonJsError.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportNameSpaceImportDts.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportNameSpaceImportInEs5.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportNamedImportDts.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportNamedImportInEs5.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/es6ImportNamedImportWithExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/esModuleInterop.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/esModuleInteropImportCall.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/esModuleInteropImportDefaultWhenAllNamedAreDefaultAlias.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/esModuleInteropNamedDefaultImports.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/esModuleInteropTslibHelpers.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/esModuleInteropUsesExportStarWhenDefaultPlusNames.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesNoValue.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportAsNamespace_augment.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportAssignedNamespaceIsVisibleInDeclarationEmit.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportAssignmentEnum.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportAssignmentImportMergeNoCrash.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportAssignmentVariable.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportDefaultStripsFreshness.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportEqualErrorType.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportEqualMemberMissing.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportEqualsProperty.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/exportStarNotElided.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/extendsUntypedModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/externalModuleImmutableBindings.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/externalModuleRefernceResolutionOrderInImportDeclaration.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/externalModuleResolution.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/externalModuleResolution2.js.diff create mode 100644 testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/genericInferenceDefaultTypeParameterJsxReact.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/ignoredJsxAttributes.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/importAsBaseClass.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/importHelpersInTsx.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/importNotElidedWhenNotFound.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/importWithTrailingSlash.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/inferredIndexerOnNamespaceImport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/inlineMappedTypeModifierDeclarationEmit.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/isolatedModulesExportDeclarationType.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/isolatedModulesImportConstEnum.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsonFileImportChecksCallCorrectlyTwice.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxCallElaborationCheckNoCrash1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxChildrenSingleChildConfusableWithMultipleChildrenNoError.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxComplexSignatureHasApplicabilityError.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxElementTypeLiteral.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxElementTypeLiteralWithGeneric.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxExcessPropsAndAssignability.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxFragmentAndFactoryUsedOnFragmentUse.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxHasLiteralType.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxImportForSideEffectsNonExtantNoError.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxImportInAttribute.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxImportSourceNonPragmaComment.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxIntrinsicElementsCompatability.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxIntrinsicElementsTypeArgumentErrors.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxIntrinsicUnions.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxNamespaceReexports.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxPartialSpread.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=preserve).js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxSpreadFirstUnionNoErrors.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxViaImport.2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/jsxViaImport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/keyofModuleObjectHasCorrectKeys.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/literalTypeNameAssertionNotTriggered.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/localAliasExportAssignment.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/mappedTypeGenericInstantiationPreservesHomomorphism.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/mergeSymbolRexportFunction.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/mergedDeclarations7.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/missingMemberErrorHasShortPath.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleAugmentationDeclarationEmit1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleAugmentationDeclarationEmit2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleAugmentationDoesNamespaceEnumMergeOfReexport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleAugmentationExtendAmbientModule1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleAugmentationExtendAmbientModule2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleAugmentationExtendFileModule1.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleAugmentationExtendFileModule2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleAugmentationNoNewNames.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleNodeImportRequireEmit(target=es5).js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=commonjs,moduleresolution=node16).js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=commonjs,moduleresolution=nodenext).js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleResolutionWithSymlinks_preserveSymlinks.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/module_augmentUninstantiatedModule2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/multiImportExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/namedImportNonExistentName.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/namespaceMergedWithFunctionWithOverloadsUsage.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/narrowedImports.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/narrowedImports_assumeInitialized.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/newAbstractInstance2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/noCrashOnImportShadowing.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/nodeColonModuleResolution.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/nodeColonModuleResolution2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/nodeModuleReexportFromDottedPath.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/propTypeValidatorInference.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reExportUndefined2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reactHOCSpreadprops.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reactNamespaceImportPresevation.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reactReadonlyHOCAssignabilityReal.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reactSFCAndFunctionResolvable.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reactTagNameComponentWithPropsNoOOM.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reactTagNameComponentWithPropsNoOOM2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reactTransitiveImportHasValidDeclaration.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/recursiveExportAssignmentAndFindAliasedType4.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/recursiveExportAssignmentAndFindAliasedType5.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/recursiveExportAssignmentAndFindAliasedType6.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/recursiveExportAssignmentAndFindAliasedType7.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reexportDefaultIsCallable.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/reexportedMissingAlias.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/referenceTypesPreferedToPathIfPossible.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireAsFunctionInExternalModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFile.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileNonRelative.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileNonRelativeWithoutExtensionResolvesToTs.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileTypes.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithAlwaysStrictWithoutErrors.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithComputedPropertyName.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithDeclaration.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithEmptyObject.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithEmptyObjectWithErrors.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithErrors.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithNoContent.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithSourceMap.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithTraillingComma.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutAllowJs.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutExtension.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutExtensionResolvesToTs.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutOutDir.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/requireOfJsonFileWithoutResolveJsonModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/satisfiesEmit.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/selfReferentialDefaultNoStackOverflow.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/shebangBeforeReferences.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/spellingSuggestionJSXAttribute.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/spreadExpressionContextualTypeWithNamespace.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/stackDepthLimitCastingType.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/staticInstanceResolution3.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/superPropertyAccess1.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/superPropertyAccess_ES5.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNamesImportRef.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/taggedTemplateWithoutDeclaredHelper.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/transformNestedGeneratorsWithTry.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/tsxDeepAttributeAssignabilityError.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/tsxInvokeComponentType.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/tsxNoTypeAnnotatedSFC.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/tsxNotUsingApparentTypeOfSFC.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/tsxReactPropsInferenceSucceedsOnIntersections.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/tsxSpreadDoesNotReportExcessProps.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/tsxStatelessComponentDefaultProps.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/tsxUnionMemberChecksFilterDataProps.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/typeCheckObjectCreationExpressionWithUndefinedCallResolutionData.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/typeReferenceDirectives8.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/typeRootsFromMultipleNodeModulesDirectories.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/typeRootsFromNodeModulesInParentDirectory.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/typeofExternalModules.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/undeclaredModuleError.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unicodeEscapesInNames01(target=es5).errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/uniqueSymbolPropertyDeclarationEmit.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports11.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports13.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports14.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports15.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports16.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports2.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports3.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports4.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports5.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports8.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedImports_entireImportDeclaration.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/unusedInvalidTypeArguments.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/voidAsNonAmbiguousReturnType.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/ambientDeclarationsExternal.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/ambientDeclarationsPatterns.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/ambientShorthand.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/arraySpreadImportHelpers.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/asOperator4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/asyncAliasReturnType_es5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/asyncArrowFunctionCapturesArguments_es5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/asyncFunctionDeclaration15_es5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/asyncFunctionDeclarationCapturesArguments_es5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/asyncImportedPromise_es5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/asyncQualifiedReturnType_es5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/autoAccessor1(target=es5).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/autoAccessor3(target=es5).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/autoAccessor4(target=es5).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/bundlerCommonJS.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty12.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty13.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty14.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty15.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty5.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty6.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty7.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty8.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxChildrenProperty9.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxGenericTagHasCorrectInferences.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/checkJsxUnionSFXContextualTypeInferredCorrectly.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/classStaticBlock5(target=es5).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/classStaticBlock6.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/contextuallyTypedStringLiteralsInJsxAttributes02.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/declarationFileForJsonImport(resolvejsonmodule=false).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/declarationFileForJsonImport(resolvejsonmodule=true).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/defaultExportsCannotMerge01.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/defaultExportsCannotMerge02.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/defaultExportsCannotMerge03.js.diff create mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments01.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments01.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments02.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments02.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments03.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments04.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments05.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments06.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments07.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments09.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments10.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments11.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments12.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments14.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments15.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments16.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments17.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments18.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitArrowFunctionWhenUsingArguments19.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/esDecorators-classDeclaration-fields-staticAmbient(target=es5).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportAndImport-es5.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=commonjs).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=commonjs).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=commonjs).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=commonjs).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportAsNamespace_missingEmitHelpers.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportAssignDottedName.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportAssignImportedIdentifier.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportAssignTypes.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportAssignmentMergedModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportDeclaredModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportDefault.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace11.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace12.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace7.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace8.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace9.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportStar.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportTypeMergedWithExportStarAsNamespace.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportsAndImports4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportsAndImportsWithContextualKeywordNames02.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportsAndImportsWithUnderscores1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportsAndImportsWithUnderscores2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportsAndImportsWithUnderscores3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportsAndImportsWithUnderscores4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/extendClassExpressionFromModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importCallExpressionES5CJS.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importElisionConstEnumMerge1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importEquals1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importEquals2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importNonExternalModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importTsBeforeDTs.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/importsImplicitlyReadonly.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/inlineJsxAndJsxFragPragma.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/inlineJsxAndJsxFragPragmaOverridesCompilerOptions.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/inlineJsxFactoryDeclarations.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/inlineJsxFactoryLocalTypeGlobalFallback.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/inlineJsxFactoryOverridesCompilerOption.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/inlineJsxFactoryWithFragmentIsError.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/invalidSyntaxNamespaceImportWithCommonjs.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsxSpreadOverwritesAttributeStrict.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash1.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash2.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash3.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/labeledStatementDeclarationListInLoopNoCrash4.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=commonjs).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/labeledStatementExportDeclarationNoCrash1(module=esnext).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/moduleScoping.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/multiline.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/multipleDefaultExports01.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/multipleDefaultExports02.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nameDelimitedBySlashes.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nameWithFileExtension.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nameWithRelativePaths.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nullishCoalescingOperatorInParameterBindingPattern(target=es5).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nullishCoalescingOperatorInParameterInitializer(target=es5).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/optionalChainingInParameterBindingPattern(target=es5).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/optionalChainingInParameterInitializer(target=es5).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/packageJsonMain.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/privateNameES5Ban.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/protectedStaticClassPropertyAccessibleWithinSubclass2.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/reExportDefaultExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/reexportClassDefinition.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/relativePathMustResolve.js.diff create mode 100644 testdata/baselines/reference/submodule/conformance/superInStaticMembers1(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/topLevelAmbientModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/topLevelFileModule.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/topLevelFileModuleMissing.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/topLevelModuleDeclarationAndFile.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxAttributeResolution16.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxDefaultAttributesResolution1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxDefaultAttributesResolution2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxDefaultAttributesResolution3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxElementResolution19.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxExternalModuleEmit2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxGenericAttributesType1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxGenericAttributesType2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxGenericAttributesType3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxGenericAttributesType4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxGenericAttributesType7.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxGenericAttributesType8.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxGenericAttributesType9.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxReactComponentWithDefaultTypeParameter1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxReactComponentWithDefaultTypeParameter2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxReactComponentWithDefaultTypeParameter3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSfcReturnUndefinedStrictNullChecks.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution10.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution11.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution12.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution13.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution14.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution15.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution16.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution6.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution7.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution8.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxSpreadAttributesResolution9.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload5.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentOverload6.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxStatelessFunctionComponentsWithTypeArguments4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxTypeArgumentResolution.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxUnionElementType1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxUnionElementType2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxUnionElementType3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxUnionElementType4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxUnionElementType5.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxUnionElementType6.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxUnionTypeComponent1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/tsxUnionTypeComponent2.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typeAndNamespaceExportMerge.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typeOfThisInStaticMembers3(target=es5).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeOfThisInStaticMembers4(target=es5).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeOfThisInStaticMembers7(target=es5).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typeOnlyMerge1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typeofImportTypeOnlyExport.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typesOnlyExternalModuleStillHasInstance.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typingsLookup4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/umd-augmentation-1.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/umd-augmentation-3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/umd3.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/umd4.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/umd5.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions01(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions02(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions03(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions04(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions05(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions06(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions08(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions09(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions10(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions11(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions13(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions15(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions16(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/unicodeExtendedEscapesInRegularExpressions18(target=es5).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/untypedModuleImport.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/untypedModuleImport_vsAmbient.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/untypedModuleImport_withAugmentation.js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/valuesMergingAcrossModules.js.diff diff --git a/_submodules/TypeScript b/_submodules/TypeScript index bf40cd8606..763d8821ca 160000 --- a/_submodules/TypeScript +++ b/_submodules/TypeScript @@ -1 +1 @@ -Subproject commit bf40cd86065cde495ec5333d61411668756bb159 +Subproject commit 763d8821ca3fe9277eab23f82640425f7222ddd4 diff --git a/internal/binder/nameresolver.go b/internal/binder/nameresolver.go index dbac222247..a14c9319d4 100644 --- a/internal/binder/nameresolver.go +++ b/internal/binder/nameresolver.go @@ -205,13 +205,6 @@ loop: return nil } } - case ast.KindArrowFunction: - // when targeting ES6 or higher there is no 'arguments' in an arrow function - // for lower compile targets the resolved symbol is used to emit an error - if r.CompilerOptions.GetEmitScriptTarget() >= core.ScriptTargetES2015 { - break - } - fallthrough case ast.KindMethodDeclaration, ast.KindConstructor, ast.KindGetAccessor, ast.KindSetAccessor, ast.KindFunctionDeclaration: if meaning&ast.SymbolFlagsVariable != 0 && name == "arguments" { result = r.argumentsSymbol() @@ -354,21 +347,18 @@ func (r *NameResolver) useOuterVariableScopeInParameter(result *ast.Symbol, loca // - optional chaining pre-es2020 // - nullish coalesce pre-es2020 // - spread assignment in binding pattern pre-es2017 - target := r.CompilerOptions.GetEmitScriptTarget() - if target >= core.ScriptTargetES2015 { - functionLocation := location - declarationRequiresScopeChange := core.TSUnknown - if r.GetRequiresScopeChangeCache != nil { - declarationRequiresScopeChange = r.GetRequiresScopeChangeCache(functionLocation) - } - if declarationRequiresScopeChange == core.TSUnknown { - declarationRequiresScopeChange = core.IfElse(core.Some(functionLocation.Parameters(), r.requiresScopeChange), core.TSTrue, core.TSFalse) - if r.SetRequiresScopeChangeCache != nil { - r.SetRequiresScopeChangeCache(functionLocation, declarationRequiresScopeChange) - } + functionLocation := location + declarationRequiresScopeChange := core.TSUnknown + if r.GetRequiresScopeChangeCache != nil { + declarationRequiresScopeChange = r.GetRequiresScopeChangeCache(functionLocation) + } + if declarationRequiresScopeChange == core.TSUnknown { + declarationRequiresScopeChange = core.IfElse(core.Some(functionLocation.Parameters(), r.requiresScopeChange), core.TSTrue, core.TSFalse) + if r.SetRequiresScopeChangeCache != nil { + r.SetRequiresScopeChangeCache(functionLocation, declarationRequiresScopeChange) } - return declarationRequiresScopeChange != core.TSTrue } + return declarationRequiresScopeChange != core.TSTrue } } return false diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 4def9ddbc6..0ff050b0a7 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -5817,6 +5817,7 @@ func (c *Checker) getIteratedTypeOrElementType(use IterationUse, inputType *Type } return nil } + // TODO: remove ScriptTargetES2015 uplevelIteration := c.languageVersion >= core.ScriptTargetES2015 downlevelIteration := !uplevelIteration && c.compilerOptions.DownlevelIteration == core.TSTrue possibleOutOfBounds := c.compilerOptions.NoUncheckedIndexedAccess == core.TSTrue && use&IterationUsePossiblyOutOfBounds != 0 @@ -7675,10 +7676,6 @@ func (c *Checker) checkSuperExpression(node *ast.Node) *Type { // c.captureLexicalThis(node.Parent, container) // } if container.Parent.Kind == ast.KindObjectLiteralExpression { - if c.languageVersion < core.ScriptTargetES2015 { - c.error(node, diagnostics.X_super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher) - return c.errorType - } // for object literal assume that type of 'super' is 'any' return c.anyType } @@ -11343,14 +11340,6 @@ func (c *Checker) checkPropertyAccessibilityAtLocation(location *ast.Node, isSup // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if c.languageVersion < core.ScriptTargetES2015 { - if c.symbolHasNonMethodDeclaration(prop) { - if errorNode != nil { - c.error(errorNode, diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword) - } - return false - } - } if flags&ast.ModifierFlagsAbstract != 0 { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member @@ -17356,6 +17345,7 @@ func (c *Checker) getTypeFromArrayBindingPattern(pattern *ast.Node, includePatte restElement = lastElement } if len(elements) == 0 || len(elements) == 1 && restElement != nil { + // TODO: remove ScriptTargetES2015 if c.languageVersion >= core.ScriptTargetES2015 { return c.createIterableType(c.anyType) } diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index 28a18ed053..644c4d9604 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -1338,9 +1338,6 @@ func (c *Checker) checkGrammarForInOrForOfStatement(forInOrOfStatement *ast.ForI func (c *Checker) checkGrammarAccessor(accessor *ast.AccessorDeclaration) bool { body := accessor.Body() if accessor.Flags&ast.NodeFlagsAmbient == 0 && (accessor.Parent.Kind != ast.KindTypeLiteral) && (accessor.Parent.Kind != ast.KindInterfaceDeclaration) { - if c.languageVersion < core.ScriptTargetES2015 && ast.IsPrivateIdentifier(accessor.Name()) { - return c.grammarErrorOnNode(accessor.Name(), diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher) - } if body == nil && !ast.HasSyntacticModifier(accessor, ast.ModifierFlagsAbstract) { return c.grammarErrorAtPos(accessor, accessor.End()-1, len(";"), diagnostics.X_0_expected, "{") } @@ -1492,9 +1489,6 @@ func (c *Checker) checkGrammarMethod(node *ast.Node /*Union[MethodDeclaration, M } if ast.IsClassLike(node.Parent) { - if c.languageVersion < core.ScriptTargetES2015 && ast.IsPrivateIdentifier(node.Name()) { - return c.grammarErrorOnNode(node.Name(), diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher) - } // Technically, computed properties in ambient contexts is disallowed // for property declarations and accessors too, not just methods. // However, property declarations disallow computed names in general, @@ -1934,12 +1928,6 @@ func (c *Checker) checkGrammarProperty(node *ast.Node /*Union[PropertyDeclaratio if c.checkGrammarForInvalidDynamicName(propertyName, diagnostics.A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type) { return true } - if c.languageVersion < core.ScriptTargetES2015 && ast.IsPrivateIdentifier(propertyName) { - return c.grammarErrorOnNode(propertyName, diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher) - } - if c.languageVersion < core.ScriptTargetES2015 && ast.IsAutoAccessorPropertyDeclaration(node) && node.Flags&ast.NodeFlagsAmbient == 0 { - return c.grammarErrorOnNode(propertyName, diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher) - } if ast.IsAutoAccessorPropertyDeclaration(node) && c.checkGrammarForInvalidQuestionMark(node.AsPropertyDeclaration().PostfixToken, diagnostics.An_accessor_property_cannot_be_declared_optional) { return true } diff --git a/internal/checker/types.go b/internal/checker/types.go index f9b6f642e1..5a6066f458 100644 --- a/internal/checker/types.go +++ b/internal/checker/types.go @@ -1210,20 +1210,6 @@ const ( type TypeComparer func(s *Type, t *Type, reportErrors bool) Ternary type LanguageFeatureMinimumTargetMap struct { - Classes core.ScriptTarget - ForOf core.ScriptTarget - Generators core.ScriptTarget - Iteration core.ScriptTarget - SpreadElements core.ScriptTarget - RestElements core.ScriptTarget - TaggedTemplates core.ScriptTarget - DestructuringAssignment core.ScriptTarget - BindingPatterns core.ScriptTarget - ArrowFunctions core.ScriptTarget - BlockScopedVariables core.ScriptTarget - ObjectAssign core.ScriptTarget - RegularExpressionFlagsUnicode core.ScriptTarget - RegularExpressionFlagsSticky core.ScriptTarget Exponentiation core.ScriptTarget AsyncFunctions core.ScriptTarget ForAwaitOf core.ScriptTarget @@ -1247,20 +1233,6 @@ type LanguageFeatureMinimumTargetMap struct { } var LanguageFeatureMinimumTarget = LanguageFeatureMinimumTargetMap{ - Classes: core.ScriptTargetES2015, - ForOf: core.ScriptTargetES2015, - Generators: core.ScriptTargetES2015, - Iteration: core.ScriptTargetES2015, - SpreadElements: core.ScriptTargetES2015, - RestElements: core.ScriptTargetES2015, - TaggedTemplates: core.ScriptTargetES2015, - DestructuringAssignment: core.ScriptTargetES2015, - BindingPatterns: core.ScriptTargetES2015, - ArrowFunctions: core.ScriptTargetES2015, - BlockScopedVariables: core.ScriptTargetES2015, - ObjectAssign: core.ScriptTargetES2015, - RegularExpressionFlagsUnicode: core.ScriptTargetES2015, - RegularExpressionFlagsSticky: core.ScriptTargetES2015, Exponentiation: core.ScriptTargetES2016, AsyncFunctions: core.ScriptTargetES2017, ForAwaitOf: core.ScriptTargetES2018, diff --git a/internal/compiler/program.go b/internal/compiler/program.go index 7238991f97..794d2fa96d 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -725,20 +725,10 @@ func (p *Program) verifyCompilerOptions() { createDiagnosticForOptionName(diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib") } - languageVersion := options.GetEmitScriptTarget() - - firstNonAmbientExternalModuleSourceFile := core.Find(p.files, func(f *ast.SourceFile) bool { return ast.IsExternalModule(f) && !f.IsDeclarationFile }) if options.IsolatedModules.IsTrue() || options.VerbatimModuleSyntax.IsTrue() { - if options.Module == core.ModuleKindNone && languageVersion < core.ScriptTargetES2015 && options.IsolatedModules.IsTrue() { - // !!! - // createDiagnosticForOptionName(diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target") - } - if options.PreserveConstEnums.IsFalse() { createDiagnosticForOptionName(diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_0_is_enabled, core.IfElse(options.VerbatimModuleSyntax.IsTrue(), "verbatimModuleSyntax", "isolatedModules"), "preserveConstEnums") } - } else if firstNonAmbientExternalModuleSourceFile != nil && languageVersion < core.ScriptTargetES2015 && options.Module == core.ModuleKindNone { - // !!! } if options.OutDir != "" || diff --git a/internal/fourslash/_scripts/failingTests.txt b/internal/fourslash/_scripts/failingTests.txt index f2ad135364..2aba718e6e 100644 --- a/internal/fourslash/_scripts/failingTests.txt +++ b/internal/fourslash/_scripts/failingTests.txt @@ -224,7 +224,6 @@ TestDoubleUnderscoreCompletions TestEditJsdocType TestExportDefaultClass TestExportDefaultFunction -TestFindAllRefsForModule TestFindAllRefsModuleDotExports TestFindReferencesBindingPatternInJsdocNoCrash1 TestFindReferencesBindingPatternInJsdocNoCrash2 diff --git a/internal/fourslash/tests/gen/completionListStaticProtectedMembers2_test.go b/internal/fourslash/tests/gen/completionListStaticProtectedMembers2_test.go index 274cd4dc14..7b5cb87dae 100644 --- a/internal/fourslash/tests/gen/completionListStaticProtectedMembers2_test.go +++ b/internal/fourslash/tests/gen/completionListStaticProtectedMembers2_test.go @@ -140,14 +140,30 @@ class C2 extends Base { Label: "protectedOverriddenMethod", SortText: PtrTo(string(ls.SortTextLocalDeclarationPriority)), }, + &lsproto.CompletionItem{ + Label: "protectedOverriddenProperty", + SortText: PtrTo(string(ls.SortTextLocalDeclarationPriority)), + }, + &lsproto.CompletionItem{ + Label: "protectedProperty", + SortText: PtrTo(string(ls.SortTextLocalDeclarationPriority)), + }, &lsproto.CompletionItem{ Label: "publicMethod", SortText: PtrTo(string(ls.SortTextLocalDeclarationPriority)), }, + &lsproto.CompletionItem{ + Label: "publicProperty", + SortText: PtrTo(string(ls.SortTextLocalDeclarationPriority)), + }, &lsproto.CompletionItem{ Label: "apply", SortText: PtrTo(string(ls.SortTextLocationPriority)), }, + &lsproto.CompletionItem{ + Label: "arguments", + SortText: PtrTo(string(ls.SortTextLocationPriority)), + }, &lsproto.CompletionItem{ Label: "bind", SortText: PtrTo(string(ls.SortTextLocationPriority)), @@ -156,6 +172,18 @@ class C2 extends Base { Label: "call", SortText: PtrTo(string(ls.SortTextLocationPriority)), }, + &lsproto.CompletionItem{ + Label: "caller", + SortText: PtrTo(string(ls.SortTextLocationPriority)), + }, + &lsproto.CompletionItem{ + Label: "length", + SortText: PtrTo(string(ls.SortTextLocationPriority)), + }, + &lsproto.CompletionItem{ + Label: "prototype", + SortText: PtrTo(string(ls.SortTextLocationPriority)), + }, &lsproto.CompletionItem{ Label: "toString", SortText: PtrTo(string(ls.SortTextLocationPriority)), diff --git a/internal/fourslash/tests/gen/findAllRefsForModule_test.go b/internal/fourslash/tests/gen/findAllRefsForModule_test.go index f0f4d2f456..fef3dab43e 100644 --- a/internal/fourslash/tests/gen/findAllRefsForModule_test.go +++ b/internal/fourslash/tests/gen/findAllRefsForModule_test.go @@ -9,7 +9,7 @@ import ( func TestFindAllRefsForModule(t *testing.T) { t.Parallel() - t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @allowJs: true // @Filename: /a.ts diff --git a/internal/printer/factory.go b/internal/printer/factory.go index adbd0a2cf2..b276a3b293 100644 --- a/internal/printer/factory.go +++ b/internal/printer/factory.go @@ -548,17 +548,7 @@ func (f *NodeFactory) NewDisposeResourcesHelper(envBinding *ast.Expression) *ast // !!! ES2018 Helpers // Chains a sequence of expressions using the __assign helper or Object.assign if available in the target func (f *NodeFactory) NewAssignHelper(attributesSegments []*ast.Expression, scriptTarget core.ScriptTarget) *ast.Expression { - if scriptTarget >= core.ScriptTargetES2015 { - return f.NewCallExpression(f.NewPropertyAccessExpression(f.NewIdentifier("Object"), nil, f.NewIdentifier("assign"), ast.NodeFlagsNone), nil, nil, f.NewNodeList(attributesSegments), ast.NodeFlagsNone) - } - f.emitContext.RequestEmitHelper(assignHelper) - return f.NewCallExpression( - f.NewUnscopedHelperName("__assign"), - nil, - nil, - f.NewNodeList(attributesSegments), - ast.NodeFlagsNone, - ) + return f.NewCallExpression(f.NewPropertyAccessExpression(f.NewIdentifier("Object"), nil, f.NewIdentifier("assign"), ast.NodeFlagsNone), nil, nil, f.NewNodeList(attributesSegments), ast.NodeFlagsNone) } // ES2018 Destructuring Helpers diff --git a/internal/printer/helpers.go b/internal/printer/helpers.go index 0b3918af7b..a2d1348917 100644 --- a/internal/printer/helpers.go +++ b/internal/printer/helpers.go @@ -100,23 +100,6 @@ var disposeResourcesHelper = &EmitHelper{ // !!! Class Fields Helpers // !!! ES2018 Helpers -var assignHelper = &EmitHelper{ - Name: "typescript:assign", - ImportName: "__assign", - Scoped: false, - Priority: &Priority{1}, - Text: `var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -};`, -} // !!! ES2018 Destructuring Helpers var restHelper = &EmitHelper{ diff --git a/testdata/baselines/reference/fourslash/documentHighlights/findAllRefsForModule.baseline.jsonc b/testdata/baselines/reference/fourslash/documentHighlights/findAllRefsForModule.baseline.jsonc new file mode 100644 index 0000000000..fbd7faf736 --- /dev/null +++ b/testdata/baselines/reference/fourslash/documentHighlights/findAllRefsForModule.baseline.jsonc @@ -0,0 +1,15 @@ +// === documentHighlights === +// === /b.ts === +// import { x } from "/*HIGHLIGHTS*/[|./a|]"; + + + +// === documentHighlights === +// === /c/sub.js === +// const a = require("/*HIGHLIGHTS*/[|../a|]"); + + + +// === documentHighlights === +// === /d.ts === +// /// \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForModule.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForModule.baseline.jsonc new file mode 100644 index 0000000000..8173e6641a --- /dev/null +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsForModule.baseline.jsonc @@ -0,0 +1,33 @@ +// === findAllReferences === +// === /b.ts === +// import { x } from "/*FIND ALL REFS*/[|./a|]"; + +// === /c/sub.js === +// const a = require("[|../a|]"); + +// === /d.ts === +// /// + + + +// === findAllReferences === +// === /b.ts === +// import { x } from "[|./a|]"; + +// === /c/sub.js === +// const a = require("/*FIND ALL REFS*/[|../a|]"); + +// === /d.ts === +// /// + + + +// === findAllReferences === +// === /b.ts === +// import { x } from "[|./a|]"; + +// === /c/sub.js === +// const a = require("[|../a|]"); + +// === /d.ts === +// /// \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/APISample_Watch.js.diff b/testdata/baselines/reference/submodule/compiler/APISample_Watch.js.diff deleted file mode 100644 index a44deac7f4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/APISample_Watch.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.APISample_Watch.js -+++ new.APISample_Watch.js -@@= skipped -90, +90 lines =@@ - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - Object.defineProperty(exports, "__esModule", { value: true }); --var ts = require("typescript"); -+const ts = require("typescript"); - const formatHost = { - getCanonicalFileName: path => path, - getCurrentDirectory: ts.sys.getCurrentDirectory, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/APISample_WatchWithDefaults.js.diff b/testdata/baselines/reference/submodule/compiler/APISample_WatchWithDefaults.js.diff deleted file mode 100644 index be2d9cde75..0000000000 --- a/testdata/baselines/reference/submodule/compiler/APISample_WatchWithDefaults.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.APISample_WatchWithDefaults.js -+++ new.APISample_WatchWithDefaults.js -@@= skipped -62, +62 lines =@@ - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - Object.defineProperty(exports, "__esModule", { value: true }); --var ts = require("typescript"); -+const ts = require("typescript"); - function watchMain() { - const configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json"); - if (!configPath) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/APISample_WatchWithOwnWatchHost.js.diff b/testdata/baselines/reference/submodule/compiler/APISample_WatchWithOwnWatchHost.js.diff deleted file mode 100644 index 4d88a0aa98..0000000000 --- a/testdata/baselines/reference/submodule/compiler/APISample_WatchWithOwnWatchHost.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.APISample_WatchWithOwnWatchHost.js -+++ new.APISample_WatchWithOwnWatchHost.js -@@= skipped -69, +69 lines =@@ - * Please log a "breaking change" issue for any API breaking change affecting this issue - */ - Object.defineProperty(exports, "__esModule", { value: true }); --var ts = require("typescript"); -+const ts = require("typescript"); - function watchMain() { - // get list of files and compiler options somehow - const files = []; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/APISample_compile.js.diff b/testdata/baselines/reference/submodule/compiler/APISample_compile.js.diff deleted file mode 100644 index 9b6c00442b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/APISample_compile.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.APISample_compile.js -+++ new.APISample_compile.js -@@= skipped -54, +54 lines =@@ - */ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.compile = compile; --var ts = require("typescript"); -+const ts = require("typescript"); - function compile(fileNames, options) { - var program = ts.createProgram(fileNames, options); - var emitResult = program.emit(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/APISample_jsdoc.js.diff b/testdata/baselines/reference/submodule/compiler/APISample_jsdoc.js.diff deleted file mode 100644 index 467a8e297e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/APISample_jsdoc.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.APISample_jsdoc.js -+++ new.APISample_jsdoc.js -@@= skipped -162, +162 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var ts = __importStar(require("typescript")); -+const ts = __importStar(require("typescript")); - // excerpted from https://github.com/YousefED/typescript-json-schema - // (converted from a method and modified; for example, `this: any` to compensate, among other changes) - function parseCommentsIntoDefinition(symbol, definition, otherAnnotations) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/APISample_linter.js.diff b/testdata/baselines/reference/submodule/compiler/APISample_linter.js.diff deleted file mode 100644 index 6104a135e1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/APISample_linter.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.APISample_linter.js -+++ new.APISample_linter.js -@@= skipped -113, +113 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.delint = delint; --var ts = __importStar(require("typescript")); -+const ts = __importStar(require("typescript")); - function delint(sourceFile) { - delintNode(sourceFile); - function delintNode(node) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/APISample_parseConfig.js.diff b/testdata/baselines/reference/submodule/compiler/APISample_parseConfig.js.diff deleted file mode 100644 index 417f4c229e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/APISample_parseConfig.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.APISample_parseConfig.js -+++ new.APISample_parseConfig.js -@@= skipped -52, +52 lines =@@ - */ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.createProgram = createProgram; --var ts = require("typescript"); -+const ts = require("typescript"); - function printError(error) { - if (!error) { - return; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/APISample_transform.js.diff b/testdata/baselines/reference/submodule/compiler/APISample_transform.js.diff deleted file mode 100644 index c50c35bc1e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/APISample_transform.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.APISample_transform.js -+++ new.APISample_transform.js -@@= skipped -64, +64 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var ts = __importStar(require("typescript")); -+const ts = __importStar(require("typescript")); - const source = "let x: string = 'string'"; - let result = ts.transpile(source, { module: ts.ModuleKind.CommonJS }); - console.log(JSON.stringify(result)); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/APISample_watcher.js.diff b/testdata/baselines/reference/submodule/compiler/APISample_watcher.js.diff deleted file mode 100644 index 4ed94ed8ed..0000000000 --- a/testdata/baselines/reference/submodule/compiler/APISample_watcher.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.APISample_watcher.js -+++ new.APISample_watcher.js -@@= skipped -159, +159 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var ts = __importStar(require("typescript")); -+const ts = __importStar(require("typescript")); - function watch(rootFileNames, options) { - const files = {}; - // initialize the list of files \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js.diff index 8998fe2750..043b393a91 100644 --- a/testdata/baselines/reference/submodule/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js.diff +++ b/testdata/baselines/reference/submodule/compiler/ClassDeclarationWithInvalidConstOnPropertyDeclaration.js.diff @@ -1,15 +1,9 @@ --- old.ClassDeclarationWithInvalidConstOnPropertyDeclaration.js +++ new.ClassDeclarationWithInvalidConstOnPropertyDeclaration.js -@@= skipped -5, +5 lines =@@ - } +@@= skipped -6, +6 lines =@@ //// [ClassDeclarationWithInvalidConstOnPropertyDeclaration.js] --let AtomicNumbers = (() => { -- class AtomicNumbers { -- } -- AtomicNumbers.H = 1; -- return AtomicNumbers; --})(); -+class AtomicNumbers { + class AtomicNumbers { + static H = 1; -+} \ No newline at end of file + } +-AtomicNumbers.H = 1; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/accessorInAmbientContextES5.errors.txt b/testdata/baselines/reference/submodule/compiler/accessorInAmbientContextES5.errors.txt deleted file mode 100644 index c9351f69f7..0000000000 --- a/testdata/baselines/reference/submodule/compiler/accessorInAmbientContextES5.errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -accessorInAmbientContextES5.ts(25,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - - -==== accessorInAmbientContextES5.ts (1 errors) ==== - // Should allow accessor in ambient contexts even when targeting ES5 - - declare class AmbientClass { - accessor prop1: string; - static accessor prop2: number; - private accessor prop3: boolean; - private static accessor prop4: symbol; - } - - declare namespace AmbientNamespace { - class C { - accessor prop: string; - } - } - - // Should also work in .d.ts files (simulated with declare) - declare module "some-module" { - export class ExportedClass { - accessor value: any; - } - } - - // Regular class should still error when targeting ES5 - class RegularClass { - accessor shouldError: string; // Should still error - ~~~~~~~~~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/aliasAssignments.js.diff b/testdata/baselines/reference/submodule/compiler/aliasAssignments.js.diff index bd54a55b29..581976bdb6 100644 --- a/testdata/baselines/reference/submodule/compiler/aliasAssignments.js.diff +++ b/testdata/baselines/reference/submodule/compiler/aliasAssignments.js.diff @@ -7,11 +7,4 @@ + someData; } exports.someClass = someClass; - //// [aliasAssignments_1.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var moduleA = require("./aliasAssignments_moduleA"); -+const moduleA = require("./aliasAssignments_moduleA"); - var x = moduleA; - x = 1; // Should be error - var y = 1; \ No newline at end of file + //// [aliasAssignments_1.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/aliasDoesNotDuplicateSignatures.js.diff b/testdata/baselines/reference/submodule/compiler/aliasDoesNotDuplicateSignatures.js.diff deleted file mode 100644 index 78ff4b84b6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/aliasDoesNotDuplicateSignatures.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.aliasDoesNotDuplicateSignatures.js -+++ new.aliasDoesNotDuplicateSignatures.js -@@= skipped -16, +16 lines =@@ - //// [user.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var demoModule_1 = require("demoModule"); -+const demoModule_1 = require("demoModule"); - // Assign an incorrect type here to see the type of 'f'. - let x1 = demoNS.f; - let x2 = demoModule_1.f; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/aliasUsageInAccessorsOfClass.js.diff b/testdata/baselines/reference/submodule/compiler/aliasUsageInAccessorsOfClass.js.diff index e816863525..3081aa94b0 100644 --- a/testdata/baselines/reference/submodule/compiler/aliasUsageInAccessorsOfClass.js.diff +++ b/testdata/baselines/reference/submodule/compiler/aliasUsageInAccessorsOfClass.js.diff @@ -8,19 +8,9 @@ } exports.Model = Model; //// [aliasUsage1_moduleA.js] - "use strict"; +@@= skipped -15, +16 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./aliasUsage1_backbone"); -+const Backbone = require("./aliasUsage1_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; - //// [aliasUsage1_main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var moduleA = require("./aliasUsage1_moduleA"); -+const moduleA = require("./aliasUsage1_moduleA"); + const moduleA = require("./aliasUsage1_moduleA"); class C2 { + x; get A() { diff --git a/testdata/baselines/reference/submodule/compiler/aliasUsageInArray.js.diff b/testdata/baselines/reference/submodule/compiler/aliasUsageInArray.js.diff index 7db6c429c0..973a486287 100644 --- a/testdata/baselines/reference/submodule/compiler/aliasUsageInArray.js.diff +++ b/testdata/baselines/reference/submodule/compiler/aliasUsageInArray.js.diff @@ -7,19 +7,4 @@ + someData; } exports.Model = Model; - //// [aliasUsageInArray_moduleA.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./aliasUsageInArray_backbone"); -+const Backbone = require("./aliasUsageInArray_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; - //// [aliasUsageInArray_main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var moduleA = require("./aliasUsageInArray_moduleA"); -+const moduleA = require("./aliasUsageInArray_moduleA"); - var xs = [moduleA]; - var xs2 = [moduleA]; \ No newline at end of file + //// [aliasUsageInArray_moduleA.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/aliasUsageInFunctionExpression.js.diff b/testdata/baselines/reference/submodule/compiler/aliasUsageInFunctionExpression.js.diff index cc771acb3a..ca249740f6 100644 --- a/testdata/baselines/reference/submodule/compiler/aliasUsageInFunctionExpression.js.diff +++ b/testdata/baselines/reference/submodule/compiler/aliasUsageInFunctionExpression.js.diff @@ -7,19 +7,4 @@ + someData; } exports.Model = Model; - //// [aliasUsageInFunctionExpression_moduleA.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./aliasUsageInFunctionExpression_backbone"); -+const Backbone = require("./aliasUsageInFunctionExpression_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; - //// [aliasUsageInFunctionExpression_main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var moduleA = require("./aliasUsageInFunctionExpression_moduleA"); -+const moduleA = require("./aliasUsageInFunctionExpression_moduleA"); - var f = (x) => x; - f = (x) => moduleA; \ No newline at end of file + //// [aliasUsageInFunctionExpression_moduleA.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/aliasUsageInGenericFunction.js.diff b/testdata/baselines/reference/submodule/compiler/aliasUsageInGenericFunction.js.diff index 5de3c24e3f..fe13be5cc5 100644 --- a/testdata/baselines/reference/submodule/compiler/aliasUsageInGenericFunction.js.diff +++ b/testdata/baselines/reference/submodule/compiler/aliasUsageInGenericFunction.js.diff @@ -7,20 +7,4 @@ + someData; } exports.Model = Model; - //// [aliasUsageInGenericFunction_moduleA.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./aliasUsageInGenericFunction_backbone"); -+const Backbone = require("./aliasUsageInGenericFunction_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; - //// [aliasUsageInGenericFunction_main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var moduleA = require("./aliasUsageInGenericFunction_moduleA"); -+const moduleA = require("./aliasUsageInGenericFunction_moduleA"); - function foo(x) { - return x; - } \ No newline at end of file + //// [aliasUsageInGenericFunction_moduleA.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/aliasUsageInIndexerOfClass.js.diff b/testdata/baselines/reference/submodule/compiler/aliasUsageInIndexerOfClass.js.diff index 32d8707f5d..fcda875c2c 100644 --- a/testdata/baselines/reference/submodule/compiler/aliasUsageInIndexerOfClass.js.diff +++ b/testdata/baselines/reference/submodule/compiler/aliasUsageInIndexerOfClass.js.diff @@ -8,19 +8,9 @@ } exports.Model = Model; //// [aliasUsageInIndexerOfClass_moduleA.js] - "use strict"; +@@= skipped -15, +16 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./aliasUsageInIndexerOfClass_backbone"); -+const Backbone = require("./aliasUsageInIndexerOfClass_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; - //// [aliasUsageInIndexerOfClass_main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var moduleA = require("./aliasUsageInIndexerOfClass_moduleA"); -+const moduleA = require("./aliasUsageInIndexerOfClass_moduleA"); + const moduleA = require("./aliasUsageInIndexerOfClass_moduleA"); class N { - constructor() { - this.x = moduleA; diff --git a/testdata/baselines/reference/submodule/compiler/aliasUsageInObjectLiteral.js.diff b/testdata/baselines/reference/submodule/compiler/aliasUsageInObjectLiteral.js.diff index 906bac9bc4..1dc622e0c1 100644 --- a/testdata/baselines/reference/submodule/compiler/aliasUsageInObjectLiteral.js.diff +++ b/testdata/baselines/reference/submodule/compiler/aliasUsageInObjectLiteral.js.diff @@ -7,20 +7,4 @@ + someData; } exports.Model = Model; - //// [aliasUsageInObjectLiteral_moduleA.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./aliasUsageInObjectLiteral_backbone"); -+const Backbone = require("./aliasUsageInObjectLiteral_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; - //// [aliasUsageInObjectLiteral_main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var moduleA = require("./aliasUsageInObjectLiteral_moduleA"); -+const moduleA = require("./aliasUsageInObjectLiteral_moduleA"); - var a = { x: moduleA }; - var b = { x: moduleA }; - var c = { y: { z: moduleA } }; \ No newline at end of file + //// [aliasUsageInObjectLiteral_moduleA.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/aliasUsageInOrExpression.js.diff b/testdata/baselines/reference/submodule/compiler/aliasUsageInOrExpression.js.diff index 2770714897..9ef8e17d24 100644 --- a/testdata/baselines/reference/submodule/compiler/aliasUsageInOrExpression.js.diff +++ b/testdata/baselines/reference/submodule/compiler/aliasUsageInOrExpression.js.diff @@ -7,20 +7,4 @@ + someData; } exports.Model = Model; - //// [aliasUsageInOrExpression_moduleA.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./aliasUsageInOrExpression_backbone"); -+const Backbone = require("./aliasUsageInOrExpression_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; - //// [aliasUsageInOrExpression_main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var moduleA = require("./aliasUsageInOrExpression_moduleA"); -+const moduleA = require("./aliasUsageInOrExpression_moduleA"); - var i; - var d1 = i || moduleA; - var d2 = i || moduleA; \ No newline at end of file + //// [aliasUsageInOrExpression_moduleA.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/aliasUsageInTypeArgumentOfExtendsClause.js.diff b/testdata/baselines/reference/submodule/compiler/aliasUsageInTypeArgumentOfExtendsClause.js.diff index 47986a8d15..9227a0eaa8 100644 --- a/testdata/baselines/reference/submodule/compiler/aliasUsageInTypeArgumentOfExtendsClause.js.diff +++ b/testdata/baselines/reference/submodule/compiler/aliasUsageInTypeArgumentOfExtendsClause.js.diff @@ -8,19 +8,9 @@ } exports.Model = Model; //// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js] - "use strict"; +@@= skipped -15, +16 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); -+const Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; - //// [aliasUsageInTypeArgumentOfExtendsClause_main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); -+const moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); + const moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); class C { + x; } diff --git a/testdata/baselines/reference/submodule/compiler/aliasUsageInVarAssignment.js.diff b/testdata/baselines/reference/submodule/compiler/aliasUsageInVarAssignment.js.diff index f2b32cfcab..734bc153c7 100644 --- a/testdata/baselines/reference/submodule/compiler/aliasUsageInVarAssignment.js.diff +++ b/testdata/baselines/reference/submodule/compiler/aliasUsageInVarAssignment.js.diff @@ -7,12 +7,4 @@ + someData; } exports.Model = Model; - //// [aliasUsageInVarAssignment_moduleA.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./aliasUsageInVarAssignment_backbone"); -+const Backbone = require("./aliasUsageInVarAssignment_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; \ No newline at end of file + //// [aliasUsageInVarAssignment_moduleA.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/aliasUsedAsNameValue.js.diff b/testdata/baselines/reference/submodule/compiler/aliasUsedAsNameValue.js.diff deleted file mode 100644 index fae82e58f4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/aliasUsedAsNameValue.js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.aliasUsedAsNameValue.js -+++ new.aliasUsedAsNameValue.js -@@= skipped -32, +32 lines =@@ - exports.a = void 0; - /// - /// --var mod = require("./aliasUsedAsNameValue_0"); --var b = require("./aliasUsedAsNameValue_1"); -+const mod = require("./aliasUsedAsNameValue_0"); -+const b = require("./aliasUsedAsNameValue_1"); - var a = function () { - //var x = mod.id; // TODO needed hack that mod is loaded - b.b(mod); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowImportClausesToMergeWithTypes.js.diff b/testdata/baselines/reference/submodule/compiler/allowImportClausesToMergeWithTypes.js.diff deleted file mode 100644 index c17a90fb7f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowImportClausesToMergeWithTypes.js.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.allowImportClausesToMergeWithTypes.js -+++ new.allowImportClausesToMergeWithTypes.js -@@= skipped -39, +39 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = void 0; --var b_1 = __importDefault(require("./b")); -+const b_1 = __importDefault(require("./b")); - exports.default = b_1.default; - const x = { x: "" }; - b_1.default; -@@= skipped -10, +10 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var a_1 = __importDefault(require("./a")); -+const a_1 = __importDefault(require("./a")); - const x = { x: "" }; - a_1.default; --var b_1 = __importDefault(require("./b")); -+const b_1 = __importDefault(require("./b")); - b_1.default; - const y = x; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowJscheckJsTypeParameterNoCrash.js.diff b/testdata/baselines/reference/submodule/compiler/allowJscheckJsTypeParameterNoCrash.js.diff deleted file mode 100644 index 44a7593278..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowJscheckJsTypeParameterNoCrash.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.allowJscheckJsTypeParameterNoCrash.js -+++ new.allowJscheckJsTypeParameterNoCrash.js -@@= skipped -27, +27 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.a = void 0; --var func_1 = require("./func"); -+const func_1 = require("./func"); - // hover on vextend - exports.a = (0, func_1.vextend)({ - watch: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports1.js.diff b/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports1.js.diff deleted file mode 100644 index b6cac15f88..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports1.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.allowSyntheticDefaultImports1.js -+++ new.allowSyntheticDefaultImports1.js -@@= skipped -16, +16 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; --var b_1 = __importDefault(require("./b")); -+const b_1 = __importDefault(require("./b")); - exports.x = new b_1.default.Foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports10.js.diff b/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports10.js.diff deleted file mode 100644 index 85ecbe9ed6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports10.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.allowSyntheticDefaultImports10.js -+++ new.allowSyntheticDefaultImports10.js -@@= skipped -12, +12 lines =@@ - //// [a.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var Foo = require("./b"); -+const Foo = require("./b"); - Foo.default.bar(); - Foo.default.default.foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports4.js.diff b/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports4.js.diff deleted file mode 100644 index db2b69074d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports4.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.allowSyntheticDefaultImports4.js -+++ new.allowSyntheticDefaultImports4.js -@@= skipped -17, +17 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; --var b_1 = __importDefault(require("./b")); -+const b_1 = __importDefault(require("./b")); - exports.x = new b_1.default(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports9.js.diff b/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports9.js.diff deleted file mode 100644 index 6b4e52d16e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImports9.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.allowSyntheticDefaultImports9.js -+++ new.allowSyntheticDefaultImports9.js -@@= skipped -15, +15 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var b_1 = __importDefault(require("./b")); -+const b_1 = __importDefault(require("./b")); - b_1.default.bar(); - b_1.default.foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.js.diff deleted file mode 100644 index 6c8338cf1e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.js -+++ new.allowSyntheticDefaultImportsCanPaintCrossModuleDeclaration.js -@@= skipped -21, +21 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.A = void 0; --var file1_1 = require("./file1"); -+const file1_1 = require("./file1"); - exports.A = (0, file1_1.styled)(); - diff --git a/testdata/baselines/reference/submodule/compiler/ambientExternalModuleInAnotherExternalModule.js.diff b/testdata/baselines/reference/submodule/compiler/ambientExternalModuleInAnotherExternalModule.js.diff deleted file mode 100644 index a0ce2f8517..0000000000 --- a/testdata/baselines/reference/submodule/compiler/ambientExternalModuleInAnotherExternalModule.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.ambientExternalModuleInAnotherExternalModule.js -+++ new.ambientExternalModuleInAnotherExternalModule.js -@@= skipped -16, +16 lines =@@ - class D { - } - // Cannot resolve this ext module reference --var ext = require("ext"); -+const ext = require("ext"); - var x = ext; - module.exports = D; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/amdDependencyComment1.js.diff b/testdata/baselines/reference/submodule/compiler/amdDependencyComment1.js.diff deleted file mode 100644 index de0a9033ec..0000000000 --- a/testdata/baselines/reference/submodule/compiler/amdDependencyComment1.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.amdDependencyComment1.js -+++ new.amdDependencyComment1.js -@@= skipped -9, +9 lines =@@ - "use strict"; - /// - Object.defineProperty(exports, "__esModule", { value: true }); --var m1 = require("m2"); -+const m1 = require("m2"); - m1.f(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/amdDependencyCommentName1.js.diff b/testdata/baselines/reference/submodule/compiler/amdDependencyCommentName1.js.diff deleted file mode 100644 index 98845f5611..0000000000 --- a/testdata/baselines/reference/submodule/compiler/amdDependencyCommentName1.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.amdDependencyCommentName1.js -+++ new.amdDependencyCommentName1.js -@@= skipped -9, +9 lines =@@ - "use strict"; - /// - Object.defineProperty(exports, "__esModule", { value: true }); --var m1 = require("m2"); -+const m1 = require("m2"); - m1.f(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/anonClassDeclarationEmitIsAnon.js.diff b/testdata/baselines/reference/submodule/compiler/anonClassDeclarationEmitIsAnon.js.diff index 211600ef2e..2b40a28b20 100644 --- a/testdata/baselines/reference/submodule/compiler/anonClassDeclarationEmitIsAnon.js.diff +++ b/testdata/baselines/reference/submodule/compiler/anonClassDeclarationEmitIsAnon.js.diff @@ -12,11 +12,7 @@ }; } //// [index.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.TimestampedUser = exports.User = void 0; --var wrapClass_1 = require("./wrapClass"); -+const wrapClass_1 = require("./wrapClass"); +@@= skipped -14, +11 lines =@@ exports.default = (0, wrapClass_1.wrapClass)(0); // Simple class class User { diff --git a/testdata/baselines/reference/submodule/compiler/anyAndUnknownHaveFalsyComponents.js b/testdata/baselines/reference/submodule/compiler/anyAndUnknownHaveFalsyComponents.js index e793b344ad..57b2108428 100644 --- a/testdata/baselines/reference/submodule/compiler/anyAndUnknownHaveFalsyComponents.js +++ b/testdata/baselines/reference/submodule/compiler/anyAndUnknownHaveFalsyComponents.js @@ -31,26 +31,15 @@ function foo2() { //// [anyAndUnknownHaveFalsyComponents.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; const y1 = x1 && 3; function foo1() { - return __assign({ display: "block" }, (isTreeHeader1 && { + return Object.assign({ display: "block" }, (isTreeHeader1 && { display: "flex", })); } const y2 = x2 && 3; function foo2() { - return __assign({ display: "block" }, (isTreeHeader1 && { + return Object.assign({ display: "block" }, (isTreeHeader1 && { display: "flex", })); } diff --git a/testdata/baselines/reference/submodule/compiler/assertionFunctionWildcardImport1.js.diff b/testdata/baselines/reference/submodule/compiler/assertionFunctionWildcardImport1.js.diff deleted file mode 100644 index 79c4471801..0000000000 --- a/testdata/baselines/reference/submodule/compiler/assertionFunctionWildcardImport1.js.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.assertionFunctionWildcardImport1.js -+++ new.assertionFunctionWildcardImport1.js -@@= skipped -67, +67 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Debug = void 0; --var Debug = __importStar(require("../debug")); -+const Debug = __importStar(require("../debug")); - exports.Debug = Debug; - //// [foo.js] - "use strict"; -@@= skipped -38, +38 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var ts = __importStar(require("./_namespaces/ts")); --var ts_1 = require("./_namespaces/ts"); -+const ts = __importStar(require("./_namespaces/ts")); -+const ts_1 = require("./_namespaces/ts"); - ts.Debug.assert(true); - ts_1.Debug.assert(true); - //// [ts.js] -@@= skipped -58, +58 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var ts = __importStar(require("./_namespaces/ts")); --var ts_1 = require("./_namespaces/ts"); -+const ts = __importStar(require("./_namespaces/ts")); -+const ts_1 = require("./_namespaces/ts"); - ts.Debug.assert(true); - ts_1.Debug.assert(true); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/assertionFunctionWildcardImport2.js.diff b/testdata/baselines/reference/submodule/compiler/assertionFunctionWildcardImport2.js.diff deleted file mode 100644 index bf6949f146..0000000000 --- a/testdata/baselines/reference/submodule/compiler/assertionFunctionWildcardImport2.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.assertionFunctionWildcardImport2.js -+++ new.assertionFunctionWildcardImport2.js -@@= skipped -64, +64 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var asserts = __importStar(require("./asserts")); -+const asserts = __importStar(require("./asserts")); - function test(obj) { - asserts.isNonNullable(obj); - obj.trim(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/asyncArrowInClassES5.js.diff b/testdata/baselines/reference/submodule/compiler/asyncArrowInClassES5.js.diff index 27a288a967..27259ce322 100644 --- a/testdata/baselines/reference/submodule/compiler/asyncArrowInClassES5.js.diff +++ b/testdata/baselines/reference/submodule/compiler/asyncArrowInClassES5.js.diff @@ -4,14 +4,9 @@ //// [asyncArrowInClassES5.js] // https://github.com/Microsoft/TypeScript/issues/16924 // Should capture `this` --let Test = (() => { -- var _a; -- class Test { -- } -- _a = Test; -- Test.member = (x) => __awaiter(_a, void 0, void 0, function* () { }); -- return Test; --})(); -+class Test { +-var _a; + class Test { + static member = async (x) => { }; -+} \ No newline at end of file + } +-_a = Test; +-Test.member = (x) => __awaiter(_a, void 0, void 0, function* () { }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/asyncFunctionReturnExpressionErrorSpans.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/asyncFunctionReturnExpressionErrorSpans.errors.txt.diff deleted file mode 100644 index 72beb7473c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/asyncFunctionReturnExpressionErrorSpans.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.asyncFunctionReturnExpressionErrorSpans.errors.txt -+++ new.asyncFunctionReturnExpressionErrorSpans.errors.txt -@@= skipped -0, +0 lines =@@ --asyncFunctionReturnExpressionErrorSpans.ts(11,28): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - asyncFunctionReturnExpressionErrorSpans.ts(16,21): error TS2322: Type 'number' is not assignable to type 'string'. - - --==== asyncFunctionReturnExpressionErrorSpans.ts (2 errors) ==== -+==== asyncFunctionReturnExpressionErrorSpans.ts (1 errors) ==== - interface Foo { - bar: { - baz: { -@@= skipped -13, +12 lines =@@ - } - - async function asyncFoo(): Promise { -- ~~~~~~~~~~~~ --!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - return { - bar: { - baz: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/asyncImportNestedYield.js.diff b/testdata/baselines/reference/submodule/compiler/asyncImportNestedYield.js.diff index db8e2cd81b..499a337e4f 100644 --- a/testdata/baselines/reference/submodule/compiler/asyncImportNestedYield.js.diff +++ b/testdata/baselines/reference/submodule/compiler/asyncImportNestedYield.js.diff @@ -19,7 +19,7 @@ -}; -function foo() { - return __asyncGenerator(this, arguments, function* foo_1() { -- Promise.resolve("".concat((yield __await(Promise.resolve("".concat(yield yield __await("foo"))).then(function (s) { return __importStar(require(s)); }))).default)).then(function (s) { return __importStar(require(s)); }); +- Promise.resolve(`${(yield __await(Promise.resolve(`${yield yield __await("foo")}`).then(s => __importStar(require(s))))).default}`).then(s => __importStar(require(s))); - }); +async function* foo() { + Promise.resolve(`${(await Promise.resolve(`${yield "foo"}`).then(s => __importStar(require(s)))).default}`).then(s => __importStar(require(s))); diff --git a/testdata/baselines/reference/submodule/compiler/augmentExportEquals3.js.diff b/testdata/baselines/reference/submodule/compiler/augmentExportEquals3.js.diff deleted file mode 100644 index 898c818540..0000000000 --- a/testdata/baselines/reference/submodule/compiler/augmentExportEquals3.js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.augmentExportEquals3.js -+++ new.augmentExportEquals3.js -@@= skipped -32, +32 lines =@@ - //// [file2.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var x = require("./file1"); -+const x = require("./file1"); - x.b = 1; - //// [file3.js] - "use strict"; -@@= skipped -38, +38 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var x = __importStar(require("./file1")); -+const x = __importStar(require("./file1")); - require("./file2"); - let a; - let b = x.b; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/augmentExportEquals4.js.diff b/testdata/baselines/reference/submodule/compiler/augmentExportEquals4.js.diff deleted file mode 100644 index a781171be5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/augmentExportEquals4.js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.augmentExportEquals4.js -+++ new.augmentExportEquals4.js -@@= skipped -33, +33 lines =@@ - //// [file2.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var x = require("./file1"); -+const x = require("./file1"); - x.b = 1; - //// [file3.js] - "use strict"; -@@= skipped -38, +38 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var x = __importStar(require("./file1")); -+const x = __importStar(require("./file1")); - require("./file2"); - let a; - let b = x.b; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/augmentExportEquals6.js.diff b/testdata/baselines/reference/submodule/compiler/augmentExportEquals6.js.diff deleted file mode 100644 index a2e50f5a74..0000000000 --- a/testdata/baselines/reference/submodule/compiler/augmentExportEquals6.js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.augmentExportEquals6.js -+++ new.augmentExportEquals6.js -@@= skipped -42, +42 lines =@@ - //// [file2.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var x = require("./file1"); -+const x = require("./file1"); - x.B.b = 1; - //// [file3.js] - "use strict"; -@@= skipped -38, +38 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var x = __importStar(require("./file1")); -+const x = __importStar(require("./file1")); - require("./file2"); - let a; - let b = a.a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/autolift4.js.diff b/testdata/baselines/reference/submodule/compiler/autolift4.js.diff index 425be45ce6..142cca6b30 100644 --- a/testdata/baselines/reference/submodule/compiler/autolift4.js.diff +++ b/testdata/baselines/reference/submodule/compiler/autolift4.js.diff @@ -1,34 +1,21 @@ --- old.autolift4.js +++ new.autolift4.js -@@= skipped -25, +25 lines =@@ - +@@= skipped -26, +26 lines =@@ //// [autolift4.js] --let Point = (() => { -- class Point { -- constructor(x, y) { -- this.x = x; -- this.y = y; -- } -- getDist() { -- return Math.sqrt(this.x * this.x + this.y * this.y); -- } -- } -- Point.origin = new Point(0, 0); -- return Point; --})(); -+class Point { + class Point { + x; + y; -+ constructor(x, y) { -+ this.x = x; -+ this.y = y; -+ } -+ getDist() { -+ return Math.sqrt(this.x * this.x + this.y * this.y); -+ } + constructor(x, y) { + this.x = x; + this.y = y; +@@= skipped -7, +9 lines =@@ + getDist() { + return Math.sqrt(this.x * this.x + this.y * this.y); + } + static origin = new Point(0, 0); -+} + } +-Point.origin = new Point(0, 0); class Point3D extends Point { + z; constructor(x, y, z, m) { diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt.diff deleted file mode 100644 index a92cdeb5e1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationInStrictClass.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.blockScopedFunctionDeclarationInStrictClass.errors.txt -+++ new.blockScopedFunctionDeclarationInStrictClass.errors.txt -@@= skipped -0, +0 lines =@@ --blockScopedFunctionDeclarationInStrictClass.ts(4,22): error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. Class definitions are automatically in strict mode. - blockScopedFunctionDeclarationInStrictClass.ts(7,9): error TS2304: Cannot find name 'foo'. - - --==== blockScopedFunctionDeclarationInStrictClass.ts (2 errors) ==== -+==== blockScopedFunctionDeclarationInStrictClass.ts (1 errors) ==== - class c { - method() { - if (true) { - function foo() { } -- ~~~ --!!! error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. Class definitions are automatically in strict mode. - foo(); // ok - } - foo(); // not ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt.diff deleted file mode 100644 index 9c8c1bcd6c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/blockScopedFunctionDeclarationStrictES5.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.blockScopedFunctionDeclarationStrictES5.errors.txt -+++ new.blockScopedFunctionDeclarationStrictES5.errors.txt -@@= skipped -0, +0 lines =@@ --blockScopedFunctionDeclarationStrictES5.ts(3,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - blockScopedFunctionDeclarationStrictES5.ts(6,1): error TS2304: Cannot find name 'foo'. - - --==== blockScopedFunctionDeclarationStrictES5.ts (2 errors) ==== -+==== blockScopedFunctionDeclarationStrictES5.ts (1 errors) ==== - "use strict"; - if (true) { - function foo() { } // Error to declare function in block scope -- ~~~ --!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - foo(); // This call should be ok - } - foo(); // Error to find name foo \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt.diff deleted file mode 100644 index dcc648a56c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.blockScopedSameNameFunctionDeclarationStrictES5.errors.txt -+++ new.blockScopedSameNameFunctionDeclarationStrictES5.errors.txt -@@= skipped -0, +0 lines =@@ --blockScopedSameNameFunctionDeclarationStrictES5.ts(4,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - blockScopedSameNameFunctionDeclarationStrictES5.ts(6,13): error TS2554: Expected 0 arguments, but got 1. --blockScopedSameNameFunctionDeclarationStrictES5.ts(9,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - blockScopedSameNameFunctionDeclarationStrictES5.ts(11,13): error TS2554: Expected 0 arguments, but got 1. - blockScopedSameNameFunctionDeclarationStrictES5.ts(14,5): error TS2554: Expected 1 arguments, but got 0. - blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): error TS2554: Expected 1 arguments, but got 0. - - --==== blockScopedSameNameFunctionDeclarationStrictES5.ts (6 errors) ==== -+==== blockScopedSameNameFunctionDeclarationStrictES5.ts (4 errors) ==== - "use strict"; - function foo(a: number) { - if (a === 1) { - function foo() { } // Error to declare function in block scope -- ~~~ --!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - foo(); - foo(10); // not ok - ~~ -@@= skipped -19, +15 lines =@@ - } - else { - function foo() { } // Error to declare function in block scope -- ~~~ --!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. - foo(); - foo(10); // not ok - ~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/blockScopedVariablesUseBeforeDef.js.diff b/testdata/baselines/reference/submodule/compiler/blockScopedVariablesUseBeforeDef.js.diff index 6ccdd13b93..643fa59775 100644 --- a/testdata/baselines/reference/submodule/compiler/blockScopedVariablesUseBeforeDef.js.diff +++ b/testdata/baselines/reference/submodule/compiler/blockScopedVariablesUseBeforeDef.js.diff @@ -66,15 +66,10 @@ let x; } function foo10() { -- let A = (() => { -- class A { -- } -- A.a = x; -- return A; -- })(); -+ class A { + class A { + static a = x; -+ } + } +- A.a = x; let x; } function foo11() { @@ -98,7 +93,7 @@ constructor() { this.a = x; } -@@= skipped -81, +69 lines =@@ +@@= skipped -78, +69 lines =@@ let [a] = (() => a)(); } function foo17() { diff --git a/testdata/baselines/reference/submodule/compiler/callsOnComplexSignatures.js.diff b/testdata/baselines/reference/submodule/compiler/callsOnComplexSignatures.js.diff deleted file mode 100644 index 2f48bfa689..0000000000 --- a/testdata/baselines/reference/submodule/compiler/callsOnComplexSignatures.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.callsOnComplexSignatures.js -+++ new.callsOnComplexSignatures.js -@@= skipped -112, +112 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var react_1 = __importDefault(require("react")); -+const react_1 = __importDefault(require("react")); - // Simple calls from real usecases - function test1() { - function test(t) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/capturedParametersInInitializers2.js.diff b/testdata/baselines/reference/submodule/compiler/capturedParametersInInitializers2.js.diff index e208cc7efa..b8e7399dfd 100644 --- a/testdata/baselines/reference/submodule/compiler/capturedParametersInInitializers2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/capturedParametersInInitializers2.js.diff @@ -8,15 +8,18 @@ - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); -}; --function foo(y = (_a = class { -- get [x]() { return x; } -- constructor() { x; } -- [z]() { return z; } -- }, -- __setFunctionName(_a, "y"), -- _a.c = x, -- _a), x = 1, z = 2) { +-function foo(y, x, z) { - var _a; +- if (y === void 0) { y = (_a = class { +- get [x]() { return x; } +- constructor() { x; } +- [z]() { return z; } +- }, +- __setFunctionName(_a, "y"), +- _a.c = x, +- _a); } +- if (x === void 0) { x = 1; } +- if (z === void 0) { z = 2; } +function foo(y = class { + static c = x; + get [x]() { return x; } @@ -25,14 +28,16 @@ +}, x = 1, z = 2) { y.c; } --function foo2(y = (_a = class { -- constructor() { -- this[_b] = x; -- } -- }, -- _b = x, -- _a), x = 1) { -- var _b, _a; +-function foo2(y, x) { +- var _a, _b; +- if (y === void 0) { y = (_b = class { +- constructor() { +- this[_a] = x; +- } +- }, +- _a = x, +- _b); } +- if (x === void 0) { x = 1; } +function foo2(y = class { + [x] = x; +}, x = 1) { diff --git a/testdata/baselines/reference/submodule/compiler/chainedImportAlias.js.diff b/testdata/baselines/reference/submodule/compiler/chainedImportAlias.js.diff index d1d1a1bbbd..aeaadd6c45 100644 --- a/testdata/baselines/reference/submodule/compiler/chainedImportAlias.js.diff +++ b/testdata/baselines/reference/submodule/compiler/chainedImportAlias.js.diff @@ -1,10 +1,8 @@ --- old.chainedImportAlias.js +++ new.chainedImportAlias.js -@@= skipped -22, +22 lines =@@ - //// [chainedImportAlias_file1.js] +@@= skipped -23, +23 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); --var x = require("./chainedImportAlias_file0"); + const x = require("./chainedImportAlias_file0"); -var y = x; -+const x = require("./chainedImportAlias_file0"); y.m.foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.js.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.js.diff deleted file mode 100644 index d196532b84..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment1.js -+++ new.checkJsdocTypeTagOnExportAssignment1.js -@@= skipped -33, +33 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var a_1 = __importDefault(require("./a")); -+const a_1 = __importDefault(require("./a")); - a_1.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.js.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.js.diff deleted file mode 100644 index 6238a28034..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment2.js -+++ new.checkJsdocTypeTagOnExportAssignment2.js -@@= skipped -31, +31 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var b_1 = __importDefault(require("./b")); -+const b_1 = __importDefault(require("./b")); - b_1.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.js.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.js.diff deleted file mode 100644 index 77c151c3e4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment3.js -+++ new.checkJsdocTypeTagOnExportAssignment3.js -@@= skipped -36, +36 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var a_1 = __importDefault(require("./a")); -+const a_1 = __importDefault(require("./a")); - a_1.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.js.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.js.diff deleted file mode 100644 index 1c86e1e49b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment5.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment5.js -+++ new.checkJsdocTypeTagOnExportAssignment5.js -@@= skipped -33, +33 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var a_1 = __importDefault(require("./a")); -+const a_1 = __importDefault(require("./a")); - a_1.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.js.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.js.diff deleted file mode 100644 index d7bf707e0f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment6.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment6.js -+++ new.checkJsdocTypeTagOnExportAssignment6.js -@@= skipped -33, +33 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var a_1 = __importDefault(require("./a")); -+const a_1 = __importDefault(require("./a")); - a_1.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.js.diff b/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.js.diff deleted file mode 100644 index ed5775a164..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment7.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.checkJsdocTypeTagOnExportAssignment7.js -+++ new.checkJsdocTypeTagOnExportAssignment7.js -@@= skipped -36, +36 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var a_1 = __importDefault(require("./a")); -+const a_1 = __importDefault(require("./a")); - a_1.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsxNotSetError.js.diff b/testdata/baselines/reference/submodule/compiler/checkJsxNotSetError.js.diff deleted file mode 100644 index ee74eaaf13..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsxNotSetError.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.checkJsxNotSetError.js -+++ new.checkJsxNotSetError.js -@@= skipped -20, +20 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var foo_1 = __importDefault(require("/foo")); -+const foo_1 = __importDefault(require("/foo")); - const a = ; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/class2.js.diff b/testdata/baselines/reference/submodule/compiler/class2.js.diff index 77299a1995..16c2b84804 100644 --- a/testdata/baselines/reference/submodule/compiler/class2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/class2.js.diff @@ -1,17 +1,9 @@ --- old.class2.js +++ new.class2.js -@@= skipped -3, +3 lines =@@ - class foo { constructor() { static f = 3; } } - +@@= skipped -5, +5 lines =@@ //// [class2.js] --let foo = (() => { -- class foo { -- constructor() { } -- } -- foo.f = 3; -- return foo; --})(); -+class foo { -+ constructor() { } + class foo { + constructor() { } + static f = 3; -+} \ No newline at end of file + } +-foo.f = 3; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/classBlockScoping.js.diff b/testdata/baselines/reference/submodule/compiler/classBlockScoping.js.diff index 567f5e7605..17f2c3b975 100644 --- a/testdata/baselines/reference/submodule/compiler/classBlockScoping.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classBlockScoping.js.diff @@ -29,27 +29,16 @@ new Foo(); } else { -- let Foo = (() => { -- class Foo { -- static x() { -- new Foo(); -- } -- m() { -- new Foo(); -- } -- } -- Foo.y = new Foo(); -- return Foo; -- })(); -+ class Foo { + class Foo { + static y = new Foo(); -+ static x() { -+ new Foo(); -+ } -+ m() { -+ new Foo(); -+ } -+ } + static x() { + new Foo(); + } +@@= skipped -24, +23 lines =@@ + new Foo(); + } + } +- Foo.y = new Foo(); new Foo(); } } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.js.diff b/testdata/baselines/reference/submodule/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.js.diff index 7801fd670c..e4a37da834 100644 --- a/testdata/baselines/reference/submodule/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.js.diff @@ -4,29 +4,23 @@ //// [classDeclarationShouldBeOutOfScopeInComputedNames.js] --let A = (() => { -- var _a, _b; -- class A { -- constructor() { -- this[_b] = 0; -- } -- static [(_a = A.p1, A.p2)]() { return 0; } -- ; -- [A.p1]() { } +-var _a, _b; + class A { +- constructor() { +- this[_b] = 0; - } -- _b = A.p2; -- A.p1 = Symbol(); -- A.p2 = Symbol(); -+class A { +- static [(_a = A.p1, A.p2)]() { return 0; } + static p1 = Symbol(); + static p2 = Symbol(); - // All of the below should be out of scope or TDZ - `A` has not finished being constructed as they are executed -- A[_a] = 0; -- return A; --})(); ++ // All of the below should be out of scope or TDZ - `A` has not finished being constructed as they are executed + static [A.p1] = 0; + static [A.p2]() { return 0; } -+ ; -+ [A.p1]() { } + ; + [A.p1]() { } + [A.p2] = 0; -+} \ No newline at end of file + } +-_b = A.p2; +-A.p1 = Symbol(); +-A.p2 = Symbol(); +-// All of the below should be out of scope or TDZ - `A` has not finished being constructed as they are executed +-A[_a] = 0; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/classExpressionInClassStaticDeclarations.js.diff b/testdata/baselines/reference/submodule/compiler/classExpressionInClassStaticDeclarations.js.diff index a9267943fe..83f7c77a2a 100644 --- a/testdata/baselines/reference/submodule/compiler/classExpressionInClassStaticDeclarations.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classExpressionInClassStaticDeclarations.js.diff @@ -1,19 +1,14 @@ --- old.classExpressionInClassStaticDeclarations.js +++ new.classExpressionInClassStaticDeclarations.js -@@= skipped -5, +5 lines =@@ - } +@@= skipped -6, +6 lines =@@ //// [classExpressionInClassStaticDeclarations.js] --let C = (() => { -- class C { -- } -- C.D = class extends C { -+class C { + class C { + static D = class extends C { - }; -- return C; --})(); -+} ++ }; + } +-C.D = class extends C { +-}; //// [classExpressionInClassStaticDeclarations.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/classExpressionWithStaticProperties3.js.diff b/testdata/baselines/reference/submodule/compiler/classExpressionWithStaticProperties3.js.diff index 923d045ae3..fc596b8c32 100644 --- a/testdata/baselines/reference/submodule/compiler/classExpressionWithStaticProperties3.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classExpressionWithStaticProperties3.js.diff @@ -1,10 +1,12 @@ --- old.classExpressionWithStaticProperties3.js +++ new.classExpressionWithStaticProperties3.js -@@= skipped -13, +13 lines =@@ +@@= skipped -11, +11 lines =@@ + arr.forEach(C => console.log(C.y())); + //// [classExpressionWithStaticProperties3.js] +-var _a; const arr = []; for (let i = 0; i < 3; i++) { -- let _a; - arr.push((_a = class C { - }, - _a.x = i, diff --git a/testdata/baselines/reference/submodule/compiler/classExtendsAcrossFiles.js.diff b/testdata/baselines/reference/submodule/compiler/classExtendsAcrossFiles.js.diff deleted file mode 100644 index d27eb5143d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/classExtendsAcrossFiles.js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.classExtendsAcrossFiles.js -+++ new.classExtendsAcrossFiles.js -@@= skipped -22, +22 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.b = void 0; --var a_1 = require("./a"); -+const a_1 = require("./a"); - exports.b = { - f: () => { - class A { -@@= skipped -14, +14 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.a = void 0; --var b_1 = require("./b"); -+const b_1 = require("./b"); - exports.a = { - f: () => { - class A { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/classInConvertedLoopES5.js.diff b/testdata/baselines/reference/submodule/compiler/classInConvertedLoopES5.js.diff index 3efec32be8..f281641cf2 100644 --- a/testdata/baselines/reference/submodule/compiler/classInConvertedLoopES5.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classInConvertedLoopES5.js.diff @@ -1,21 +1,15 @@ --- old.classInConvertedLoopES5.js +++ new.classInConvertedLoopES5.js -@@= skipped -13, +13 lines =@@ - //// [classInConvertedLoopES5.js] +@@= skipped -14, +14 lines =@@ const classesByRow = {}; for (const row of ['1', '2', '3', '4', '5']) { -- let RowClass = (() => { -- class RowClass { -- constructor() { -- this.row = row; -- } + class RowClass { +- constructor() { +- this.row = row; - } -- RowClass.factory = () => new RowClass(); -- return RowClass; -- })(); -+ class RowClass { + row = row; + static factory = () => new RowClass(); -+ } + } +- RowClass.factory = () => new RowClass(); classesByRow[row] = RowClass; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/classMemberInitializerScoping.js.diff b/testdata/baselines/reference/submodule/compiler/classMemberInitializerScoping.js.diff index 8f41ee3304..a0f8ce4fe7 100644 --- a/testdata/baselines/reference/submodule/compiler/classMemberInitializerScoping.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classMemberInitializerScoping.js.diff @@ -1,25 +1,17 @@ --- old.classMemberInitializerScoping.js +++ new.classMemberInitializerScoping.js -@@= skipped -23, +23 lines =@@ - +@@= skipped -24, +24 lines =@@ //// [classMemberInitializerScoping.js] var aaa = 1; --let CCC = (() => { -- class CCC { -- constructor(aaa) { -- this.y = aaa; -- this.y = ''; // was: error, cannot assign string to number -- } -+class CCC { + class CCC { + y = aaa; + static staticY = aaa; // This shouldnt be error -+ constructor(aaa) { -+ this.y = ''; // was: error, cannot assign string to number + constructor(aaa) { +- this.y = aaa; + this.y = ''; // was: error, cannot assign string to number } -- CCC.staticY = aaa; // This shouldnt be error -- return CCC; --})(); -+} + } +-CCC.staticY = aaa; // This shouldnt be error // above is equivalent to this: var aaaa = 1; class CCCC { diff --git a/testdata/baselines/reference/submodule/compiler/classMemberInitializerWithLamdaScoping.js.diff b/testdata/baselines/reference/submodule/compiler/classMemberInitializerWithLamdaScoping.js.diff index a8bac01050..1c37fe0f95 100644 --- a/testdata/baselines/reference/submodule/compiler/classMemberInitializerWithLamdaScoping.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classMemberInitializerWithLamdaScoping.js.diff @@ -1,61 +1,51 @@ --- old.classMemberInitializerWithLamdaScoping.js +++ new.classMemberInitializerWithLamdaScoping.js -@@= skipped -32, +32 lines =@@ - } +@@= skipped -33, +33 lines =@@ //// [classMemberInitializerWithLamdaScoping.js] --let Test = (() => { -- class Test { -- constructor(field) { -- this.field = field; -- this.messageHandler = () => { -- var field = this.field; -- console.log(field); // Using field here shouldnt be error -- }; -- } -+class Test { + class Test { + field; -+ constructor(field) { -+ this.field = field; + constructor(field) { + this.field = field; +- this.messageHandler = () => { +- var field = this.field; +- console.log(field); // Using field here shouldnt be error +- }; } -- Test.staticMessageHandler = () => { + messageHandler = () => { + var field = this.field; + console.log(field); // Using field here shouldnt be error + }; + static field; + static staticMessageHandler = () => { - var field = Test.field; - console.log(field); // Using field here shouldnt be error - }; -- return Test; --})(); -+} ++ var field = Test.field; ++ console.log(field); // Using field here shouldnt be error ++ }; + } +-Test.staticMessageHandler = () => { +- var field = Test.field; +- console.log(field); // Using field here shouldnt be error +-}; var field1; --let Test1 = (() => { -- class Test1 { -- constructor(field1) { -- this.field1 = field1; -- this.messageHandler = () => { -- console.log(field1); // But this should be error as the field1 will resolve to var field1 -- // but since this code would be generated inside constructor, in generated js -- // it would resolve to private field1 and thats not what user intended here. -- }; -- } -+class Test1 { + class Test1 { + field1; -+ constructor(field1) { -+ this.field1 = field1; + constructor(field1) { + this.field1 = field1; +- this.messageHandler = () => { +- console.log(field1); // But this should be error as the field1 will resolve to var field1 +- // but since this code would be generated inside constructor, in generated js +- // it would resolve to private field1 and thats not what user intended here. +- }; } -- Test1.staticMessageHandler = () => { + messageHandler = () => { + console.log(field1); // But this should be error as the field1 will resolve to var field1 + // but since this code would be generated inside constructor, in generated js + // it would resolve to private field1 and thats not what user intended here. + }; + static staticMessageHandler = () => { - console.log(field1); // This shouldnt be error as its a static property - }; -- return Test1; --})(); -+} \ No newline at end of file ++ console.log(field1); // This shouldnt be error as its a static property ++ }; + } +-Test1.staticMessageHandler = () => { +- console.log(field1); // This shouldnt be error as its a static property +-}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/classStaticInitializersUsePropertiesBeforeDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/classStaticInitializersUsePropertiesBeforeDeclaration.js.diff index 79bc13238b..fab9d28d9f 100644 --- a/testdata/baselines/reference/submodule/compiler/classStaticInitializersUsePropertiesBeforeDeclaration.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classStaticInitializersUsePropertiesBeforeDeclaration.js.diff @@ -1,22 +1,16 @@ --- old.classStaticInitializersUsePropertiesBeforeDeclaration.js +++ new.classStaticInitializersUsePropertiesBeforeDeclaration.js -@@= skipped -20, +20 lines =@@ - +@@= skipped -21, +21 lines =@@ //// [classStaticInitializersUsePropertiesBeforeDeclaration.js] --let Foo = (() => { -- class Foo { -- } -- Foo.enumMember = Enum.A; -- Foo.objLiteralMember = ObjLiteral.A; -- Foo.namespaceMember = Namespace.A; -- return Foo; --})(); -+class Foo { + class Foo { + static enumMember = Enum.A; + static objLiteralMember = ObjLiteral.A; + static namespaceMember = Namespace.A; -+} + } +-Foo.enumMember = Enum.A; +-Foo.objLiteralMember = ObjLiteral.A; +-Foo.namespaceMember = Namespace.A; var Enum; (function (Enum) { Enum[Enum["A"] = 0] = "A"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/classStaticPropertyAccess.js.diff b/testdata/baselines/reference/submodule/compiler/classStaticPropertyAccess.js.diff index 6be9d96ae2..2497d8fdfb 100644 --- a/testdata/baselines/reference/submodule/compiler/classStaticPropertyAccess.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classStaticPropertyAccess.js.diff @@ -5,21 +5,15 @@ //// [classStaticPropertyAccess.js] -"use strict"; --let A = (() => { -- class A { -- static "\""() { } -- } -- A.x = 1; -- A.y = 1; -- A._b = 2; -- return A; --})(); -+class A { -+ static "\""() { } + class A { + static "\""() { } + static x = 1; + static y = 1; + static _b = 2; -+} + } +-A.x = 1; +-A.y = 1; +-A._b = 2; const a = new A(); a["\""]; // Error a['y']; // Error \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/cloduleStaticMembers.js.diff b/testdata/baselines/reference/submodule/compiler/cloduleStaticMembers.js.diff index 97ee21132c..4e32ce7670 100644 --- a/testdata/baselines/reference/submodule/compiler/cloduleStaticMembers.js.diff +++ b/testdata/baselines/reference/submodule/compiler/cloduleStaticMembers.js.diff @@ -1,20 +1,14 @@ --- old.cloduleStaticMembers.js +++ new.cloduleStaticMembers.js -@@= skipped -14, +14 lines =@@ - +@@= skipped -15, +15 lines =@@ //// [cloduleStaticMembers.js] --let Clod = (() => { -- class Clod { -- } -- Clod.x = 10; -- Clod.y = 10; -- return Clod; --})(); -+class Clod { + class Clod { + static x = 10; + static y = 10; -+} + } +-Clod.x = 10; +-Clod.y = 10; (function (Clod) { var p = Clod.x; var q = x; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/collisionArgumentsArrowFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/collisionArgumentsArrowFunctions.errors.txt.diff deleted file mode 100644 index f96cac74e5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/collisionArgumentsArrowFunctions.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.collisionArgumentsArrowFunctions.errors.txt -+++ new.collisionArgumentsArrowFunctions.errors.txt -@@= skipped -0, +0 lines =@@ --collisionArgumentsArrowFunctions.ts(1,22): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. --collisionArgumentsArrowFunctions.ts(4,12): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- -- --==== collisionArgumentsArrowFunctions.ts (2 errors) ==== -- var f1 = (i: number, ...arguments) => { //arguments is error -- ~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- var arguments: any[]; // no error -- } -- var f12 = (arguments: number, ...rest) => { //arguments is error -- ~~~~~~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- var arguments = 10; // no error -- } -- var f1NoError = (arguments: number) => { // no error -- var arguments = 10; // no error -- } -- -- var f2 = (...restParameters) => { -- var arguments = 10; // No Error -- } -- var f2NoError = () => { -- var arguments = 10; // no error -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/collisionArgumentsClassConstructor.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/collisionArgumentsClassConstructor.errors.txt.diff deleted file mode 100644 index 93aee44d32..0000000000 --- a/testdata/baselines/reference/submodule/compiler/collisionArgumentsClassConstructor.errors.txt.diff +++ /dev/null @@ -1,80 +0,0 @@ ---- old.collisionArgumentsClassConstructor.errors.txt -+++ new.collisionArgumentsClassConstructor.errors.txt -@@= skipped -0, +0 lines =@@ --collisionArgumentsClassConstructor.ts(3,28): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - collisionArgumentsClassConstructor.ts(3,31): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(4,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(8,17): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. --collisionArgumentsClassConstructor.ts(8,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - collisionArgumentsClassConstructor.ts(9,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(13,17): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(14,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(20,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(25,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. --collisionArgumentsClassConstructor.ts(30,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - collisionArgumentsClassConstructor.ts(30,24): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(31,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(35,24): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(36,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(51,31): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(52,31): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. --collisionArgumentsClassConstructor.ts(53,25): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - collisionArgumentsClassConstructor.ts(53,28): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(54,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(59,17): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(60,17): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(61,17): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. --collisionArgumentsClassConstructor.ts(61,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - collisionArgumentsClassConstructor.ts(62,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(67,17): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassConstructor.ts(68,17): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. -@@= skipped -28, +23 lines =@@ - collisionArgumentsClassConstructor.ts(70,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - - --==== collisionArgumentsClassConstructor.ts (29 errors) ==== -+==== collisionArgumentsClassConstructor.ts (24 errors) ==== - // Constructors - class c1 { - constructor(i: number, ...arguments) { // error -- ~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - var arguments: any[]; // no error -@@= skipped -17, +15 lines =@@ - constructor(arguments: number, ...rest) { // error - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. -- ~~~~~~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - var arguments = 10; // no error - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. -@@= skipped -34, +32 lines =@@ - - class c3 { - constructor(public arguments: number, ...restParameters) { //arguments is error -- ~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - var arguments = 10; // no error -@@= skipped -37, +35 lines =@@ - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - constructor(i: any, ...arguments) { // error -- ~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - var arguments: any[]; // no error -@@= skipped -20, +18 lines =@@ - constructor(arguments: any, ...rest) { // error - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. -- ~~~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - var arguments: any; // no error - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/collisionArgumentsClassMethod.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/collisionArgumentsClassMethod.errors.txt.diff deleted file mode 100644 index 7b28f2f76d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/collisionArgumentsClassMethod.errors.txt.diff +++ /dev/null @@ -1,63 +0,0 @@ ---- old.collisionArgumentsClassMethod.errors.txt -+++ new.collisionArgumentsClassMethod.errors.txt -@@= skipped -0, +0 lines =@@ --collisionArgumentsClassMethod.ts(2,27): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - collisionArgumentsClassMethod.ts(2,30): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(3,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(5,17): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. --collisionArgumentsClassMethod.ts(5,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - collisionArgumentsClassMethod.ts(6,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(8,23): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(9,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(11,29): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(12,29): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. --collisionArgumentsClassMethod.ts(13,23): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - collisionArgumentsClassMethod.ts(13,26): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(14,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(16,16): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(17,16): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(18,16): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. --collisionArgumentsClassMethod.ts(18,16): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - collisionArgumentsClassMethod.ts(19,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(21,22): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - collisionArgumentsClassMethod.ts(22,22): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. -@@= skipped -23, +19 lines =@@ - collisionArgumentsClassMethod.ts(46,13): error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - - --==== collisionArgumentsClassMethod.ts (24 errors) ==== -+==== collisionArgumentsClassMethod.ts (20 errors) ==== - class c1 { - public foo(i: number, ...arguments) { //arguments is error -- ~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - var arguments: any[]; // no error -@@= skipped -14, +12 lines =@@ - public foo1(arguments: number, ...rest) { //arguments is error - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. -- ~~~~~~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - var arguments = 10; // no error - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. -@@= skipped -20, +18 lines =@@ - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - public f4(i: any, ...arguments) { // error -- ~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. - var arguments: any[]; // no error -@@= skipped -17, +15 lines =@@ - public f41(arguments: any, ...rest) { // error - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. -- ~~~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. - var arguments: any; // no error - ~~~~~~~~~ - !!! error TS1210: Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of 'arguments'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/collisionArgumentsFunction.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/collisionArgumentsFunction.errors.txt.diff deleted file mode 100644 index d7fd771020..0000000000 --- a/testdata/baselines/reference/submodule/compiler/collisionArgumentsFunction.errors.txt.diff +++ /dev/null @@ -1,63 +0,0 @@ ---- old.collisionArgumentsFunction.errors.txt -+++ new.collisionArgumentsFunction.errors.txt -@@= skipped -0, +0 lines =@@ --collisionArgumentsFunction.ts(2,13): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. --collisionArgumentsFunction.ts(5,25): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. --collisionArgumentsFunction.ts(25,13): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. --collisionArgumentsFunction.ts(30,22): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- -- --==== collisionArgumentsFunction.ts (4 errors) ==== -- // Functions -- function f1(arguments: number, ...restParameters) { //arguments is error -- ~~~~~~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- var arguments = 10; // no error -- } -- function f12(i: number, ...arguments) { //arguments is error -- ~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- var arguments: any[]; // no error -- } -- function f1NoError(arguments: number) { // no error -- var arguments = 10; // no error -- } -- -- declare function f2(i: number, ...arguments); // no error - no code gen -- declare function f21(arguments: number, ...rest); // no error - no code gen -- declare function f2NoError(arguments: number); // no error -- -- function f3(...restParameters) { -- var arguments = 10; // no error -- } -- function f3NoError() { -- var arguments = 10; // no error -- } -- -- function f4(arguments: number, ...rest); // no codegen no error -- function f4(arguments: string, ...rest); // no codegen no error -- function f4(arguments: any, ...rest) { // error -- ~~~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- var arguments: any; // No error -- } -- function f42(i: number, ...arguments); // no codegen no error -- function f42(i: string, ...arguments); // no codegen no error -- function f42(i: any, ...arguments) { // error -- ~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- var arguments: any[]; // No error -- } -- function f4NoError(arguments: number); // no error -- function f4NoError(arguments: string); // no error -- function f4NoError(arguments: any) { // no error -- var arguments: any; // No error -- } -- -- declare function f5(arguments: number, ...rest); // no codegen no error -- declare function f5(arguments: string, ...rest); // no codegen no error -- declare function f52(i: number, ...arguments); // no codegen no error -- declare function f52(i: string, ...arguments); // no codegen no error -- declare function f6(arguments: number); // no codegen no error -- declare function f6(arguments: string); // no codegen no error -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/collisionArgumentsFunctionExpressions.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/collisionArgumentsFunctionExpressions.errors.txt.diff deleted file mode 100644 index b07df7399a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/collisionArgumentsFunctionExpressions.errors.txt.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.collisionArgumentsFunctionExpressions.errors.txt -+++ new.collisionArgumentsFunctionExpressions.errors.txt -@@= skipped -0, +0 lines =@@ --collisionArgumentsFunctionExpressions.ts(2,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. --collisionArgumentsFunctionExpressions.ts(5,29): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. --collisionArgumentsFunctionExpressions.ts(21,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. --collisionArgumentsFunctionExpressions.ts(26,26): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- -- --==== collisionArgumentsFunctionExpressions.ts (4 errors) ==== -- function foo() { -- function f1(arguments: number, ...restParameters) { //arguments is error -- ~~~~~~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- var arguments = 10; // no error -- } -- function f12(i: number, ...arguments) { //arguments is error -- ~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- var arguments: any[]; // no error -- } -- function f1NoError(arguments: number) { // no error -- var arguments = 10; // no error -- } -- -- function f3(...restParameters) { -- var arguments = 10; // no error -- } -- function f3NoError() { -- var arguments = 10; // no error -- } -- -- function f4(arguments: number, ...rest); // no codegen no error -- function f4(arguments: string, ...rest); // no codegen no error -- function f4(arguments: any, ...rest) { // error -- ~~~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- var arguments: any; // No error -- } -- function f42(i: number, ...arguments); // no codegen no error -- function f42(i: string, ...arguments); // no codegen no error -- function f42(i: any, ...arguments) { // error -- ~~~~~~~~~~~~ --!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. -- var arguments: any[]; // No error -- } -- function f4NoError(arguments: number); // no error -- function f4NoError(arguments: string); // no error -- function f4NoError(arguments: any) { // no error -- var arguments: any; // No error -- } -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/collisionExportsRequireAndAlias.js.diff b/testdata/baselines/reference/submodule/compiler/collisionExportsRequireAndAlias.js.diff deleted file mode 100644 index 400f530342..0000000000 --- a/testdata/baselines/reference/submodule/compiler/collisionExportsRequireAndAlias.js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.collisionExportsRequireAndAlias.js -+++ new.collisionExportsRequireAndAlias.js -@@= skipped -33, +33 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.foo = foo; - exports.foo2 = foo2; --var require = require("./collisionExportsRequireAndAlias_file1"); // Error --var exports = require("./collisionExportsRequireAndAlias_file3333"); // Error -+const require = require("./collisionExportsRequireAndAlias_file1"); // Error -+const exports = require("./collisionExportsRequireAndAlias_file3333"); // Error - function foo() { - require.bar(); - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentOnDecoratedClassDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/commentOnDecoratedClassDeclaration.js.diff index 59009c5314..ac7bbf9634 100644 --- a/testdata/baselines/reference/submodule/compiler/commentOnDecoratedClassDeclaration.js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentOnDecoratedClassDeclaration.js.diff @@ -13,30 +13,23 @@ /** * Leading trivia */ --let Remote = (() => { -- let Remote = class Remote { -- }; -- Remote = __decorate([ -- decorator("hello") -- ], Remote); -- return Remote; --})(); +-let Remote = class Remote { +-}; +-Remote = __decorate([ +- decorator("hello") +-], Remote); +@decorator("hello") +class Remote { +} /** * Floating Comment */ --let AnotherRomote = (() => { -- let AnotherRomote = class AnotherRomote { -- constructor() { } -- }; -- AnotherRomote = __decorate([ -- decorator("hi") -- ], AnotherRomote); -- return AnotherRomote; --})(); +-let AnotherRomote = class AnotherRomote { +@decorator("hi") +class AnotherRomote { -+ constructor() { } + constructor() { } +-}; +-AnotherRomote = __decorate([ +- decorator("hi") +-], AnotherRomote); +} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsExternalModules3.js.diff b/testdata/baselines/reference/submodule/compiler/commentsExternalModules3.js.diff deleted file mode 100644 index 3f34288af9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/commentsExternalModules3.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.commentsExternalModules3.js -+++ new.commentsExternalModules3.js -@@= skipped -122, +122 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.newVar2 = exports.newVar = void 0; - /**This is on import declaration*/ --var extMod = require("./commentsExternalModules2_0"); // trailing comment 1 -+const extMod = require("./commentsExternalModules2_0"); // trailing comment 1 - extMod.m1.fooExport(); - exports.newVar = new extMod.m1.m2.c(); - extMod.m4.fooExport(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=auto).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=auto).js.diff index 1eb2d90098..1fba1956c2 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=auto).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=auto).js.diff @@ -1,11 +1,7 @@ --- old.commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=auto).js +++ new.commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=auto).js -@@= skipped -24, +24 lines =@@ - //// [commentsOnJSXExpressionsArePreserved.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var jsx_runtime_1 = require("react/jsx-runtime"); -+const jsx_runtime_1 = require("react/jsx-runtime"); +@@= skipped -27, +27 lines =@@ + const jsx_runtime_1 = require("react/jsx-runtime"); class Component { render() { - return (0, jsx_runtime_1.jsx)("div", { children: null /* preserved */ }); diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js.diff index 8b8005dbda..67267be814 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js.diff @@ -1,11 +1,7 @@ --- old.commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js +++ new.commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js -@@= skipped -24, +24 lines =@@ - //// [commentsOnJSXExpressionsArePreserved.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var jsx_runtime_1 = require("react/jsx-runtime"); -+const jsx_runtime_1 = require("react/jsx-runtime"); +@@= skipped -27, +27 lines =@@ + const jsx_runtime_1 = require("react/jsx-runtime"); class Component { render() { - return (0, jsx_runtime_1.jsx)("div", { children: null /* preserved */ }); diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=auto).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=auto).js.diff index 7560c57ff2..07559a37d1 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=auto).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=auto).js.diff @@ -1,11 +1,6 @@ --- old.commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=auto).js +++ new.commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=auto).js -@@= skipped -24, +24 lines =@@ - //// [commentsOnJSXExpressionsArePreserved.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var jsx_dev_runtime_1 = require("react/jsx-dev-runtime"); -+const jsx_dev_runtime_1 = require("react/jsx-dev-runtime"); +@@= skipped -28, +28 lines =@@ const _jsxFileName = "commentsOnJSXExpressionsArePreserved.tsx"; class Component { render() { diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js.diff index b1974f086e..a95f44e68d 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js.diff @@ -1,11 +1,6 @@ --- old.commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js +++ new.commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js -@@= skipped -24, +24 lines =@@ - //// [commentsOnJSXExpressionsArePreserved.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var jsx_dev_runtime_1 = require("react/jsx-dev-runtime"); -+const jsx_dev_runtime_1 = require("react/jsx-dev-runtime"); +@@= skipped -28, +28 lines =@@ const _jsxFileName = "commentsOnJSXExpressionsArePreserved.tsx"; class Component { render() { diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnStaticMembers.js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnStaticMembers.js.diff index 582a4f9338..3dac35b818 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnStaticMembers.js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnStaticMembers.js.diff @@ -1,31 +1,31 @@ --- old.commentsOnStaticMembers.js +++ new.commentsOnStaticMembers.js -@@= skipped -21, +21 lines =@@ - } +@@= skipped -22, +22 lines =@@ //// [commentsOnStaticMembers.js] --let test = (() => { -- class test { -- } -+class test { - /** - * p1 comment appears in output - */ -- test.p1 = ""; + class test { ++ /** ++ * p1 comment appears in output ++ */ + static p1 = ""; + /** + * p2 comment does not appear in output + */ + static p2; - /** - * p3 comment appears in output - */ -- test.p3 = ""; -- return test; --})(); ++ /** ++ * p3 comment appears in output ++ */ + static p3 = ""; + /** + * p4 comment does not appear in output + */ + static p4; -+} \ No newline at end of file + } +-/** +- * p1 comment appears in output +- */ +-test.p1 = ""; +-/** +- * p3 comment appears in output +- */ +-test.p3 = ""; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.diff b/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.diff deleted file mode 100644 index 4dda025c31..0000000000 --- a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.commonSourceDirectory.js -+++ new.commonSourceDirectory.js -@@= skipped -18, +18 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var foo_1 = require("foo"); --var bar_1 = require("bar"); -+const foo_1 = require("foo"); -+const bar_1 = require("bar"); - foo_1.x + bar_1.y; - //# sourceMappingURL=../myMapRoot/index.js.map diff --git a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.map.diff b/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.map.diff deleted file mode 100644 index cd5687b3c7..0000000000 --- a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.js.map.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.commonSourceDirectory.js.map -+++ new.commonSourceDirectory.js.map -@@= skipped -0, +0 lines =@@ - //// [/app/bin/index.js.map] --{"version":3,"file":"index.js","sourceRoot":"mySourceRoot/","sources":["index.ts"],"names":[],"mappings":";;AAAA,0DAA0D;AAC1D,2BAAwB;AACxB,2BAAwB;AACxB,OAAC,GAAG,OAAC,CAAC"} --//// https://sokra.github.io/source-map-visualization#base64,InVzZSBzdHJpY3QiOw0KT2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMsICJfX2VzTW9kdWxlIiwgeyB2YWx1ZTogdHJ1ZSB9KTsNCi8vLyA8cmVmZXJlbmNlIHBhdGg9Ii4uL3R5cGVzL2Jhci5kLnRzIiBwcmVzZXJ2ZT0idHJ1ZSIgLz4NCnZhciBmb29fMSA9IHJlcXVpcmUoImZvbyIpOw0KdmFyIGJhcl8xID0gcmVxdWlyZSgiYmFyIik7DQpmb29fMS54ICsgYmFyXzEueTsNCi8vIyBzb3VyY2VNYXBwaW5nVVJMPS4uL215TWFwUm9vdC9pbmRleC5qcy5tYXA=,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoibXlTb3VyY2VSb290LyIsInNvdXJjZXMiOlsiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwREFBMEQ7QUFDMUQsMkJBQXdCO0FBQ3hCLDJCQUF3QjtBQUN4QixPQUFDLEdBQUcsT0FBQyxDQUFDIn0=,ZXhwb3J0IGNvbnN0IHggPSAwOwo= -+{"version":3,"file":"index.js","sourceRoot":"mySourceRoot/","sources":["index.ts"],"names":[],"mappings":";;AAAA,0DAA0D;AAC1D,6BAAwB;AACxB,6BAAwB;AACxB,OAAC,GAAG,OAAC,CAAC"} -+//// https://sokra.github.io/source-map-visualization#base64,InVzZSBzdHJpY3QiOw0KT2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMsICJfX2VzTW9kdWxlIiwgeyB2YWx1ZTogdHJ1ZSB9KTsNCi8vLyA8cmVmZXJlbmNlIHBhdGg9Ii4uL3R5cGVzL2Jhci5kLnRzIiBwcmVzZXJ2ZT0idHJ1ZSIgLz4NCmNvbnN0IGZvb18xID0gcmVxdWlyZSgiZm9vIik7DQpjb25zdCBiYXJfMSA9IHJlcXVpcmUoImJhciIpOw0KZm9vXzEueCArIGJhcl8xLnk7DQovLyMgc291cmNlTWFwcGluZ1VSTD0uLi9teU1hcFJvb3QvaW5kZXguanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoibXlTb3VyY2VSb290LyIsInNvdXJjZXMiOlsiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwREFBMEQ7QUFDMUQsNkJBQXdCO0FBQ3hCLDZCQUF3QjtBQUN4QixPQUFDLEdBQUcsT0FBQyxDQUFDIn0=,ZXhwb3J0IGNvbnN0IHggPSAwOwo= \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.sourcemap.txt.diff b/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.sourcemap.txt.diff deleted file mode 100644 index 24cb164301..0000000000 --- a/testdata/baselines/reference/submodule/compiler/commonSourceDirectory.sourcemap.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.commonSourceDirectory.sourcemap.txt -+++ new.commonSourceDirectory.sourcemap.txt -@@= skipped -17, +17 lines =@@ - 1 >Emitted(3, 1) Source(1, 1) + SourceIndex(0) - 2 >Emitted(3, 59) Source(1, 59) + SourceIndex(0) - --- -->>>var foo_1 = require("foo"); -+>>>const foo_1 = require("foo"); - 1 > --2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^ --3 > ^-> -+2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -+3 > ^-> - 1 > - > - 2 >import { x } from "foo"; - 1 >Emitted(4, 1) Source(2, 1) + SourceIndex(0) --2 >Emitted(4, 28) Source(2, 25) + SourceIndex(0) -+2 >Emitted(4, 30) Source(2, 25) + SourceIndex(0) - --- -->>>var bar_1 = require("bar"); -+>>>const bar_1 = require("bar"); - 1-> --2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^ -+2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 1-> - > - 2 >import { y } from "bar"; - 1->Emitted(5, 1) Source(3, 1) + SourceIndex(0) --2 >Emitted(5, 28) Source(3, 25) + SourceIndex(0) -+2 >Emitted(5, 30) Source(3, 25) + SourceIndex(0) - --- - >>>foo_1.x + bar_1.y; - 1 > \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commonjsSafeImport.js.diff b/testdata/baselines/reference/submodule/compiler/commonjsSafeImport.js.diff deleted file mode 100644 index 20ccf77735..0000000000 --- a/testdata/baselines/reference/submodule/compiler/commonjsSafeImport.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.commonjsSafeImport.js -+++ new.commonjsSafeImport.js -@@= skipped -16, +16 lines =@@ - //// [main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var _10_lib_1 = require("./10_lib"); -+const _10_lib_1 = require("./10_lib"); - (0, _10_lib_1.Foo)(); - diff --git a/testdata/baselines/reference/submodule/compiler/compositeWithNodeModulesSourceFile.js.diff b/testdata/baselines/reference/submodule/compiler/compositeWithNodeModulesSourceFile.js.diff deleted file mode 100644 index 4657390583..0000000000 --- a/testdata/baselines/reference/submodule/compiler/compositeWithNodeModulesSourceFile.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.compositeWithNodeModulesSourceFile.js -+++ new.compositeWithNodeModulesSourceFile.js -@@= skipped -11, +11 lines =@@ - //// [test.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var myModule = require("myModule"); -+const myModule = require("myModule"); - new myModule.c(); - diff --git a/testdata/baselines/reference/submodule/compiler/computedPropertyNameWithImportedKey.js.diff b/testdata/baselines/reference/submodule/compiler/computedPropertyNameWithImportedKey.js.diff deleted file mode 100644 index 3012b0c7f0..0000000000 --- a/testdata/baselines/reference/submodule/compiler/computedPropertyNameWithImportedKey.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.computedPropertyNameWithImportedKey.js -+++ new.computedPropertyNameWithImportedKey.js -@@= skipped -18, +18 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.fn = fn; --var a_1 = require("./a"); -+const a_1 = require("./a"); - function fn({ [a_1.a]: value }) { - return value; - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/conflictingDeclarationsImportFromNamespace1.js.diff b/testdata/baselines/reference/submodule/compiler/conflictingDeclarationsImportFromNamespace1.js.diff deleted file mode 100644 index 5529c7a3b1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/conflictingDeclarationsImportFromNamespace1.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.conflictingDeclarationsImportFromNamespace1.js -+++ new.conflictingDeclarationsImportFromNamespace1.js -@@= skipped -65, +65 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.pick = void 0; --var pick = __importStar(require("lodash/pick")); -+const pick = __importStar(require("lodash/pick")); - const pick = () => (0, exports.pick)(); - exports.pick = pick; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/conflictingDeclarationsImportFromNamespace2.js.diff b/testdata/baselines/reference/submodule/compiler/conflictingDeclarationsImportFromNamespace2.js.diff deleted file mode 100644 index 991583d9d6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/conflictingDeclarationsImportFromNamespace2.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.conflictingDeclarationsImportFromNamespace2.js -+++ new.conflictingDeclarationsImportFromNamespace2.js -@@= skipped -65, +65 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.pick = void 0; --var pick = __importStar(require("lodash/pick")); -+const pick = __importStar(require("lodash/pick")); - const pick = () => (0, exports.pick)(); - exports.pick = pick; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=true).js.diff b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=true).js.diff deleted file mode 100644 index 34760791b2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport(isolatedmodules=true).js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.constEnumNamespaceReferenceCausesNoImport(isolatedmodules=true).js -+++ new.constEnumNamespaceReferenceCausesNoImport(isolatedmodules=true).js -@@= skipped -65, +65 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var Foo = __importStar(require("./foo")); -+const Foo = __importStar(require("./foo")); - function check(x) { - switch (x) { - case Foo.ConstFooEnum.Some: \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js.diff deleted file mode 100644 index 442a70cd5e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/constEnumNamespaceReferenceCausesNoImport2.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.constEnumNamespaceReferenceCausesNoImport2.js -+++ new.constEnumNamespaceReferenceCausesNoImport2.js -@@= skipped -69, +69 lines =@@ - return result; - }; - })(); --var Foo = __importStar(require("./foo")); -+const Foo = __importStar(require("./foo")); - module.exports = Foo.ConstEnumOnlyModule; - //// [index.js] - "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/constEnumPreserveEmitReexport.js.diff b/testdata/baselines/reference/submodule/compiler/constEnumPreserveEmitReexport.js.diff index d60104cb07..6c82ad07fc 100644 --- a/testdata/baselines/reference/submodule/compiler/constEnumPreserveEmitReexport.js.diff +++ b/testdata/baselines/reference/submodule/compiler/constEnumPreserveEmitReexport.js.diff @@ -1,13 +1,6 @@ --- old.constEnumPreserveEmitReexport.js +++ new.constEnumPreserveEmitReexport.js -@@= skipped -23, +23 lines =@@ - //// [ImportExport.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var ConstEnum_1 = require("./ConstEnum"); -+const ConstEnum_1 = require("./ConstEnum"); - exports.default = ConstEnum_1.MyConstEnum; - //// [ReExport.js] +@@= skipped -29, +29 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; diff --git a/testdata/baselines/reference/submodule/compiler/contextualTypeObjectSpreadExpression.js b/testdata/baselines/reference/submodule/compiler/contextualTypeObjectSpreadExpression.js index 032928668e..dc90049321 100644 --- a/testdata/baselines/reference/submodule/compiler/contextualTypeObjectSpreadExpression.js +++ b/testdata/baselines/reference/submodule/compiler/contextualTypeObjectSpreadExpression.js @@ -9,16 +9,5 @@ i = { ...{ a: "a" } }; //// [contextualTypeObjectSpreadExpression.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; let i; -i = __assign({ a: "a" }); +i = Object.assign({ a: "a" }); diff --git a/testdata/baselines/reference/submodule/compiler/copyrightWithNewLine1.js.diff b/testdata/baselines/reference/submodule/compiler/copyrightWithNewLine1.js.diff deleted file mode 100644 index 96e6e80b5b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/copyrightWithNewLine1.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.copyrightWithNewLine1.js -+++ new.copyrightWithNewLine1.js -@@= skipped -16, +16 lines =@@ - * (c) Copyright - Important - ****************************/ - Object.defineProperty(exports, "__esModule", { value: true }); --var model = require("./greeter"); -+const model = require("./greeter"); - var el = document.getElementById('content'); - var greeter = new model.Greeter(el); - /** things */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/copyrightWithoutNewLine1.js.diff b/testdata/baselines/reference/submodule/compiler/copyrightWithoutNewLine1.js.diff deleted file mode 100644 index f7d1d0ec44..0000000000 --- a/testdata/baselines/reference/submodule/compiler/copyrightWithoutNewLine1.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.copyrightWithoutNewLine1.js -+++ new.copyrightWithoutNewLine1.js -@@= skipped -15, +15 lines =@@ - /***************************** - * (c) Copyright - Important - ****************************/ --var model = require("./greeter"); -+const model = require("./greeter"); - var el = document.getElementById('content'); - var greeter = new model.Greeter(el); - /** things */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/ctsFileInEsnextHelpers.js.diff b/testdata/baselines/reference/submodule/compiler/ctsFileInEsnextHelpers.js.diff index 9c35582427..561af60e67 100644 --- a/testdata/baselines/reference/submodule/compiler/ctsFileInEsnextHelpers.js.diff +++ b/testdata/baselines/reference/submodule/compiler/ctsFileInEsnextHelpers.js.diff @@ -4,7 +4,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.foo = foo; --var tslib_1 = require("tslib"); +-const tslib_1 = require("tslib"); -function foo() { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - yield 0; diff --git a/testdata/baselines/reference/submodule/compiler/declFileImportModuleWithExportAssignment.js.diff b/testdata/baselines/reference/submodule/compiler/declFileImportModuleWithExportAssignment.js.diff deleted file mode 100644 index 707573c553..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declFileImportModuleWithExportAssignment.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declFileImportModuleWithExportAssignment.js -+++ new.declFileImportModuleWithExportAssignment.js -@@= skipped -33, +33 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.a = void 0; - /**This is on import declaration*/ --var a1 = require("./declFileImportModuleWithExportAssignment_0"); -+const a1 = require("./declFileImportModuleWithExportAssignment_0"); - exports.a = a1; - exports.a.test1(null, null, null); diff --git a/testdata/baselines/reference/submodule/compiler/declFilePrivateStatic.js.diff b/testdata/baselines/reference/submodule/compiler/declFilePrivateStatic.js.diff index 3a10a0258f..77c446c875 100644 --- a/testdata/baselines/reference/submodule/compiler/declFilePrivateStatic.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declFilePrivateStatic.js.diff @@ -1,32 +1,20 @@ --- old.declFilePrivateStatic.js +++ new.declFilePrivateStatic.js -@@= skipped -15, +15 lines =@@ - } +@@= skipped -16, +16 lines =@@ //// [declFilePrivateStatic.js] --let C = (() => { -- class C { -- static a() { } -- static b() { } -- static get c() { return 1; } -- static get d() { return 1; } -- static set e(v) { } -- static set f(v) { } -- } -- C.x = 1; -- C.y = 1; -- return C; --})(); -+class C { + class C { + static x = 1; + static y = 1; -+ static a() { } -+ static b() { } -+ static get c() { return 1; } -+ static get d() { return 1; } -+ static set e(v) { } -+ static set f(v) { } -+} + static a() { } + static b() { } + static get c() { return 1; } +@@= skipped -7, +9 lines =@@ + static set e(v) { } + static set f(v) { } + } +-C.x = 1; +-C.y = 1; //// [declFilePrivateStatic.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitAliasInlineing.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitAliasInlineing.js.diff index 4e8d8abc1b..c090f2aba6 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitAliasInlineing.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitAliasInlineing.js.diff @@ -1,17 +1,6 @@ --- old.declarationEmitAliasInlineing.js +++ new.declarationEmitAliasInlineing.js -@@= skipped -45, +45 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.fExp = exports.f = void 0; --var a_1 = require("./a"); --var aExp_1 = require("./aExp"); -+const a_1 = require("./a"); -+const aExp_1 = require("./aExp"); - exports.f = a_1.fn; - exports.fExp = aExp_1.fnExp; - -@@= skipped -11, +11 lines =@@ +@@= skipped -56, +56 lines =@@ prop: string; prop2: string; }; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js.diff deleted file mode 100644 index fbcdc4678c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitAnyComputedPropertyInClass.js -+++ new.declarationEmitAnyComputedPropertyInClass.js -@@= skipped -17, +17 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.C = void 0; --var abcdefgh_1 = __importDefault(require("abcdefgh")); -+const abcdefgh_1 = __importDefault(require("abcdefgh")); - class C { - [abcdefgh_1.default.someKey]() { } - ; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCommonJsModuleReferencedType.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCommonJsModuleReferencedType.js.diff index edcebccf41..abbf5818ba 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCommonJsModuleReferencedType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCommonJsModuleReferencedType.js.diff @@ -1,13 +1,7 @@ --- old.declarationEmitCommonJsModuleReferencedType.js +++ new.declarationEmitCommonJsModuleReferencedType.js -@@= skipped -27, +27 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.y = exports.x = void 0; --var foo_1 = require("foo"); --var root_1 = require("root"); -+const foo_1 = require("foo"); -+const root_1 = require("root"); +@@= skipped -31, +31 lines =@@ + const root_1 = require("root"); exports.x = (0, foo_1.foo)(); exports.y = (0, root_1.bar)(); + diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameCausesImportToBePainted.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameCausesImportToBePainted.js.diff deleted file mode 100644 index 8133ac4d0b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameCausesImportToBePainted.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitComputedNameCausesImportToBePainted.js -+++ new.declarationEmitComputedNameCausesImportToBePainted.js -@@= skipped -22, +22 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.withContext = exports.context = void 0; --var context_1 = require("./context"); -+const context_1 = require("./context"); - exports.context = { - [context_1.Key]: 'bar', - }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameConstEnumAlias.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameConstEnumAlias.js.diff deleted file mode 100644 index b45c5f33de..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameConstEnumAlias.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitComputedNameConstEnumAlias.js -+++ new.declarationEmitComputedNameConstEnumAlias.js -@@= skipped -27, +27 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var EnumExample_1 = __importDefault(require("./EnumExample")); -+const EnumExample_1 = __importDefault(require("./EnumExample")); - exports.default = { - [EnumExample_1.default.TEST]: {}, - }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCrossFileCopiedGeneratedImportType.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCrossFileCopiedGeneratedImportType.js.diff deleted file mode 100644 index eba36378c1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCrossFileCopiedGeneratedImportType.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitCrossFileCopiedGeneratedImportType.js -+++ new.declarationEmitCrossFileCopiedGeneratedImportType.js -@@= skipped -19, +19 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.d = void 0; --var projC_1 = require("../projC"); -+const projC_1 = require("../projC"); - exports.d = { e: projC_1.e }; - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCrossFileImportTypeOfAmbientModule.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCrossFileImportTypeOfAmbientModule.js.diff deleted file mode 100644 index 2d89dfd119..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCrossFileImportTypeOfAmbientModule.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitCrossFileImportTypeOfAmbientModule.js -+++ new.declarationEmitCrossFileImportTypeOfAmbientModule.js -@@= skipped -15, +15 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.reeexported = void 0; --var somepackage_1 = require("../somepackage"); -+const somepackage_1 = require("../somepackage"); - exports.reeexported = somepackage_1.item; - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js.diff index 552d88daf0..fd924cc8df 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js.diff @@ -1,24 +1,6 @@ --- old.declarationEmitDefaultExportWithStaticAssignment.js +++ new.declarationEmitDefaultExportWithStaticAssignment.js -@@= skipped -42, +42 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = Example; --var foo_1 = require("./foo"); -+const foo_1 = require("./foo"); - function Example() { } - Example.Foo = foo_1.Foo; - //// [index2.js] -@@= skipped -8, +8 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Foo = void 0; - exports.default = Example; --var foo_1 = require("./foo"); -+const foo_1 = require("./foo"); - Object.defineProperty(exports, "Foo", { enumerable: true, get: function () { return foo_1.Foo; } }); - function Example() { } - Example.Foo = foo_1.Foo; -@@= skipped -32, +32 lines =@@ +@@= skipped -82, +82 lines =@@ } //// [index1.d.ts] declare function Example(): void; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitEnumReferenceViaImportEquals.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitEnumReferenceViaImportEquals.js.diff index fb4b2e41db..33b3ee054f 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitEnumReferenceViaImportEquals.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitEnumReferenceViaImportEquals.js.diff @@ -1,12 +1,10 @@ --- old.declarationEmitEnumReferenceViaImportEquals.js +++ new.declarationEmitEnumReferenceViaImportEquals.js -@@= skipped -43, +43 lines =@@ - "use strict"; +@@= skipped -44, +44 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Test = void 0; --var translation_1 = require("./translation"); + const translation_1 = require("./translation"); -var TranslationKeyEnum = translation_1.Translation.TranslationKeyEnum; -+const translation_1 = require("./translation"); class Test { - constructor() { - this.TranslationKeyEnum = TranslationKeyEnum; @@ -14,12 +12,4 @@ + TranslationKeyEnum = TranslationKeyEnum; print() { console.log(TranslationKeyEnum.Translation1); - } -@@= skipped -14, +11 lines =@@ - //// [index.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var test_1 = require("./test"); -+const test_1 = require("./test"); - new test_1.Test().print(); - + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js.diff index 1a0346d4ab..1abfb0de76 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js.diff @@ -1,15 +1,6 @@ --- old.declarationEmitExpandoPropertyPrivateName.js +++ new.declarationEmitExpandoPropertyPrivateName.js -@@= skipped -18, +18 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.q = q; --var a_1 = require("./a"); -+const a_1 = require("./a"); - function q() { } - q.val = (0, a_1.f)(); - -@@= skipped -10, +10 lines =@@ +@@= skipped -28, +28 lines =@@ } export declare function f(): I; export {}; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExportAliasVisibiilityMarking.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitExportAliasVisibiilityMarking.js.diff deleted file mode 100644 index 2fe590e41d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExportAliasVisibiilityMarking.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitExportAliasVisibiilityMarking.js -+++ new.declarationEmitExportAliasVisibiilityMarking.js -@@= skipped -57, +57 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.lazyCard = void 0; --let lazyCard = () => Promise.resolve().then(function () { return __importStar(require('./Card')); }).then(a => a.default); -+let lazyCard = () => Promise.resolve().then(() => __importStar(require('./Card'))).then(a => a.default); - exports.lazyCard = lazyCard; - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.js.diff deleted file mode 100644 index 5dc38271c6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.js -+++ new.declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.js -@@= skipped -47, +47 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.obj = void 0; --var get_comp_1 = require("./get-comp"); -+const get_comp_1 = require("./get-comp"); - // this shouldn't need any triple-slash references - it should have a direct import to `react` and that's it - // This issue (#35343) _only_ reproduces in the test harness when the file in question is in a subfolder - exports.obj = { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExportAssignment.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitExportAssignment.js.diff index 7a73d31f02..1505533561 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExportAssignment.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitExportAssignment.js.diff @@ -1,12 +1,10 @@ --- old.declarationEmitExportAssignment.js +++ new.declarationEmitExportAssignment.js -@@= skipped -17, +17 lines =@@ - function bar() { } +@@= skipped -18, +18 lines =@@ //// [index.js] "use strict"; --var utils_1 = require("./utils"); + const utils_1 = require("./utils"); -module.exports = utils_1.foo; -+const utils_1 = require("./utils"); +module.exports = foo; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExportDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitExportDeclaration.js.diff deleted file mode 100644 index 9446b6ee50..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExportDeclaration.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitExportDeclaration.js -+++ new.declarationEmitExportDeclaration.js -@@= skipped -22, +22 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.bar = void 0; --var utils_1 = require("./utils"); -+const utils_1 = require("./utils"); - Object.defineProperty(exports, "bar", { enumerable: true, get: function () { return utils_1.bar; } }); - (0, utils_1.foo)(); - let obj; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExpressionInExtends6.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitExpressionInExtends6.js.diff deleted file mode 100644 index 36d7e179e1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExpressionInExtends6.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitExpressionInExtends6.js -+++ new.declarationEmitExpressionInExtends6.js -@@= skipped -54, +54 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var A = __importStar(require("./a")); -+const A = __importStar(require("./a")); - const { Foo } = A; - class default_1 extends Foo { - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.js.diff index 8cdb6b27c2..430a3b280f 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.js.diff @@ -1,15 +1,6 @@ --- old.declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.js +++ new.declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.js -@@= skipped -15, +15 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.A1 = void 0; --var a_1 = require("./a"); -+const a_1 = require("./a"); - exports.A1 = a_1.A; - - -@@= skipped -10, +10 lines =@@ +@@= skipped -25, +25 lines =@@ }; export declare const A: AX; export {}; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.js.diff deleted file mode 100644 index fb5a33f08d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitForGlobalishSpecifierSymlink.js -+++ new.declarationEmitForGlobalishSpecifierSymlink.js -@@= skipped -37, +37 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.a = void 0; --var typescript_fsa_1 = require("typescript-fsa"); -+const typescript_fsa_1 = require("typescript-fsa"); - exports.a = (0, typescript_fsa_1.getA)(); - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js.diff deleted file mode 100644 index ce8cbc65ab..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitForGlobalishSpecifierSymlink2.js -+++ new.declarationEmitForGlobalishSpecifierSymlink2.js -@@= skipped -25, +25 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.a = void 0; --var typescript_fsa_1 = require("typescript-fsa"); -+const typescript_fsa_1 = require("typescript-fsa"); - exports.a = (0, typescript_fsa_1.getA)(); - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitForModuleImportingModuleAugmentationRetainsImport.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitForModuleImportingModuleAugmentationRetainsImport.js.diff deleted file mode 100644 index b76d77ddb0..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitForModuleImportingModuleAugmentationRetainsImport.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitForModuleImportingModuleAugmentationRetainsImport.js -+++ new.declarationEmitForModuleImportingModuleAugmentationRetainsImport.js -@@= skipped -23, +23 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ParentThing = void 0; --var child1_1 = require("./child1"); // this import should still exist in some form in the output, since it augments this module -+const child1_1 = require("./child1"); // this import should still exist in some form in the output, since it augments this module - class ParentThing { - } - exports.ParentThing = ParentThing; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitForTypesWhichNeedImportTypes.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitForTypesWhichNeedImportTypes.js.diff deleted file mode 100644 index 967880ec67..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitForTypesWhichNeedImportTypes.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitForTypesWhichNeedImportTypes.js -+++ new.declarationEmitForTypesWhichNeedImportTypes.js -@@= skipped -22, +22 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Value = void 0; --var b_1 = require("./b"); -+const b_1 = require("./b"); - exports.Value = (0, b_1.createNamed)(); - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitInlinedDistributiveConditional.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitInlinedDistributiveConditional.js.diff deleted file mode 100644 index d6791facc1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitInlinedDistributiveConditional.js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.declarationEmitInlinedDistributiveConditional.js -+++ new.declarationEmitInlinedDistributiveConditional.js -@@= skipped -24, +24 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.dropPrivateProps2 = exports.dropPrivateProps1 = void 0; --var internal_1 = require("./internal"); -+const internal_1 = require("./internal"); - const dropPrivateProps1 = (obj) => (0, internal_1.excludePrivateKeys1)(obj); - exports.dropPrivateProps1 = dropPrivateProps1; - const dropPrivateProps2 = (obj) => (0, internal_1.excludePrivateKeys2)(obj); -@@= skipped -8, +8 lines =@@ - //// [test.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var api_1 = require("./api"); -+const api_1 = require("./api"); - const a = (0, api_1.dropPrivateProps1)({ foo: 42, _bar: 'secret' }); // type is {foo: number} - //a._bar // error: _bar does not exist <===== as expected - const b = (0, api_1.dropPrivateProps2)({ foo: 42, _bar: 'secret' }); // type is {foo: number, _bar: string} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js.diff index d4735170cf..67520d73bd 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js.diff @@ -1,12 +1,6 @@ --- old.declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js +++ new.declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.js -@@= skipped -59, +59 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.publicProcedure = exports.router = exports.middleware = void 0; --var server_1 = require("@trpc/server"); -+const server_1 = require("@trpc/server"); - const trpc = server_1.initTRPC.create(); +@@= skipped -64, +64 lines =@@ exports.middleware = trpc.middleware; exports.router = trpc.router; exports.publicProcedure = trpc.procedure; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitLocalClassHasRequiredDeclare.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitLocalClassHasRequiredDeclare.js.diff index e5e32cc2f0..a46c191fc7 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitLocalClassHasRequiredDeclare.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitLocalClassHasRequiredDeclare.js.diff @@ -1,18 +1,13 @@ --- old.declarationEmitLocalClassHasRequiredDeclare.js +++ new.declarationEmitLocalClassHasRequiredDeclare.js -@@= skipped -22, +22 lines =@@ - exports.Y = exports.A = void 0; +@@= skipped -23, +23 lines =@@ class X { } --let A = (() => { -- class A { -- } -- A.X = X; -- return A; --})(); -+class A { + class A { + static X = X; -+} + } exports.A = A; +-A.X = X; class Y { - } \ No newline at end of file + } + exports.Y = Y; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitMappedTypeDistributivityPreservesConstraints.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitMappedTypeDistributivityPreservesConstraints.js.diff index 3ea7a9a561..125e0e4d0c 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitMappedTypeDistributivityPreservesConstraints.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitMappedTypeDistributivityPreservesConstraints.js.diff @@ -1,15 +1,6 @@ --- old.declarationEmitMappedTypeDistributivityPreservesConstraints.js +++ new.declarationEmitMappedTypeDistributivityPreservesConstraints.js -@@= skipped -29, +29 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var types_1 = __importDefault(require("./types")); -+const types_1 = __importDefault(require("./types")); - exports.default = { test: types_1.default }; - - -@@= skipped -28, +28 lines =@@ +@@= skipped -57, +57 lines =@@ } ? { [K in keyof T_1]: T_1[K]; } : never; }>(sliceIndex: T) => T["x"] extends infer T_2 extends { [x: string]: (...params: unknown[]) => unknown; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitMappedTypeTemplateTypeofSymbol.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitMappedTypeTemplateTypeofSymbol.js.diff index 5f4af238eb..1df1396ace 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitMappedTypeTemplateTypeofSymbol.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitMappedTypeTemplateTypeofSymbol.js.diff @@ -1,18 +1,8 @@ --- old.declarationEmitMappedTypeTemplateTypeofSymbol.js +++ new.declarationEmitMappedTypeTemplateTypeofSymbol.js -@@= skipped -54, +54 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); +@@= skipped -62, +62 lines =@@ exports.timestamp = void 0; --var x = __importStar(require("./a")); -+const x = __importStar(require("./a")); - exports.timestamp = x.now(); - //// [c.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.timestamp = void 0; --var a_1 = require("./a"); -+const a_1 = require("./a"); + const a_1 = require("./a"); exports.timestamp = (0, a_1.now)(); + + diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.js.diff index aa67cad6dd..6018ca4ef1 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitNameConflicts.js.diff @@ -1,15 +1,6 @@ --- old.declarationEmitNameConflicts.js +++ new.declarationEmitNameConflicts.js -@@= skipped -61, +61 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.M = void 0; --var im = require("./declarationEmit_nameConflicts_1"); -+const im = require("./declarationEmit_nameConflicts_1"); - var M; - (function (M) { - function f() { } -@@= skipped -20, +20 lines =@@ +@@= skipped -81, +81 lines =@@ M.d = im; })(M || (exports.M = M = {})); (function (M) { diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitOfTypeofAliasedExport.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitOfTypeofAliasedExport.js.diff deleted file mode 100644 index 9c5fb28bb8..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitOfTypeofAliasedExport.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitOfTypeofAliasedExport.js -+++ new.declarationEmitOfTypeofAliasedExport.js -@@= skipped -51, +51 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var a = __importStar(require("./a")); -+const a = __importStar(require("./a")); - exports.default = a.D; - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitPreserveReferencedImports.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitPreserveReferencedImports.js.diff deleted file mode 100644 index 83b706aaeb..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitPreserveReferencedImports.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitPreserveReferencedImports.js -+++ new.declarationEmitPreserveReferencedImports.js -@@= skipped -26, +26 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.f = void 0; --var decl_1 = require("./decl"); -+const decl_1 = require("./decl"); - exports.f = { o: (0, decl_1.o)({ v: null }) }; - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitPrivateReadonlyLiterals.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitPrivateReadonlyLiterals.js.diff index 9b324bfd28..f75495e4f1 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitPrivateReadonlyLiterals.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitPrivateReadonlyLiterals.js.diff @@ -1,26 +1,20 @@ --- old.declarationEmitPrivateReadonlyLiterals.js +++ new.declarationEmitPrivateReadonlyLiterals.js -@@= skipped -9, +9 lines =@@ - +@@= skipped -10, +10 lines =@@ //// [declarationEmitPrivateReadonlyLiterals.js] --let Foo = (() => { -- class Foo { -- constructor() { -- this.B = "b"; -- this.D = 42; -- } + class Foo { +- constructor() { +- this.B = "b"; +- this.D = 42; - } -- Foo.A = "a"; -- Foo.C = 42; -- return Foo; --})(); -+class Foo { + static A = "a"; + B = "b"; + static C = 42; + D = 42; -+} + } +-Foo.A = "a"; +-Foo.C = 42; //// [declarationEmitPrivateReadonlyLiterals.d.ts] diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js.diff index 68223f05a7..f4e99ebf67 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js.diff @@ -7,8 +7,7 @@ -var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; --var a_1 = require("./a"); -+const a_1 = require("./a"); + const a_1 = require("./a"); class C { - constructor() { - this[_a] = 1; @@ -22,10 +21,8 @@ -var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.D = void 0; --var a_1 = require("./a"); --var b_1 = require("./b"); -+const a_1 = require("./a"); -+const b_1 = require("./b"); + const a_1 = require("./a"); + const b_1 = require("./b"); class D extends b_1.C { - constructor() { - super(...arguments); diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitQualifiedAliasTypeArgument.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitQualifiedAliasTypeArgument.js.diff deleted file mode 100644 index e09ce24362..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitQualifiedAliasTypeArgument.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitQualifiedAliasTypeArgument.js -+++ new.declarationEmitQualifiedAliasTypeArgument.js -@@= skipped -30, +30 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.fun2 = exports.fun = void 0; --var bbb_1 = require("./bbb"); -+const bbb_1 = require("./bbb"); - exports.fun = (0, bbb_1.create)(); - exports.fun2 = (0, bbb_1.create)(); diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReadonlyComputedProperty.js b/testdata/baselines/reference/submodule/compiler/declarationEmitReadonlyComputedProperty.js index 80863fe47d..cc545d98a2 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReadonlyComputedProperty.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReadonlyComputedProperty.js @@ -33,21 +33,10 @@ function createInstance() { } //// [index.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++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.spread = void 0; const bug_1 = require("./bug"); -exports.spread = __assign({}, (0, bug_1.createInstance)()); +exports.spread = Object.assign({}, (0, bug_1.createInstance)()); //// [bug.d.ts] diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReadonlyComputedProperty.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitReadonlyComputedProperty.js.diff index 57152bbabf..0bea973d83 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReadonlyComputedProperty.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReadonlyComputedProperty.js.diff @@ -1,15 +1,6 @@ --- old.declarationEmitReadonlyComputedProperty.js +++ new.declarationEmitReadonlyComputedProperty.js -@@= skipped -45, +45 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.spread = void 0; --var bug_1 = require("./bug"); -+const bug_1 = require("./bug"); - exports.spread = __assign({}, (0, bug_1.createInstance)()); - - -@@= skipped -10, +10 lines =@@ +@@= skipped -44, +44 lines =@@ readonly [SYMBOL]: string; } export declare function createInstance(): Interface; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js.diff deleted file mode 100644 index 02b2051f9a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitReexportedSymlinkReference.js -+++ new.declarationEmitReexportedSymlinkReference.js -@@= skipped -46, +46 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ADMIN = void 0; --var pkg2_1 = require("@raymondfeng/pkg2"); -+const pkg2_1 = require("@raymondfeng/pkg2"); - exports.ADMIN = pkg2_1.MetadataAccessor.create('1'); - //// [index.js] - "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.js.diff index e4c91af8f8..67bb08a149 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.js.diff @@ -1,15 +1,6 @@ --- old.declarationEmitReexportedSymlinkReference2.js +++ new.declarationEmitReexportedSymlinkReference2.js -@@= skipped -49, +49 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ADMIN = void 0; --var pkg2_1 = require("@raymondfeng/pkg2"); -+const pkg2_1 = require("@raymondfeng/pkg2"); - exports.ADMIN = pkg2_1.MetadataAccessor.create('1'); - //// [index.js] - "use strict"; -@@= skipped -24, +24 lines =@@ +@@= skipped -73, +73 lines =@@ //// [keys.d.ts] import { MetadataAccessor } from "@raymondfeng/pkg2"; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.js.diff index 63337a5943..b09fdf0eb0 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.js.diff @@ -1,15 +1,6 @@ --- old.declarationEmitReexportedSymlinkReference3.js +++ new.declarationEmitReexportedSymlinkReference3.js -@@= skipped -46, +46 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ADMIN = void 0; --var pkg2_1 = require("@raymondfeng/pkg2"); -+const pkg2_1 = require("@raymondfeng/pkg2"); - exports.ADMIN = pkg2_1.MetadataAccessor.create('1'); - //// [index.js] - "use strict"; -@@= skipped -22, +22 lines =@@ +@@= skipped -68, +68 lines =@@ __exportStar(require("./keys"), exports); diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitRetainedAnnotationRetainsImportInOutput.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitRetainedAnnotationRetainsImportInOutput.js.diff deleted file mode 100644 index a55c73011a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitRetainedAnnotationRetainsImportInOutput.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitRetainedAnnotationRetainsImportInOutput.js -+++ new.declarationEmitRetainedAnnotationRetainsImportInOutput.js -@@= skipped -45, +45 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.run = void 0; --var E = __importStar(require("whatever")); -+const E = __importStar(require("whatever")); - const run = (i) => E.something(i); - exports.run = run; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitScopeConsistency.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitScopeConsistency.js.diff deleted file mode 100644 index 3cf7d94e90..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitScopeConsistency.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitScopeConsistency.js -+++ new.declarationEmitScopeConsistency.js -@@= skipped -19, +19 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.g = void 0; --var a_1 = require("./a"); -+const a_1 = require("./a"); - exports.g = a_1.f; - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitSpreadStringlyKeyedEnum.js b/testdata/baselines/reference/submodule/compiler/declarationEmitSpreadStringlyKeyedEnum.js index a41ed9e6ef..3bcd5e2c1e 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitSpreadStringlyKeyedEnum.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitSpreadStringlyKeyedEnum.js @@ -6,17 +6,6 @@ export const SpotifyAgeGroupEnum = { ...AgeGroups }; //// [declarationEmitSpreadStringlyKeyedEnum.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++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.SpotifyAgeGroupEnum = void 0; var AgeGroups; @@ -29,7 +18,7 @@ var AgeGroups; AgeGroups[AgeGroups["45-59"] = 5] = "45-59"; AgeGroups[AgeGroups["60-150"] = 6] = "60-150"; })(AgeGroups || (AgeGroups = {})); -exports.SpotifyAgeGroupEnum = __assign({}, AgeGroups); +exports.SpotifyAgeGroupEnum = Object.assign({}, AgeGroups); //// [declarationEmitSpreadStringlyKeyedEnum.d.ts] diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitSpreadStringlyKeyedEnum.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitSpreadStringlyKeyedEnum.js.diff index ad0166b32d..fe7caa9b71 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitSpreadStringlyKeyedEnum.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitSpreadStringlyKeyedEnum.js.diff @@ -1,6 +1,6 @@ --- old.declarationEmitSpreadStringlyKeyedEnum.js +++ new.declarationEmitSpreadStringlyKeyedEnum.js -@@= skipped -43, +43 lines =@@ +@@= skipped -32, +32 lines =@@ } export declare const SpotifyAgeGroupEnum: { [x: number]: string; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js b/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js index b9e1f3e3e9..2b76c687bb 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js @@ -46,23 +46,12 @@ class A { exports.A = A; //// [index.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++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.B = void 0; const class_1 = require("./class"); class B extends class_1.A { getA() { - return __assign(__assign({}, super.getA()), { a: '123' }); + return Object.assign(Object.assign({}, super.getA()), { a: '123' }); } } exports.B = B; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff deleted file mode 100644 index 10be9dc844..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitStringEnumUsedInNonlocalSpread.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitStringEnumUsedInNonlocalSpread.js -+++ new.declarationEmitStringEnumUsedInNonlocalSpread.js -@@= skipped -58, +58 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.B = void 0; --var class_1 = require("./class"); -+const class_1 = require("./class"); - class B extends class_1.A { - getA() { - return __assign(__assign({}, super.getA()), { a: '123' }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitSymlinkPaths.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitSymlinkPaths.js.diff deleted file mode 100644 index 698bf06685..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitSymlinkPaths.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.declarationEmitSymlinkPaths.js -+++ new.declarationEmitSymlinkPaths.js -@@= skipped -34, +34 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.NotificationScenario = void 0; --var index_1 = require("search/lib/index"); --var NotificationAPIUtils_1 = require("../API/NotificationAPIUtils"); -+const index_1 = require("search/lib/index"); -+const NotificationAPIUtils_1 = require("../API/NotificationAPIUtils"); - exports.NotificationScenario = (0, index_1.test)(NotificationAPIUtils_1.getNotification); - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTopLevelNodeFromCrossFile.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitTopLevelNodeFromCrossFile.js.diff index 3ade3ca35d..78af8589f8 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTopLevelNodeFromCrossFile.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitTopLevelNodeFromCrossFile.js.diff @@ -1,15 +1,6 @@ --- old.declarationEmitTopLevelNodeFromCrossFile.js +++ new.declarationEmitTopLevelNodeFromCrossFile.js -@@= skipped -24, +24 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = exports.m = void 0; --var a_1 = require("./a"); -+const a_1 = require("./a"); - exports.m = { - /** - * leading doc for prop -@@= skipped -13, +13 lines =@@ +@@= skipped -37, +37 lines =@@ //// [a.d.ts] export type X = string; export declare const fn: { diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTopLevelNodeFromCrossFile2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitTopLevelNodeFromCrossFile2.js.diff deleted file mode 100644 index 69a7035dd1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTopLevelNodeFromCrossFile2.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitTopLevelNodeFromCrossFile2.js -+++ new.declarationEmitTopLevelNodeFromCrossFile2.js -@@= skipped -25, +25 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports._ = void 0; --var boxedBox_1 = require("./boxedBox"); -+const boxedBox_1 = require("./boxedBox"); - exports._ = boxedBox_1.boxedBox; - // At index 83 - /** \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTransitiveImportOfHtmlDeclarationItem.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitTransitiveImportOfHtmlDeclarationItem.js.diff index 0b54229003..8685202443 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTransitiveImportOfHtmlDeclarationItem.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitTransitiveImportOfHtmlDeclarationItem.js.diff @@ -1,24 +1,6 @@ --- old.declarationEmitTransitiveImportOfHtmlDeclarationItem.js +++ new.declarationEmitTransitiveImportOfHtmlDeclarationItem.js -@@= skipped -17, +17 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.func = func; --var foo_html_1 = require("./foo.html"); -+const foo_html_1 = require("./foo.html"); - function func() { - return new foo_html_1.CustomHtmlRepresentationThing(); - } -@@= skipped -8, +8 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.c = void 0; --var reexporter_1 = require("./reexporter"); -+const reexporter_1 = require("./reexporter"); - exports.c = (0, reexporter_1.func)(); - - -@@= skipped -8, +8 lines =@@ +@@= skipped -33, +33 lines =@@ import { CustomHtmlRepresentationThing } from "./foo.html"; export declare function func(): CustomHtmlRepresentationThing; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofDefaultExport.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofDefaultExport.js.diff deleted file mode 100644 index 825f4f6ab5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofDefaultExport.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitTypeofDefaultExport.js -+++ new.declarationEmitTypeofDefaultExport.js -@@= skipped -50, +50 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var a = __importStar(require("./a")); -+const a = __importStar(require("./a")); - exports.default = a.default; - diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUnnessesaryTypeReferenceNotAdded.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUnnessesaryTypeReferenceNotAdded.js.diff deleted file mode 100644 index 3aa75a2b79..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUnnessesaryTypeReferenceNotAdded.js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.declarationEmitUnnessesaryTypeReferenceNotAdded.js -+++ new.declarationEmitUnnessesaryTypeReferenceNotAdded.js -@@= skipped -33, +33 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = parseArgs; --var minimist = require("minimist"); --var process = require("process"); -+const minimist = require("minimist"); -+const process = require("process"); - function parseArgs() { - return minimist(process.argv.slice(2)); - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitWithDefaultAsComputedName.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitWithDefaultAsComputedName.js.diff deleted file mode 100644 index 82c1d39bcd..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitWithDefaultAsComputedName.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitWithDefaultAsComputedName.js -+++ new.declarationEmitWithDefaultAsComputedName.js -@@= skipped -29, +29 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.obj = void 0; --var other_1 = __importDefault(require("./other")); -+const other_1 = __importDefault(require("./other")); - exports.obj = { - [other_1.default.name]: 1, - }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitWithDefaultAsComputedName2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitWithDefaultAsComputedName2.js.diff deleted file mode 100644 index db93e12166..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitWithDefaultAsComputedName2.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationEmitWithDefaultAsComputedName2.js -+++ new.declarationEmitWithDefaultAsComputedName2.js -@@= skipped -59, +59 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.obj = void 0; --var other2 = __importStar(require("./other")); -+const other2 = __importStar(require("./other")); - exports.obj = { - [other2.default.name]: 1 - }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationMapsMultifile.js.diff b/testdata/baselines/reference/submodule/compiler/declarationMapsMultifile.js.diff deleted file mode 100644 index 3bd4d3f673..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationMapsMultifile.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationMapsMultifile.js -+++ new.declarationMapsMultifile.js -@@= skipped -35, +35 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Foo = exports.c = exports.x = void 0; --var a_1 = require("./a"); -+const a_1 = require("./a"); - Object.defineProperty(exports, "Foo", { enumerable: true, get: function () { return a_1.Foo; } }); - const c = new a_1.Foo(); - exports.c = c; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationNoDanglingGenerics.js.diff b/testdata/baselines/reference/submodule/compiler/declarationNoDanglingGenerics.js.diff index ab998bb17c..6775d3e345 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationNoDanglingGenerics.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationNoDanglingGenerics.js.diff @@ -13,25 +13,19 @@ - }, - _a.THE_KIND = kind, - _a; --} --let Kinds = (() => { -- class Kinds { -- } -- Kinds.A = "A"; -- Kinds.B = "B"; -- Kinds.C = "C"; -- return Kinds; --})(); + return class { + static THE_KIND = kind; + kind = kind; + }; -+} -+class Kinds { + } + class Kinds { + static A = "A"; + static B = "B"; + static C = "C"; -+} + } +-Kinds.A = "A"; +-Kinds.B = "B"; +-Kinds.C = "C"; class AKind extends ClassFactory(Kinds.A) { } exports.AKind = AKind; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationsForInferredTypeFromOtherFile.js.diff b/testdata/baselines/reference/submodule/compiler/declarationsForInferredTypeFromOtherFile.js.diff deleted file mode 100644 index 832b323d4f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationsForInferredTypeFromOtherFile.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationsForInferredTypeFromOtherFile.js -+++ new.declarationsForInferredTypeFromOtherFile.js -@@= skipped -30, +30 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.bar = bar; --var file2_1 = require("./file2"); -+const file2_1 = require("./file2"); - function bar() { - return (0, file2_1.foo)(); - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js.diff b/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js.diff deleted file mode 100644 index 3a61d94d5c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationsIndirectGeneratedAliasReference.js -+++ new.declarationsIndirectGeneratedAliasReference.js -@@= skipped -54, +54 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MyComp = void 0; --var ns = __importStar(require("mod")); -+const ns = __importStar(require("mod")); - const Ctor = ns.default; - exports.MyComp = Ctor.extends({ foo: "bar" }); diff --git a/testdata/baselines/reference/submodule/compiler/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.js b/testdata/baselines/reference/submodule/compiler/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.js index 618990a5f9..eefbdc979e 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.js +++ b/testdata/baselines/reference/submodule/compiler/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.js @@ -46,17 +46,6 @@ void p3.result.three; "use strict"; // Note that both of the following have an `any` in their return type from where we bottom out the type printout // for having too many instances of the same symbol nesting. -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.testRecFun = exports.updateIfChanged = void 0; const updateIfChanged = (t) => { @@ -73,7 +62,7 @@ exports.updateIfChanged = updateIfChanged; const testRecFun = (parent) => { return { result: parent, - deeper: (child) => (0, exports.testRecFun)(__assign(__assign({}, parent), child)) + deeper: (child) => (0, exports.testRecFun)(Object.assign(Object.assign({}, parent), child)) }; }; exports.testRecFun = testRecFun; diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataConditionalType.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataConditionalType.js.diff index 984a229851..6295e21a3b 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataConditionalType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataConditionalType.js.diff @@ -13,29 +13,19 @@ -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; --let BaseEntity = (() => { -- class BaseEntity { -- } -- __decorate([ -- d(), -- __metadata("design:type", Object) -- ], BaseEntity.prototype, "attributes", void 0); -- return BaseEntity; --})(); --let C = (() => { -- class C { -- } -- __decorate([ -- d(), -- __metadata("design:type", Boolean) -- ], C.prototype, "x", void 0); -- return C; --})(); -+class BaseEntity { + class BaseEntity { + @d() + attributes; -+} -+class C { + } +-__decorate([ +- d(), +- __metadata("design:type", Object) +-], BaseEntity.prototype, "attributes", void 0); + class C { + @d() + x; -+} \ No newline at end of file + } +-__decorate([ +- d(), +- __metadata("design:type", Boolean) +-], C.prototype, "x", void 0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js.diff index 7c093f8747..a8d7592793 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js.diff @@ -1,28 +1,16 @@ --- old.decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js +++ new.decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js -@@= skipped -15, +15 lines =@@ - - - //// [decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js] --let MyClass = (() => { -- class MyClass { -- constructor(test, test2) { -- } -- doSomething() { -- } -- } -- __decorate([ -- decorator, -- __metadata("design:type", Function), -- __metadata("design:paramtypes", []), -- __metadata("design:returntype", void 0) -- ], MyClass.prototype, "doSomething", null); -- return MyClass; --})(); -+class MyClass { -+ constructor(test, test2) { -+ } +@@= skipped -18, +18 lines =@@ + class MyClass { + constructor(test, test2) { + } + @decorator -+ doSomething() { -+ } -+} \ No newline at end of file + doSomething() { + } + } +-__decorate([ +- decorator, +- __metadata("design:type", Function), +- __metadata("design:paramtypes", []), +- __metadata("design:returntype", void 0) +-], MyClass.prototype, "doSomething", null); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariable.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariable.js.diff index a244db4e3a..539bf51b76 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariable.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariable.js.diff @@ -15,17 +15,12 @@ -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; --let C = (() => { -- class C { -- } -- __decorate([ -- Decorate, -- __metadata("design:type", Object) -- ], C.prototype, "member", void 0); -- return C; --})(); -+class C { + class C { + @Decorate + member; -+} - exports.C = C; \ No newline at end of file + } + exports.C = C; +-__decorate([ +- Decorate, +- __metadata("design:type", Object) +-], C.prototype, "member", void 0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariableDefault.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariableDefault.js.diff index 2b9ff874c4..c2166ee642 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariableDefault.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariableDefault.js.diff @@ -15,17 +15,12 @@ -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; --let C = (() => { -- class C { -- } -- __decorate([ -- Decorate, -- __metadata("design:type", Object) -- ], C.prototype, "member", void 0); -- return C; --})(); -+class C { + class C { + @Decorate + member; -+} - exports.C = C; \ No newline at end of file + } + exports.C = C; +-__decorate([ +- Decorate, +- __metadata("design:type", Object) +-], C.prototype, "member", void 0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariableInScope.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariableInScope.js.diff index 3d6afafc4b..f0a4f7418e 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariableInScope.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataGenericTypeVariableInScope.js.diff @@ -18,17 +18,12 @@ // Unused, but could collide with the named type argument below. class TypeVariable { } --let C = (() => { -- class C { -- } -- __decorate([ -- Decorate, -- __metadata("design:type", Object) -- ], C.prototype, "member", void 0); -- return C; --})(); -+class C { + class C { + @Decorate + member; -+} - exports.C = C; \ No newline at end of file + } + exports.C = C; +-__decorate([ +- Decorate, +- __metadata("design:type", Object) +-], C.prototype, "member", void 0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataNoLibIsolatedModulesTypes.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataNoLibIsolatedModulesTypes.js.diff index cbe209f149..6945d65ec3 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataNoLibIsolatedModulesTypes.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataNoLibIsolatedModulesTypes.js.diff @@ -13,20 +13,15 @@ -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; +-var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.B = void 0; --let B = (() => { -- var _a; -- class B { -- } -- __decorate([ -- Decorate, -- __metadata("design:type", typeof (_a = typeof Map !== "undefined" && Map) === "function" ? _a : Object) -- ], B.prototype, "member", void 0); -- return B; --})(); -+class B { + class B { + @Decorate + member; -+} - exports.B = B; \ No newline at end of file + } + exports.B = B; +-__decorate([ +- Decorate, +- __metadata("design:type", typeof (_a = typeof Map !== "undefined" && Map) === "function" ? _a : Object) +-], B.prototype, "member", void 0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataNoStrictNull.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataNoStrictNull.js.diff index ef3a9eeac5..e434c0db47 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataNoStrictNull.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataNoStrictNull.js.diff @@ -14,22 +14,17 @@ - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; const dec = (obj, prop) => undefined; --let Foo = (() => { -- class Foo { -- } -- __decorate([ -- dec, -- __metadata("design:type", String) -- ], Foo.prototype, "foo", void 0); -- __decorate([ -- dec, -- __metadata("design:type", String) -- ], Foo.prototype, "bar", void 0); -- return Foo; --})(); -+class Foo { + class Foo { + @dec + foo; + @dec + bar; -+} \ No newline at end of file + } +-__decorate([ +- dec, +- __metadata("design:type", String) +-], Foo.prototype, "foo", void 0); +-__decorate([ +- dec, +- __metadata("design:type", String) +-], Foo.prototype, "bar", void 0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataOnInferredType.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataOnInferredType.js.diff index be80267c83..62a64235ff 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataOnInferredType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataOnInferredType.js.diff @@ -1,23 +1,17 @@ --- old.decoratorMetadataOnInferredType.js +++ new.decoratorMetadataOnInferredType.js -@@= skipped -26, +26 lines =@@ - } +@@= skipped -27, +27 lines =@@ function decorator(target, propertyKey) { } --let B = (() => { -- class B { -- constructor() { -- this.x = new A(); -- } + class B { +- constructor() { +- this.x = new A(); - } -- __decorate([ -- decorator, -- __metadata("design:type", Object) -- ], B.prototype, "x", void 0); -- return B; --})(); -+class B { + @decorator + x = new A(); -+} - exports.B = B; \ No newline at end of file + } + exports.B = B; +-__decorate([ +- decorator, +- __metadata("design:type", Object) +-], B.prototype, "x", void 0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataRestParameterWithImportedType.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataRestParameterWithImportedType.js.diff index fdaf69b640..6fecd8f7c1 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataRestParameterWithImportedType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataRestParameterWithImportedType.js.diff @@ -36,42 +36,34 @@ -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.ClassA = void 0; --var aux_1 = require("./aux"); --var aux1_1 = require("./aux1"); +-const aux_1 = require("./aux"); +-const aux1_1 = require("./aux1"); function annotation() { return (target) => { }; } function annotation1() { return (target) => { }; } --let ClassA = (() => { -- let ClassA = class ClassA { -- constructor(...init) { -- this.array = init; -- } -- foo(...args) { -- } -- }; -- __decorate([ -- annotation1(), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [aux1_1.SomeClass1]), -- __metadata("design:returntype", void 0) -- ], ClassA.prototype, "foo", null); -- ClassA = __decorate([ -- annotation(), -- __metadata("design:paramtypes", [aux_1.SomeClass]) -- ], ClassA); -- return ClassA; --})(); +-let ClassA = class ClassA { +@annotation() +class ClassA { + array; -+ constructor(...init) { -+ this.array = init; -+ } + constructor(...init) { + this.array = init; + } + @annotation1() -+ foo(...args) { -+ } + foo(...args) { + } +-}; +} - exports.ClassA = ClassA; \ No newline at end of file + exports.ClassA = ClassA; +-__decorate([ +- annotation1(), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [aux1_1.SomeClass1]), +- __metadata("design:returntype", void 0) +-], ClassA.prototype, "foo", null); +-exports.ClassA = ClassA = __decorate([ +- annotation(), +- __metadata("design:paramtypes", [aux_1.SomeClass]) +-], ClassA); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataTypeOnlyExport.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataTypeOnlyExport.js.diff index 9f026d745b..6810d758b3 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataTypeOnlyExport.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataTypeOnlyExport.js.diff @@ -15,17 +15,13 @@ -}; Object.defineProperty(exports, "__esModule", { value: true }); const Decorator = () => undefined; --let Bar = (() => { -- let Bar = class Bar { -- constructor(par) { } -- }; -- Bar = __decorate([ -- Decorator, -- __metadata("design:paramtypes", [Function]) -- ], Bar); -- return Bar; --})(); +-let Bar = class Bar { +@Decorator +class Bar { -+ constructor(par) { } + constructor(par) { } +-}; +-Bar = __decorate([ +- Decorator, +- __metadata("design:paramtypes", [Function]) +-], Bar); +} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataTypeOnlyImport.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataTypeOnlyImport.js.diff index a49628cdf0..178e1243ec 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataTypeOnlyImport.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataTypeOnlyImport.js.diff @@ -14,16 +14,11 @@ - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; Object.defineProperty(exports, "__esModule", { value: true }); --let Foo = (() => { -- class Foo { -- } -- __decorate([ -- Decorator, -- __metadata("design:type", Object) -- ], Foo.prototype, "myList", void 0); -- return Foo; --})(); -+class Foo { + class Foo { + @Decorator + myList; -+} \ No newline at end of file + } +-__decorate([ +- Decorator, +- __metadata("design:type", Object) +-], Foo.prototype, "myList", void 0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithConstructorType.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithConstructorType.js.diff index 26885372e7..42987000ba 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithConstructorType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithConstructorType.js.diff @@ -1,23 +1,17 @@ --- old.decoratorMetadataWithConstructorType.js +++ new.decoratorMetadataWithConstructorType.js -@@= skipped -26, +26 lines =@@ - } +@@= skipped -27, +27 lines =@@ function decorator(target, propertyKey) { } --let B = (() => { -- class B { -- constructor() { -- this.x = new A(); -- } + class B { +- constructor() { +- this.x = new A(); - } -- __decorate([ -- decorator, -- __metadata("design:type", A) -- ], B.prototype, "x", void 0); -- return B; --})(); -+class B { + @decorator + x = new A(); -+} - exports.B = B; \ No newline at end of file + } + exports.B = B; +-__decorate([ +- decorator, +- __metadata("design:type", A) +-], B.prototype, "x", void 0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision.js.diff index d2adab911a..451939e964 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision.js.diff @@ -4,29 +4,22 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass = void 0; --var db_1 = require("./db"); +-const db_1 = require("./db"); function someDecorator(target) { return target; } --let MyClass = (() => { -- let MyClass = class MyClass { -- constructor(db) { -- this.db = db; -- this.db.doSomething(); -- } -- }; -- MyClass = __decorate([ -- someDecorator, -- __metadata("design:paramtypes", [db_1.db]) -- ], MyClass); -- return MyClass; --})(); +-let MyClass = class MyClass { +@someDecorator +class MyClass { + db; -+ constructor(db) { -+ this.db = db; -+ this.db.doSomething(); -+ } + constructor(db) { + this.db = db; + this.db.doSomething(); + } +-}; +} - exports.MyClass = MyClass; \ No newline at end of file + exports.MyClass = MyClass; +-exports.MyClass = MyClass = __decorate([ +- someDecorator, +- __metadata("design:paramtypes", [db_1.db]) +-], MyClass); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision2.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision2.js.diff index fcc4f9fc78..ce4fc16af7 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision2.js.diff @@ -4,29 +4,22 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass = void 0; --var db_1 = require("./db"); +-const db_1 = require("./db"); function someDecorator(target) { return target; } --let MyClass = (() => { -- let MyClass = class MyClass { -- constructor(db) { -- this.db = db; -- this.db.doSomething(); -- } -- }; -- MyClass = __decorate([ -- someDecorator, -- __metadata("design:paramtypes", [db_1.db]) -- ], MyClass); -- return MyClass; --})(); +-let MyClass = class MyClass { +@someDecorator +class MyClass { + db; -+ constructor(db) { -+ this.db = db; -+ this.db.doSomething(); -+ } + constructor(db) { + this.db = db; + this.db.doSomething(); + } +-}; +} - exports.MyClass = MyClass; \ No newline at end of file + exports.MyClass = MyClass; +-exports.MyClass = MyClass = __decorate([ +- someDecorator, +- __metadata("design:paramtypes", [db_1.db]) +-], MyClass); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision3.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision3.js.diff index 3b7e2467b4..f7743bd292 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision3.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision3.js.diff @@ -4,29 +4,22 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass = void 0; --var db = require("./db"); +-const db = require("./db"); function someDecorator(target) { return target; } --let MyClass = (() => { -- let MyClass = class MyClass { -- constructor(db) { -- this.db = db; -- this.db.doSomething(); -- } -- }; -- MyClass = __decorate([ -- someDecorator, -- __metadata("design:paramtypes", [db.db]) -- ], MyClass); -- return MyClass; --})(); +-let MyClass = class MyClass { +@someDecorator +class MyClass { + db; -+ constructor(db) { -+ this.db = db; -+ this.db.doSomething(); -+ } + constructor(db) { + this.db = db; + this.db.doSomething(); + } +-}; +} - exports.MyClass = MyClass; \ No newline at end of file + exports.MyClass = MyClass; +-exports.MyClass = MyClass = __decorate([ +- someDecorator, +- __metadata("design:paramtypes", [db.db]) +-], MyClass); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision4.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision4.js.diff index 33cd58ddcf..f4e8746982 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision4.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision4.js.diff @@ -1,33 +1,28 @@ --- old.decoratorMetadataWithImportDeclarationNameCollision4.js +++ new.decoratorMetadataWithImportDeclarationNameCollision4.js -@@= skipped -35, +35 lines =@@ +@@= skipped -33, +33 lines =@@ + exports.db = db; + //// [service.js] "use strict"; +-var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass = void 0; --var db_1 = __importDefault(require("./db")); // error no default export +-const db_1 = __importDefault(require("./db")); // error no default export function someDecorator(target) { return target; } --let MyClass = (() => { -- var _a; -- let MyClass = class MyClass { -- constructor(db) { -- this.db = db; -- this.db.doSomething(); -- } -- }; -- MyClass = __decorate([ -- someDecorator, -- __metadata("design:paramtypes", [typeof (_a = typeof db_1.default !== "undefined" && db_1.default.db) === "function" ? _a : Object]) -- ], MyClass); -- return MyClass; --})(); +-let MyClass = class MyClass { +@someDecorator +class MyClass { + db; -+ constructor(db) { -+ this.db = db; -+ this.db.doSomething(); -+ } + constructor(db) { + this.db = db; + this.db.doSomething(); + } +-}; +} - exports.MyClass = MyClass; \ No newline at end of file + exports.MyClass = MyClass; +-exports.MyClass = MyClass = __decorate([ +- someDecorator, +- __metadata("design:paramtypes", [typeof (_a = typeof db_1.default !== "undefined" && db_1.default.db) === "function" ? _a : Object]) +-], MyClass); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision5.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision5.js.diff index f5402ef4ab..8cc2adf934 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision5.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision5.js.diff @@ -4,29 +4,22 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass = void 0; --var db_1 = __importDefault(require("./db")); +-const db_1 = __importDefault(require("./db")); function someDecorator(target) { return target; } --let MyClass = (() => { -- let MyClass = class MyClass { -- constructor(db) { -- this.db = db; -- this.db.doSomething(); -- } -- }; -- MyClass = __decorate([ -- someDecorator, -- __metadata("design:paramtypes", [db_1.default]) -- ], MyClass); -- return MyClass; --})(); +-let MyClass = class MyClass { +@someDecorator +class MyClass { + db; -+ constructor(db) { -+ this.db = db; -+ this.db.doSomething(); -+ } + constructor(db) { + this.db = db; + this.db.doSomething(); + } +-}; +} - exports.MyClass = MyClass; \ No newline at end of file + exports.MyClass = MyClass; +-exports.MyClass = MyClass = __decorate([ +- someDecorator, +- __metadata("design:paramtypes", [db_1.default]) +-], MyClass); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision6.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision6.js.diff index 57d51ce2dd..73bd2dd2bc 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision6.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision6.js.diff @@ -4,29 +4,22 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass = void 0; --var db_1 = __importDefault(require("./db")); +-const db_1 = __importDefault(require("./db")); function someDecorator(target) { return target; } --let MyClass = (() => { -- let MyClass = class MyClass { -- constructor(db) { -- this.db = db; -- this.db.doSomething(); -- } -- }; -- MyClass = __decorate([ -- someDecorator, -- __metadata("design:paramtypes", [db_1.default]) -- ], MyClass); -- return MyClass; --})(); +-let MyClass = class MyClass { +@someDecorator +class MyClass { + db; -+ constructor(db) { -+ this.db = db; -+ this.db.doSomething(); -+ } + constructor(db) { + this.db = db; + this.db.doSomething(); + } +-}; +} - exports.MyClass = MyClass; \ No newline at end of file + exports.MyClass = MyClass; +-exports.MyClass = MyClass = __decorate([ +- someDecorator, +- __metadata("design:paramtypes", [db_1.default]) +-], MyClass); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision7.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision7.js.diff index c1441cd345..6252ef03d8 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision7.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision7.js.diff @@ -1,33 +1,28 @@ --- old.decoratorMetadataWithImportDeclarationNameCollision7.js +++ new.decoratorMetadataWithImportDeclarationNameCollision7.js -@@= skipped -34, +34 lines =@@ +@@= skipped -32, +32 lines =@@ + exports.default = db; + //// [service.js] "use strict"; +-var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass = void 0; --var db_1 = __importDefault(require("./db")); +-const db_1 = __importDefault(require("./db")); function someDecorator(target) { return target; } --let MyClass = (() => { -- var _a; -- let MyClass = class MyClass { -- constructor(db) { -- this.db = db; -- this.db.doSomething(); -- } -- }; -- MyClass = __decorate([ -- someDecorator, -- __metadata("design:paramtypes", [typeof (_a = typeof db_1.default !== "undefined" && db_1.default.db) === "function" ? _a : Object]) -- ], MyClass); -- return MyClass; --})(); +-let MyClass = class MyClass { +@someDecorator +class MyClass { + db; //error -+ constructor(db) { -+ this.db = db; -+ this.db.doSomething(); -+ } + constructor(db) { + this.db = db; + this.db.doSomething(); + } +-}; +} - exports.MyClass = MyClass; \ No newline at end of file + exports.MyClass = MyClass; +-exports.MyClass = MyClass = __decorate([ +- someDecorator, +- __metadata("design:paramtypes", [typeof (_a = typeof db_1.default !== "undefined" && db_1.default.db) === "function" ? _a : Object]) +-], MyClass); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision8.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision8.js.diff index 44fcb18c71..561b77d13e 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision8.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorMetadataWithImportDeclarationNameCollision8.js.diff @@ -4,29 +4,22 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass = void 0; --var database = require("./db"); +-const database = require("./db"); function someDecorator(target) { return target; } --let MyClass = (() => { -- let MyClass = class MyClass { -- constructor(db) { -- this.db = db; -- this.db.doSomething(); -- } -- }; -- MyClass = __decorate([ -- someDecorator, -- __metadata("design:paramtypes", [database.db]) -- ], MyClass); -- return MyClass; --})(); +-let MyClass = class MyClass { +@someDecorator +class MyClass { + db; -+ constructor(db) { -+ this.db = db; -+ this.db.doSomething(); -+ } + constructor(db) { + this.db = db; + this.db.doSomething(); + } +-}; +} - exports.MyClass = MyClass; \ No newline at end of file + exports.MyClass = MyClass; +-exports.MyClass = MyClass = __decorate([ +- someDecorator, +- __metadata("design:paramtypes", [database.db]) +-], MyClass); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorReferenceOnOtherProperty.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorReferenceOnOtherProperty.js.diff index 9831574364..3ca0672a71 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorReferenceOnOtherProperty.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorReferenceOnOtherProperty.js.diff @@ -17,23 +17,17 @@ - return function (target, key) { decorator(target, key, paramIndex); } -}; Object.defineProperty(exports, "__esModule", { value: true }); --var yoha_1 = require("./yoha"); +-const yoha_1 = require("./yoha"); function foo(...args) { } --let Bar = (() => { -- class Bar { -- yoha(yoha, bar) { } -- } -- __decorate([ -- __param(0, foo), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [Object, yoha_1.Yoha]), -- __metadata("design:returntype", void 0) -- ], Bar.prototype, "yoha", null); -- return Bar; --})(); -+class Bar { -+ yoha(yoha, bar) { } -+} + class Bar { + yoha(yoha, bar) { } + } +-__decorate([ +- __param(0, foo), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [Object, yoha_1.Yoha]), +- __metadata("design:returntype", void 0) +-], Bar.prototype, "yoha", null); //// [index2.js] "use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { @@ -49,20 +43,14 @@ - return function (target, key) { decorator(target, key, paramIndex); } -}; Object.defineProperty(exports, "__esModule", { value: true }); --var yoha_1 = require("./yoha"); +-const yoha_1 = require("./yoha"); function foo(...args) { } --let Bar = (() => { -- class Bar { -- yoha(yoha, ...bar) { } -- } -- __decorate([ -- __param(0, foo), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [Object, yoha_1.Yoha]), -- __metadata("design:returntype", void 0) -- ], Bar.prototype, "yoha", null); -- return Bar; --})(); -+class Bar { -+ yoha(yoha, ...bar) { } -+} \ No newline at end of file + class Bar { + yoha(yoha, ...bar) { } + } +-__decorate([ +- __param(0, foo), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [Object, yoha_1.Yoha]), +- __metadata("design:returntype", void 0) +-], Bar.prototype, "yoha", null); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorReferences.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorReferences.js.diff index 97bd982473..461ddb8ec1 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorReferences.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorReferences.js.diff @@ -13,22 +13,18 @@ -var __param = (this && this.__param) || function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -}; --let C = (() => { -- let C = class C { -- method(x, y) { } // <-- decorator y should be resolved at the class declaration, not the parameter. -- }; -- __decorate([ -- y(null) // <-- y should resolve to the function declaration, not the parameter; T should resolve to the type parameter of the class -- , -- __param(0, y) -- ], C.prototype, "method", null); -- C = __decorate([ -- y(1, () => C) // <-- T should be resolved to the type alias, not the type parameter of the class; C should resolve to the class -- ], C); -- return C; --})(); +-let C = class C { +@y(1, () => C) // <-- T should be resolved to the type alias, not the type parameter of the class; C should resolve to the class +class C { + @y(null) // <-- y should resolve to the function declaration, not the parameter; T should resolve to the type parameter of the class -+ method(x, y) { } // <-- decorator y should be resolved at the class declaration, not the parameter. + method(x, y) { } // <-- decorator y should be resolved at the class declaration, not the parameter. +-}; +-__decorate([ +- y(null) // <-- y should resolve to the function declaration, not the parameter; T should resolve to the type parameter of the class +- , +- __param(0, y) +-], C.prototype, "method", null); +-C = __decorate([ +- y(1, () => C) // <-- T should be resolved to the type alias, not the type parameter of the class; C should resolve to the class +-], C); +} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorUsedBeforeDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorUsedBeforeDeclaration.js.diff index 9d4bca892f..89776def3c 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorUsedBeforeDeclaration.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorUsedBeforeDeclaration.js.diff @@ -13,150 +13,110 @@ -var __param = (this && this.__param) || function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -}; --let Greeter = (() => { -- let Greeter = class Greeter { -- constructor(message) { -- this.greeting = message; -- } -- greet() { -- return "Hello, " + this.greeting; -- } -- greet1() { -- return "Hello, " + this.greeting; -- } -- greet2(param) { -- return "Hello, " + this.greeting; -- } -- greet3(param) { -- return "Hello, " + this.greeting; -- } -- }; -- __decorate([ -- lambda(Enum.No), -- deco(Enum.No) -- ], Greeter.prototype, "greeting", void 0); -- __decorate([ -- lambda(Enum.No), -- deco(Enum.No) -- ], Greeter.prototype, "greet", null); -- __decorate([ -- lambda, -- deco -- ], Greeter.prototype, "greet1", null); -- __decorate([ -- __param(0, lambda(Enum.No)), -- __param(0, deco(Enum.No)) -- ], Greeter.prototype, "greet2", null); -- __decorate([ -- __param(0, lambda), -- __param(0, deco) -- ], Greeter.prototype, "greet3", null); -- Greeter = __decorate([ -- lambda(Enum.No), -- deco(Enum.No) -- ], Greeter); -- return Greeter; --})(); +-let Greeter = class Greeter { +@lambda(Enum.No) +@deco(Enum.No) +class Greeter { + @lambda(Enum.No) + @deco(Enum.No) + greeting; -+ constructor(message) { -+ this.greeting = message; -+ } + constructor(message) { + this.greeting = message; + } + @lambda(Enum.No) + @deco(Enum.No) -+ greet() { -+ return "Hello, " + this.greeting; -+ } + greet() { + return "Hello, " + this.greeting; + } + @lambda + @deco -+ greet1() { -+ return "Hello, " + this.greeting; -+ } -+ greet2(param) { -+ return "Hello, " + this.greeting; -+ } -+ greet3(param) { -+ return "Hello, " + this.greeting; -+ } + greet1() { + return "Hello, " + this.greeting; + } +@@= skipped -25, +25 lines =@@ + greet3(param) { + return "Hello, " + this.greeting; + } +-}; +-__decorate([ +- lambda(Enum.No), +- deco(Enum.No) +-], Greeter.prototype, "greeting", void 0); +-__decorate([ +- lambda(Enum.No), +- deco(Enum.No) +-], Greeter.prototype, "greet", null); +-__decorate([ +- lambda, +- deco +-], Greeter.prototype, "greet1", null); +-__decorate([ +- __param(0, lambda(Enum.No)), +- __param(0, deco(Enum.No)) +-], Greeter.prototype, "greet2", null); +-__decorate([ +- __param(0, lambda), +- __param(0, deco) +-], Greeter.prototype, "greet3", null); +-Greeter = __decorate([ +- lambda(Enum.No), +- deco(Enum.No) +-], Greeter); +} function deco(...args) { } var Enum; (function (Enum) { -@@= skipped -60, +33 lines =@@ +@@= skipped -32, +8 lines =@@ Enum[Enum["Yes"] = 1] = "Yes"; })(Enum || (Enum = {})); const lambda = (...args) => { }; --let Greeter1 = (() => { -- let Greeter1 = class Greeter1 { -- constructor(message) { -- this.greeting = message; -- } -- greet() { -- return "Hello, " + this.greeting; -- } -- greet1() { -- return "Hello, " + this.greeting; -- } -- greet2(param) { -- return "Hello, " + this.greeting; -- } -- greet3(param) { -- return "Hello, " + this.greeting; -- } -- }; -- __decorate([ -- lambda(Enum.No), -- deco(Enum.No) -- ], Greeter1.prototype, "greeting", void 0); -- __decorate([ -- lambda(Enum.No), -- deco(Enum.No) -- ], Greeter1.prototype, "greet", null); -- __decorate([ -- lambda, -- deco -- ], Greeter1.prototype, "greet1", null); -- __decorate([ -- __param(0, lambda(Enum.No)), -- __param(0, deco(Enum.No)) -- ], Greeter1.prototype, "greet2", null); -- __decorate([ -- __param(0, lambda), -- __param(0, deco) -- ], Greeter1.prototype, "greet3", null); -- Greeter1 = __decorate([ -- lambda(Enum.No), -- deco(Enum.No) -- ], Greeter1); -- return Greeter1; --})(); +-let Greeter1 = class Greeter1 { +@lambda(Enum.No) +@deco(Enum.No) +class Greeter1 { + @lambda(Enum.No) + @deco(Enum.No) + greeting; -+ constructor(message) { -+ this.greeting = message; -+ } + constructor(message) { + this.greeting = message; + } + @lambda(Enum.No) + @deco(Enum.No) -+ greet() { -+ return "Hello, " + this.greeting; -+ } + greet() { + return "Hello, " + this.greeting; + } + @lambda + @deco -+ greet1() { -+ return "Hello, " + this.greeting; -+ } -+ greet2(param) { -+ return "Hello, " + this.greeting; -+ } -+ greet3(param) { -+ return "Hello, " + this.greeting; -+ } + greet1() { + return "Hello, " + this.greeting; + } +@@= skipped -16, +25 lines =@@ + greet3(param) { + return "Hello, " + this.greeting; + } +-}; +-__decorate([ +- lambda(Enum.No), +- deco(Enum.No) +-], Greeter1.prototype, "greeting", void 0); +-__decorate([ +- lambda(Enum.No), +- deco(Enum.No) +-], Greeter1.prototype, "greet", null); +-__decorate([ +- lambda, +- deco +-], Greeter1.prototype, "greet1", null); +-__decorate([ +- __param(0, lambda(Enum.No)), +- __param(0, deco(Enum.No)) +-], Greeter1.prototype, "greet2", null); +-__decorate([ +- __param(0, lambda), +- __param(0, deco) +-], Greeter1.prototype, "greet3", null); +-Greeter1 = __decorate([ +- lambda(Enum.No), +- deco(Enum.No) +-], Greeter1); +} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorWithNegativeLiteralTypeNoCrash.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorWithNegativeLiteralTypeNoCrash.js.diff index 3901d9ac35..0c4b632359 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorWithNegativeLiteralTypeNoCrash.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorWithNegativeLiteralTypeNoCrash.js.diff @@ -13,20 +13,15 @@ -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; --let A = (() => { -- class A { -- constructor() { -- this.field1 = -1; -- } + class A { +- constructor() { +- this.field1 = -1; - } -- __decorate([ -- decorator, -- __metadata("design:type", Number) -- ], A.prototype, "field1", void 0); -- return A; --})(); -+class A { + @decorator + field1 = -1; -+} + } +-__decorate([ +- decorator, +- __metadata("design:type", Number) +-], A.prototype, "field1", void 0); function decorator(target, field) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/decoratorWithUnderscoreMethod.js.diff b/testdata/baselines/reference/submodule/compiler/decoratorWithUnderscoreMethod.js.diff index e0bece90d5..26c25a70f7 100644 --- a/testdata/baselines/reference/submodule/compiler/decoratorWithUnderscoreMethod.js.diff +++ b/testdata/baselines/reference/submodule/compiler/decoratorWithUnderscoreMethod.js.diff @@ -1,22 +1,14 @@ --- old.decoratorWithUnderscoreMethod.js +++ new.decoratorWithUnderscoreMethod.js -@@= skipped -24, +24 lines =@@ - //propKey has three underscores as prefix, but the method has only two underscores +@@= skipped -25, +25 lines =@@ }; } --let A = (() => { -- class A { -- __foo(bar) { -- // do something with bar -- } -+class A { + class A { + @dec() -+ __foo(bar) { -+ // do something with bar + __foo(bar) { + // do something with bar } -- __decorate([ -- dec() -- ], A.prototype, "__foo", null); -- return A; --})(); -+} \ No newline at end of file + } +-__decorate([ +- dec() +-], A.prototype, "__foo", null); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitDefaultImport.js.diff b/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitDefaultImport.js.diff deleted file mode 100644 index c452d600c7..0000000000 --- a/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitDefaultImport.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.defaultDeclarationEmitDefaultImport.js -+++ new.defaultDeclarationEmitDefaultImport.js -@@= skipped -19, +19 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.instance = void 0; --var root_1 = require("./root"); -+const root_1 = require("./root"); - exports.instance = (0, root_1.getSomething)(); - diff --git a/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitNamedCorrectly.js.diff b/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitNamedCorrectly.js.diff index 8ddf6a5f80..1292087ee6 100644 --- a/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitNamedCorrectly.js.diff +++ b/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitNamedCorrectly.js.diff @@ -1,18 +1,12 @@ --- old.defaultDeclarationEmitNamedCorrectly.js +++ new.defaultDeclarationEmitNamedCorrectly.js -@@= skipped -23, +23 lines =@@ - function make(x) { +@@= skipped -24, +24 lines =@@ return null; } --let MyComponent = (() => { -- class MyComponent { -- } -- MyComponent.create = make(MyComponent); -- return MyComponent; --})(); -+class MyComponent { + class MyComponent { + props; + static create = make(MyComponent); -+} + } +-MyComponent.create = make(MyComponent); exports.default = MyComponent; diff --git a/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitShadowedNamedCorrectly.js.diff b/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitShadowedNamedCorrectly.js.diff index 6d9089577b..3e8205680a 100644 --- a/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitShadowedNamedCorrectly.js.diff +++ b/testdata/baselines/reference/submodule/compiler/defaultDeclarationEmitShadowedNamedCorrectly.js.diff @@ -1,12 +1,6 @@ --- old.defaultDeclarationEmitShadowedNamedCorrectly.js +++ new.defaultDeclarationEmitShadowedNamedCorrectly.js -@@= skipped -58, +58 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Something = void 0; - exports.make = make; --var me = __importStar(require("./this")); -+const me = __importStar(require("./this")); - function make(x) { +@@= skipped -63, +63 lines =@@ return null; } class MyComponent { @@ -14,7 +8,7 @@ } exports.default = MyComponent; var Something; -@@= skipped -31, +32 lines =@@ +@@= skipped -26, +27 lines =@@ props: Props; } export declare namespace Something { diff --git a/testdata/baselines/reference/submodule/compiler/defaultKeywordWithoutExport1.js.diff b/testdata/baselines/reference/submodule/compiler/defaultKeywordWithoutExport1.js.diff index 6f2ceb0597..93b578960f 100644 --- a/testdata/baselines/reference/submodule/compiler/defaultKeywordWithoutExport1.js.diff +++ b/testdata/baselines/reference/submodule/compiler/defaultKeywordWithoutExport1.js.diff @@ -10,14 +10,11 @@ - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; --let default_1 = (() => { -- let default_1 = class { -- }; -- default_1 = __decorate([ -- decorator -- ], default_1); -- return default_1; --})(); +-let default_1 = class { +-}; +-default_1 = __decorate([ +- decorator +-], default_1); +@decorator +default class { +} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.js.diff b/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.js.diff index 96490a6aa9..247f91233b 100644 --- a/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.js.diff +++ b/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.js.diff @@ -1,21 +1,10 @@ --- old.defaultPropsEmptyCurlyBecomesAnyForJs.js +++ new.defaultPropsEmptyCurlyBecomesAnyForJs.js -@@= skipped -28, +28 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); +@@= skipped -30, +30 lines =@@ exports.MyFoo = void 0; --var library_1 = require("./library"); -+const library_1 = require("./library"); + const library_1 = require("./library"); class MyFoo extends library_1.Foo { + member; } exports.MyFoo = MyFoo; - //// [typed_component.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.TypedFoo = void 0; --var component_1 = require("./component"); -+const component_1 = require("./component"); - class TypedFoo extends component_1.MyFoo { - constructor() { - super({ x: "string", y: 42 }, { value: undefined }); \ No newline at end of file + //// [typed_component.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/destructuredDeclarationEmit.js.diff b/testdata/baselines/reference/submodule/compiler/destructuredDeclarationEmit.js.diff index eb09637a97..c700d21d3e 100644 --- a/testdata/baselines/reference/submodule/compiler/destructuredDeclarationEmit.js.diff +++ b/testdata/baselines/reference/submodule/compiler/destructuredDeclarationEmit.js.diff @@ -1,11 +1,6 @@ --- old.destructuredDeclarationEmit.js +++ new.destructuredDeclarationEmit.js -@@= skipped -33, +33 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.foo2 = exports.sec = exports.bee = exports.one = exports.ibaz = exports.baz = exports.arr = exports.foo = void 0; --var foo_1 = require("./foo"); -+const foo_1 = require("./foo"); +@@= skipped -37, +37 lines =@@ Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return foo_1.foo; } }); Object.defineProperty(exports, "arr", { enumerable: true, get: function () { return foo_1.arr; } }); const { bar: baz, bat, bam: { bork: { bar: ibar, baz: ibaz } } } = foo_1.foo; diff --git a/testdata/baselines/reference/submodule/compiler/destructuringFromUnionSpread.js b/testdata/baselines/reference/submodule/compiler/destructuringFromUnionSpread.js index 420a13ded7..0adf7740fb 100644 --- a/testdata/baselines/reference/submodule/compiler/destructuringFromUnionSpread.js +++ b/testdata/baselines/reference/submodule/compiler/destructuringFromUnionSpread.js @@ -9,15 +9,4 @@ const { a } = { ...x } // error //// [destructuringFromUnionSpread.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -const { a } = __assign({}, x); // error +const { a } = Object.assign({}, x); // error diff --git a/testdata/baselines/reference/submodule/compiler/destructuringInitializerContextualTypeFromContext.js b/testdata/baselines/reference/submodule/compiler/destructuringInitializerContextualTypeFromContext.js index 97d4281b50..20b5671142 100644 --- a/testdata/baselines/reference/submodule/compiler/destructuringInitializerContextualTypeFromContext.js +++ b/testdata/baselines/reference/submodule/compiler/destructuringInitializerContextualTypeFromContext.js @@ -28,17 +28,6 @@ f(([_1, _2 = undefined]) => undefined) //// [destructuringInitializerContextualTypeFromContext.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) @@ -52,7 +41,7 @@ var __rest = (this && this.__rest) || function (s, e) { }; const Parent = (_a) => { var { children, name = "Artemis" } = _a, props = __rest(_a, ["children", "name"]); - return Child(__assign({ name }, props)); + return Child(Object.assign({ name }, props)); }; const Child = (_a) => { var { children, name = "Artemis" } = _a, props = __rest(_a, ["children", "name"]); diff --git a/testdata/baselines/reference/submodule/compiler/destructuringInitializerContextualTypeFromContext.js.diff b/testdata/baselines/reference/submodule/compiler/destructuringInitializerContextualTypeFromContext.js.diff index 0e60106225..5a3c5763ae 100644 --- a/testdata/baselines/reference/submodule/compiler/destructuringInitializerContextualTypeFromContext.js.diff +++ b/testdata/baselines/reference/submodule/compiler/destructuringInitializerContextualTypeFromContext.js.diff @@ -5,6 +5,6 @@ //// [destructuringInitializerContextualTypeFromContext.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++) { \ No newline at end of file + var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/downlevelLetConst18.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/downlevelLetConst18.errors.txt.diff deleted file mode 100644 index 53cd185a95..0000000000 --- a/testdata/baselines/reference/submodule/compiler/downlevelLetConst18.errors.txt.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.downlevelLetConst18.errors.txt -+++ new.downlevelLetConst18.errors.txt -@@= skipped -0, +0 lines =@@ --downlevelLetConst18.ts(4,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. --downlevelLetConst18.ts(8,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. -- -- --==== downlevelLetConst18.ts (2 errors) ==== -- 'use strict' -- -- for (let x; ;) { -- function foo() { x }; -- ~~~ --!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. -- } -- -- for (let x; ;) { -- function foo1() { x }; -- ~~~~ --!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. -- } -- -- for (let x; ;) { -- (() => { x })(); -- } -- -- for (const x = 1; ;) { -- (() => { x })(); -- } -- -- for (let x; ;) { -- ({ foo() { x }}) -- } -- -- for (let x; ;) { -- ({ get foo() { return x } }) -- } -- -- for (let x; ;) { -- ({ set foo(v) { x } }) -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/downlevelLetConst19.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/downlevelLetConst19.errors.txt.diff deleted file mode 100644 index fb3eb9ab2a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/downlevelLetConst19.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.downlevelLetConst19.errors.txt -+++ new.downlevelLetConst19.errors.txt -@@= skipped -0, +0 lines =@@ --downlevelLetConst19.ts(9,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. -- -- --==== downlevelLetConst19.ts (1 errors) ==== -- 'use strict' -- declare function use(a: any); -- var x; -- function a() { -- { -- let x; -- use(x); -- -- function b() { -- ~ --!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES5'. -- { -- let x; -- use(x); -- } -- use(x); -- } -- } -- use(x) -- } -- use(x) -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/duplicateObjectLiteralProperty_computedName3.js.diff b/testdata/baselines/reference/submodule/compiler/duplicateObjectLiteralProperty_computedName3.js.diff deleted file mode 100644 index 9efdbdf108..0000000000 --- a/testdata/baselines/reference/submodule/compiler/duplicateObjectLiteralProperty_computedName3.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.duplicateObjectLiteralProperty_computedName3.js -+++ new.duplicateObjectLiteralProperty_computedName3.js -@@= skipped -79, +79 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var keys = __importStar(require("./a")); -+const keys = __importStar(require("./a")); - const t1 = { - [keys.n]: 1, - [keys.n]: 1, // duplicate \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage.js.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage.js.diff deleted file mode 100644 index 2ff214f59b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/duplicatePackage.js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.duplicatePackage.js -+++ new.duplicatePackage.js -@@= skipped -44, +44 lines =@@ - //// [a.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var a_1 = require("a"); --var b_1 = require("b"); --var c_1 = require("c"); -+const a_1 = require("a"); -+const b_1 = require("b"); -+const c_1 = require("c"); - (0, a_1.a)(b_1.b); // Works - (0, a_1.a)(c_1.c); // Error, these are from different versions of the library. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.js.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.js.diff deleted file mode 100644 index 9791edb463..0000000000 --- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.duplicatePackage_referenceTypes.js -+++ new.duplicatePackage_referenceTypes.js -@@= skipped -59, +59 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var a = __importStar(require("a")); -+const a = __importStar(require("a")); - let foo = a.foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.js.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.js.diff deleted file mode 100644 index b3cf10182e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.duplicatePackage_relativeImportWithinPackage.js -+++ new.duplicatePackage_relativeImportWithinPackage.js -@@= skipped -39, +39 lines =@@ - //// [index.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var use_1 = require("foo/use"); --var a_1 = require("a"); -+const use_1 = require("foo/use"); -+const a_1 = require("a"); - (0, use_1.use)(a_1.o); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.js.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.js.diff deleted file mode 100644 index b81645b5e7..0000000000 --- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.duplicatePackage_relativeImportWithinPackage_scoped.js -+++ new.duplicatePackage_relativeImportWithinPackage_scoped.js -@@= skipped -39, +39 lines =@@ - //// [index.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var use_1 = require("@foo/bar/use"); --var a_1 = require("a"); -+const use_1 = require("@foo/bar/use"); -+const a_1 = require("a"); - (0, use_1.use)(a_1.o); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.js.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.js.diff deleted file mode 100644 index e706bdab21..0000000000 --- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.duplicatePackage_subModule.js -+++ new.duplicatePackage_subModule.js -@@= skipped -62, +62 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var a = __importStar(require("a")); -+const a = __importStar(require("a")); - const o = a.o; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/dynamicImportInDefaultExportExpression.js.diff b/testdata/baselines/reference/submodule/compiler/dynamicImportInDefaultExportExpression.js.diff deleted file mode 100644 index 0b7d21b4bd..0000000000 --- a/testdata/baselines/reference/submodule/compiler/dynamicImportInDefaultExportExpression.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.dynamicImportInDefaultExportExpression.js -+++ new.dynamicImportInDefaultExportExpression.js -@@= skipped -44, +44 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = { - getInstance: function () { -- return Promise.resolve().then(function () { return __importStar(require('./foo2')); }); -+ return Promise.resolve().then(() => __importStar(require('./foo2'))); - } - }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/dynamicImportTrailingComma.js.diff b/testdata/baselines/reference/submodule/compiler/dynamicImportTrailingComma.js.diff deleted file mode 100644 index 778c134b83..0000000000 --- a/testdata/baselines/reference/submodule/compiler/dynamicImportTrailingComma.js.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.dynamicImportTrailingComma.js -+++ new.dynamicImportTrailingComma.js -@@= skipped -38, +38 lines =@@ - }; - })(); - const path = './foo'; --Promise.resolve("".concat(path)).then(function (s) { return __importStar(require(s)); }); -+Promise.resolve(`${path}`).then(s => __importStar(require(s))); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/elidedJSImport2(module=commonjs).js.diff b/testdata/baselines/reference/submodule/compiler/elidedJSImport2(module=commonjs).js.diff index 5568f5f597..4d40ad977d 100644 --- a/testdata/baselines/reference/submodule/compiler/elidedJSImport2(module=commonjs).js.diff +++ b/testdata/baselines/reference/submodule/compiler/elidedJSImport2(module=commonjs).js.diff @@ -1,19 +1,6 @@ --- old.elidedJSImport2(module=commonjs).js +++ new.elidedJSImport2(module=commonjs).js -@@= skipped -66, +66 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var other_js_1 = require("./other.js"); --var other = __importStar(require("./other.js")); --var other_js_2 = __importDefault(require("./other.js")); -+const other_js_1 = require("./other.js"); -+const other = __importStar(require("./other.js")); -+const other_js_2 = __importDefault(require("./other.js")); - const x = new other_js_1.Foo(); - const y = other.Foo(); - const z = new other_js_2.default(); -@@= skipped -11, +11 lines =@@ +@@= skipped -77, +77 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Foo = void 0; class Foo { diff --git a/testdata/baselines/reference/submodule/compiler/elidingImportNames.js.diff b/testdata/baselines/reference/submodule/compiler/elidingImportNames.js.diff deleted file mode 100644 index 4a245e2aef..0000000000 --- a/testdata/baselines/reference/submodule/compiler/elidingImportNames.js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.elidingImportNames.js -+++ new.elidingImportNames.js -@@= skipped -26, +26 lines =@@ - //// [elidingImportNames_test.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var a = require("./elidingImportNames_main"); // alias used in typeof -+const a = require("./elidingImportNames_main"); // alias used in typeof - var b = a; - var x; --var a2 = require("./elidingImportNames_main1"); // alias not used in typeof -+const a2 = require("./elidingImportNames_main1"); // alias not used in typeof - var b2 = a2; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/emitClassMergedWithConstNamespaceNotElided.js.diff b/testdata/baselines/reference/submodule/compiler/emitClassMergedWithConstNamespaceNotElided.js.diff deleted file mode 100644 index 797ca26125..0000000000 --- a/testdata/baselines/reference/submodule/compiler/emitClassMergedWithConstNamespaceNotElided.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.emitClassMergedWithConstNamespaceNotElided.js -+++ new.emitClassMergedWithConstNamespaceNotElided.js -@@= skipped -20, +20 lines =@@ - //// [usage.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var enum_1 = require("./enum"); -+const enum_1 = require("./enum"); - enum_1.Clone.clone("ok"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_isolatedModules(module=commonjs).js.diff b/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_isolatedModules(module=commonjs).js.diff index 2ac7ff8e29..1d3a1524b5 100644 --- a/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_isolatedModules(module=commonjs).js.diff +++ b/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_isolatedModules(module=commonjs).js.diff @@ -47,51 +47,13 @@ - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; Object.defineProperty(exports, "__esModule", { value: true }); --var t1 = __importStar(require("./type1")); --var class3_1 = require("./class3"); --let HelloWorld = (() => { -- class HelloWorld { -- handleEvent1(event) { } // Error -- handleEvent2(event) { } // Ok -- handleEvent3(event) { return undefined; } // Ok, Error -- } -- __decorate([ -- EventListener('1'), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [Object]), -- __metadata("design:returntype", void 0) -- ], HelloWorld.prototype, "handleEvent1", null); -- __decorate([ -- EventListener('2'), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [Object]), -- __metadata("design:returntype", void 0) -- ], HelloWorld.prototype, "handleEvent2", null); -- __decorate([ -- EventListener('1'), -- __metadata("design:type", Object) -- ], HelloWorld.prototype, "p1", void 0); -- __decorate([ -- EventListener('1'), -- __metadata("design:type", Object) -- ], HelloWorld.prototype, "p1_ns", void 0); -- __decorate([ -- EventListener('2'), -- __metadata("design:type", Object) -- ], HelloWorld.prototype, "p2", void 0); -- __decorate([ -- EventListener('3'), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [class3_1.C3]), -- __metadata("design:returntype", Object) -- ], HelloWorld.prototype, "handleEvent3", null); -- return HelloWorld; --})(); -+class HelloWorld { +-const t1 = __importStar(require("./type1")); +-const class3_1 = require("./class3"); + class HelloWorld { + @EventListener('1') -+ handleEvent1(event) { } // Error + handleEvent1(event) { } // Error + @EventListener('2') -+ handleEvent2(event) { } // Ok + handleEvent2(event) { } // Ok + @EventListener('1') + p1; // Error + @EventListener('1') @@ -99,5 +61,35 @@ + @EventListener('2') + p2; // Ok + @EventListener('3') -+ handleEvent3(event) { return undefined; } // Ok, Error -+} \ No newline at end of file + handleEvent3(event) { return undefined; } // Ok, Error + } +-__decorate([ +- EventListener('1'), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [Object]), +- __metadata("design:returntype", void 0) +-], HelloWorld.prototype, "handleEvent1", null); +-__decorate([ +- EventListener('2'), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [Object]), +- __metadata("design:returntype", void 0) +-], HelloWorld.prototype, "handleEvent2", null); +-__decorate([ +- EventListener('1'), +- __metadata("design:type", Object) +-], HelloWorld.prototype, "p1", void 0); +-__decorate([ +- EventListener('1'), +- __metadata("design:type", Object) +-], HelloWorld.prototype, "p1_ns", void 0); +-__decorate([ +- EventListener('2'), +- __metadata("design:type", Object) +-], HelloWorld.prototype, "p2", void 0); +-__decorate([ +- EventListener('3'), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [class3_1.C3]), +- __metadata("design:returntype", Object) +-], HelloWorld.prototype, "handleEvent3", null); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_isolatedModules(module=esnext).js.diff b/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_isolatedModules(module=esnext).js.diff index d6e0b1b851..8278bb05cc 100644 --- a/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_isolatedModules(module=esnext).js.diff +++ b/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_isolatedModules(module=esnext).js.diff @@ -15,49 +15,11 @@ -}; -import * as t1 from "./type1"; -import { C3 } from "./class3"; --let HelloWorld = (() => { -- class HelloWorld { -- handleEvent1(event) { } // Error -- handleEvent2(event) { } // Ok -- handleEvent3(event) { return undefined; } // Ok, Error -- } -- __decorate([ -- EventListener('1'), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [Object]), -- __metadata("design:returntype", void 0) -- ], HelloWorld.prototype, "handleEvent1", null); -- __decorate([ -- EventListener('2'), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [Object]), -- __metadata("design:returntype", void 0) -- ], HelloWorld.prototype, "handleEvent2", null); -- __decorate([ -- EventListener('1'), -- __metadata("design:type", Object) -- ], HelloWorld.prototype, "p1", void 0); -- __decorate([ -- EventListener('1'), -- __metadata("design:type", Object) -- ], HelloWorld.prototype, "p1_ns", void 0); -- __decorate([ -- EventListener('2'), -- __metadata("design:type", Object) -- ], HelloWorld.prototype, "p2", void 0); -- __decorate([ -- EventListener('3'), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [C3]), -- __metadata("design:returntype", Object) -- ], HelloWorld.prototype, "handleEvent3", null); -- return HelloWorld; --})(); -+class HelloWorld { + class HelloWorld { + @EventListener('1') -+ handleEvent1(event) { } // Error + handleEvent1(event) { } // Error + @EventListener('2') -+ handleEvent2(event) { } // Ok + handleEvent2(event) { } // Ok + @EventListener('1') + p1; // Error + @EventListener('1') @@ -65,6 +27,36 @@ + @EventListener('2') + p2; // Ok + @EventListener('3') -+ handleEvent3(event) { return undefined; } // Ok, Error -+} + handleEvent3(event) { return undefined; } // Ok, Error + } +-__decorate([ +- EventListener('1'), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [Object]), +- __metadata("design:returntype", void 0) +-], HelloWorld.prototype, "handleEvent1", null); +-__decorate([ +- EventListener('2'), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [Object]), +- __metadata("design:returntype", void 0) +-], HelloWorld.prototype, "handleEvent2", null); +-__decorate([ +- EventListener('1'), +- __metadata("design:type", Object) +-], HelloWorld.prototype, "p1", void 0); +-__decorate([ +- EventListener('1'), +- __metadata("design:type", Object) +-], HelloWorld.prototype, "p1_ns", void 0); +-__decorate([ +- EventListener('2'), +- __metadata("design:type", Object) +-], HelloWorld.prototype, "p2", void 0); +-__decorate([ +- EventListener('3'), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [C3]), +- __metadata("design:returntype", Object) +-], HelloWorld.prototype, "handleEvent3", null); +export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_object.js.diff b/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_object.js.diff index 0da589efcf..c1437b5b01 100644 --- a/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_object.js.diff +++ b/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_object.js.diff @@ -13,26 +13,21 @@ -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; --let A = (() => { -- let A = class A { -- constructor(hi) { } -- method(there) { } -- }; -- __decorate([ -- MyMethodDecorator, -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [Object]), -- __metadata("design:returntype", void 0) -- ], A.prototype, "method", null); -- A = __decorate([ -- MyClassDecorator, -- __metadata("design:paramtypes", [Object]) -- ], A); -- return A; --})(); +-let A = class A { +@MyClassDecorator +class A { -+ constructor(hi) { } + constructor(hi) { } + @MyMethodDecorator -+ method(there) { } + method(there) { } +-}; +-__decorate([ +- MyMethodDecorator, +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [Object]), +- __metadata("design:returntype", void 0) +-], A.prototype, "method", null); +-A = __decorate([ +- MyClassDecorator, +- __metadata("design:paramtypes", [Object]) +-], A); +} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_restArgs.js.diff b/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_restArgs.js.diff index 279f00977e..cf3e674a5c 100644 --- a/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_restArgs.js.diff +++ b/testdata/baselines/reference/submodule/compiler/emitDecoratorMetadata_restArgs.js.diff @@ -13,40 +13,34 @@ -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; --let A = (() => { -- let A = class A { -- constructor(...args) { } -- method(...args) { } -- }; -- __decorate([ -- MyMethodDecorator, -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [Object]), -- __metadata("design:returntype", void 0) -- ], A.prototype, "method", null); -- A = __decorate([ -- MyClassDecorator, -- __metadata("design:paramtypes", [Object]) -- ], A); -- return A; --})(); --let B = (() => { -- let B = class B { -- constructor(...args) { } -- method(...args) { } -- }; -- __decorate([ -- MyMethodDecorator, -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [String]), -- __metadata("design:returntype", void 0) -- ], B.prototype, "method", null); -- B = __decorate([ -- MyClassDecorator, -- __metadata("design:paramtypes", [Number]) -- ], B); -- return B; --})(); +-let A = class A { +- constructor(...args) { } +- method(...args) { } +-}; +-__decorate([ +- MyMethodDecorator, +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [Object]), +- __metadata("design:returntype", void 0) +-], A.prototype, "method", null); +-A = __decorate([ +- MyClassDecorator, +- __metadata("design:paramtypes", [Object]) +-], A); +-let B = class B { +- constructor(...args) { } +- method(...args) { } +-}; +-__decorate([ +- MyMethodDecorator, +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [String]), +- __metadata("design:returntype", void 0) +-], B.prototype, "method", null); +-B = __decorate([ +- MyClassDecorator, +- __metadata("design:paramtypes", [Number]) +-], B); +@MyClassDecorator +class A { + constructor(...args) { } diff --git a/testdata/baselines/reference/submodule/compiler/emptyModuleName.js.diff b/testdata/baselines/reference/submodule/compiler/emptyModuleName.js.diff deleted file mode 100644 index 553ca7bb65..0000000000 --- a/testdata/baselines/reference/submodule/compiler/emptyModuleName.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.emptyModuleName.js -+++ new.emptyModuleName.js -@@= skipped -40, +40 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var A = __importStar(require("")); -+const A = __importStar(require("")); - class B extends A { - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/enumDeclarationEmitInitializerHasImport.js.diff b/testdata/baselines/reference/submodule/compiler/enumDeclarationEmitInitializerHasImport.js.diff deleted file mode 100644 index 7ebd9dfb64..0000000000 --- a/testdata/baselines/reference/submodule/compiler/enumDeclarationEmitInitializerHasImport.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.enumDeclarationEmitInitializerHasImport.js -+++ new.enumDeclarationEmitInitializerHasImport.js -@@= skipped -22, +22 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.value = void 0; --var provider = require("./provider"); -+const provider = require("./provider"); - exports.value = provider.Enum.Value1; - diff --git a/testdata/baselines/reference/submodule/compiler/enumFromExternalModule.js.diff b/testdata/baselines/reference/submodule/compiler/enumFromExternalModule.js.diff deleted file mode 100644 index 15b6cbbdde..0000000000 --- a/testdata/baselines/reference/submodule/compiler/enumFromExternalModule.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.enumFromExternalModule.js -+++ new.enumFromExternalModule.js -@@= skipped -21, +21 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var f = require("./enumFromExternalModule_0"); -+const f = require("./enumFromExternalModule_0"); - var x = f.Mode.Open; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/enumNoInitializerFollowsNonLiteralInitializer.js.diff b/testdata/baselines/reference/submodule/compiler/enumNoInitializerFollowsNonLiteralInitializer.js.diff index 6c0e96ada0..bb593297ee 100644 --- a/testdata/baselines/reference/submodule/compiler/enumNoInitializerFollowsNonLiteralInitializer.js.diff +++ b/testdata/baselines/reference/submodule/compiler/enumNoInitializerFollowsNonLiteralInitializer.js.diff @@ -1,11 +1,7 @@ --- old.enumNoInitializerFollowsNonLiteralInitializer.js +++ new.enumNoInitializerFollowsNonLiteralInitializer.js -@@= skipped -48, +48 lines =@@ - //// [bad.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var helpers_1 = require("./helpers"); -+const helpers_1 = require("./helpers"); +@@= skipped -51, +51 lines =@@ + const helpers_1 = require("./helpers"); var A; (function (A) { - A[A["a"] = 2] = "a"; @@ -21,9 +17,8 @@ })(A || (A = {})); //// [good.js] "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var helpers_1 = require("./helpers"); -+const helpers_1 = require("./helpers"); +@@= skipped -12, +13 lines =@@ + const helpers_1 = require("./helpers"); var A; (function (A) { - A[A["a"] = 2] = "a"; diff --git a/testdata/baselines/reference/submodule/compiler/enumWithNonLiteralStringInitializer.js.diff b/testdata/baselines/reference/submodule/compiler/enumWithNonLiteralStringInitializer.js.diff index 86ed94ccbc..74bfbd0128 100644 --- a/testdata/baselines/reference/submodule/compiler/enumWithNonLiteralStringInitializer.js.diff +++ b/testdata/baselines/reference/submodule/compiler/enumWithNonLiteralStringInitializer.js.diff @@ -1,11 +1,7 @@ --- old.enumWithNonLiteralStringInitializer.js +++ new.enumWithNonLiteralStringInitializer.js -@@= skipped -28, +28 lines =@@ - //// [bad.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var helpers_1 = require("./helpers"); -+const helpers_1 = require("./helpers"); +@@= skipped -31, +31 lines =@@ + const helpers_1 = require("./helpers"); var A; (function (A) { - A["a"] = "bar"; @@ -14,9 +10,8 @@ })(A || (A = {})); //// [good.js] "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var helpers_1 = require("./helpers"); -+const helpers_1 = require("./helpers"); +@@= skipped -8, +9 lines =@@ + const helpers_1 = require("./helpers"); var A; (function (A) { - A["a"] = "2"; diff --git a/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js.diff b/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js.diff index 2a89f2735f..96cc7ca90d 100644 --- a/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js.diff +++ b/testdata/baselines/reference/submodule/compiler/erasableSyntaxOnly.js.diff @@ -52,8 +52,4 @@ +})); //// [commonjs.cjs] "use strict"; --var foo = require("./other.cjs"); -+const foo = require("./other.cjs"); - module.exports = foo; - //// [esm.mjs] - const foo = 1234; \ No newline at end of file + const foo = require("./other.cjs"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/errorForConflictingExportEqualsValue.js.diff b/testdata/baselines/reference/submodule/compiler/errorForConflictingExportEqualsValue.js.diff index b96c5d6c30..8ffaf96a94 100644 --- a/testdata/baselines/reference/submodule/compiler/errorForConflictingExportEqualsValue.js.diff +++ b/testdata/baselines/reference/submodule/compiler/errorForConflictingExportEqualsValue.js.diff @@ -1,10 +1,8 @@ --- old.errorForConflictingExportEqualsValue.js +++ new.errorForConflictingExportEqualsValue.js -@@= skipped -41, +41 lines =@@ - }; +@@= skipped -42, +42 lines =@@ })(); exports.x = void 0; --Promise.resolve().then(function () { return __importStar(require("./a")); }); + Promise.resolve().then(() => __importStar(require("./a"))); -module.exports = exports.x; -+Promise.resolve().then(() => __importStar(require("./a"))); +module.exports = x; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/es5-importHelpersAsyncFunctions.js.diff b/testdata/baselines/reference/submodule/compiler/es5-importHelpersAsyncFunctions.js.diff index ec23565193..735579036f 100644 --- a/testdata/baselines/reference/submodule/compiler/es5-importHelpersAsyncFunctions.js.diff +++ b/testdata/baselines/reference/submodule/compiler/es5-importHelpersAsyncFunctions.js.diff @@ -4,7 +4,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.foo = foo; --var tslib_1 = require("tslib"); +-const tslib_1 = require("tslib"); -function foo() { - return tslib_1.__awaiter(this, void 0, void 0, function* () { - }); diff --git a/testdata/baselines/reference/submodule/compiler/es6ClassTest.js.diff b/testdata/baselines/reference/submodule/compiler/es6ClassTest.js.diff index ed56937c71..03870ab0dc 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ClassTest.js.diff +++ b/testdata/baselines/reference/submodule/compiler/es6ClassTest.js.diff @@ -8,43 +8,30 @@ prop1(x) { return x; } - constructor(n) { } +@@= skipped -7, +8 lines =@@ } // new-style class --let Foo = (() => { -- class Foo extends Bar { -- bar() { return 0; } -- boo(x) { return x; } -- constructor(x, y, z = 0) { -- super(x); -- this.y = y; -- this.z = z; -- this.gar = 0; -- this.zoo = "zoo"; -- this.x = x; -- this.gar = 5; -- } -+class Foo extends Bar { + class Foo extends Bar { + y; + z; + foo; + gar = 0; + zoo = "zoo"; + x; -+ bar() { return 0; } -+ boo(x) { return x; } + bar() { return 0; } + boo(x) { return x; } + static statVal = 0; -+ constructor(x, y, z = 0) { -+ super(x); -+ this.y = y; -+ this.z = z; -+ this.x = x; -+ this.gar = 5; + constructor(x, y, z = 0) { + super(x); + this.y = y; + this.z = z; +- this.gar = 0; +- this.zoo = "zoo"; + this.x = x; + this.gar = 5; } -- Foo.statVal = 0; -- return Foo; --})(); -+} + } +-Foo.statVal = 0; var f = new Foo(); //class GetSetMonster { // // attack(target) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/es6ClassTest2.js.diff b/testdata/baselines/reference/submodule/compiler/es6ClassTest2.js.diff index 0615839804..7742b36811 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ClassTest2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/es6ClassTest2.js.diff @@ -59,25 +59,17 @@ } class SuperParent { constructor(a) { -@@= skipped -24, +23 lines =@@ - super.c(); +@@= skipped -25, +24 lines =@@ } } --let Statics = (() => { -- class Statics { -- static baz() { -- return ""; -- } -+class Statics { + class Statics { + static foo = 1; + static bar; -+ static baz() { -+ return ""; + static baz() { + return ""; } -- Statics.foo = 1; -- return Statics; --})(); -+} + } +-Statics.foo = 1; var stat = new Statics(); class ImplementsInterface { + x; @@ -85,7 +77,7 @@ constructor() { this.x = 1; this.z = "foo"; -@@= skipped -19, +19 lines =@@ +@@= skipped -15, +18 lines =@@ class Visibility { foo() { } bar() { } diff --git a/testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.js.diff b/testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.js.diff index a723facb67..97c3e66eb5 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.js.diff +++ b/testdata/baselines/reference/submodule/compiler/es6ExportEqualsInterop.js.diff @@ -1,83 +1,6 @@ --- old.es6ExportEqualsInterop.js +++ new.es6ExportEqualsInterop.js -@@= skipped -246, +246 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.a0 = exports.a9 = exports.a8 = exports.a7 = exports.a6 = exports.a5 = exports.a4 = exports.a3 = exports.a2 = exports.a1 = void 0; --var z2 = require("variable"); --var z3 = require("interface-variable"); --var z4 = require("module"); --var z5 = require("interface-module"); --var z6 = require("variable-module"); --var z7 = require("function"); --var z8 = require("function-module"); --var z9 = require("class"); --var z0 = require("class-module"); -+const z2 = require("variable"); -+const z3 = require("interface-variable"); -+const z4 = require("module"); -+const z5 = require("interface-module"); -+const z6 = require("variable-module"); -+const z7 = require("function"); -+const z8 = require("function-module"); -+const z9 = require("class"); -+const z0 = require("class-module"); - z1.a; - z2.a; - z3.a; -@@= skipped -19, +19 lines =@@ - z8.a; - z9.a; - z0.a; --var y2 = __importStar(require("variable")); --var y3 = __importStar(require("interface-variable")); --var y4 = __importStar(require("module")); --var y5 = __importStar(require("interface-module")); --var y6 = __importStar(require("variable-module")); --var y7 = __importStar(require("function")); --var y8 = __importStar(require("function-module")); --var y9 = __importStar(require("class")); --var y0 = __importStar(require("class-module")); -+const y2 = __importStar(require("variable")); -+const y3 = __importStar(require("interface-variable")); -+const y4 = __importStar(require("module")); -+const y5 = __importStar(require("interface-module")); -+const y6 = __importStar(require("variable-module")); -+const y7 = __importStar(require("function")); -+const y8 = __importStar(require("function-module")); -+const y9 = __importStar(require("class")); -+const y0 = __importStar(require("class-module")); - y1.a; - y2.a; - y3.a; -@@= skipped -20, +20 lines =@@ - y9.a; - y0.a; - // named import --var interface_1 = require("interface"); --var variable_1 = require("variable"); --var interface_variable_1 = require("interface-variable"); --var module_1 = require("module"); --var interface_module_1 = require("interface-module"); --var variable_module_1 = require("variable-module"); --var function_1 = require("function"); --var function_module_1 = require("function-module"); --var class_1 = require("class"); --var class_module_1 = require("class-module"); -+const interface_1 = require("interface"); -+const variable_1 = require("variable"); -+const interface_variable_1 = require("interface-variable"); -+const module_1 = require("module"); -+const interface_module_1 = require("interface-module"); -+const variable_module_1 = require("variable-module"); -+const function_1 = require("function"); -+const function_module_1 = require("function-module"); -+const class_1 = require("class"); -+const class_module_1 = require("class-module"); - interface_1.a; - variable_1.a; - interface_variable_1.a; -@@= skipped -21, +21 lines =@@ +@@= skipped -306, +306 lines =@@ class_1.a; class_module_1.a; // named export diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingDts.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingDts.js.diff deleted file mode 100644 index e83572726b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingDts.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.es6ImportDefaultBindingDts.js -+++ new.es6ImportDefaultBindingDts.js -@@= skipped -22, +22 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; --var server_1 = __importDefault(require("./server")); -+const server_1 = __importDefault(require("./server")); - exports.x = new server_1.default(); - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.js.diff deleted file mode 100644 index 7aeca00d12..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.js.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.es6ImportDefaultBindingFollowedWithNamedImport1InEs5.js -+++ new.es6ImportDefaultBindingFollowedWithNamedImport1InEs5.js -@@= skipped -29, +29 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_1 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); -+const es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_1 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); - var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_1.default; --var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_2 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); -+const es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_2 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); - var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_2.default; --var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_3 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); -+const es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_3 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); - var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_3.default; --var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_4 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); -+const es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_4 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); - var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_4.default; --var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_5 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); -+const es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_5 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); - var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_5.default; --var es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_6 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); -+const es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_6 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0")); - var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_6.default; - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.js.diff deleted file mode 100644 index b9907939cd..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.js.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.es6ImportDefaultBindingFollowedWithNamedImport1WithExport.js -+++ new.es6ImportDefaultBindingFollowedWithNamedImport1WithExport.js -@@= skipped -30, +30 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x1 = void 0; --var server_1 = __importDefault(require("./server")); -+const server_1 = __importDefault(require("./server")); - exports.x1 = server_1.default; --var server_2 = __importDefault(require("./server")); -+const server_2 = __importDefault(require("./server")); - exports.x1 = server_2.default; --var server_3 = __importDefault(require("./server")); -+const server_3 = __importDefault(require("./server")); - exports.x1 = server_3.default; --var server_4 = __importDefault(require("./server")); -+const server_4 = __importDefault(require("./server")); - exports.x1 = server_4.default; --var server_5 = __importDefault(require("./server")); -+const server_5 = __importDefault(require("./server")); - exports.x1 = server_5.default; --var server_6 = __importDefault(require("./server")); -+const server_6 = __importDefault(require("./server")); - exports.x1 = server_6.default; - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts.js.diff deleted file mode 100644 index b5b4c6dc24..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts.js.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.es6ImportDefaultBindingFollowedWithNamedImportDts.js -+++ new.es6ImportDefaultBindingFollowedWithNamedImportDts.js -@@= skipped -48, +48 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x6 = exports.x3 = exports.x5 = exports.x4 = exports.x2 = exports.x1 = void 0; --var server_1 = require("./server"); -+const server_1 = require("./server"); - exports.x1 = new server_1.a(); --var server_2 = require("./server"); -+const server_2 = require("./server"); - exports.x2 = new server_2.a11(); --var server_3 = require("./server"); -+const server_3 = require("./server"); - exports.x4 = new server_3.x(); - exports.x5 = new server_3.a12(); --var server_4 = require("./server"); -+const server_4 = require("./server"); - exports.x3 = new server_4.x11(); --var server_5 = require("./server"); -+const server_5 = require("./server"); - exports.x6 = new server_5.m(); - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts1.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts1.js.diff deleted file mode 100644 index 169259c82f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportDts1.js.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.es6ImportDefaultBindingFollowedWithNamedImportDts1.js -+++ new.es6ImportDefaultBindingFollowedWithNamedImportDts1.js -@@= skipped -30, +30 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x6 = exports.x5 = exports.x4 = exports.x3 = exports.x2 = exports.x1 = void 0; --var server_1 = __importDefault(require("./server")); -+const server_1 = __importDefault(require("./server")); - exports.x1 = new server_1.default(); --var server_2 = __importDefault(require("./server")); -+const server_2 = __importDefault(require("./server")); - exports.x2 = new server_2.default(); --var server_3 = __importDefault(require("./server")); -+const server_3 = __importDefault(require("./server")); - exports.x3 = new server_3.default(); --var server_4 = __importDefault(require("./server")); -+const server_4 = __importDefault(require("./server")); - exports.x4 = new server_4.default(); --var server_5 = __importDefault(require("./server")); -+const server_5 = __importDefault(require("./server")); - exports.x5 = new server_5.default(); --var server_6 = __importDefault(require("./server")); -+const server_6 = __importDefault(require("./server")); - exports.x6 = new server_6.default(); - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js.diff deleted file mode 100644 index 63f3d833b4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.es6ImportDefaultBindingFollowedWithNamedImportInEs5.js -+++ new.es6ImportDefaultBindingFollowedWithNamedImportInEs5.js -@@= skipped -29, +29 lines =@@ - //// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); -+const es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); - var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_1.a; --var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); -+const es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); - var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_2.a; --var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); -+const es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); - var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3.x; - var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_3.a; --var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); -+const es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); - var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_4.x; --var es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); -+const es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"); - var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_5.m; - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportWithExport.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportWithExport.js.diff deleted file mode 100644 index 30ed2cd485..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamedImportWithExport.js.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.es6ImportDefaultBindingFollowedWithNamedImportWithExport.js -+++ new.es6ImportDefaultBindingFollowedWithNamedImportWithExport.js -@@= skipped -32, +32 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x1 = void 0; --var server_1 = require("./server"); -+const server_1 = require("./server"); - exports.x1 = server_1.a; --var server_2 = require("./server"); -+const server_2 = require("./server"); - exports.x1 = server_2.a; --var server_3 = require("./server"); -+const server_3 = require("./server"); - exports.x1 = server_3.x; - exports.x1 = server_3.a; --var server_4 = require("./server"); -+const server_4 = require("./server"); - exports.x1 = server_4.x; --var server_5 = require("./server"); -+const server_5 = require("./server"); - exports.x1 = server_5.m; - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.js.diff deleted file mode 100644 index 8a18fef8fe..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.js -+++ new.es6ImportDefaultBindingFollowedWithNamespaceBinding1InEs5.js -@@= skipped -18, +18 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0")); -+const es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1 = __importDefault(require("./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0")); - var x = es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0_1.default; - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.js.diff deleted file mode 100644 index 9e05a355e1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingDts.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.es6ImportDefaultBindingFollowedWithNamespaceBindingDts.js -+++ new.es6ImportDefaultBindingFollowedWithNamespaceBindingDts.js -@@= skipped -50, +50 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; --var nameSpaceBinding = __importStar(require("./server")); -+const nameSpaceBinding = __importStar(require("./server")); - exports.x = new nameSpaceBinding.a(); - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js.diff deleted file mode 100644 index c2c683c82c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js -+++ new.es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js -@@= skipped -47, +47 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var nameSpaceBinding = __importStar(require("./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0")); -+const nameSpaceBinding = __importStar(require("./es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0")); - var x = nameSpaceBinding.a; - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.js.diff deleted file mode 100644 index c8720bfeb2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.js -+++ new.es6ImportDefaultBindingFollowedWithNamespaceBindingWithExport.js -@@= skipped -48, +48 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; --var nameSpaceBinding = __importStar(require("./server")); -+const nameSpaceBinding = __importStar(require("./server")); - exports.x = nameSpaceBinding.a; - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingMergeErrors.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingMergeErrors.js.diff deleted file mode 100644 index bf927e1a8d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingMergeErrors.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.es6ImportDefaultBindingMergeErrors.js -+++ new.es6ImportDefaultBindingMergeErrors.js -@@= skipped -25, +25 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var es6ImportDefaultBindingMergeErrors_0_1 = __importDefault(require("./es6ImportDefaultBindingMergeErrors_0")); -+const es6ImportDefaultBindingMergeErrors_0_1 = __importDefault(require("./es6ImportDefaultBindingMergeErrors_0")); - var x = es6ImportDefaultBindingMergeErrors_0_1.default; - var defaultBinding2 = "hello world"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingWithExport.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingWithExport.js.diff deleted file mode 100644 index 63dcd8eb0b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportDefaultBindingWithExport.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.es6ImportDefaultBindingWithExport.js -+++ new.es6ImportDefaultBindingWithExport.js -@@= skipped -20, +20 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; --var server_1 = __importDefault(require("./server")); -+const server_1 = __importDefault(require("./server")); - exports.x = server_1.default; - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportEqualsExportModuleCommonJsError.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportEqualsExportModuleCommonJsError.js.diff deleted file mode 100644 index 67b0f535ad..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportEqualsExportModuleCommonJsError.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.es6ImportEqualsExportModuleCommonJsError.js -+++ new.es6ImportEqualsExportModuleCommonJsError.js -@@= skipped -51, +51 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var a = __importStar(require("./a")); -+const a = __importStar(require("./a")); - a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportNameSpaceImportDts.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportNameSpaceImportDts.js.diff deleted file mode 100644 index 3da20d148f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportNameSpaceImportDts.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.es6ImportNameSpaceImportDts.js -+++ new.es6ImportNameSpaceImportDts.js -@@= skipped -52, +52 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; --var nameSpaceBinding = __importStar(require("./server")); -+const nameSpaceBinding = __importStar(require("./server")); - exports.x = new nameSpaceBinding.c(); - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportNameSpaceImportInEs5.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportNameSpaceImportInEs5.js.diff deleted file mode 100644 index 9118520456..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportNameSpaceImportInEs5.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.es6ImportNameSpaceImportInEs5.js -+++ new.es6ImportNameSpaceImportInEs5.js -@@= skipped -49, +49 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var nameSpaceBinding = __importStar(require("./es6ImportNameSpaceImportInEs5_0")); -+const nameSpaceBinding = __importStar(require("./es6ImportNameSpaceImportInEs5_0")); - var x = nameSpaceBinding.a; - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportDts.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportDts.js.diff deleted file mode 100644 index 26231b39d7..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportDts.js.diff +++ /dev/null @@ -1,37 +0,0 @@ ---- old.es6ImportNamedImportDts.js -+++ new.es6ImportNamedImportDts.js -@@= skipped -94, +94 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.z2 = exports.z111 = exports.xxxx9 = exports.xxxx8 = exports.xxxx7 = exports.xxxx6 = exports.xxxx5 = exports.xxxx4 = exports.xxxx3 = exports.xxxx2 = exports.xxxx1 = exports.xxxx = void 0; --var server_1 = require("./server"); -+const server_1 = require("./server"); - exports.xxxx = new server_1.a(); --var server_2 = require("./server"); -+const server_2 = require("./server"); - exports.xxxx1 = new server_2.a11(); --var server_3 = require("./server"); -+const server_3 = require("./server"); - exports.xxxx2 = new server_3.x(); - exports.xxxx3 = new server_3.a12(); --var server_4 = require("./server"); -+const server_4 = require("./server"); - exports.xxxx4 = new server_4.x11(); --var server_5 = require("./server"); -+const server_5 = require("./server"); - exports.xxxx5 = new server_5.m(); --var server_6 = require("./server"); -+const server_6 = require("./server"); - exports.xxxx6 = new server_6.a1(); - exports.xxxx7 = new server_6.x1(); --var server_7 = require("./server"); -+const server_7 = require("./server"); - exports.xxxx8 = new server_7.a111(); - exports.xxxx9 = new server_7.x111(); --var server_8 = require("./server"); -+const server_8 = require("./server"); - exports.z111 = new server_8.z1(); --var server_9 = require("./server"); -+const server_9 = require("./server"); - exports.z2 = new server_9.z2(); // z2 shouldn't give redeclare error - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportInEs5.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportInEs5.js.diff deleted file mode 100644 index f7af11b31e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportInEs5.js.diff +++ /dev/null @@ -1,37 +0,0 @@ ---- old.es6ImportNamedImportInEs5.js -+++ new.es6ImportNamedImportInEs5.js -@@= skipped -54, +54 lines =@@ - //// [es6ImportNamedImportInEs5_1.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var es6ImportNamedImportInEs5_0_1 = require("./es6ImportNamedImportInEs5_0"); -+const es6ImportNamedImportInEs5_0_1 = require("./es6ImportNamedImportInEs5_0"); - var xxxx = es6ImportNamedImportInEs5_0_1.a; --var es6ImportNamedImportInEs5_0_2 = require("./es6ImportNamedImportInEs5_0"); -+const es6ImportNamedImportInEs5_0_2 = require("./es6ImportNamedImportInEs5_0"); - var xxxx = es6ImportNamedImportInEs5_0_2.a; --var es6ImportNamedImportInEs5_0_3 = require("./es6ImportNamedImportInEs5_0"); -+const es6ImportNamedImportInEs5_0_3 = require("./es6ImportNamedImportInEs5_0"); - var xxxx = es6ImportNamedImportInEs5_0_3.x; - var xxxx = es6ImportNamedImportInEs5_0_3.a; --var es6ImportNamedImportInEs5_0_4 = require("./es6ImportNamedImportInEs5_0"); -+const es6ImportNamedImportInEs5_0_4 = require("./es6ImportNamedImportInEs5_0"); - var xxxx = es6ImportNamedImportInEs5_0_4.x; --var es6ImportNamedImportInEs5_0_5 = require("./es6ImportNamedImportInEs5_0"); -+const es6ImportNamedImportInEs5_0_5 = require("./es6ImportNamedImportInEs5_0"); - var xxxx = es6ImportNamedImportInEs5_0_5.m; --var es6ImportNamedImportInEs5_0_6 = require("./es6ImportNamedImportInEs5_0"); -+const es6ImportNamedImportInEs5_0_6 = require("./es6ImportNamedImportInEs5_0"); - var xxxx = es6ImportNamedImportInEs5_0_6.a1; - var xxxx = es6ImportNamedImportInEs5_0_6.x1; --var es6ImportNamedImportInEs5_0_7 = require("./es6ImportNamedImportInEs5_0"); -+const es6ImportNamedImportInEs5_0_7 = require("./es6ImportNamedImportInEs5_0"); - var xxxx = es6ImportNamedImportInEs5_0_7.a1; - var xxxx = es6ImportNamedImportInEs5_0_7.x1; --var es6ImportNamedImportInEs5_0_8 = require("./es6ImportNamedImportInEs5_0"); -+const es6ImportNamedImportInEs5_0_8 = require("./es6ImportNamedImportInEs5_0"); - var z111 = es6ImportNamedImportInEs5_0_8.z1; --var es6ImportNamedImportInEs5_0_9 = require("./es6ImportNamedImportInEs5_0"); -+const es6ImportNamedImportInEs5_0_9 = require("./es6ImportNamedImportInEs5_0"); - var z2 = es6ImportNamedImportInEs5_0_9.z2; // z2 shouldn't give redeclare error - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportInIndirectExportAssignment.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportInIndirectExportAssignment.js.diff index 35e6767d87..cc9619f956 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportInIndirectExportAssignment.js.diff +++ b/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportInIndirectExportAssignment.js.diff @@ -1,11 +1,9 @@ --- old.es6ImportNamedImportInIndirectExportAssignment.js +++ new.es6ImportNamedImportInIndirectExportAssignment.js -@@= skipped -22, +22 lines =@@ - })(a || (exports.a = a = {})); +@@= skipped -23, +23 lines =@@ //// [es6ImportNamedImportInIndirectExportAssignment_1.js] "use strict"; --var es6ImportNamedImportInIndirectExportAssignment_0_1 = require("./es6ImportNamedImportInIndirectExportAssignment_0"); + const es6ImportNamedImportInIndirectExportAssignment_0_1 = require("./es6ImportNamedImportInIndirectExportAssignment_0"); -var x = es6ImportNamedImportInIndirectExportAssignment_0_1.a; -+const es6ImportNamedImportInIndirectExportAssignment_0_1 = require("./es6ImportNamedImportInIndirectExportAssignment_0"); module.exports = x; diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportWithExport.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportWithExport.js.diff deleted file mode 100644 index 3e0f2c5373..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportWithExport.js.diff +++ /dev/null @@ -1,37 +0,0 @@ ---- old.es6ImportNamedImportWithExport.js -+++ new.es6ImportNamedImportWithExport.js -@@= skipped -54, +54 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.z2 = exports.z111 = exports.xxxx = void 0; --var server_1 = require("./server"); -+const server_1 = require("./server"); - exports.xxxx = server_1.a; --var server_2 = require("./server"); -+const server_2 = require("./server"); - exports.xxxx = server_2.a; --var server_3 = require("./server"); -+const server_3 = require("./server"); - exports.xxxx = server_3.x; - exports.xxxx = server_3.a; --var server_4 = require("./server"); -+const server_4 = require("./server"); - exports.xxxx = server_4.x; --var server_5 = require("./server"); -+const server_5 = require("./server"); - exports.xxxx = server_5.m; --var server_6 = require("./server"); -+const server_6 = require("./server"); - exports.xxxx = server_6.a1; - exports.xxxx = server_6.x1; --var server_7 = require("./server"); -+const server_7 = require("./server"); - exports.xxxx = server_7.a1; - exports.xxxx = server_7.x1; --var server_8 = require("./server"); -+const server_8 = require("./server"); - exports.z111 = server_8.z1; --var server_9 = require("./server"); -+const server_9 = require("./server"); - exports.z2 = server_9.z2; // z2 shouldn't give redeclare error - diff --git a/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportWithTypesAndValues.js.diff b/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportWithTypesAndValues.js.diff index 5cb9073eb2..b3348520b5 100644 --- a/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportWithTypesAndValues.js.diff +++ b/testdata/baselines/reference/submodule/compiler/es6ImportNamedImportWithTypesAndValues.js.diff @@ -17,11 +17,4 @@ + prop2 = "world"; } exports.C2 = C2; - //// [client.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.cVal = void 0; --var server_1 = require("./server"); // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file -+const server_1 = require("./server"); // Shouldnt emit I and C2 into the js file and emit C and I in .d.ts file - exports.cVal = new server_1.C(); - + //// [client.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInterop.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInterop.js.diff deleted file mode 100644 index 2984280048..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInterop.js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.esModuleInterop.js -+++ new.esModuleInterop.js -@@= skipped -56, +56 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var hybrid_1 = require("./hybrid"); --var path_1 = __importDefault(require("./path")); --var fs = __importStar(require("./fs")); -+const hybrid_1 = require("./hybrid"); -+const path_1 = __importDefault(require("./path")); -+const fs = __importStar(require("./fs")); - path_1.default; - (0, hybrid_1.sayHello)(); - fs; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.js.diff index 4d24abf74d..3df8093184 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.js.diff +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.js.diff @@ -1,27 +1,10 @@ --- old.esModuleInteropDefaultImports.js +++ new.esModuleInteropDefaultImports.js -@@= skipped -41, +41 lines =@@ - exports.default = fun; - //// [a.js] - "use strict"; --var mod = require("./mod"); -+const mod = require("./mod"); - module.exports = mod; - //// [b.js] - "use strict"; -@@= skipped -42, +42 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.def = exports.default = void 0; --var a_1 = __importDefault(require("./a")); --var a_2 = __importDefault(require("./a")); --var a_3 = __importDefault(require("./a")); --var self = __importStar(require("./b")); +@@= skipped -87, +87 lines =@@ + const a_2 = __importDefault(require("./a")); + const a_3 = __importDefault(require("./a")); + const self = __importStar(require("./b")); -var a_4 = require("./a"); -+const a_1 = __importDefault(require("./a")); -+const a_2 = __importDefault(require("./a")); -+const a_3 = __importDefault(require("./a")); -+const self = __importStar(require("./b")); +const a_4 = require("./a"); Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(a_4).default; } }); -var a_5 = require("./a"); diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.js.diff deleted file mode 100644 index 265e37fbe9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.js -+++ new.esModuleInteropDefaultMemberMustBeSyntacticallyDefaultExport.js -@@= skipped -23, +23 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var point_1 = __importDefault(require("./point")); -+const point_1 = __importDefault(require("./point")); - const C = point_1.default; - const p = new C(1, 2); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportCall.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportCall.js.diff deleted file mode 100644 index 558a6649b8..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportCall.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.esModuleInteropImportCall.js -+++ new.esModuleInteropImportCall.js -@@= skipped -43, +43 lines =@@ - return result; - }; - })(); --Promise.resolve().then(function () { return __importStar(require("./foo")); }).then(f => { -+Promise.resolve().then(() => __importStar(require("./foo"))).then(f => { - f.default; - }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportDefaultWhenAllNamedAreDefaultAlias.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportDefaultWhenAllNamedAreDefaultAlias.js.diff deleted file mode 100644 index f19e80f484..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportDefaultWhenAllNamedAreDefaultAlias.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.esModuleInteropImportDefaultWhenAllNamedAreDefaultAlias.js -+++ new.esModuleInteropImportDefaultWhenAllNamedAreDefaultAlias.js -@@= skipped -10, +10 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var m_1 = __importDefault(require("m")); -+const m_1 = __importDefault(require("m")); - void m_1.default; - void m_1.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.js.diff deleted file mode 100644 index 4d528e5341..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.esModuleInteropImportNamespace.js -+++ new.esModuleInteropImportNamespace.js -@@= skipped -45, +45 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var foo = __importStar(require("./foo")); -+const foo = __importStar(require("./foo")); - foo.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropNamedDefaultImports.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropNamedDefaultImports.js.diff deleted file mode 100644 index 93eefcf4dc..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropNamedDefaultImports.js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.esModuleInteropNamedDefaultImports.js -+++ new.esModuleInteropNamedDefaultImports.js -@@= skipped -60, +60 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var mod_1 = __importDefault(require("./mod")); --var mod_2 = __importDefault(require("./mod")); --var mod_3 = __importStar(require("./mod")); -+const mod_1 = __importDefault(require("./mod")); -+const mod_2 = __importDefault(require("./mod")); -+const mod_3 = __importStar(require("./mod")); - new mod_1.default(); - new mod_2.default(); - new mod_3.Bar(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.js.diff deleted file mode 100644 index 8d6125ffe9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.esModuleInteropPrettyErrorRelatedInformation.js -+++ new.esModuleInteropPrettyErrorRelatedInformation.js -@@= skipped -45, +45 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var foo = __importStar(require("./foo")); -+const foo = __importStar(require("./foo")); - function invoke(f) { f(); } - invoke(foo); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropTslibHelpers.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropTslibHelpers.js.diff deleted file mode 100644 index 29b8bcd865..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropTslibHelpers.js.diff +++ /dev/null @@ -1,45 +0,0 @@ ---- old.esModuleInteropTslibHelpers.js -+++ new.esModuleInteropTslibHelpers.js -@@= skipped -22, +22 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Foo = void 0; --var tslib_1 = require("tslib"); --var path_1 = tslib_1.__importDefault(require("path")); -+const tslib_1 = require("tslib"); -+const path_1 = tslib_1.__importDefault(require("path")); - path_1.default.resolve("", "../"); - class Foo { - } -@@= skipped -10, +10 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Foo2 = void 0; --var tslib_1 = require("tslib"); --var path = tslib_1.__importStar(require("path")); -+const tslib_1 = require("tslib"); -+const path = tslib_1.__importStar(require("path")); - path.resolve("", "../"); - class Foo2 { - } -@@= skipped -10, +10 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Foo3 = void 0; --var tslib_1 = require("tslib"); --var path_1 = tslib_1.__importDefault(require("path")); -+const tslib_1 = require("tslib"); -+const path_1 = tslib_1.__importDefault(require("path")); - (0, path_1.default)("", "../"); - class Foo3 { - } -@@= skipped -10, +10 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Bar = void 0; --var tslib_1 = require("tslib"); --var path_1 = tslib_1.__importStar(require("path")); -+const tslib_1 = require("tslib"); -+const path_1 = tslib_1.__importStar(require("path")); - Object.defineProperty(exports, "Bar", { enumerable: true, get: function () { return path_1.Bar; } }); - (0, path_1.default)("", "../"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropUsesExportStarWhenDefaultPlusNames.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropUsesExportStarWhenDefaultPlusNames.js.diff deleted file mode 100644 index 55b7e6e2e9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropUsesExportStarWhenDefaultPlusNames.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.esModuleInteropUsesExportStarWhenDefaultPlusNames.js -+++ new.esModuleInteropUsesExportStarWhenDefaultPlusNames.js -@@= skipped -40, +40 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var dep_1 = __importStar(require("./dep")); -+const dep_1 = __importStar(require("./dep")); - void dep_1.default; - void dep_1.var2; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropWithExportStar.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropWithExportStar.js.diff index 9b7e71879a..aa30c76447 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropWithExportStar.js.diff +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropWithExportStar.js.diff @@ -1,11 +1,7 @@ --- old.esModuleInteropWithExportStar.js +++ new.esModuleInteropWithExportStar.js -@@= skipped -51, +51 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.y = exports.x = void 0; --var fs = __importStar(require("./fs")); -+const fs = __importStar(require("./fs")); +@@= skipped -54, +54 lines =@@ + const fs = __importStar(require("./fs")); fs; __exportStar(require("./fs"), exports); -var fs_1 = require("./fs"); diff --git a/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.js.diff b/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.js.diff deleted file mode 100644 index 65eac7792f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.esModuleIntersectionCrash.js -+++ new.esModuleIntersectionCrash.js -@@= skipped -47, +47 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var mod = __importStar(require("./mod")); -+const mod = __importStar(require("./mod")); - mod.a; - mod.b; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithSpread.js b/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithSpread.js index a05d342391..a5de2298a1 100644 --- a/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithSpread.js +++ b/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithSpread.js @@ -20,16 +20,5 @@ f({ a: 1, ...l, ...r }); //// [excessPropertyCheckWithSpread.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -f(__assign({ a: 1 }, i)); -f(__assign(__assign({ a: 1 }, l), r)); +f(Object.assign({ a: 1 }, i)); +f(Object.assign(Object.assign({ a: 1 }, l), r)); diff --git a/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithUnions.js b/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithUnions.js index 269fade2d4..bb71f95023 100644 --- a/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithUnions.js +++ b/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithUnions.js @@ -155,17 +155,6 @@ F2({ //// [excessPropertyCheckWithUnions.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; let wrong = { tag: "T", a1: "extra" }; wrong = { tag: "A", d20: 12 }; wrong = { tag: "D" }; @@ -184,7 +173,7 @@ let over; // these two are still errors despite their doubled up discriminants over = { a: 1, b: 1, first: "ok", second: "error" }; over = { a: 1, b: 1, first: "ok", third: "error" }; -let t2 = __assign({}, t1); +let t2 = Object.assign({}, t1); t0 = t2; const abab = { kind: "A", diff --git a/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithUnions.js.diff b/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithUnions.js.diff index 05b1283df7..405702c061 100644 --- a/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithUnions.js.diff +++ b/testdata/baselines/reference/submodule/compiler/excessPropertyCheckWithUnions.js.diff @@ -5,6 +5,6 @@ //// [excessPropertyCheckWithUnions.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++) { \ No newline at end of file + let wrong = { tag: "T", a1: "extra" }; + wrong = { tag: "A", d20: 12 }; + wrong = { tag: "D" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesNoValue.js.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesNoValue.js.diff deleted file mode 100644 index 043acea3ee..0000000000 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesNoValue.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.expandoFunctionContextualTypesNoValue.js -+++ new.expandoFunctionContextualTypesNoValue.js -@@= skipped -16, +16 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Foo = Foo; - // GH #38532 --var blah_1 = __importDefault(require("blah")); -+const blah_1 = __importDefault(require("blah")); - function Foo() { } - blah_1.default.bar = () => { }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.js.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.js.diff index 3c63bfc7f6..8c79a52141 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.js.diff +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionSymbolPropertyJs.js.diff @@ -1,15 +1,6 @@ --- old.expandoFunctionSymbolPropertyJs.js +++ new.expandoFunctionSymbolPropertyJs.js -@@= skipped -28, +28 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.test = test; --var types_1 = require("./types"); -+const types_1 = require("./types"); - /** - * @returns {import("./types").TestSymb} - */ -@@= skipped -21, +21 lines =@@ +@@= skipped -49, +49 lines =@@ /** * @returns {import("./types").TestSymb} */ diff --git a/testdata/baselines/reference/submodule/compiler/experimentalDecoratorMetadataUnresolvedTypeObjectInEmit.js.diff b/testdata/baselines/reference/submodule/compiler/experimentalDecoratorMetadataUnresolvedTypeObjectInEmit.js.diff index 131d8587e6..131321b18c 100644 --- a/testdata/baselines/reference/submodule/compiler/experimentalDecoratorMetadataUnresolvedTypeObjectInEmit.js.diff +++ b/testdata/baselines/reference/submodule/compiler/experimentalDecoratorMetadataUnresolvedTypeObjectInEmit.js.diff @@ -16,19 +16,13 @@ -var __param = (this && this.__param) || function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -}; --let Foo = (() => { -- var _a, _b, _c, _d; -- class Foo { -- f(user) { } -- } -- __decorate([ -- __param(0, decorate), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [typeof (_d = typeof A !== "undefined" && (_a = A.B) !== void 0 && (_b = _a.C) !== void 0 && (_c = _b.D) !== void 0 && _c.E) === "function" ? _d : Object]), -- __metadata("design:returntype", void 0) -- ], Foo.prototype, "f", null); -- return Foo; --})(); -+class Foo { -+ f(user) { } -+} \ No newline at end of file +-var _a, _b, _c, _d; + class Foo { + f(user) { } + } +-__decorate([ +- __param(0, decorate), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [typeof (_d = typeof A !== "undefined" && (_a = A.B) !== void 0 && (_b = _a.C) !== void 0 && (_c = _b.D) !== void 0 && _c.E) === "function" ? _d : Object]), +- __metadata("design:returntype", void 0) +-], Foo.prototype, "f", null); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/explicitAnyAfterSpreadNoImplicitAnyError.js b/testdata/baselines/reference/submodule/compiler/explicitAnyAfterSpreadNoImplicitAnyError.js index 5cd098b2d1..23bc21278c 100644 --- a/testdata/baselines/reference/submodule/compiler/explicitAnyAfterSpreadNoImplicitAnyError.js +++ b/testdata/baselines/reference/submodule/compiler/explicitAnyAfterSpreadNoImplicitAnyError.js @@ -6,16 +6,5 @@ let x: any; //// [explicitAnyAfterSpreadNoImplicitAnyError.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -(__assign({ a: [] }, null)); +(Object.assign({ a: [] }, null)); let x; diff --git a/testdata/baselines/reference/submodule/compiler/exportAsNamespace_augment.js.diff b/testdata/baselines/reference/submodule/compiler/exportAsNamespace_augment.js.diff deleted file mode 100644 index c08eccc480..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportAsNamespace_augment.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.exportAsNamespace_augment.js -+++ new.exportAsNamespace_augment.js -@@= skipped -59, +59 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var a2 = __importStar(require("./a")); -+const a2 = __importStar(require("./a")); - a.x + a.y + a.z + a.conflict; - a2.x + a2.y + a2.z + a2.conflict; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportAssignedNamespaceIsVisibleInDeclarationEmit.js.diff b/testdata/baselines/reference/submodule/compiler/exportAssignedNamespaceIsVisibleInDeclarationEmit.js.diff deleted file mode 100644 index 9df2ffa85b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportAssignedNamespaceIsVisibleInDeclarationEmit.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.exportAssignedNamespaceIsVisibleInDeclarationEmit.js -+++ new.exportAssignedNamespaceIsVisibleInDeclarationEmit.js -@@= skipped -13, +13 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.thing = void 0; --var thing_1 = require("./thing"); -+const thing_1 = require("./thing"); - exports.thing = (0, thing_1.f)(); - diff --git a/testdata/baselines/reference/submodule/compiler/exportAssignmentEnum.js.diff b/testdata/baselines/reference/submodule/compiler/exportAssignmentEnum.js.diff deleted file mode 100644 index 202b5b9f9b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportAssignmentEnum.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.exportAssignmentEnum.js -+++ new.exportAssignmentEnum.js -@@= skipped -27, +27 lines =@@ - //// [exportAssignmentEnum_B.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var EnumE = require("./exportAssignmentEnum_A"); -+const EnumE = require("./exportAssignmentEnum_A"); - var a = EnumE.A; - var b = EnumE.B; - var c = EnumE.C; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportAssignmentImportMergeNoCrash.js.diff b/testdata/baselines/reference/submodule/compiler/exportAssignmentImportMergeNoCrash.js.diff deleted file mode 100644 index de5757db68..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportAssignmentImportMergeNoCrash.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.exportAssignmentImportMergeNoCrash.js -+++ new.exportAssignmentImportMergeNoCrash.js -@@= skipped -23, +23 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Obj = void 0; --var assignment_1 = __importDefault(require("./assignment")); -+const assignment_1 = __importDefault(require("./assignment")); - exports.Obj = void exports.Obj; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportAssignmentVariable.js.diff b/testdata/baselines/reference/submodule/compiler/exportAssignmentVariable.js.diff deleted file mode 100644 index 4f2c34796c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportAssignmentVariable.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.exportAssignmentVariable.js -+++ new.exportAssignmentVariable.js -@@= skipped -16, +16 lines =@@ - //// [exportAssignmentVariable_B.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var y = require("./exportAssignmentVariable_A"); -+const y = require("./exportAssignmentVariable_A"); - var n = y; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportClassExtendingIntersection.js.diff b/testdata/baselines/reference/submodule/compiler/exportClassExtendingIntersection.js.diff index 3ae7308b38..4b34c32ba5 100644 --- a/testdata/baselines/reference/submodule/compiler/exportClassExtendingIntersection.js.diff +++ b/testdata/baselines/reference/submodule/compiler/exportClassExtendingIntersection.js.diff @@ -16,23 +16,11 @@ }; } //// [FinalClass.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MyExtendedClass = void 0; --var BaseClass_1 = require("./BaseClass"); --var MixinClass_1 = require("./MixinClass"); -+const BaseClass_1 = require("./BaseClass"); -+const MixinClass_1 = require("./MixinClass"); +@@= skipped -9, +10 lines =@@ + const BaseClass_1 = require("./BaseClass"); + const MixinClass_1 = require("./MixinClass"); class MyExtendedClass extends (0, MixinClass_1.MyMixin)(BaseClass_1.MyBaseClass) { + extendedClassProperty; } exports.MyExtendedClass = MyExtendedClass; - //// [Main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var FinalClass_1 = require("./FinalClass"); --var MixinClass_1 = require("./MixinClass"); -+const FinalClass_1 = require("./FinalClass"); -+const MixinClass_1 = require("./MixinClass"); - const myExtendedClass = new FinalClass_1.MyExtendedClass('string'); - const AnotherMixedClass = (0, MixinClass_1.MyMixin)(FinalClass_1.MyExtendedClass); + //// [Main.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultAbstractClass.js.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultAbstractClass.js.diff index 31534f4ea4..03dc85abcc 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultAbstractClass.js.diff +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultAbstractClass.js.diff @@ -7,13 +7,4 @@ + a; } exports.default = A; - class B extends A { -@@= skipped -11, +12 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var a_1 = __importDefault(require("./a")); -+const a_1 = __importDefault(require("./a")); - class C extends a_1.default { - } - new C().a.toExponential(); \ No newline at end of file + class B extends A { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultProperty.js.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultProperty.js.diff index af236e3409..980e865d8a 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultProperty.js.diff +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultProperty.js.diff @@ -1,19 +1,10 @@ --- old.exportDefaultProperty.js +++ new.exportDefaultProperty.js -@@= skipped -63, +63 lines =@@ - }; +@@= skipped -64, +64 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); /// --var foobar_1 = __importDefault(require("foobar")); + const foobar_1 = __importDefault(require("foobar")); -var X = foobar_1.default.X; --var foobarx_1 = __importDefault(require("foobarx")); -+const foobar_1 = __importDefault(require("foobar")); -+const foobarx_1 = __importDefault(require("foobarx")); + const foobarx_1 = __importDefault(require("foobarx")); const x = X; - const x2 = foobarx_1.default; --var a_1 = __importDefault(require("./a")); -+const a_1 = __importDefault(require("./a")); - const b = new a_1.default(a_1.default.b); --var b_1 = __importDefault(require("./b")); -+const b_1 = __importDefault(require("./b")); - b_1.default + 1; \ No newline at end of file + const x2 = foobarx_1.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultProperty2.js.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultProperty2.js.diff index 1590d2038f..8deefbe0c6 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultProperty2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultProperty2.js.diff @@ -7,11 +7,4 @@ + static B; } exports.default = C.B; - //// [b.js] -@@= skipped -8, +9 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var a_1 = __importDefault(require("./a")); -+const a_1 = __importDefault(require("./a")); - const x = { c: a_1.default }; \ No newline at end of file + //// [b.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultQualifiedNameNoError.js.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultQualifiedNameNoError.js.diff index 3fc32e21b4..6219aea4c6 100644 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultQualifiedNameNoError.js.diff +++ b/testdata/baselines/reference/submodule/compiler/exportDefaultQualifiedNameNoError.js.diff @@ -1,25 +1,12 @@ --- old.exportDefaultQualifiedNameNoError.js +++ new.exportDefaultQualifiedNameNoError.js -@@= skipped -9, +9 lines =@@ - //// [code.js] +@@= skipped -10, +10 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); --let C = (() => { -- class C { -- } -- C.x = 0; -- return C; --})(); -+class C { + class C { + static x = 0; -+} + } +-C.x = 0; ; exports.default = C.x; - //// [usage.js] -@@= skipped -14, +11 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var code_1 = __importDefault(require("./code")); -+const code_1 = __importDefault(require("./code")); - void code_1.default; \ No newline at end of file + //// [usage.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportDefaultStripsFreshness.js.diff b/testdata/baselines/reference/submodule/compiler/exportDefaultStripsFreshness.js.diff deleted file mode 100644 index e047563812..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportDefaultStripsFreshness.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.exportDefaultStripsFreshness.js -+++ new.exportDefaultStripsFreshness.js -@@= skipped -68, +68 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var items_1 = __importStar(require("./items")); -+const items_1 = __importStar(require("./items")); - function nFoo(x) { } - nFoo(items_1.q); // for comparison - nFoo(items_1.default); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportEqualErrorType.js.diff b/testdata/baselines/reference/submodule/compiler/exportEqualErrorType.js.diff deleted file mode 100644 index 1f7489d16a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportEqualErrorType.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.exportEqualErrorType.js -+++ new.exportEqualErrorType.js -@@= skipped -28, +28 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var connect = require("./exportEqualErrorType_0"); -+const connect = require("./exportEqualErrorType_0"); - connect().use(connect.static('foo')); // Error 1 The property 'static' does not exist on value of type ''. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportEqualMemberMissing.js.diff b/testdata/baselines/reference/submodule/compiler/exportEqualMemberMissing.js.diff deleted file mode 100644 index ce0c70e5d5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportEqualMemberMissing.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.exportEqualMemberMissing.js -+++ new.exportEqualMemberMissing.js -@@= skipped -28, +28 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var connect = require("./exportEqualMemberMissing_0"); -+const connect = require("./exportEqualMemberMissing_0"); - connect().use(connect.static('foo')); // Error 1 The property 'static' does not exist on value of type ''. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.js.diff b/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.js.diff deleted file mode 100644 index 0d1643296a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportEqualsDefaultProperty.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.exportEqualsDefaultProperty.js -+++ new.exportEqualsDefaultProperty.js -@@= skipped -25, +25 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var exp_1 = __importDefault(require("./exp")); -+const exp_1 = __importDefault(require("./exp")); - exp_1.default.toExponential(2); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportEqualsProperty.js.diff b/testdata/baselines/reference/submodule/compiler/exportEqualsProperty.js.diff deleted file mode 100644 index 8e802fff75..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportEqualsProperty.js.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.exportEqualsProperty.js -+++ new.exportEqualsProperty.js -@@= skipped -57, +57 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var foobar_1 = require("foobar"); --var X2 = require("foobarx"); -+const foobar_1 = require("foobar"); -+const X2 = require("foobarx"); - const x = foobar_1.X; - const x2 = X2; --var B = require("./a"); -+const B = require("./a"); - const b = new B(B.b); --var fooLength = require("./b"); -+const fooLength = require("./b"); - fooLength + 1; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportEqualsProperty2.js.diff b/testdata/baselines/reference/submodule/compiler/exportEqualsProperty2.js.diff index 8c18c82539..32562c1313 100644 --- a/testdata/baselines/reference/submodule/compiler/exportEqualsProperty2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/exportEqualsProperty2.js.diff @@ -7,9 +7,4 @@ + static B; } module.exports = C.B; - //// [b.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var B = require("./a"); -+const B = require("./a"); - const x = { c: B }; \ No newline at end of file + //// [b.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportStarFromEmptyModule.js.diff b/testdata/baselines/reference/submodule/compiler/exportStarFromEmptyModule.js.diff index 10f9a6049f..379a412124 100644 --- a/testdata/baselines/reference/submodule/compiler/exportStarFromEmptyModule.js.diff +++ b/testdata/baselines/reference/submodule/compiler/exportStarFromEmptyModule.js.diff @@ -15,13 +15,4 @@ + static q; } exports.A = A; - //// [exportStarFromEmptyModule_module4.js] -@@= skipped -38, +39 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var X = __importStar(require("./exportStarFromEmptyModule_module3")); -+const X = __importStar(require("./exportStarFromEmptyModule_module3")); - var s; - X.A.q; - X.A.r; // Error \ No newline at end of file + //// [exportStarFromEmptyModule_module4.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportStarNotElided.js.diff b/testdata/baselines/reference/submodule/compiler/exportStarNotElided.js.diff deleted file mode 100644 index fd2907710b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/exportStarNotElided.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.exportStarNotElided.js -+++ new.exportStarNotElided.js -@@= skipped -66, +66 lines =@@ - //// [data1.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var _1 = require("./"); -+const _1 = require("./"); - (0, _1.register)("ok"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/expressionsForbiddenInParameterInitializers.js.diff b/testdata/baselines/reference/submodule/compiler/expressionsForbiddenInParameterInitializers.js.diff index aba90e7e84..23547c2967 100644 --- a/testdata/baselines/reference/submodule/compiler/expressionsForbiddenInParameterInitializers.js.diff +++ b/testdata/baselines/reference/submodule/compiler/expressionsForbiddenInParameterInitializers.js.diff @@ -17,7 +17,7 @@ exports.foo = foo; exports.foo2 = foo2; -function foo(_a) { -- return __awaiter(this, arguments, void 0, function* ({ foo = yield Promise.resolve().then(function () { return __importStar(require("./bar")); }) }) { +- return __awaiter(this, arguments, void 0, function* ({ foo = yield Promise.resolve().then(() => __importStar(require("./bar"))) }) { - }); +async function foo({ foo = await Promise.resolve().then(() => __importStar(require("./bar"))) }) { } diff --git a/testdata/baselines/reference/submodule/compiler/extendFromAny.js.diff b/testdata/baselines/reference/submodule/compiler/extendFromAny.js.diff index 7668d6323a..4fa0a2cad4 100644 --- a/testdata/baselines/reference/submodule/compiler/extendFromAny.js.diff +++ b/testdata/baselines/reference/submodule/compiler/extendFromAny.js.diff @@ -1,23 +1,17 @@ --- old.extendFromAny.js +++ new.extendFromAny.js -@@= skipped -14, +14 lines =@@ - +@@= skipped -15, +15 lines =@@ //// [extendFromAny.js] --let C = (() => { -- class C extends Base { -- constructor() { -- super(...arguments); -- this.known = 1; -- } + class C extends Base { +- constructor() { +- super(...arguments); +- this.known = 1; - } -- C.sknown = 2; -- return C; --})(); -+class C extends Base { + known = 1; + static sknown = 2; -+} + } +-C.sknown = 2; let c = new C(); c.known.length; // error, 'known' has no 'length' property C.sknown.length; // error, 'sknown' has no 'length' property \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/extendingClassFromAliasAndUsageInIndexer.js.diff b/testdata/baselines/reference/submodule/compiler/extendingClassFromAliasAndUsageInIndexer.js.diff index a59c81ff2f..a699617e7c 100644 --- a/testdata/baselines/reference/submodule/compiler/extendingClassFromAliasAndUsageInIndexer.js.diff +++ b/testdata/baselines/reference/submodule/compiler/extendingClassFromAliasAndUsageInIndexer.js.diff @@ -7,31 +7,4 @@ + someData; } exports.Model = Model; - //// [extendingClassFromAliasAndUsageInIndexer_moduleA.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); -+const Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; -@@= skipped -14, +15 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationModel = void 0; --var Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); -+const Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); - class VisualizationModel extends Backbone.Model { - } - exports.VisualizationModel = VisualizationModel; - //// [extendingClassFromAliasAndUsageInIndexer_main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var moduleA = require("./extendingClassFromAliasAndUsageInIndexer_moduleA"); --var moduleB = require("./extendingClassFromAliasAndUsageInIndexer_moduleB"); -+const moduleA = require("./extendingClassFromAliasAndUsageInIndexer_moduleA"); -+const moduleB = require("./extendingClassFromAliasAndUsageInIndexer_moduleB"); - var moduleATyped = moduleA; - var moduleMap = { - "moduleA": moduleA, \ No newline at end of file + //// [extendingClassFromAliasAndUsageInIndexer_moduleA.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/extendsUntypedModule.js.diff b/testdata/baselines/reference/submodule/compiler/extendsUntypedModule.js.diff deleted file mode 100644 index 85b1eff8c0..0000000000 --- a/testdata/baselines/reference/submodule/compiler/extendsUntypedModule.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.extendsUntypedModule.js -+++ new.extendsUntypedModule.js -@@= skipped -18, +18 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.A = void 0; --var foo_1 = __importDefault(require("foo")); -+const foo_1 = __importDefault(require("foo")); - class A extends foo_1.default { - } - exports.A = A; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/externalModuleExportingGenericClass.js.diff b/testdata/baselines/reference/submodule/compiler/externalModuleExportingGenericClass.js.diff index 33c84a2710..30b4e28f74 100644 --- a/testdata/baselines/reference/submodule/compiler/externalModuleExportingGenericClass.js.diff +++ b/testdata/baselines/reference/submodule/compiler/externalModuleExportingGenericClass.js.diff @@ -7,11 +7,4 @@ + foo; } module.exports = C; - //// [externalModuleExportingGenericClass_file1.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var a = require("./externalModuleExportingGenericClass_file0"); -+const a = require("./externalModuleExportingGenericClass_file0"); - var v; // this should report error - var v2 = (new a()).foo; - var v3 = (new a()).foo; \ No newline at end of file + //// [externalModuleExportingGenericClass_file1.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/externalModuleImmutableBindings.js.diff b/testdata/baselines/reference/submodule/compiler/externalModuleImmutableBindings.js.diff deleted file mode 100644 index b55faa2aa4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/externalModuleImmutableBindings.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.externalModuleImmutableBindings.js -+++ new.externalModuleImmutableBindings.js -@@= skipped -91, +91 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - // all mutations below are illegal and should be fixed --var stuff = __importStar(require("./f1")); -+const stuff = __importStar(require("./f1")); - var n = 'baz'; - stuff.x = 0; - stuff['x'] = 1; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/externalModuleRefernceResolutionOrderInImportDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/externalModuleRefernceResolutionOrderInImportDeclaration.js.diff deleted file mode 100644 index 2657cbcbfa..0000000000 --- a/testdata/baselines/reference/submodule/compiler/externalModuleRefernceResolutionOrderInImportDeclaration.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.externalModuleRefernceResolutionOrderInImportDeclaration.js -+++ new.externalModuleRefernceResolutionOrderInImportDeclaration.js -@@= skipped -27, +27 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var file1 = require("./externalModuleRefernceResolutionOrderInImportDeclaration_file1"); -+const file1 = require("./externalModuleRefernceResolutionOrderInImportDeclaration_file1"); - file1.foo(); - file1.bar(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/externalModuleResolution.js.diff b/testdata/baselines/reference/submodule/compiler/externalModuleResolution.js.diff deleted file mode 100644 index ce095e4ffb..0000000000 --- a/testdata/baselines/reference/submodule/compiler/externalModuleResolution.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.externalModuleResolution.js -+++ new.externalModuleResolution.js -@@= skipped -25, +25 lines =@@ - //// [consumer.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var x = require("./foo"); -+const x = require("./foo"); - x.Y; // .ts should be picked \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/externalModuleResolution2.js.diff b/testdata/baselines/reference/submodule/compiler/externalModuleResolution2.js.diff deleted file mode 100644 index 6710c9036a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/externalModuleResolution2.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.externalModuleResolution2.js -+++ new.externalModuleResolution2.js -@@= skipped -26, +26 lines =@@ - //// [consumer.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var x = require("./foo"); -+const x = require("./foo"); - x.X; // .ts should be picked \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/forwardRefInClassProperties.js.diff b/testdata/baselines/reference/submodule/compiler/forwardRefInClassProperties.js.diff index 512ed20ca3..3cbfa36d12 100644 --- a/testdata/baselines/reference/submodule/compiler/forwardRefInClassProperties.js.diff +++ b/testdata/baselines/reference/submodule/compiler/forwardRefInClassProperties.js.diff @@ -1,30 +1,21 @@ --- old.forwardRefInClassProperties.js +++ new.forwardRefInClassProperties.js -@@= skipped -17, +17 lines =@@ - +@@= skipped -18, +18 lines =@@ //// [forwardRefInClassProperties.js] --let Test = (() => { -- class Test { -- constructor() { -- this._b = this._a; // undefined, no error/warning -- this._a = 3; -- } -- method() { -- let a = b; // Property 'b' is used before its initialization. -- let b = 3; -- } -+class Test { + class Test { +- constructor() { +- this._b = this._a; // undefined, no error/warning +- this._a = 3; +- } + _b = this._a; // undefined, no error/warning + _a = 3; + static _B = Test._A; // undefined, no error/warning + static _A = 3; -+ method() { -+ let a = b; // Property 'b' is used before its initialization. -+ let b = 3; + method() { + let a = b; // Property 'b' is used before its initialization. + let b = 3; } -- Test._B = Test._A; // undefined, no error/warning -- Test._A = 3; -- return Test; --})(); -+} \ No newline at end of file + } +-Test._B = Test._A; // undefined, no error/warning +-Test._A = 3; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/forwardRefInTypeDeclaration(strict=false).js.diff b/testdata/baselines/reference/submodule/compiler/forwardRefInTypeDeclaration(strict=false).js.diff index e8ff4b3490..0ee80793ed 100644 --- a/testdata/baselines/reference/submodule/compiler/forwardRefInTypeDeclaration(strict=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/forwardRefInTypeDeclaration(strict=false).js.diff @@ -1,16 +1,10 @@ --- old.forwardRefInTypeDeclaration(strict=false).js +++ new.forwardRefInTypeDeclaration(strict=false).js -@@= skipped -34, +34 lines =@@ - const s3 = "x"; +@@= skipped -35, +35 lines =@@ const s4 = "x"; const s5 = "x"; --let Cls2 = (() => { -- class Cls2 { -- } -- Cls2.b = "b"; -- return Cls2; --})(); -+class Cls2 { + class Cls2 { + static b = "b"; -+} + } +-Cls2.b = "b"; const obj2 = { d: 'd' }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/forwardRefInTypeDeclaration(strict=true).js.diff b/testdata/baselines/reference/submodule/compiler/forwardRefInTypeDeclaration(strict=true).js.diff index 76eeeaccd4..cd313ceab0 100644 --- a/testdata/baselines/reference/submodule/compiler/forwardRefInTypeDeclaration(strict=true).js.diff +++ b/testdata/baselines/reference/submodule/compiler/forwardRefInTypeDeclaration(strict=true).js.diff @@ -10,13 +10,8 @@ const s3 = "x"; const s4 = "x"; const s5 = "x"; --let Cls2 = (() => { -- class Cls2 { -- } -- Cls2.b = "b"; -- return Cls2; --})(); -+class Cls2 { + class Cls2 { + static b = "b"; -+} + } +-Cls2.b = "b"; const obj2 = { d: 'd' }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.errors.txt b/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.errors.txt new file mode 100644 index 0000000000..a51f29297d --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.errors.txt @@ -0,0 +1,34 @@ +functionLikeInParameterInitializer.ts(2,34): error TS2304: Cannot find name 'foo'. +functionLikeInParameterInitializer.ts(6,44): error TS2304: Cannot find name 'foo'. +functionLikeInParameterInitializer.ts(11,50): error TS2304: Cannot find name 'foo'. +functionLikeInParameterInitializer.ts(16,41): error TS2304: Cannot find name 'foo'. + + +==== functionLikeInParameterInitializer.ts (4 errors) ==== + // error + export function bar(func = () => foo) { + ~~~ +!!! error TS2304: Cannot find name 'foo'. + let foo = "in"; + } + // error + export function baz1(func = { f() { return foo } }) { + ~~~ +!!! error TS2304: Cannot find name 'foo'. + let foo = "in"; + } + + // error + export function baz2(func = function () { return foo }) { + ~~~ +!!! error TS2304: Cannot find name 'foo'. + let foo = "in"; + } + + // error + export function baz3(func = class { x = foo }) { + ~~~ +!!! error TS2304: Cannot find name 'foo'. + let foo = "in"; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.symbols b/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.symbols index c2ccb25545..c67e44f4e6 100644 --- a/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.symbols +++ b/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.symbols @@ -5,7 +5,6 @@ export function bar(func = () => foo) { >bar : Symbol(bar, Decl(functionLikeInParameterInitializer.ts, 0, 0)) >func : Symbol(func, Decl(functionLikeInParameterInitializer.ts, 1, 20)) ->foo : Symbol(foo, Decl(functionLikeInParameterInitializer.ts, 2, 7)) let foo = "in"; >foo : Symbol(foo, Decl(functionLikeInParameterInitializer.ts, 2, 7)) @@ -15,7 +14,6 @@ export function baz1(func = { f() { return foo } }) { >baz1 : Symbol(baz1, Decl(functionLikeInParameterInitializer.ts, 3, 1)) >func : Symbol(func, Decl(functionLikeInParameterInitializer.ts, 5, 21)) >f : Symbol(f, Decl(functionLikeInParameterInitializer.ts, 5, 29)) ->foo : Symbol(foo, Decl(functionLikeInParameterInitializer.ts, 6, 7)) let foo = "in"; >foo : Symbol(foo, Decl(functionLikeInParameterInitializer.ts, 6, 7)) @@ -25,7 +23,6 @@ export function baz1(func = { f() { return foo } }) { export function baz2(func = function () { return foo }) { >baz2 : Symbol(baz2, Decl(functionLikeInParameterInitializer.ts, 7, 1)) >func : Symbol(func, Decl(functionLikeInParameterInitializer.ts, 10, 21)) ->foo : Symbol(foo, Decl(functionLikeInParameterInitializer.ts, 11, 7)) let foo = "in"; >foo : Symbol(foo, Decl(functionLikeInParameterInitializer.ts, 11, 7)) @@ -36,7 +33,6 @@ export function baz3(func = class { x = foo }) { >baz3 : Symbol(baz3, Decl(functionLikeInParameterInitializer.ts, 12, 1)) >func : Symbol(func, Decl(functionLikeInParameterInitializer.ts, 15, 21)) >x : Symbol((Anonymous class).x, Decl(functionLikeInParameterInitializer.ts, 15, 35)) ->foo : Symbol(foo, Decl(functionLikeInParameterInitializer.ts, 16, 7)) let foo = "in"; >foo : Symbol(foo, Decl(functionLikeInParameterInitializer.ts, 16, 7)) diff --git a/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.types b/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.types index cf27ae4b1b..cf9011b879 100644 --- a/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.types +++ b/testdata/baselines/reference/submodule/compiler/functionLikeInParameterInitializer.types @@ -3,10 +3,10 @@ === functionLikeInParameterInitializer.ts === // error export function bar(func = () => foo) { ->bar : (func?: () => string) => void ->func : () => string ->() => foo : () => string ->foo : string +>bar : (func?: () => any) => void +>func : () => any +>() => foo : () => any +>foo : any let foo = "in"; >foo : string @@ -14,11 +14,11 @@ export function bar(func = () => foo) { } // error export function baz1(func = { f() { return foo } }) { ->baz1 : (func?: { f(): string; }) => void ->func : { f(): string; } ->{ f() { return foo } } : { f(): string; } ->f : () => string ->foo : string +>baz1 : (func?: { f(): any; }) => void +>func : { f(): any; } +>{ f() { return foo } } : { f(): any; } +>f : () => any +>foo : any let foo = "in"; >foo : string @@ -27,10 +27,10 @@ export function baz1(func = { f() { return foo } }) { // error export function baz2(func = function () { return foo }) { ->baz2 : (func?: () => string) => void ->func : () => string ->function () { return foo } : () => string ->foo : string +>baz2 : (func?: () => any) => void +>func : () => any +>function () { return foo } : () => any +>foo : any let foo = "in"; >foo : string @@ -42,8 +42,8 @@ export function baz3(func = class { x = foo }) { >baz3 : (func?: typeof (Anonymous class)) => void >func : typeof (Anonymous class) >class { x = foo } : typeof (Anonymous class) ->x : string ->foo : string +>x : any +>foo : any let foo = "in"; >foo : string diff --git a/testdata/baselines/reference/submodule/compiler/genericClassWithStaticsUsingTypeArguments.js.diff b/testdata/baselines/reference/submodule/compiler/genericClassWithStaticsUsingTypeArguments.js.diff index 0a9021b60f..248c48accc 100644 --- a/testdata/baselines/reference/submodule/compiler/genericClassWithStaticsUsingTypeArguments.js.diff +++ b/testdata/baselines/reference/submodule/compiler/genericClassWithStaticsUsingTypeArguments.js.diff @@ -1,27 +1,19 @@ --- old.genericClassWithStaticsUsingTypeArguments.js +++ new.genericClassWithStaticsUsingTypeArguments.js -@@= skipped -20, +20 lines =@@ - +@@= skipped -21, +21 lines =@@ //// [genericClassWithStaticsUsingTypeArguments.js] // Should be error to use 'T' in all declarations within Foo. --let Foo = (() => { -- class Foo { -- static f(xs) { -- return xs.reverse(); -- } -+class Foo { + class Foo { + static a = (n) => { }; + static b; + static c = []; + static d = false || ((x) => x || undefined)(null); + static e = function (x) { return null; }; -+ static f(xs) { -+ return xs.reverse(); + static f(xs) { + return xs.reverse(); } -- Foo.a = (n) => { }; -- Foo.c = []; -- Foo.d = false || ((x) => x || undefined)(null); -- Foo.e = function (x) { return null; }; -- return Foo; --})(); -+} \ No newline at end of file + } +-Foo.a = (n) => { }; +-Foo.c = []; +-Foo.d = false || ((x) => x || undefined)(null); +-Foo.e = function (x) { return null; }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/genericInferenceDefaultTypeParameterJsxReact.js.diff b/testdata/baselines/reference/submodule/compiler/genericInferenceDefaultTypeParameterJsxReact.js.diff deleted file mode 100644 index 7cd137b7da..0000000000 --- a/testdata/baselines/reference/submodule/compiler/genericInferenceDefaultTypeParameterJsxReact.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.genericInferenceDefaultTypeParameterJsxReact.js -+++ new.genericInferenceDefaultTypeParameterJsxReact.js -@@= skipped -23, +23 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - // Repro from #50858 --var react_1 = __importDefault(require("react")); -+const react_1 = __importDefault(require("react")); - function Component(props) { - return react_1.default.createElement(react_1.default.Fragment, null); - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/genericIsNeverEmptyObject.js b/testdata/baselines/reference/submodule/compiler/genericIsNeverEmptyObject.js index c4f2c68476..98b27f0aa0 100644 --- a/testdata/baselines/reference/submodule/compiler/genericIsNeverEmptyObject.js +++ b/testdata/baselines/reference/submodule/compiler/genericIsNeverEmptyObject.js @@ -14,17 +14,6 @@ let o2: { b: string, x: number } = test(o1); //// [genericIsNeverEmptyObject.js] // Repro from #29067 -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) @@ -38,7 +27,7 @@ var __rest = (this && this.__rest) || function (s, e) { }; function test(obj) { let { a } = obj, rest = __rest(obj, ["a"]); - return __assign(__assign({}, rest), { b: a }); + return Object.assign(Object.assign({}, rest), { b: a }); } let o1 = { a: 'hello', x: 42 }; let o2 = test(o1); diff --git a/testdata/baselines/reference/submodule/compiler/genericIsNeverEmptyObject.js.diff b/testdata/baselines/reference/submodule/compiler/genericIsNeverEmptyObject.js.diff index 4d67e47082..e93cafb9c8 100644 --- a/testdata/baselines/reference/submodule/compiler/genericIsNeverEmptyObject.js.diff +++ b/testdata/baselines/reference/submodule/compiler/genericIsNeverEmptyObject.js.diff @@ -6,5 +6,5 @@ //// [genericIsNeverEmptyObject.js] -"use strict"; // Repro from #29067 - var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { \ No newline at end of file + var __rest = (this && this.__rest) || function (s, e) { + var t = {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit.js.diff b/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit.js.diff index 4c75f38b3a..d5ef1c6171 100644 --- a/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit.js.diff +++ b/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit.js.diff @@ -1,13 +1,6 @@ --- old.globalThisDeclarationEmit.js +++ new.globalThisDeclarationEmit.js -@@= skipped -15, +15 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.globalThis = void 0; --var variable_1 = require("./variable"); -+const variable_1 = require("./variable"); - exports.globalThis = variable_1.variable; - +@@= skipped -21, +21 lines =@@ //// [variable.d.ts] export declare const variable: typeof globalThis; diff --git a/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit2.js.diff b/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit2.js.diff deleted file mode 100644 index 037089f8d7..0000000000 --- a/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit2.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.globalThisDeclarationEmit2.js -+++ new.globalThisDeclarationEmit2.js -@@= skipped -15, +15 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.globalThis = void 0; --var variable_1 = require("./variable"); -+const variable_1 = require("./variable"); - Object.defineProperty(exports, "globalThis", { enumerable: true, get: function () { return variable_1.variable; } }); - diff --git a/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit3.js.diff b/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit3.js.diff index 7a0d64d79f..5c8a78e223 100644 --- a/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit3.js.diff +++ b/testdata/baselines/reference/submodule/compiler/globalThisDeclarationEmit3.js.diff @@ -8,9 +8,4 @@ -exports.variable = mod; //// [index.js] "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.globalThis = void 0; --var variable_1 = require("./variable"); -+const variable_1 = require("./variable"); - Object.defineProperty(exports, "globalThis", { enumerable: true, get: function () { return variable_1.variable; } }); - + Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/ignoredJsxAttributes.js.diff b/testdata/baselines/reference/submodule/compiler/ignoredJsxAttributes.js.diff deleted file mode 100644 index 27f718e4f3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/ignoredJsxAttributes.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.ignoredJsxAttributes.js -+++ new.ignoredJsxAttributes.js -@@= skipped -60, +60 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - // Repro from #44797 --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - let props = { - foo: "", - "data-yadda": 42, // Error \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importAliasAnExternalModuleInsideAnInternalModule.js.diff b/testdata/baselines/reference/submodule/compiler/importAliasAnExternalModuleInsideAnInternalModule.js.diff index b8f0a9480d..7fdcb8aec7 100644 --- a/testdata/baselines/reference/submodule/compiler/importAliasAnExternalModuleInsideAnInternalModule.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importAliasAnExternalModuleInsideAnInternalModule.js.diff @@ -1,11 +1,7 @@ --- old.importAliasAnExternalModuleInsideAnInternalModule.js +++ new.importAliasAnExternalModuleInsideAnInternalModule.js -@@= skipped -25, +25 lines =@@ - //// [importAliasAnExternalModuleInsideAnInternalModule_file1.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var r = require("./importAliasAnExternalModuleInsideAnInternalModule_file0"); -+const r = require("./importAliasAnExternalModuleInsideAnInternalModule_file0"); +@@= skipped -28, +28 lines =@@ + const r = require("./importAliasAnExternalModuleInsideAnInternalModule_file0"); var m_private; (function (m_private) { - //import r2 = require('m'); // would be error diff --git a/testdata/baselines/reference/submodule/compiler/importAsBaseClass.js.diff b/testdata/baselines/reference/submodule/compiler/importAsBaseClass.js.diff deleted file mode 100644 index b6981328a5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/importAsBaseClass.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.importAsBaseClass.js -+++ new.importAsBaseClass.js -@@= skipped -20, +20 lines =@@ - //// [importAsBaseClass_1.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var Greeter = require("./importAsBaseClass_0"); -+const Greeter = require("./importAsBaseClass_0"); - class Hello extends Greeter { - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importDecl.js.diff b/testdata/baselines/reference/submodule/compiler/importDecl.js.diff index 91fad09376..d99f46071e 100644 --- a/testdata/baselines/reference/submodule/compiler/importDecl.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importDecl.js.diff @@ -31,44 +31,4 @@ + bing; } exports.d = d; - function foo() { return null; } -@@= skipped -17, +18 lines =@@ - /// - /// - /// --var m4 = require("./importDecl_require"); // Emit used -+const m4 = require("./importDecl_require"); // Emit used - exports.x4 = m4.x; - exports.d4 = m4.d; - exports.f4 = m4.foo(); -@@= skipped -14, +14 lines =@@ - var f3 = m4.foo(); - })(m1 || (exports.m1 = m1 = {})); - //Emit global only usage --var glo_m4 = require("./importDecl_require1"); -+const glo_m4 = require("./importDecl_require1"); - exports.useGlo_m4_d4 = glo_m4.d; - exports.useGlo_m4_f4 = glo_m4.foo(); - //Emit even when used just in function type --var fncOnly_m4 = require("./importDecl_require2"); -+const fncOnly_m4 = require("./importDecl_require2"); - exports.useFncOnly_m4_f4 = fncOnly_m4.foo(); - // only used privately no need to emit --var private_m4 = require("./importDecl_require3"); -+const private_m4 = require("./importDecl_require3"); - var usePrivate_m4_m1; - (function (usePrivate_m4_m1) { - var x3 = private_m4.x; -@@= skipped -15, +15 lines =@@ - var f3 = private_m4.foo(); - })(usePrivate_m4_m1 || (exports.usePrivate_m4_m1 = usePrivate_m4_m1 = {})); - // Do not emit unused import --var m5 = require("./importDecl_require4"); -+const m5 = require("./importDecl_require4"); - exports.d = m5.foo2(); - // Do not emit multiple used import statements --var multiImport_m4 = require("./importDecl_require"); // Emit used -+const multiImport_m4 = require("./importDecl_require"); // Emit used - exports.useMultiImport_m4_x4 = multiImport_m4.x; - exports.useMultiImport_m4_d4 = multiImport_m4.d; - exports.useMultiImport_m4_f4 = multiImport_m4.foo(); \ No newline at end of file + function foo() { return null; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpers.js.diff b/testdata/baselines/reference/submodule/compiler/importHelpers.js.diff index 832953b793..91026ef138 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpers.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpers.js.diff @@ -4,33 +4,28 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.result = exports.B = exports.A = void 0; --var tslib_1 = require("tslib"); +-const tslib_1 = require("tslib"); class A { } exports.A = A; class B extends A { } exports.B = B; --let C = (() => { -- let C = class C { -- method(x) { -- } -- }; -- tslib_1.__decorate([ -- tslib_1.__param(0, dec), -- tslib_1.__metadata("design:type", Function), -- tslib_1.__metadata("design:paramtypes", [Number]), -- tslib_1.__metadata("design:returntype", void 0) -- ], C.prototype, "method", null); -- C = tslib_1.__decorate([ -- dec -- ], C); -- return C; --})(); +-let C = class C { +@dec +class C { -+ method(x) { -+ } + method(x) { + } +-}; +-tslib_1.__decorate([ +- tslib_1.__param(0, dec), +- tslib_1.__metadata("design:type", Function), +- tslib_1.__metadata("design:paramtypes", [Number]), +- tslib_1.__metadata("design:returntype", void 0) +-], C.prototype, "method", null); +-C = tslib_1.__decorate([ +- dec +-], C); +} function id(x) { return x; @@ -53,26 +48,21 @@ } class B extends A { } --let C = (() => { -- let C = class C { -- method(x) { -- } -- }; -- __decorate([ -- __param(0, dec), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [Number]), -- __metadata("design:returntype", void 0) -- ], C.prototype, "method", null); -- C = __decorate([ -- dec -- ], C); -- return C; --})(); +-let C = class C { +@dec +class C { -+ method(x) { -+ } + method(x) { + } +-}; +-__decorate([ +- __param(0, dec), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [Number]), +- __metadata("design:returntype", void 0) +-], C.prototype, "method", null); +-C = __decorate([ +- dec +-], C); +} function id(x) { return x; diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersInIsolatedModules.js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersInIsolatedModules.js.diff index 0953e78b12..db0ab0c55e 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersInIsolatedModules.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersInIsolatedModules.js.diff @@ -4,33 +4,28 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.B = exports.A = void 0; --var tslib_1 = require("tslib"); +-const tslib_1 = require("tslib"); class A { } exports.A = A; class B extends A { } exports.B = B; --let C = (() => { -- let C = class C { -- method(x) { -- } -- }; -- tslib_1.__decorate([ -- tslib_1.__param(0, dec), -- tslib_1.__metadata("design:type", Function), -- tslib_1.__metadata("design:paramtypes", [Number]), -- tslib_1.__metadata("design:returntype", void 0) -- ], C.prototype, "method", null); -- C = tslib_1.__decorate([ -- dec -- ], C); -- return C; --})(); +-let C = class C { +@dec +class C { -+ method(x) { -+ } + method(x) { + } +-}; +-tslib_1.__decorate([ +- tslib_1.__param(0, dec), +- tslib_1.__metadata("design:type", Function), +- tslib_1.__metadata("design:paramtypes", [Number]), +- tslib_1.__metadata("design:returntype", void 0) +-], C.prototype, "method", null); +-C = tslib_1.__decorate([ +- dec +-], C); +} //// [script.js] -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { @@ -49,24 +44,19 @@ } class B extends A { } --let C = (() => { -- let C = class C { -- method(x) { -- } -- }; -- __decorate([ -- __param(0, dec), -- __metadata("design:type", Function), -- __metadata("design:paramtypes", [Number]), -- __metadata("design:returntype", void 0) -- ], C.prototype, "method", null); -- C = __decorate([ -- dec -- ], C); -- return C; --})(); +-let C = class C { +@dec +class C { -+ method(x) { -+ } + method(x) { + } +-}; +-__decorate([ +- __param(0, dec), +- __metadata("design:type", Function), +- __metadata("design:paramtypes", [Number]), +- __metadata("design:returntype", void 0) +-], C.prototype, "method", null); +-C = __decorate([ +- dec +-], C); +} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersInTsx.js b/testdata/baselines/reference/submodule/compiler/importHelpersInTsx.js index 5541448594..054c0daeea 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersInTsx.js +++ b/testdata/baselines/reference/submodule/compiler/importHelpersInTsx.js @@ -23,18 +23,6 @@ export declare function __awaiter(thisArg: any, _arguments: any, P: Function, ge "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; -const tslib_1 = require("tslib"); -exports.x = React.createElement("span", tslib_1.__assign({}, o)); +exports.x = React.createElement("span", Object.assign({}, o)); //// [script.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -const x = React.createElement("span", __assign({}, o)); +const x = React.createElement("span", Object.assign({}, o)); diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersInTsx.js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersInTsx.js.diff deleted file mode 100644 index 0727e4623f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/importHelpersInTsx.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.importHelpersInTsx.js -+++ new.importHelpersInTsx.js -@@= skipped -22, +22 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; --var tslib_1 = require("tslib"); -+const tslib_1 = require("tslib"); - exports.x = React.createElement("span", tslib_1.__assign({}, o)); - //// [script.js] - var __assign = (this && this.__assign) || function () { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersNoEmitHelpersExportDefault.js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersNoEmitHelpersExportDefault.js.diff index 2eb8da4d08..7935cee152 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersNoEmitHelpersExportDefault.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersNoEmitHelpersExportDefault.js.diff @@ -1,11 +1,8 @@ --- old.importHelpersNoEmitHelpersExportDefault.js +++ new.importHelpersNoEmitHelpersExportDefault.js -@@= skipped -22, +22 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); +@@= skipped -24, +24 lines =@@ exports.A = void 0; --var tslib_1 = require("tslib"); -+const tslib_1 = require("tslib"); + const tslib_1 = require("tslib"); // https://github.com/microsoft/TypeScript/issues/40328 -var other_1 = require("./other"); +const other_1 = require("./other"); @@ -14,8 +11,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; --var tslib_1 = require("tslib"); + const tslib_1 = require("tslib"); -var other_1 = require("./other"); -+const tslib_1 = require("tslib"); +const other_1 = require("./other"); Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(other_1).default; } }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importNotElidedWhenNotFound.js.diff b/testdata/baselines/reference/submodule/compiler/importNotElidedWhenNotFound.js.diff deleted file mode 100644 index a1c8b307f5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/importNotElidedWhenNotFound.js.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.importNotElidedWhenNotFound.js -+++ new.importNotElidedWhenNotFound.js -@@= skipped -24, +24 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var file_1 = __importDefault(require("file")); --var other_file_1 = __importDefault(require("other_file")); -+const file_1 = __importDefault(require("file")); -+const other_file_1 = __importDefault(require("other_file")); - class Y extends other_file_1.default { - constructor() { - super(file_1.default); - } - } --var file2_1 = __importDefault(require("file2")); --var file3_1 = __importDefault(require("file3")); -+const file2_1 = __importDefault(require("file2")); -+const file3_1 = __importDefault(require("file3")); - class Q extends other_file_1.default { - constructor() { - super(file2_1.default, file3_1.default); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js.diff b/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js.diff deleted file mode 100644 index 2bdd49bfaa..0000000000 --- a/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.importShouldNotBeElidedInDeclarationEmit.js -+++ new.importShouldNotBeElidedInDeclarationEmit.js -@@= skipped -16, +16 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.thing = void 0; --var umd_1 = require("umd"); -+const umd_1 = require("umd"); - exports.thing = (0, umd_1.makeThing)(); - diff --git a/testdata/baselines/reference/submodule/compiler/importTypeGenericArrowTypeParenthesized.js.diff b/testdata/baselines/reference/submodule/compiler/importTypeGenericArrowTypeParenthesized.js.diff index e12f973bdb..7dfb52db99 100644 --- a/testdata/baselines/reference/submodule/compiler/importTypeGenericArrowTypeParenthesized.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importTypeGenericArrowTypeParenthesized.js.diff @@ -1,15 +1,6 @@ --- old.importTypeGenericArrowTypeParenthesized.js +++ new.importTypeGenericArrowTypeParenthesized.js -@@= skipped -22, +22 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.works2 = exports.works1 = exports.fail2 = exports.fail1 = void 0; --var module_1 = require("module"); -+const module_1 = require("module"); - exports.fail1 = (0, module_1.fn)((x) => x); - exports.fail2 = (0, module_1.fn)(function (x) { - return x; -@@= skipped -10, +10 lines =@@ +@@= skipped -32, +32 lines =@@ //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/compiler/importUsedInExtendsList1.js.diff b/testdata/baselines/reference/submodule/compiler/importUsedInExtendsList1.js.diff index dbd7527ee1..2dece451dc 100644 --- a/testdata/baselines/reference/submodule/compiler/importUsedInExtendsList1.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importUsedInExtendsList1.js.diff @@ -7,12 +7,4 @@ + foo; } exports.Super = Super; - //// [importUsedInExtendsList1_1.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var foo = require("./importUsedInExtendsList1_require"); -+const foo = require("./importUsedInExtendsList1_require"); - class Sub extends foo.Super { - } - var s; \ No newline at end of file + //// [importUsedInExtendsList1_1.js] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importWithTrailingSlash.js.diff b/testdata/baselines/reference/submodule/compiler/importWithTrailingSlash.js.diff deleted file mode 100644 index 930c371999..0000000000 --- a/testdata/baselines/reference/submodule/compiler/importWithTrailingSlash.js.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.importWithTrailingSlash.js -+++ new.importWithTrailingSlash.js -@@= skipped -32, +32 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var _1 = __importDefault(require(".")); --var _2 = __importDefault(require("./")); -+const _1 = __importDefault(require(".")); -+const _2 = __importDefault(require("./")); - _1.default.a; - _2.default.aIndex; - //// [test.js] -@@= skipped -10, +10 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var __1 = __importDefault(require("..")); --var __2 = __importDefault(require("../")); -+const __1 = __importDefault(require("..")); -+const __2 = __importDefault(require("../")); - __1.default.a; - __2.default.aIndex; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/inferredIndexerOnNamespaceImport.js.diff b/testdata/baselines/reference/submodule/compiler/inferredIndexerOnNamespaceImport.js.diff deleted file mode 100644 index ae812667a8..0000000000 --- a/testdata/baselines/reference/submodule/compiler/inferredIndexerOnNamespaceImport.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.inferredIndexerOnNamespaceImport.js -+++ new.inferredIndexerOnNamespaceImport.js -@@= skipped -54, +54 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var foo = __importStar(require("./foo")); -+const foo = __importStar(require("./foo")); - function f(map) { - // ... - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/inlineMappedTypeModifierDeclarationEmit.js.diff b/testdata/baselines/reference/submodule/compiler/inlineMappedTypeModifierDeclarationEmit.js.diff deleted file mode 100644 index 8a81efd1b8..0000000000 --- a/testdata/baselines/reference/submodule/compiler/inlineMappedTypeModifierDeclarationEmit.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.inlineMappedTypeModifierDeclarationEmit.js -+++ new.inlineMappedTypeModifierDeclarationEmit.js -@@= skipped -50, +50 lines =@@ - exports.processedInternally2 = exports.processedInternally1 = void 0; - exports.wrappedTest1 = wrappedTest1; - exports.wrappedTest2 = wrappedTest2; --var other_1 = require("./other"); -+const other_1 = require("./other"); - function wrappedTest1(obj, k) { - return (0, other_1.test1)(obj, k); - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/instanceAndStaticDeclarations1.js.diff b/testdata/baselines/reference/submodule/compiler/instanceAndStaticDeclarations1.js.diff index 4419386572..8dbbbb87a9 100644 --- a/testdata/baselines/reference/submodule/compiler/instanceAndStaticDeclarations1.js.diff +++ b/testdata/baselines/reference/submodule/compiler/instanceAndStaticDeclarations1.js.diff @@ -1,37 +1,19 @@ --- old.instanceAndStaticDeclarations1.js +++ new.instanceAndStaticDeclarations1.js -@@= skipped -15, +15 lines =@@ - +@@= skipped -16, +16 lines =@@ //// [instanceAndStaticDeclarations1.js] // from spec --let Point = (() => { -- class Point { -- constructor(x, y) { -- this.x = x; -- this.y = y; -- } -- distance(p) { -- var dx = this.x - p.x; -- var dy = this.y - p.y; -- return Math.sqrt(dx * dx + dy * dy); -- } -- static distance(p1, p2) { return p1.distance(p2); } -- } -- Point.origin = new Point(0, 0); -- return Point; --})(); -+class Point { + class Point { + x; + y; -+ constructor(x, y) { -+ this.x = x; -+ this.y = y; -+ } -+ distance(p) { -+ var dx = this.x - p.x; -+ var dy = this.y - p.y; -+ return Math.sqrt(dx * dx + dy * dy); -+ } + constructor(x, y) { + this.x = x; + this.y = y; +@@= skipped -9, +11 lines =@@ + var dy = this.y - p.y; + return Math.sqrt(dx * dx + dy * dy); + } + static origin = new Point(0, 0); -+ static distance(p1, p2) { return p1.distance(p2); } -+} \ No newline at end of file + static distance(p1, p2) { return p1.distance(p2); } + } +-Point.origin = new Point(0, 0); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/intersectionPropertyCheck.js b/testdata/baselines/reference/submodule/compiler/intersectionPropertyCheck.js index 5a649b1f60..74100e2f4b 100644 --- a/testdata/baselines/reference/submodule/compiler/intersectionPropertyCheck.js +++ b/testdata/baselines/reference/submodule/compiler/intersectionPropertyCheck.js @@ -22,22 +22,11 @@ function test(value: T): Test { //// [intersectionPropertyCheck.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; let obj = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property let weak = wrong; // Nested weak object type function foo(x, y) { x = y; // Mismatched property in source intersection } function test(value) { - return __assign(__assign({}, value), { hi: true }); + return Object.assign(Object.assign({}, value), { hi: true }); } diff --git a/testdata/baselines/reference/submodule/compiler/intersectionPropertyCheck.js.diff b/testdata/baselines/reference/submodule/compiler/intersectionPropertyCheck.js.diff index abe516b032..94359d3969 100644 --- a/testdata/baselines/reference/submodule/compiler/intersectionPropertyCheck.js.diff +++ b/testdata/baselines/reference/submodule/compiler/intersectionPropertyCheck.js.diff @@ -5,6 +5,6 @@ //// [intersectionPropertyCheck.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++) { \ No newline at end of file + let obj = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property + let weak = wrong; // Nested weak object type + function foo(x, y) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/invalidStaticField.js.diff b/testdata/baselines/reference/submodule/compiler/invalidStaticField.js.diff index d9767632c3..9dbc8f8609 100644 --- a/testdata/baselines/reference/submodule/compiler/invalidStaticField.js.diff +++ b/testdata/baselines/reference/submodule/compiler/invalidStaticField.js.diff @@ -1,15 +1,9 @@ --- old.invalidStaticField.js +++ new.invalidStaticField.js -@@= skipped -7, +7 lines =@@ - class A { +@@= skipped -8, +8 lines =@@ foo() { return B.NULL; } } --let B = (() => { -- class B { -- } -- B.NOT_NULL = new B(); -- return B; --})(); -+class B { + class B { + static NOT_NULL = new B(); -+} \ No newline at end of file + } +-B.NOT_NULL = new B(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedModulesExportDeclarationType.js.diff b/testdata/baselines/reference/submodule/compiler/isolatedModulesExportDeclarationType.js.diff deleted file mode 100644 index 9d7c080d06..0000000000 --- a/testdata/baselines/reference/submodule/compiler/isolatedModulesExportDeclarationType.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.isolatedModulesExportDeclarationType.js -+++ new.isolatedModulesExportDeclarationType.js -@@= skipped -43, +43 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - // @ts-expect-error --var doesntexist_1 = __importDefault(require("./doesntexist")); -+const doesntexist_1 = __importDefault(require("./doesntexist")); - exports.default = doesntexist_1.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedModulesImportConstEnum.js.diff b/testdata/baselines/reference/submodule/compiler/isolatedModulesImportConstEnum.js.diff deleted file mode 100644 index b8f064d666..0000000000 --- a/testdata/baselines/reference/submodule/compiler/isolatedModulesImportConstEnum.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.isolatedModulesImportConstEnum.js -+++ new.isolatedModulesImportConstEnum.js -@@= skipped -20, +20 lines =@@ - //// [file1.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var file2_1 = require("./file2"); -+const file2_1 = require("./file2"); - console.log(file2_1.Foo.BAR); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedModulesImportExportElision.js.diff b/testdata/baselines/reference/submodule/compiler/isolatedModulesImportExportElision.js.diff index 23c828b364..de3aaece90 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedModulesImportExportElision.js.diff +++ b/testdata/baselines/reference/submodule/compiler/isolatedModulesImportExportElision.js.diff @@ -1,16 +1,6 @@ --- old.isolatedModulesImportExportElision.js +++ new.isolatedModulesImportExportElision.js -@@= skipped -50, +50 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.z = exports.c1 = void 0; --var module_1 = require("module"); --var module_2 = require("module"); --var ns = __importStar(require("module")); -+const module_1 = require("module"); -+const module_2 = require("module"); -+const ns = __importStar(require("module")); - class C extends module_2.c2.C { +@@= skipped -57, +57 lines =@@ } let x = new module_1.c(); let y = ns.value; diff --git a/testdata/baselines/reference/submodule/compiler/isolatedModulesReExportType.js.diff b/testdata/baselines/reference/submodule/compiler/isolatedModulesReExportType.js.diff index 2aeca4fb61..8f5c550e48 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedModulesReExportType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/isolatedModulesReExportType.js.diff @@ -8,6 +8,4 @@ +const exportValue_1 = require("./exportValue"); Object.defineProperty(exports, "C", { enumerable: true, get: function () { return exportValue_1.C; } }); // OK, even though the namespace it exports is only types. --var NS = __importStar(require("./exportT")); -+const NS = __importStar(require("./exportT")); - exports.NS = NS; \ No newline at end of file + const NS = __importStar(require("./exportT")); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/javascriptThisAssignmentInStaticBlock.js.diff b/testdata/baselines/reference/submodule/compiler/javascriptThisAssignmentInStaticBlock.js.diff index daef94d047..21bd9b3f2f 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptThisAssignmentInStaticBlock.js.diff +++ b/testdata/baselines/reference/submodule/compiler/javascriptThisAssignmentInStaticBlock.js.diff @@ -4,7 +4,7 @@ ElementsArray.isArray(new ElementsArray()); //// [a.js] --var _a, _b; +-var _a, _b, _c; class Thing { + static { + this.doSomething = () => { }; @@ -16,7 +16,8 @@ -})(); Thing.doSomething(); // GH#46468 - class ElementsArray extends Array { +-class ElementsArray extends (_c = Array) { ++class ElementsArray extends Array { + static { + const superisArray = super.isArray; + const customIsArray = (arg) => superisArray(arg); @@ -25,7 +26,7 @@ } -_b = ElementsArray; -(() => { -- const superisArray = super.isArray; +- const superisArray = Reflect.get(_c, "isArray", _b); - const customIsArray = (arg) => superisArray(arg); - _b.isArray = customIsArray; -})(); diff --git a/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.js.diff b/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.js.diff deleted file mode 100644 index 280dbab05a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsNoImplicitAnyNoCascadingReferenceErrors.js -+++ new.jsNoImplicitAnyNoCascadingReferenceErrors.js -@@= skipped -17, +17 lines =@@ - //// [index.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var somelib_1 = require("./somelib"); -+const somelib_1 = require("./somelib"); - class MyFoo extends somelib_1.Foo { - constructor() { - super(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsdocInTypeScript.js.diff b/testdata/baselines/reference/submodule/compiler/jsdocInTypeScript.js.diff index 103c5aba5e..fb618d4330 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocInTypeScript.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsdocInTypeScript.js.diff @@ -16,10 +16,4 @@ -var M = N; // Error: @typedef does not create namespaces in TypeScript code. // Not legal JSDoc, but that shouldn't matter in TypeScript. /** - * @type {{foo: (function(string, string): string)}} -@@= skipped -12, +10 lines =@@ - E[""]; - // make sure import types in JSDoc are not resolved - /** @type {import("should-not-be-resolved").Type} */ --var v = Promise.resolve("".concat(String())).then(function (s) { return __importStar(require(s)); }); -+var v = Promise.resolve(`${String()}`).then(s => __importStar(require(s))); \ No newline at end of file + * @type {{foo: (function(string, string): string)}} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsonFileImportChecksCallCorrectlyTwice.js.diff b/testdata/baselines/reference/submodule/compiler/jsonFileImportChecksCallCorrectlyTwice.js.diff deleted file mode 100644 index dd8de95162..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsonFileImportChecksCallCorrectlyTwice.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsonFileImportChecksCallCorrectlyTwice.js -+++ new.jsonFileImportChecksCallCorrectlyTwice.js -@@= skipped -35, +35 lines =@@ - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); --var data_json_1 = __importDefault(require("./data.json")); -+const data_json_1 = __importDefault(require("./data.json")); - fn(data_json_1.default.foo); - fn(data_json_1.default.foo); // <-- shouldn't error! - function fn(arg) { } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxCallElaborationCheckNoCrash1.js.diff b/testdata/baselines/reference/submodule/compiler/jsxCallElaborationCheckNoCrash1.js.diff deleted file mode 100644 index 7cedd68599..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxCallElaborationCheckNoCrash1.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxCallElaborationCheckNoCrash1.js -+++ new.jsxCallElaborationCheckNoCrash1.js -@@= skipped -52, +52 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Hoc = void 0; --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - const Hoc = (TagElement) => { - const Component = () => React.createElement(TagElement, null); - return Component; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff b/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff deleted file mode 100644 index 8e5f62f059..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxChildrenIndividualErrorElaborations.js -+++ new.jsxChildrenIndividualErrorElaborations.js -@@= skipped -117, +117 lines =@@ - exports.Blah2 = Blah2; - exports.Blah3 = Blah3; - /// --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - function Blah(props) { - return React.createElement(React.Fragment, null); - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenSingleChildConfusableWithMultipleChildrenNoError.js.diff b/testdata/baselines/reference/submodule/compiler/jsxChildrenSingleChildConfusableWithMultipleChildrenNoError.js.diff deleted file mode 100644 index 8eedc69562..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenSingleChildConfusableWithMultipleChildrenNoError.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxChildrenSingleChildConfusableWithMultipleChildrenNoError.js -+++ new.jsxChildrenSingleChildConfusableWithMultipleChildrenNoError.js -@@= skipped -63, +63 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.App = void 0; --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - function TabLayout(props) { - return React.createElement("div", null); - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxComplexSignatureHasApplicabilityError.js b/testdata/baselines/reference/submodule/compiler/jsxComplexSignatureHasApplicabilityError.js index f45854f7fc..5881830d2c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxComplexSignatureHasApplicabilityError.js +++ b/testdata/baselines/reference/submodule/compiler/jsxComplexSignatureHasApplicabilityError.js @@ -613,17 +613,6 @@ export interface ReactSelectProps extends React.Props -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -662,7 +651,7 @@ exports.createReactSingleSelect = createReactSingleSelect; const React = __importStar(require("react")); function createReactSingleSelect(WrappedComponent) { return (props) => { - return (React.createElement(ReactSelectClass, __assign({}, props, { multi: false, autosize: false, value: props.value, onChange: (value) => { + return (React.createElement(ReactSelectClass, Object.assign({}, props, { multi: false, autosize: false, value: props.value, onChange: (value) => { if (props.onChange) { props.onChange(value === null ? undefined : value); } diff --git a/testdata/baselines/reference/submodule/compiler/jsxComplexSignatureHasApplicabilityError.js.diff b/testdata/baselines/reference/submodule/compiler/jsxComplexSignatureHasApplicabilityError.js.diff deleted file mode 100644 index 2af1147c64..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxComplexSignatureHasApplicabilityError.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxComplexSignatureHasApplicabilityError.js -+++ new.jsxComplexSignatureHasApplicabilityError.js -@@= skipped -658, +658 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.createReactSingleSelect = createReactSingleSelect; --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - function createReactSingleSelect(WrappedComponent) { - return (props) => { - return (React.createElement(ReactSelectClass, __assign({}, props, { multi: false, autosize: false, value: props.value, onChange: (value) => { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxElementType.js.diff b/testdata/baselines/reference/submodule/compiler/jsxElementType.js.diff index 6e2c151d8f..bb33f9e8b6 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxElementType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxElementType.js.diff @@ -15,11 +15,7 @@ -}; Object.defineProperty(exports, "__esModule", { value: true }); /// --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - let Component; - const RenderElement = ({ title }) => React.createElement("div", null, title); - Component = RenderElement; + const React = __importStar(require("react")); @@= skipped -34, +25 lines =@@ React.createElement(RenderArray, { title: "react" }); React.createElement(RenderArray, { excessProp: true }); diff --git a/testdata/baselines/reference/submodule/compiler/jsxElementTypeLiteral.js.diff b/testdata/baselines/reference/submodule/compiler/jsxElementTypeLiteral.js.diff deleted file mode 100644 index 0f06438602..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxElementTypeLiteral.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxElementTypeLiteral.js -+++ new.jsxElementTypeLiteral.js -@@= skipped -59, +59 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - // should be fine - `ElementType` accepts `div` - let a = React.createElement("div", null); - // should be an error - `ElementType` does not accept `span` \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxElementTypeLiteralWithGeneric.js.diff b/testdata/baselines/reference/submodule/compiler/jsxElementTypeLiteralWithGeneric.js.diff deleted file mode 100644 index 11d529ddee..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxElementTypeLiteralWithGeneric.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxElementTypeLiteralWithGeneric.js -+++ new.jsxElementTypeLiteralWithGeneric.js -@@= skipped -60, +60 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - // should be fine - `ElementType` accepts `div` - let a = React.createElement("div", null); - // Should be an error. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff deleted file mode 100644 index 44160b830f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxEmptyExpressionNotCountedAsChild(jsx=react).js -+++ new.jsxEmptyExpressionNotCountedAsChild(jsx=react).js -@@= skipped -55, +55 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - function Wrapper(props) { - return React.createElement("div", null, props.children); - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react-jsx).js.diff b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react-jsx).js.diff index 345ffbaac1..3d6a980f16 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react-jsx).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react-jsx).js.diff @@ -1,11 +1,8 @@ --- old.jsxEmptyExpressionNotCountedAsChild(jsx=react-jsx).js +++ new.jsxEmptyExpressionNotCountedAsChild(jsx=react-jsx).js -@@= skipped -21, +21 lines =@@ - //// [jsxEmptyExpressionNotCountedAsChild.js] - "use strict"; +@@= skipped -23, +23 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); --var jsx_runtime_1 = require("react/jsx-runtime"); -+const jsx_runtime_1 = require("react/jsx-runtime"); + const jsx_runtime_1 = require("react/jsx-runtime"); function Wrapper(props) { - return (0, jsx_runtime_1.jsx)("div", { children: props.children }); + return jsx_runtime_1.jsx("div", { children: props.children }); diff --git a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react-jsxdev).js.diff b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react-jsxdev).js.diff index 536da522f2..16b1877734 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react-jsxdev).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react-jsxdev).js.diff @@ -1,11 +1,7 @@ --- old.jsxEmptyExpressionNotCountedAsChild(jsx=react-jsxdev).js +++ new.jsxEmptyExpressionNotCountedAsChild(jsx=react-jsxdev).js -@@= skipped -21, +21 lines =@@ - //// [jsxEmptyExpressionNotCountedAsChild.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --var jsx_dev_runtime_1 = require("react/jsx-dev-runtime"); -+const jsx_dev_runtime_1 = require("react/jsx-dev-runtime"); +@@= skipped -24, +24 lines =@@ + const jsx_dev_runtime_1 = require("react/jsx-dev-runtime"); const _jsxFileName = "jsxEmptyExpressionNotCountedAsChild.tsx"; function Wrapper(props) { - return (0, jsx_dev_runtime_1.jsxDEV)("div", { children: props.children }, void 0, false, { fileName: _jsxFileName, lineNumber: 9, columnNumber: 11 }, this); diff --git a/testdata/baselines/reference/submodule/compiler/jsxExcessPropsAndAssignability.js b/testdata/baselines/reference/submodule/compiler/jsxExcessPropsAndAssignability.js index 57e4ea348d..c64a015bd6 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxExcessPropsAndAssignability.js +++ b/testdata/baselines/reference/submodule/compiler/jsxExcessPropsAndAssignability.js @@ -21,17 +21,6 @@ const myHoc = ( //// [jsxExcessPropsAndAssignability.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++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); @@ -70,6 +59,6 @@ const React = __importStar(require("react")); const myHoc = (ComposedComponent) => { const WrapperComponent = null; const props = null; - React.createElement(WrapperComponent, __assign({}, props, { myProp: '1000000' })); - React.createElement(WrapperComponent, __assign({}, props, { myProp: 1000000 })); + React.createElement(WrapperComponent, Object.assign({}, props, { myProp: '1000000' })); + React.createElement(WrapperComponent, Object.assign({}, props, { myProp: 1000000 })); }; diff --git a/testdata/baselines/reference/submodule/compiler/jsxExcessPropsAndAssignability.js.diff b/testdata/baselines/reference/submodule/compiler/jsxExcessPropsAndAssignability.js.diff deleted file mode 100644 index a25369ea1c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxExcessPropsAndAssignability.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxExcessPropsAndAssignability.js -+++ new.jsxExcessPropsAndAssignability.js -@@= skipped -65, +65 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - const myHoc = (ComposedComponent) => { - const WrapperComponent = null; - const props = null; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFragmentAndFactoryUsedOnFragmentUse.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFragmentAndFactoryUsedOnFragmentUse.js.diff deleted file mode 100644 index 931f70d63b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxFragmentAndFactoryUsedOnFragmentUse.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.jsxFragmentAndFactoryUsedOnFragmentUse.js -+++ new.jsxFragmentAndFactoryUsedOnFragmentUse.js -@@= skipped -20, +20 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.a = void 0; --var jsx_1 = require("./jsx"); -+const jsx_1 = require("./jsx"); - exports.a = (0, jsx_1.element)(jsx_1.fragment, null, "fragment text"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff deleted file mode 100644 index 48fafba0da..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxFragmentFactoryNoUnusedLocals.js -+++ new.jsxFragmentFactoryNoUnusedLocals.js -@@= skipped -20, +20 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Counter = Counter; - /// --var react_1 = require("react"); -+const react_1 = require("react"); - function Counter({ count = 0 }) { - const [cnt, setCnt] = null; - return (0, react_1.createElement)(react_1.Fragment, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxHasLiteralType.js.diff b/testdata/baselines/reference/submodule/compiler/jsxHasLiteralType.js.diff deleted file mode 100644 index 6f12c1b34d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxHasLiteralType.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxHasLiteralType.js -+++ new.jsxHasLiteralType.js -@@= skipped -45, +45 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - class MyComponent extends React.Component { - } - const m = React.createElement(MyComponent, { x: "a" }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxImportForSideEffectsNonExtantNoError.js.diff b/testdata/baselines/reference/submodule/compiler/jsxImportForSideEffectsNonExtantNoError.js.diff deleted file mode 100644 index ed3bb5eda2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxImportForSideEffectsNonExtantNoError.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.jsxImportForSideEffectsNonExtantNoError.js -+++ new.jsxImportForSideEffectsNonExtantNoError.js -@@= skipped -45, +45 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - require("./App.css"); // doesn't actually exist - const tag = React.createElement("div", null); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxImportInAttribute.js.diff b/testdata/baselines/reference/submodule/compiler/jsxImportInAttribute.js.diff deleted file mode 100644 index 977942d0f5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxImportInAttribute.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.jsxImportInAttribute.js -+++ new.jsxImportInAttribute.js -@@= skipped -19, +19 lines =@@ - }; - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var Test_1 = __importDefault(require("Test")); -+const Test_1 = __importDefault(require("Test")); - let x = Test_1.default; // emit test_1.default - ; // ? \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxImportSourceNonPragmaComment.js.diff b/testdata/baselines/reference/submodule/compiler/jsxImportSourceNonPragmaComment.js.diff deleted file mode 100644 index 4ba41a3fec..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxImportSourceNonPragmaComment.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxImportSourceNonPragmaComment.js -+++ new.jsxImportSourceNonPragmaComment.js -@@= skipped -20, +20 lines =@@ - exports.default = Component; - /* eslint-disable react/react-in-jsx-scope -- Unaware of @jsxImportSource */ - /** @jsxImportSource @emotion/react */ --var react_1 = require("@emotion/react"); -+const react_1 = require("@emotion/react"); - function Component() { - return ( --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - function SomeComponent(props) { - // Just so the return value is RectElement, the rendered element doesnt matter - return React.createElement("div", null); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxIntrinsicElementsTypeArgumentErrors.js.diff b/testdata/baselines/reference/submodule/compiler/jsxIntrinsicElementsTypeArgumentErrors.js.diff deleted file mode 100644 index 68d8307b5c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxIntrinsicElementsTypeArgumentErrors.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxIntrinsicElementsTypeArgumentErrors.js -+++ new.jsxIntrinsicElementsTypeArgumentErrors.js -@@= skipped -67, +67 lines =@@ - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - /// --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - // opening + closing - const a = React.createElement("div", null); // empty type args - const b = React.createElement("div", null); // trailing comma type args \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxIntrinsicUnions.js.diff b/testdata/baselines/reference/submodule/compiler/jsxIntrinsicUnions.js.diff deleted file mode 100644 index c54225d8e3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxIntrinsicUnions.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.jsxIntrinsicUnions.js -+++ new.jsxIntrinsicUnions.js -@@= skipped -46, +46 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - const El = Math.random() ? 'h1' : 'h2'; - const tag = React.createElement(El, { className: "ok", key: "key" }, "Title"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.js.diff b/testdata/baselines/reference/submodule/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.js.diff deleted file mode 100644 index e022900882..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxIssuesErrorWhenTagExpectsTooManyArguments.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxIssuesErrorWhenTagExpectsTooManyArguments.js -+++ new.jsxIssuesErrorWhenTagExpectsTooManyArguments.js -@@= skipped -62, +62 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var React = __importStar(require("react")); -+const React = __importStar(require("react")); - function MyComp4(props, context, bad, verybad) { - return React.createElement("div", null); - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsx).js.diff b/testdata/baselines/reference/submodule/compiler/jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsx).js.diff index 6196964fdf..b634c12a86 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsx).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsx).js.diff @@ -1,15 +1,13 @@ --- old.jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsx).js +++ new.jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsx).js -@@= skipped -33, +33 lines =@@ - //// [test.js] +@@= skipped -34, +34 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); --var jsx_runtime_1 = require("/jsx/jsx-runtime"); + const jsx_runtime_1 = require("/jsx/jsx-runtime"); -const Title = (props) => (0, jsx_runtime_1.jsx)("h1", { children: props.children }); -(0, jsx_runtime_1.jsx)(Title, { children: "Hello, world!" }); -const Wrong = (props) => (0, jsx_runtime_1.jsx)("h1", { children: props.offspring }); -(0, jsx_runtime_1.jsx)(Wrong, { children: "Byebye, world!" }); -+const jsx_runtime_1 = require("/jsx/jsx-runtime"); +const Title = (props) => jsx_runtime_1.jsx("h1", { children: props.children }); +jsx_runtime_1.jsx(Title, { children: "Hello, world!" }); +const Wrong = (props) => jsx_runtime_1.jsx("h1", { children: props.offspring }); diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsxdev).js.diff b/testdata/baselines/reference/submodule/compiler/jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsxdev).js.diff index aef716b7f0..64ccffb3f2 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsxdev).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsxdev).js.diff @@ -1,11 +1,8 @@ --- old.jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsxdev).js +++ new.jsxNamespaceElementChildrenAttributeIgnoredWhenReactJsx(jsx=react-jsxdev).js -@@= skipped -33, +33 lines =@@ - //// [test.js] - "use strict"; +@@= skipped -35, +35 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); --var jsx_dev_runtime_1 = require("/jsx/jsx-dev-runtime"); -+const jsx_dev_runtime_1 = require("/jsx/jsx-dev-runtime"); + const jsx_dev_runtime_1 = require("/jsx/jsx-dev-runtime"); const _jsxFileName = "/test.tsx"; -const Title = (props) => (0, jsx_dev_runtime_1.jsxDEV)("h1", { children: props.children }, void 0, false, { fileName: _jsxFileName, lineNumber: 1, columnNumber: 47 }, this); -(0, jsx_dev_runtime_1.jsxDEV)(Title, { children: "Hello, world!" }, void 0, false, { fileName: _jsxFileName, lineNumber: 1, columnNumber: 74 }, this); diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespaceGlobalReexport.js.diff b/testdata/baselines/reference/submodule/compiler/jsxNamespaceGlobalReexport.js.diff index 86a236decb..c66d601acc 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespaceGlobalReexport.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxNamespaceGlobalReexport.js.diff @@ -1,11 +1,9 @@ --- old.jsxNamespaceGlobalReexport.js +++ new.jsxNamespaceGlobalReexport.js -@@= skipped -108, +108 lines =@@ - "use strict"; +@@= skipped -109, +109 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Comp = void 0; --var jsx_runtime_1 = require("preact/jsx-runtime"); + const jsx_runtime_1 = require("preact/jsx-runtime"); -const Comp = () => (0, jsx_runtime_1.jsx)("div", {}); -+const jsx_runtime_1 = require("preact/jsx-runtime"); +const Comp = () => jsx_runtime_1.jsx("div", {}); exports.Comp = Comp; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespaceGlobalReexportMissingAliasTarget.js.diff b/testdata/baselines/reference/submodule/compiler/jsxNamespaceGlobalReexportMissingAliasTarget.js.diff index c52ffb7cb8..1e810b4adb 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespaceGlobalReexportMissingAliasTarget.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxNamespaceGlobalReexportMissingAliasTarget.js.diff @@ -1,11 +1,9 @@ --- old.jsxNamespaceGlobalReexportMissingAliasTarget.js +++ new.jsxNamespaceGlobalReexportMissingAliasTarget.js -@@= skipped -104, +104 lines =@@ - "use strict"; +@@= skipped -105, +105 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Comp = void 0; --var jsx_runtime_1 = require("preact/jsx-runtime"); + const jsx_runtime_1 = require("preact/jsx-runtime"); -const Comp = () => (0, jsx_runtime_1.jsx)("div", {}); -+const jsx_runtime_1 = require("preact/jsx-runtime"); +const Comp = () => jsx_runtime_1.jsx("div", {}); exports.Comp = Comp; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespace.js.diff b/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespace.js.diff index 94896cadcc..ae5f34a376 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespace.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespace.js.diff @@ -1,11 +1,9 @@ --- old.jsxNamespaceImplicitImportJSXNamespace.js +++ new.jsxNamespaceImplicitImportJSXNamespace.js -@@= skipped -104, +104 lines =@@ - "use strict"; +@@= skipped -105, +105 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Comp = void 0; --var jsx_runtime_1 = require("preact/jsx-runtime"); + const jsx_runtime_1 = require("preact/jsx-runtime"); -const Comp = () => (0, jsx_runtime_1.jsx)("div", {}); -+const jsx_runtime_1 = require("preact/jsx-runtime"); +const Comp = () => jsx_runtime_1.jsx("div", {}); exports.Comp = Comp; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespaceFromConfigPickedOverGlobalOne(jsx=react-jsx).js.diff b/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespaceFromConfigPickedOverGlobalOne(jsx=react-jsx).js.diff index 50c71fe543..881b74c41a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespaceFromConfigPickedOverGlobalOne(jsx=react-jsx).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespaceFromConfigPickedOverGlobalOne(jsx=react-jsx).js.diff @@ -1,11 +1,9 @@ --- old.jsxNamespaceImplicitImportJSXNamespaceFromConfigPickedOverGlobalOne(jsx=react-jsx).js +++ new.jsxNamespaceImplicitImportJSXNamespaceFromConfigPickedOverGlobalOne(jsx=react-jsx).js -@@= skipped -67, +67 lines =@@ - "use strict"; +@@= skipped -68, +68 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Comp = void 0; --var jsx_runtime_1 = require("@emotion/react/jsx-runtime"); + const jsx_runtime_1 = require("@emotion/react/jsx-runtime"); -const Comp = () => (0, jsx_runtime_1.jsx)("div", { css: "color: hotpink;" }); -+const jsx_runtime_1 = require("@emotion/react/jsx-runtime"); +const Comp = () => jsx_runtime_1.jsx("div", { css: "color: hotpink;" }); exports.Comp = Comp; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespaceFromPragmaPickedOverGlobalOne.js.diff b/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespaceFromPragmaPickedOverGlobalOne.js.diff index 50f2558812..6bc104b0a4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespaceFromPragmaPickedOverGlobalOne.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxNamespaceImplicitImportJSXNamespaceFromPragmaPickedOverGlobalOne.js.diff @@ -1,11 +1,8 @@ --- old.jsxNamespaceImplicitImportJSXNamespaceFromPragmaPickedOverGlobalOne.js +++ new.jsxNamespaceImplicitImportJSXNamespaceFromPragmaPickedOverGlobalOne.js -@@= skipped -68, +68 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); +@@= skipped -70, +70 lines =@@ exports.Comp = void 0; --var jsx_runtime_1 = require("@emotion/react/jsx-runtime"); -+const jsx_runtime_1 = require("@emotion/react/jsx-runtime"); + const jsx_runtime_1 = require("@emotion/react/jsx-runtime"); /* @jsxImportSource @emotion/react */ -const Comp = () => (0, jsx_runtime_1.jsx)("div", { css: "color: hotpink;" }); +const Comp = () => jsx_runtime_1.jsx("div", { css: "color: hotpink;" }); diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsx).js.diff b/testdata/baselines/reference/submodule/compiler/jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsx).js.diff index 06c32b4f64..262f674887 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsx).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsx).js.diff @@ -1,13 +1,11 @@ --- old.jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsx).js +++ new.jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsx).js -@@= skipped -24, +24 lines =@@ - //// [test.js] +@@= skipped -25, +25 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); --var jsx_runtime_1 = require("/jsx/jsx-runtime"); + const jsx_runtime_1 = require("/jsx/jsx-runtime"); -const Title = (props) => (0, jsx_runtime_1.jsx)("h1", { children: props.children }); -const element = (0, jsx_runtime_1.jsx)(Title, { children: "Hello, world!" }); -+const jsx_runtime_1 = require("/jsx/jsx-runtime"); +const Title = (props) => jsx_runtime_1.jsx("h1", { children: props.children }); +const element = jsx_runtime_1.jsx(Title, { children: "Hello, world!" }); //// [jsx-dev-runtime.js] diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsxdev).js.diff b/testdata/baselines/reference/submodule/compiler/jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsxdev).js.diff index 40af9ba871..756aa357b1 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsxdev).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsxdev).js.diff @@ -1,11 +1,8 @@ --- old.jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsxdev).js +++ new.jsxNamespaceNoElementChildrenAttributeReactJsx(jsx=react-jsxdev).js -@@= skipped -24, +24 lines =@@ - //// [test.js] - "use strict"; +@@= skipped -26, +26 lines =@@ Object.defineProperty(exports, "__esModule", { value: true }); --var jsx_dev_runtime_1 = require("/jsx/jsx-dev-runtime"); -+const jsx_dev_runtime_1 = require("/jsx/jsx-dev-runtime"); + const jsx_dev_runtime_1 = require("/jsx/jsx-dev-runtime"); const _jsxFileName = "/test.tsx"; -const Title = (props) => (0, jsx_dev_runtime_1.jsxDEV)("h1", { children: props.children }, void 0, false, { fileName: _jsxFileName, lineNumber: 1, columnNumber: 47 }, this); -const element = (0, jsx_dev_runtime_1.jsxDEV)(Title, { children: "Hello, world!" }, void 0, false, { fileName: _jsxFileName, lineNumber: 3, columnNumber: 16 }, this); diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespacePrefixInNameReact.js b/testdata/baselines/reference/submodule/compiler/jsxNamespacePrefixInNameReact.js index 71d7334c9a..ddf6313cff 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespacePrefixInNameReact.js +++ b/testdata/baselines/reference/submodule/compiler/jsxNamespacePrefixInNameReact.js @@ -34,17 +34,6 @@ var upcaseComponent2 = ; // Parsed as instrinsic //// [jsxNamespacePrefixInNameReact.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; var justElement1 = React.createElement("a:element", null); var justElement2 = React.createElement("a:element", null); var justElement3 = React.createElement("a:element", { attr: "value" }); @@ -65,9 +54,9 @@ var justAttribute3 = React.createElement("element", { "a:attr": "value" }, "text var both1 = React.createElement("a:element", { "a:attr": "value" }); var both2 = React.createElement("a:element", { "k:attr": "value" }); var both3 = React.createElement("a:element", { "a:attr": "value" }, "text"); -var endOfIdent1 = React.createElement("a:attr", __assign({}, "value")); +var endOfIdent1 = React.createElement("a:attr", Object.assign({}, "value")); var endOfIdent2 = React.createElement("a", { "attr:": "value" }); var beginOfIdent1 = < , a, attr = { "value": } / > ; -var beginOfIdent2 = React.createElement("a:attr", __assign({}, "value")); +var beginOfIdent2 = React.createElement("a:attr", Object.assign({}, "value")); var upcaseComponent1 = React.createElement("ns:Upcase", null); // Parsed as intrinsic var upcaseComponent2 = React.createElement("Upcase:element", null); // Parsed as instrinsic diff --git a/testdata/baselines/reference/submodule/compiler/jsxNamespaceReexports.js.diff b/testdata/baselines/reference/submodule/compiler/jsxNamespaceReexports.js.diff deleted file mode 100644 index 805e5e0081..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxNamespaceReexports.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.jsxNamespaceReexports.js -+++ new.jsxNamespaceReexports.js -@@= skipped -55, +55 lines =@@ - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); --var MyLib = __importStar(require("./library")); -+const MyLib = __importStar(require("./library")); - const content = MyLib.createElement("my-element", null); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxPartialSpread.js.diff b/testdata/baselines/reference/submodule/compiler/jsxPartialSpread.js.diff deleted file mode 100644 index 36644f33cb..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxPartialSpread.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.jsxPartialSpread.js -+++ new.jsxPartialSpread.js -@@= skipped -19, +19 lines =@@ - exports.Repro = Repro; - /// - const Select = (p) =>

; --var react_1 = __importDefault(require("react")); -+const react_1 = __importDefault(require("react")); - function Repro({ SelectProps = {} }) { - return (