From 1ee5e332a82ce521677ea669b3331c014cb2f774 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Nov 2025 21:50:24 +0000 Subject: [PATCH 1/2] deps(deps): bump microsoft/typescript-go from `c9d2894` to `7cf22f6` Bumps [microsoft/typescript-go](https://github.com/microsoft/typescript-go) from `c9d2894` to `7cf22f6`. - [Commits](https://github.com/microsoft/typescript-go/compare/c9d2894de3820f0ca814a7b445d14b551e80e549...7cf22f66ba7489920686d27951a48bbac3cb6e9a) --- updated-dependencies: - dependency-name: microsoft/typescript-go dependency-version: 7cf22f66ba7489920686d27951a48bbac3cb6e9a dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- microsoft/typescript-go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/typescript-go b/microsoft/typescript-go index c9d2894d..7cf22f66 160000 --- a/microsoft/typescript-go +++ b/microsoft/typescript-go @@ -1 +1 @@ -Subproject commit c9d2894de3820f0ca814a7b445d14b551e80e549 +Subproject commit 7cf22f66ba7489920686d27951a48bbac3cb6e9a From a0c9cf27b6faf18f6bbea9e570d1439d03a21178 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Nov 2025 10:26:14 +0800 Subject: [PATCH 2/2] chore(sync): mirror internal packages into pkg/ (auto) (#21) Co-authored-by: buke <1013738+buke@users.noreply.github.com> --- pkg/ast/ast.go | 4 +- pkg/ast/kind.go | 1 - pkg/ast/kind_stringer_generated.go | 99 +++++++++---------- pkg/binder/binder.go | 28 ++++-- pkg/checker/checker.go | 60 +++++++++-- pkg/checker/grammarchecks.go | 4 +- pkg/checker/nodebuilderimpl.go | 8 -- pkg/evaluator/evaluator.go | 2 - pkg/execute/tsc.go | 1 - pkg/fourslash/_scripts/failingTests.txt | 1 - .../gen/javascriptModulesTypeImport_test.go | 2 +- pkg/outputpaths/outputpaths.go | 1 - pkg/parser/parser.go | 9 +- pkg/printer/printer.go | 3 - pkg/transformers/declarations/transform.go | 14 +-- .../typedefModuleExportsIndirect1.js | 64 ++++++++++++ .../typedefModuleExportsIndirect1.symbols | 19 ++++ .../typedefModuleExportsIndirect1.types | 21 ++++ .../typedefModuleExportsIndirect2.js | 64 ++++++++++++ .../typedefModuleExportsIndirect2.symbols | 19 ++++ .../typedefModuleExportsIndirect2.types | 21 ++++ .../typedefModuleExportsIndirect3.js | 64 ++++++++++++ .../typedefModuleExportsIndirect3.symbols | 19 ++++ .../typedefModuleExportsIndirect3.types | 21 ++++ .../findAllRefsImportType.baseline.jsonc | 6 +- ...ndAllRefsTypedef_importType.baseline.jsonc | 7 +- ...eckJsTypeDefNoUnusedLocalMarked.errors.txt | 21 ---- ...TypeDefNoUnusedLocalMarked.errors.txt.diff | 25 ----- ...xpandoFunctionContextualTypesJs.errors.txt | 61 ------------ ...oFunctionContextualTypesJs.errors.txt.diff | 65 ------------ ...unctionWithExtraTypedefsMembers.errors.txt | 5 +- ...onWithExtraTypedefsMembers.errors.txt.diff | 5 +- ...opertyCheckFromContainedLiteral.errors.txt | 45 --------- ...yCheckFromContainedLiteral.errors.txt.diff | 49 --------- .../callbackCrossModule.errors.txt | 28 ------ .../callbackCrossModule.errors.txt.diff | 32 ------ .../conformance/callbackCrossModule.types | 6 +- .../callbackCrossModule.types.diff | 17 +--- .../emitModuleCommonJS(module=nodenext).js | 1 - ...mitModuleCommonJS(module=nodenext).js.diff | 10 -- ...ctionClassesCjsExportAssignment.errors.txt | 13 +-- ...ClassesCjsExportAssignment.errors.txt.diff | 13 +-- ...tionsFunctionClassesCjsExportAssignment.js | 2 +- ...FunctionClassesCjsExportAssignment.js.diff | 2 +- ...nsFunctionClassesCjsExportAssignment.types | 30 +++--- ...ctionClassesCjsExportAssignment.types.diff | 33 +++---- ...arationsFunctionPrototypeStatic.errors.txt | 19 ---- ...onsFunctionPrototypeStatic.errors.txt.diff | 23 ----- .../jsDeclarationsFunctionPrototypeStatic.js | 27 +++++ ...eclarationsFunctionPrototypeStatic.js.diff | 29 +++++- ...tAliasExposedWithinNamespaceCjs.errors.txt | 5 +- ...sExposedWithinNamespaceCjs.errors.txt.diff | 5 +- .../jsDeclarationsTypeAliases.errors.txt | 58 ----------- .../jsDeclarationsTypeAliases.errors.txt.diff | 62 ------------ .../conformance/jsDeclarationsTypeAliases.js | 65 ++++++++++++ .../jsDeclarationsTypeAliases.js.diff | 67 ++++++++++++- ...clarationsTypedefAndImportTypes.errors.txt | 46 --------- ...tionsTypedefAndImportTypes.errors.txt.diff | 50 ---------- .../jsDeclarationsTypedefAndImportTypes.js | 42 ++++++++ ...sDeclarationsTypedefAndImportTypes.js.diff | 44 ++++++++- .../jsDeclarationsTypedefAndImportTypes.types | 4 +- ...clarationsTypedefAndImportTypes.types.diff | 12 +-- ...DeclarationsTypedefAndLatebound.errors.txt | 28 ------ ...rationsTypedefAndLatebound.errors.txt.diff | 32 ------ ...edefPropertyAndExportAssignment.errors.txt | 18 +--- ...ropertyAndExportAssignment.errors.txt.diff | 18 +--- ...nsTypedefPropertyAndExportAssignment.types | 2 +- ...edefPropertyAndExportAssignment.types.diff | 12 +-- ...erenceToImportOfClassExpression.errors.txt | 37 ------- ...eToImportOfClassExpression.errors.txt.diff | 41 -------- ...nceToImportOfFunctionExpression.errors.txt | 14 +-- ...ImportOfFunctionExpression.errors.txt.diff | 14 +-- .../moduleExportAssignment7.errors.txt | 22 +---- .../moduleExportAssignment7.errors.txt.diff | 59 ++--------- .../moduleExportAssignment7.symbols | 1 + .../moduleExportAssignment7.symbols.diff | 10 +- .../conformance/moduleExportAssignment7.types | 16 +-- .../moduleExportAssignment7.types.diff | 42 ++------ ...AllowJsCjsFromJs(module=node16).errors.txt | 10 -- ...JsCjsFromJs(module=node16).errors.txt.diff | 14 --- ...lesAllowJsCjsFromJs(module=node16).symbols | 2 + ...lowJsCjsFromJs(module=node16).symbols.diff | 9 +- ...dulesAllowJsCjsFromJs(module=node16).types | 8 +- ...AllowJsCjsFromJs(module=node16).types.diff | 16 --- ...AllowJsCjsFromJs(module=node18).errors.txt | 10 -- ...JsCjsFromJs(module=node18).errors.txt.diff | 14 --- ...lesAllowJsCjsFromJs(module=node18).symbols | 2 + ...lowJsCjsFromJs(module=node18).symbols.diff | 9 +- ...dulesAllowJsCjsFromJs(module=node18).types | 8 +- ...AllowJsCjsFromJs(module=node18).types.diff | 16 --- ...AllowJsCjsFromJs(module=node20).errors.txt | 10 -- ...JsCjsFromJs(module=node20).errors.txt.diff | 14 --- ...lesAllowJsCjsFromJs(module=node20).symbols | 2 + ...lowJsCjsFromJs(module=node20).symbols.diff | 9 +- ...dulesAllowJsCjsFromJs(module=node20).types | 8 +- ...AllowJsCjsFromJs(module=node20).types.diff | 16 --- ...lowJsCjsFromJs(module=nodenext).errors.txt | 10 -- ...CjsFromJs(module=nodenext).errors.txt.diff | 14 --- ...sAllowJsCjsFromJs(module=nodenext).symbols | 2 + ...wJsCjsFromJs(module=nodenext).symbols.diff | 9 +- ...lesAllowJsCjsFromJs(module=nodenext).types | 8 +- ...lowJsCjsFromJs(module=nodenext).types.diff | 16 --- ...eModulesCJSEmit1(module=node18).errors.txt | 5 +- ...lesCJSEmit1(module=node18).errors.txt.diff | 14 +-- ...eModulesCJSEmit1(module=node20).errors.txt | 5 +- ...lesCJSEmit1(module=node20).errors.txt.diff | 14 +-- ...odulesCJSEmit1(module=nodenext).errors.txt | 5 +- ...sCJSEmit1(module=nodenext).errors.txt.diff | 14 +-- ...verrideModeError(module=node16).errors.txt | 5 +- ...deModeError(module=node16).errors.txt.diff | 10 +- ...verrideModeError(module=node18).errors.txt | 5 +- ...deModeError(module=node18).errors.txt.diff | 10 +- ...verrideModeError(module=node20).errors.txt | 5 +- ...deModeError(module=node20).errors.txt.diff | 10 +- ...rrideModeError(module=nodenext).errors.txt | 5 +- ...ModeError(module=nodenext).errors.txt.diff | 10 +- .../conformance/typedefCrossModule.errors.txt | 50 ---------- .../typedefCrossModule.errors.txt.diff | 54 ---------- .../conformance/typedefCrossModule.types | 12 +-- .../conformance/typedefCrossModule.types.diff | 30 +----- .../typedefCrossModule2.errors.txt | 13 +-- .../typedefCrossModule2.errors.txt.diff | 19 +--- .../conformance/typedefCrossModule2.symbols | 4 + .../typedefCrossModule2.symbols.diff | 6 +- .../conformance/typedefCrossModule2.types | 10 +- .../typedefCrossModule2.types.diff | 21 ++-- .../typedefCrossModule3.errors.txt | 12 --- .../typedefCrossModule3.errors.txt.diff | 19 ++-- .../typedefCrossModule4.errors.txt | 11 --- .../typedefCrossModule4.errors.txt.diff | 17 ++-- ...based-projects-and-emits-them-correctly.js | 26 +---- .../salsa/typedefModuleExportsIndirect1.ts | 12 +++ .../salsa/typedefModuleExportsIndirect2.ts | 12 +++ .../salsa/typedefModuleExportsIndirect3.ts | 12 +++ 134 files changed, 973 insertions(+), 1669 deletions(-) create mode 100644 testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.js create mode 100644 testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.symbols create mode 100644 testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.types create mode 100644 testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.js create mode 100644 testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.symbols create mode 100644 testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.types create mode 100644 testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.js create mode 100644 testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.symbols create mode 100644 testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.types delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/emitModuleCommonJS(module=nodenext).js.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).types.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt create mode 100644 testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect1.ts create mode 100644 testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect2.ts create mode 100644 testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect3.ts diff --git a/pkg/ast/ast.go b/pkg/ast/ast.go index af2637e2..ab57bc32 100644 --- a/pkg/ast/ast.go +++ b/pkg/ast/ast.go @@ -10757,7 +10757,9 @@ type SourceFile struct { NodeCount int TextCount int CommonJSModuleIndicator *Node - ExternalModuleIndicator *Node + // If this is the SourceFile itself, then this module was "forced" + // to be an external module (previously "true"). + ExternalModuleIndicator *Node // Fields set by binder diff --git a/pkg/ast/kind.go b/pkg/ast/kind.go index c1cc5060..d2af8eaf 100644 --- a/pkg/ast/kind.go +++ b/pkg/ast/kind.go @@ -339,7 +339,6 @@ const ( KindEnumMember // Top-level nodes KindSourceFile - KindBundle // JSDoc nodes KindJSDocTypeExpression KindJSDocNameReference diff --git a/pkg/ast/kind_stringer_generated.go b/pkg/ast/kind_stringer_generated.go index 92fe343a..3430cc2c 100644 --- a/pkg/ast/kind_stringer_generated.go +++ b/pkg/ast/kind_stringer_generated.go @@ -316,59 +316,58 @@ func _() { _ = x[KindSpreadAssignment-305] _ = x[KindEnumMember-306] _ = x[KindSourceFile-307] - _ = x[KindBundle-308] - _ = x[KindJSDocTypeExpression-309] - _ = x[KindJSDocNameReference-310] - _ = x[KindJSDocMemberName-311] - _ = x[KindJSDocAllType-312] - _ = x[KindJSDocNullableType-313] - _ = x[KindJSDocNonNullableType-314] - _ = x[KindJSDocOptionalType-315] - _ = x[KindJSDocVariadicType-316] - _ = x[KindJSDoc-317] - _ = x[KindJSDocText-318] - _ = x[KindJSDocTypeLiteral-319] - _ = x[KindJSDocSignature-320] - _ = x[KindJSDocLink-321] - _ = x[KindJSDocLinkCode-322] - _ = x[KindJSDocLinkPlain-323] - _ = x[KindJSDocTag-324] - _ = x[KindJSDocAugmentsTag-325] - _ = x[KindJSDocImplementsTag-326] - _ = x[KindJSDocDeprecatedTag-327] - _ = x[KindJSDocPublicTag-328] - _ = x[KindJSDocPrivateTag-329] - _ = x[KindJSDocProtectedTag-330] - _ = x[KindJSDocReadonlyTag-331] - _ = x[KindJSDocOverrideTag-332] - _ = x[KindJSDocCallbackTag-333] - _ = x[KindJSDocOverloadTag-334] - _ = x[KindJSDocParameterTag-335] - _ = x[KindJSDocReturnTag-336] - _ = x[KindJSDocThisTag-337] - _ = x[KindJSDocTypeTag-338] - _ = x[KindJSDocTemplateTag-339] - _ = x[KindJSDocTypedefTag-340] - _ = x[KindJSDocSeeTag-341] - _ = x[KindJSDocPropertyTag-342] - _ = x[KindJSDocSatisfiesTag-343] - _ = x[KindJSDocImportTag-344] - _ = x[KindSyntaxList-345] - _ = x[KindJSTypeAliasDeclaration-346] - _ = x[KindJSExportAssignment-347] - _ = x[KindCommonJSExport-348] - _ = x[KindJSImportDeclaration-349] - _ = x[KindNotEmittedStatement-350] - _ = x[KindPartiallyEmittedExpression-351] - _ = x[KindCommaListExpression-352] - _ = x[KindSyntheticReferenceExpression-353] - _ = x[KindNotEmittedTypeElement-354] - _ = x[KindCount-355] + _ = x[KindJSDocTypeExpression-308] + _ = x[KindJSDocNameReference-309] + _ = x[KindJSDocMemberName-310] + _ = x[KindJSDocAllType-311] + _ = x[KindJSDocNullableType-312] + _ = x[KindJSDocNonNullableType-313] + _ = x[KindJSDocOptionalType-314] + _ = x[KindJSDocVariadicType-315] + _ = x[KindJSDoc-316] + _ = x[KindJSDocText-317] + _ = x[KindJSDocTypeLiteral-318] + _ = x[KindJSDocSignature-319] + _ = x[KindJSDocLink-320] + _ = x[KindJSDocLinkCode-321] + _ = x[KindJSDocLinkPlain-322] + _ = x[KindJSDocTag-323] + _ = x[KindJSDocAugmentsTag-324] + _ = x[KindJSDocImplementsTag-325] + _ = x[KindJSDocDeprecatedTag-326] + _ = x[KindJSDocPublicTag-327] + _ = x[KindJSDocPrivateTag-328] + _ = x[KindJSDocProtectedTag-329] + _ = x[KindJSDocReadonlyTag-330] + _ = x[KindJSDocOverrideTag-331] + _ = x[KindJSDocCallbackTag-332] + _ = x[KindJSDocOverloadTag-333] + _ = x[KindJSDocParameterTag-334] + _ = x[KindJSDocReturnTag-335] + _ = x[KindJSDocThisTag-336] + _ = x[KindJSDocTypeTag-337] + _ = x[KindJSDocTemplateTag-338] + _ = x[KindJSDocTypedefTag-339] + _ = x[KindJSDocSeeTag-340] + _ = x[KindJSDocPropertyTag-341] + _ = x[KindJSDocSatisfiesTag-342] + _ = x[KindJSDocImportTag-343] + _ = x[KindSyntaxList-344] + _ = x[KindJSTypeAliasDeclaration-345] + _ = x[KindJSExportAssignment-346] + _ = x[KindCommonJSExport-347] + _ = x[KindJSImportDeclaration-348] + _ = x[KindNotEmittedStatement-349] + _ = x[KindPartiallyEmittedExpression-350] + _ = x[KindCommaListExpression-351] + _ = x[KindSyntheticReferenceExpression-352] + _ = x[KindNotEmittedTypeElement-353] + _ = x[KindCount-354] } -const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindDeferKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeAliasDeclarationKindJSExportAssignmentKindCommonJSExportKindJSImportDeclarationKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindNotEmittedTypeElementKindCount" +const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindDeferKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeAliasDeclarationKindJSExportAssignmentKindCommonJSExportKindJSImportDeclarationKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindNotEmittedTypeElementKindCount" -var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3140, 3157, 3181, 3198, 3211, 3224, 3245, 3268, 3287, 3308, 3339, 3354, 3369, 3384, 3401, 3423, 3441, 3458, 3475, 3491, 3510, 3523, 3538, 3551, 3564, 3580, 3592, 3605, 3625, 3644, 3657, 3678, 3690, 3706, 3727, 3741, 3756, 3776, 3799, 3826, 3840, 3864, 3887, 3905, 3931, 3958, 3986, 4013, 4031, 4048, 4076, 4103, 4130, 4152, 4169, 4189, 4209, 4227, 4246, 4271, 4297, 4317, 4342, 4364, 4383, 4400, 4419, 4440, 4471, 4487, 4508, 4524, 4547, 4570, 4586, 4611, 4620, 4638, 4659, 4682, 4697, 4712, 4730, 4746, 4764, 4782, 4803, 4821, 4840, 4857, 4876, 4896, 4914, 4930, 4951, 4974, 5001, 5024, 5044, 5068, 5092, 5111, 5132, 5147, 5160, 5190, 5217, 5238, 5254, 5273, 5289, 5308, 5328, 5349, 5365, 5384, 5403, 5425, 5452, 5466, 5491, 5512, 5533, 5548, 5570, 5592, 5608, 5625, 5647, 5664, 5685, 5699, 5716, 5734, 5749, 5769, 5788, 5810, 5841, 5861, 5875, 5889, 5899, 5922, 5944, 5963, 5979, 6000, 6024, 6045, 6066, 6075, 6088, 6108, 6126, 6139, 6156, 6174, 6186, 6206, 6228, 6250, 6268, 6287, 6308, 6328, 6348, 6368, 6388, 6409, 6427, 6443, 6459, 6479, 6498, 6513, 6533, 6554, 6572, 6586, 6612, 6634, 6652, 6675, 6698, 6728, 6751, 6783, 6808, 6817} +var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3140, 3157, 3181, 3198, 3211, 3224, 3245, 3268, 3287, 3308, 3339, 3354, 3369, 3384, 3401, 3423, 3441, 3458, 3475, 3491, 3510, 3523, 3538, 3551, 3564, 3580, 3592, 3605, 3625, 3644, 3657, 3678, 3690, 3706, 3727, 3741, 3756, 3776, 3799, 3826, 3840, 3864, 3887, 3905, 3931, 3958, 3986, 4013, 4031, 4048, 4076, 4103, 4130, 4152, 4169, 4189, 4209, 4227, 4246, 4271, 4297, 4317, 4342, 4364, 4383, 4400, 4419, 4440, 4471, 4487, 4508, 4524, 4547, 4570, 4586, 4611, 4620, 4638, 4659, 4682, 4697, 4712, 4730, 4746, 4764, 4782, 4803, 4821, 4840, 4857, 4876, 4896, 4914, 4930, 4951, 4974, 5001, 5024, 5044, 5068, 5092, 5111, 5132, 5147, 5160, 5190, 5217, 5238, 5254, 5273, 5289, 5308, 5328, 5349, 5365, 5384, 5403, 5425, 5452, 5466, 5491, 5512, 5533, 5548, 5570, 5592, 5608, 5625, 5647, 5664, 5685, 5699, 5716, 5734, 5749, 5769, 5788, 5810, 5841, 5861, 5875, 5889, 5912, 5934, 5953, 5969, 5990, 6014, 6035, 6056, 6065, 6078, 6098, 6116, 6129, 6146, 6164, 6176, 6196, 6218, 6240, 6258, 6277, 6298, 6318, 6338, 6358, 6378, 6399, 6417, 6433, 6449, 6469, 6488, 6503, 6523, 6544, 6562, 6576, 6602, 6624, 6642, 6665, 6688, 6718, 6741, 6773, 6798, 6807} func (i Kind) String() string { idx := int(i) - 0 diff --git a/pkg/binder/binder.go b/pkg/binder/binder.go index 297b40a4..0b6fa47a 100644 --- a/pkg/binder/binder.go +++ b/pkg/binder/binder.go @@ -683,7 +683,9 @@ func (b *Binder) bind(node *ast.Node) bool { case ast.KindInterfaceDeclaration: b.bindBlockScopedDeclaration(node, ast.SymbolFlagsInterface, ast.SymbolFlagsInterfaceExcludes) case ast.KindCallExpression: - b.bindCallExpression(node) + if ast.IsInJSFile(node) { + b.bindCallExpression(node) + } case ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: b.bindBlockScopedDeclaration(node, ast.SymbolFlagsTypeAlias, ast.SymbolFlagsTypeAliasExcludes) case ast.KindEnumDeclaration: @@ -910,16 +912,24 @@ func (b *Binder) bindFunctionExpression(node *ast.Node) { } func (b *Binder) bindCallExpression(node *ast.Node) { - // !!! for ModuleDetectionKind.Force, external module indicator is forced to `true` in Strada for source files, in which case - // we should set the commonjs module indicator but not call b.bindSourceFileAsExternalModule - // !!! && file.externalModuleIndicator !== true (used for ModuleDetectionKind.Force) - if ast.IsInJSFile(node) && - b.file.ExternalModuleIndicator == nil && - b.file.CommonJSModuleIndicator == nil && - ast.IsRequireCall(node, false /*requireStringLiteralLikeArgument*/) { + // We're only inspecting call expressions to detect CommonJS modules, so we can skip + // this check if we've already seen the module indicator + if b.file.CommonJSModuleIndicator == nil && ast.IsRequireCall(node, false /*requireStringLiteralLikeArgument*/) { + b.setCommonJSModuleIndicator(node) + } +} + +func (b *Binder) setCommonJSModuleIndicator(node *ast.Node) bool { + if b.file.ExternalModuleIndicator != nil && b.file.ExternalModuleIndicator != b.file.AsNode() { + return false + } + if b.file.CommonJSModuleIndicator == nil { b.file.CommonJSModuleIndicator = node - b.bindSourceFileAsExternalModule() + if b.file.ExternalModuleIndicator == nil { + b.bindSourceFileAsExternalModule() + } } + return true } func (b *Binder) bindClassLikeDeclaration(node *ast.Node) { diff --git a/pkg/checker/checker.go b/pkg/checker/checker.go index f12ff3ef..3e3afdc4 100644 --- a/pkg/checker/checker.go +++ b/pkg/checker/checker.go @@ -2003,7 +2003,7 @@ func isSameScopeDescendentOf(initial *ast.Node, parent *ast.Node, stopAt *ast.No return false } -// stopAtAnyPropertyDeclaration is used for detecting ES-standard class field use-before-def errors +// isPropertyImmediatelyReferencedWithinDeclaration is used for detecting ES-standard class field use-before-def errors func isPropertyImmediatelyReferencedWithinDeclaration(declaration *ast.Node, usage *ast.Node, stopAtAnyPropertyDeclaration bool) bool { // always legal if usage is after declaration if usage.End() > declaration.End() { @@ -5539,7 +5539,7 @@ func (c *Checker) checkExternalModuleExports(node *ast.Node) { links := c.moduleSymbolLinks.Get(moduleSymbol) if !links.exportsChecked { exportEqualsSymbol := moduleSymbol.Exports[ast.InternalSymbolNameExportEquals] - if exportEqualsSymbol != nil && c.hasExportedMembers(moduleSymbol) { + if exportEqualsSymbol != nil && c.hasExportedMembers(moduleSymbol, exportEqualsSymbol.ValueDeclaration.Kind == ast.KindJSExportAssignment) { declaration := core.OrElse(c.getDeclarationOfAliasSymbol(exportEqualsSymbol), exportEqualsSymbol.ValueDeclaration) if declaration != nil && !isTopLevelInExternalModuleAugmentation(declaration) { c.error(declaration, diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements) @@ -5575,10 +5575,17 @@ func (c *Checker) checkExternalModuleExports(node *ast.Node) { } } -func (c *Checker) hasExportedMembers(moduleSymbol *ast.Symbol) bool { +func (c *Checker) hasExportedMembers(moduleSymbol *ast.Symbol, isCommonJS bool) bool { for id := range moduleSymbol.Exports { if id != ast.InternalSymbolNameExportEquals { - return true + if !isCommonJS { + return true + } + for _, declaration := range moduleSymbol.Exports[id].Declarations { + if declaration.Kind != ast.KindJSTypeAliasDeclaration { + return true + } + } } } return false @@ -14440,7 +14447,7 @@ func (c *Checker) canHaveSyntheticDefault(file *ast.Node, moduleSymbol *ast.Symb } // JS files have a synthetic default if they do not contain ES2015+ module syntax (export = is not valid in js) _and_ do not have an __esModule marker - return !ast.IsExternalModule(file.AsSourceFile()) && c.resolveExportByName(moduleSymbol, "__esModule", nil /*sourceNode*/, dontResolveAlias) == nil + return (file.AsSourceFile().ExternalModuleIndicator == nil || file.AsSourceFile().ExternalModuleIndicator == file) && c.resolveExportByName(moduleSymbol, "__esModule", nil /*sourceNode*/, dontResolveAlias) == nil } func (c *Checker) getEmitSyntaxForModuleSpecifierExpression(usage *ast.Node) core.ResolutionMode { @@ -15333,13 +15340,27 @@ func (c *Checker) resolveEntityName(name *ast.Node, meaning ast.SymbolFlags, ign if resolveLocation == nil { resolveLocation = name } - symbol = c.getMergedSymbol(c.resolveName(resolveLocation, name.Text(), meaning, message, true /*isUse*/, false /*excludeGlobals*/)) + if meaning == ast.SymbolFlagsNamespace { + symbol = c.getMergedSymbol(c.resolveName(resolveLocation, name.Text(), meaning, nil, true /*isUse*/, false /*excludeGlobals*/)) + if symbol == nil { + alias := c.getMergedSymbol(c.resolveName(resolveLocation, name.Text(), ast.SymbolFlagsAlias, nil, true /*isUse*/, false /*excludeGlobals*/)) + if alias != nil && alias.Name == ast.InternalSymbolNameExportEquals { + // resolve typedefs exported from commonjs, stored on the module symbol + symbol = alias.Parent + } + } + if symbol == nil && message != nil { + c.resolveName(resolveLocation, name.Text(), meaning, message, true /*isUse*/, false /*excludeGlobals*/) + } + } else { + symbol = c.getMergedSymbol(c.resolveName(resolveLocation, name.Text(), meaning, message, true /*isUse*/, false /*excludeGlobals*/)) + } case ast.KindQualifiedName: qualified := name.AsQualifiedName() - symbol = c.resolveQualifiedName(name, qualified.Left, qualified.Right, meaning, ignoreErrors, dontResolveAlias, location) + symbol = c.resolveQualifiedName(name, qualified.Left, qualified.Right, meaning, ignoreErrors, location) case ast.KindPropertyAccessExpression: access := name.AsPropertyAccessExpression() - symbol = c.resolveQualifiedName(name, access.Expression, access.Name(), meaning, ignoreErrors, dontResolveAlias, location) + symbol = c.resolveQualifiedName(name, access.Expression, access.Name(), meaning, ignoreErrors, location) default: panic("Unknown entity name kind") } @@ -15357,7 +15378,7 @@ func (c *Checker) resolveEntityName(name *ast.Node, meaning ast.SymbolFlags, ign return symbol } -func (c *Checker) resolveQualifiedName(name *ast.Node, left *ast.Node, right *ast.Node, meaning ast.SymbolFlags, ignoreErrors bool, dontResolveAlias bool, location *ast.Node) *ast.Symbol { +func (c *Checker) resolveQualifiedName(name *ast.Node, left *ast.Node, right *ast.Node, meaning ast.SymbolFlags, ignoreErrors bool, location *ast.Node) *ast.Symbol { namespace := c.resolveEntityName(left, ast.SymbolFlagsNamespace, ignoreErrors, false /*dontResolveAlias*/, location) if namespace == nil || ast.NodeIsMissing(right) { return nil @@ -15713,12 +15734,26 @@ func (c *Checker) getExportsOfModuleWorker(moduleSymbol *ast.Symbol) (exports as } return symbols } + var originalModule *ast.Symbol + if moduleSymbol != nil { + if c.resolveSymbolEx(moduleSymbol.Exports[ast.InternalSymbolNameExportEquals], false /*dontResolveAlias*/) != nil { + originalModule = moduleSymbol + } + } // A module defined by an 'export=' consists of one export that needs to be resolved moduleSymbol = c.resolveExternalModuleSymbol(moduleSymbol, false /*dontResolveAlias*/) exports = visit(moduleSymbol, nil, false) if exports == nil { exports = make(ast.SymbolTable) } + // A CommonJS module defined by an 'export=' might also export typedefs, stored on the original module + if originalModule != nil && len(originalModule.Exports) > 1 { + for _, symbol := range originalModule.Exports { + if symbol.Flags&ast.SymbolFlagsType != 0 && symbol.Name != ast.InternalSymbolNameExportEquals && exports[symbol.Name] == nil { + exports[symbol.Name] = symbol + } + } + } for name := range nonTypeOnlyNames.Keys() { delete(typeOnlyExportStarMap, name) } @@ -23972,6 +24007,13 @@ func (c *Checker) getTypeFromImportTypeNode(node *ast.Node) *Type { symbolFromVariable = c.getPropertyOfTypeEx(c.getTypeOfSymbol(mergedResolvedSymbol), current.Text(), false /*skipObjectFunctionPropertyAugment*/, true /*includeTypeOnlyMembers*/) } else { symbolFromModule = c.getSymbol(c.getExportsOfSymbol(mergedResolvedSymbol), current.Text(), meaning) + if symbolFromModule == nil { + // a CommonJS module might have typedefs exported alongside an export= + immediateModuleSymbol := c.resolveExternalModuleSymbol(innerModuleSymbol, true /*dontResolveAlias*/) + if immediateModuleSymbol != nil && core.Some(immediateModuleSymbol.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportAssignment }) { + symbolFromModule = c.getSymbol(c.getExportsOfSymbol(immediateModuleSymbol.Parent), current.Text(), meaning) + } + } } next := core.OrElse(symbolFromModule, symbolFromVariable) if next == nil { diff --git a/pkg/checker/grammarchecks.go b/pkg/checker/grammarchecks.go index c09c22f6..2643f0de 100644 --- a/pkg/checker/grammarchecks.go +++ b/pkg/checker/grammarchecks.go @@ -2093,9 +2093,7 @@ func (c *Checker) checkGrammarNumericLiteral(node *ast.NumericLiteral) { // We should test against `getTextOfNode(node)` rather than `node.text`, because `node.text` for large numeric literals can contain "." // e.g. `node.text` for numeric literal `1100000000000000000000` is `1.1e21`. isFractional := strings.ContainsRune(nodeText, '.') - // !!! - // isScientific := node.NumericLiteralFlags & ast.TokenFlagsScientific - isScientific := strings.ContainsRune(nodeText, 'e') + isScientific := node.TokenFlags&ast.TokenFlagsScientific != 0 // Scientific notation (e.g. 2e54 and 1e00000000010) can't be converted to bigint // Fractional numbers (e.g. 9000000000000000.001) are inherently imprecise anyway diff --git a/pkg/checker/nodebuilderimpl.go b/pkg/checker/nodebuilderimpl.go index 7e8259a1..28565921 100644 --- a/pkg/checker/nodebuilderimpl.go +++ b/pkg/checker/nodebuilderimpl.go @@ -1179,7 +1179,6 @@ func (b *NodeBuilderImpl) getSpecifierForModuleSymbol(symbol *ast.Symbol, overri if ok { return result } - isBundle := false // !!! remove me // For declaration bundles, we need to generate absolute paths relative to the common source dir for imports, // just like how the declaration emitter does for the ambient module declarations - we can easily accomplish this // using the `baseUrl` compiler option (which we would otherwise never use in declaration emit) and a non-relative @@ -1191,13 +1190,6 @@ func (b *NodeBuilderImpl) getSpecifierForModuleSymbol(symbol *ast.Symbol, overri if resolutionMode == core.ResolutionModeESM { endingPref = modulespecifiers.ImportModuleSpecifierEndingPreferenceJs } - if isBundle { - // !!! relies on option cloning and specifier host implementation - // specifierCompilerOptions = &core.CompilerOptions{BaseUrl: host.CommonSourceDirectory()} - // TODO: merge with b.ch.compilerOptions - specifierPref = modulespecifiers.ImportModuleSpecifierPreferenceNonRelative - endingPref = modulespecifiers.ImportModuleSpecifierEndingPreferenceMinimal - } allSpecifiers := modulespecifiers.GetModuleSpecifiers( symbol, diff --git a/pkg/evaluator/evaluator.go b/pkg/evaluator/evaluator.go index eca82304..8074ac38 100644 --- a/pkg/evaluator/evaluator.go +++ b/pkg/evaluator/evaluator.go @@ -140,7 +140,6 @@ func evaluateTemplateExpression(expr *ast.Node, location *ast.Node, evaluate Eva } func AnyToString(v any) string { - // !!! This function should behave identically to the expression `"" + v` in JS switch v := v.(type) { case string: return v @@ -155,7 +154,6 @@ func AnyToString(v any) string { } func IsTruthy(v any) bool { - // !!! This function should behave identically to the expression `!!v` in JS switch v := v.(type) { case string: return len(v) != 0 diff --git a/pkg/execute/tsc.go b/pkg/execute/tsc.go index f1470a8f..dacd5739 100644 --- a/pkg/execute/tsc.go +++ b/pkg/execute/tsc.go @@ -23,7 +23,6 @@ import ( func CommandLine(sys tsc.System, commandLineArgs []string, testing tsc.CommandLineTesting) tsc.CommandLineResult { if len(commandLineArgs) > 0 { - // !!! build mode switch strings.ToLower(commandLineArgs[0]) { case "-b", "--b", "-build", "--build": return tscBuildCompilation(sys, tsoptions.ParseBuildCommandLine(commandLineArgs, sys), testing) diff --git a/pkg/fourslash/_scripts/failingTests.txt b/pkg/fourslash/_scripts/failingTests.txt index fa8d1200..76d4a8f8 100644 --- a/pkg/fourslash/_scripts/failingTests.txt +++ b/pkg/fourslash/_scripts/failingTests.txt @@ -326,7 +326,6 @@ TestIndexerReturnTypes1 TestIndirectClassInstantiation TestInstanceTypesForGenericType1 TestJavascriptModules20 -TestJavascriptModulesTypeImport TestJsDocAugments TestJsDocAugmentsAndExtends TestJsdocCallbackTag diff --git a/pkg/fourslash/tests/gen/javascriptModulesTypeImport_test.go b/pkg/fourslash/tests/gen/javascriptModulesTypeImport_test.go index 2fd19985..849ef165 100644 --- a/pkg/fourslash/tests/gen/javascriptModulesTypeImport_test.go +++ b/pkg/fourslash/tests/gen/javascriptModulesTypeImport_test.go @@ -10,7 +10,7 @@ import ( func TestJavascriptModulesTypeImport(t *testing.T) { t.Parallel() - t.Skip() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @allowJs: true // @Filename: types.js diff --git a/pkg/outputpaths/outputpaths.go b/pkg/outputpaths/outputpaths.go index c7ed5ae0..922cbf9d 100644 --- a/pkg/outputpaths/outputpaths.go +++ b/pkg/outputpaths/outputpaths.go @@ -40,7 +40,6 @@ func (o *OutputPaths) DeclarationMapPath() string { } func GetOutputPathsFor(sourceFile *ast.SourceFile, options *core.CompilerOptions, host OutputPathsHost, forceDtsEmit bool) *OutputPaths { - // !!! bundle not implemented, may be deprecated ownOutputFilePath := getOwnEmitOutputFilePath(sourceFile.FileName(), options, host, GetOutputExtension(sourceFile.FileName(), options.Jsx)) isJsonFile := ast.IsJsonSourceFile(sourceFile) // If json file emits to the same location skip writing it, if emitDeclarationOnly skip writing it diff --git a/pkg/parser/parser.go b/pkg/parser/parser.go index 80c00c8b..0b80de78 100644 --- a/pkg/parser/parser.go +++ b/pkg/parser/parser.go @@ -6457,7 +6457,7 @@ func (p *Parser) processPragmasIntoFields(context *ast.SourceFile) { case typesOk: var parsed core.ResolutionMode if resolutionModeOk { - parsed = parseResolutionMode(resolutionMode.Value, resolutionMode.Pos(), resolutionMode.End() /*, reportDiagnostic*/) + parsed = p.parseResolutionMode(resolutionMode.Value, resolutionMode.Pos(), resolutionMode.End()) } context.TypeReferenceDirectives = append(context.TypeReferenceDirectives, &ast.FileReference{ TextRange: types.TextRange, @@ -6498,16 +6498,17 @@ func (p *Parser) processPragmasIntoFields(context *ast.SourceFile) { } } -func parseResolutionMode(mode string, pos int, end int /*reportDiagnostic: PragmaDiagnosticReporter*/) (resolutionKind core.ResolutionMode) { +func (p *Parser) parseResolutionMode(mode string, pos int, end int) (resolutionKind core.ResolutionMode) { if mode == "import" { resolutionKind = core.ModuleKindESNext + return resolutionKind } if mode == "require" { resolutionKind = core.ModuleKindCommonJS + return resolutionKind } + p.parseErrorAt(pos, end, diagnostics.X_resolution_mode_should_be_either_require_or_import) return resolutionKind - // reportDiagnostic(pos, end - pos, Diagnostics.resolution_mode_should_be_either_require_or_import); - // return undefined; } func (p *Parser) jsErrorAtRange(loc core.TextRange, message *diagnostics.Message, args ...any) { diff --git a/pkg/printer/printer.go b/pkg/printer/printer.go index 4753baaa..ecd386cf 100644 --- a/pkg/printer/printer.go +++ b/pkg/printer/printer.go @@ -4951,9 +4951,6 @@ func (p *Printer) Write(node *ast.Node, sourceFile *ast.SourceFile, writer EmitT case ast.KindSourceFile: p.emitSourceFile(node.AsSourceFile()) - case ast.KindBundle: - panic("not implemented") - // Transformation nodes case ast.KindNotEmittedTypeElement: p.emitNotEmittedTypeElement(node.AsNotEmittedTypeElement()) diff --git a/pkg/transformers/declarations/transform.go b/pkg/transformers/declarations/transform.go index c9ebd788..9fd7f7c7 100644 --- a/pkg/transformers/declarations/transform.go +++ b/pkg/transformers/declarations/transform.go @@ -50,7 +50,6 @@ type DeclarationTransformer struct { declarationFilePath string declarationMapPath string - isBundledEmit bool needsDeclare bool needsScopeFixMarker bool resultHasScopeMarker bool @@ -102,7 +101,6 @@ func (tx *DeclarationTransformer) visit(node *ast.Node) *ast.Node { if node == nil { return nil } - // !!! TODO: Bundle support? switch node.Kind { case ast.KindSourceFile: return tx.visitSourceFile(node.AsSourceFile()) @@ -161,7 +159,6 @@ func (tx *DeclarationTransformer) visitSourceFile(node *ast.SourceFile) *ast.Nod return node.AsNode() } - tx.isBundledEmit = false tx.needsDeclare = true tx.needsScopeFixMarker = false tx.resultHasScopeMarker = false @@ -238,7 +235,7 @@ func (tx *DeclarationTransformer) transformAndReplaceLatePaintedStatements(state tx.state.lateMarkedStatements = tx.state.lateMarkedStatements[1:] saveNeedsDeclare := tx.needsDeclare - tx.needsDeclare = next.Parent != nil && ast.IsSourceFile(next.Parent) && !(ast.IsExternalModule(next.Parent.AsSourceFile()) && tx.isBundledEmit) + tx.needsDeclare = next.Parent != nil && ast.IsSourceFile(next.Parent) result := tx.transformTopLevelDeclaration(next) @@ -311,8 +308,6 @@ func (tx *DeclarationTransformer) getReferencedFiles(outputFilePath string) (res if file.IsDeclarationFile { declFileName = file.FileName() } else { - // !!! bundled emit support, omit bundled refs - // if (tx.isBundledEmit && contains((node as Bundle).sourceFiles, file)) continue paths := tx.host.GetOutputPathsFor(file, true) // Try to use output path for referenced file, or output js path if that doesn't exist, or the input path if all else fails declFileName = paths.DeclarationFilePath() @@ -1047,11 +1042,6 @@ func (tx *DeclarationTransformer) rewriteModuleSpecifier(parent *ast.Node, input return nil } tx.resultHasExternalModuleIndicator = tx.resultHasExternalModuleIndicator || (parent.Kind != ast.KindModuleDeclaration && parent.Kind != ast.KindImportType) - if ast.IsStringLiteralLike(input) { - if tx.isBundledEmit { - // !!! TODO: support bundled emit specifier rewriting - } - } return input } @@ -1578,7 +1568,7 @@ func (tx *DeclarationTransformer) ensureModifierFlags(node *ast.Node) ast.Modifi additions = ast.ModifierFlagsAmbient } parentIsFile := node.Parent.Kind == ast.KindSourceFile - if !parentIsFile || (tx.isBundledEmit && parentIsFile && ast.IsExternalModule(node.Parent.AsSourceFile())) { + if !parentIsFile { mask ^= ast.ModifierFlagsAmbient additions = ast.ModifierFlagsNone } diff --git a/testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.js b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.js new file mode 100644 index 00000000..16af97d0 --- /dev/null +++ b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.js @@ -0,0 +1,64 @@ +//// [tests/cases/conformance/salsa/typedefModuleExportsIndirect1.ts] //// + +//// [typedefModuleExportsIndirect1.js] +/** @typedef {{ a: 1, m: 1 }} C */ +const dummy = 0; +module.exports = dummy; +//// [use.js] +/** @typedef {import('./typedefModuleExportsIndirect1').C} C */ +/** @type {C} */ +var c + + +//// [typedefModuleExportsIndirect1.js] +"use strict"; +/** @typedef {{ a: 1, m: 1 }} C */ +const dummy = 0; +module.exports = dummy; +//// [use.js] +"use strict"; +/** @typedef {import('./typedefModuleExportsIndirect1').C} C */ +/** @type {C} */ +var c; + + +//// [typedefModuleExportsIndirect1.d.ts] +export type C = { + a: 1; + m: 1; +}; +export = dummy; +//// [use.d.ts] +type C = import('./typedefModuleExportsIndirect1').C; +/** @typedef {import('./typedefModuleExportsIndirect1').C} C */ +/** @type {C} */ +declare var c: C; + + +//// [DtsFileErrors] + + +dist/typedefModuleExportsIndirect1.d.ts(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +dist/typedefModuleExportsIndirect1.d.ts(5,10): error TS2304: Cannot find name 'dummy'. +dist/use.d.ts(1,52): error TS2694: Namespace 'unknown' has no exported member 'C'. + + +==== dist/typedefModuleExportsIndirect1.d.ts (2 errors) ==== + export type C = { + a: 1; + m: 1; + }; + export = dummy; + ~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + ~~~~~ +!!! error TS2304: Cannot find name 'dummy'. + +==== dist/use.d.ts (1 errors) ==== + type C = import('./typedefModuleExportsIndirect1').C; + ~ +!!! error TS2694: Namespace 'unknown' has no exported member 'C'. + /** @typedef {import('./typedefModuleExportsIndirect1').C} C */ + /** @type {C} */ + declare var c: C; + \ No newline at end of file diff --git a/testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.symbols b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.symbols new file mode 100644 index 00000000..cc609e18 --- /dev/null +++ b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.symbols @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/salsa/typedefModuleExportsIndirect1.ts] //// + +=== typedefModuleExportsIndirect1.js === +/** @typedef {{ a: 1, m: 1 }} C */ +const dummy = 0; +>dummy : Symbol(dummy, Decl(typedefModuleExportsIndirect1.js, 1, 5)) + +module.exports = dummy; +>module.exports : Symbol(dummy, Decl(typedefModuleExportsIndirect1.js, 1, 5)) +>module : Symbol("typedefModuleExportsIndirect1", Decl(typedefModuleExportsIndirect1.js, 0, 0)) +>exports : Symbol(dummy, Decl(typedefModuleExportsIndirect1.js, 1, 5)) +>dummy : Symbol(dummy, Decl(typedefModuleExportsIndirect1.js, 1, 5)) + +=== use.js === +/** @typedef {import('./typedefModuleExportsIndirect1').C} C */ +/** @type {C} */ +var c +>c : Symbol(c, Decl(use.js, 2, 3)) + diff --git a/testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.types b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.types new file mode 100644 index 00000000..314c92c0 --- /dev/null +++ b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.types @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/salsa/typedefModuleExportsIndirect1.ts] //// + +=== typedefModuleExportsIndirect1.js === +/** @typedef {{ a: 1, m: 1 }} C */ +const dummy = 0; +>dummy : 0 +>0 : 0 + +module.exports = dummy; +>module.exports = dummy : 0 +>module.exports : 0 +>module : { readonly dummy: 0; } +>exports : 0 +>dummy : 0 + +=== use.js === +/** @typedef {import('./typedefModuleExportsIndirect1').C} C */ +/** @type {C} */ +var c +>c : import("typedefModuleExportsIndirect1").C + diff --git a/testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.js b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.js new file mode 100644 index 00000000..0d5492f3 --- /dev/null +++ b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.js @@ -0,0 +1,64 @@ +//// [tests/cases/conformance/salsa/typedefModuleExportsIndirect2.ts] //// + +//// [typedefModuleExportsIndirect2.js] +/** @typedef {{ a: 1, m: 1 }} C */ +const f = function() {}; +module.exports = f; +//// [use.js] +/** @typedef {import('./typedefModuleExportsIndirect2').C} C */ +/** @type {C} */ +var c + + +//// [typedefModuleExportsIndirect2.js] +"use strict"; +/** @typedef {{ a: 1, m: 1 }} C */ +const f = function () { }; +module.exports = f; +//// [use.js] +"use strict"; +/** @typedef {import('./typedefModuleExportsIndirect2').C} C */ +/** @type {C} */ +var c; + + +//// [typedefModuleExportsIndirect2.d.ts] +export type C = { + a: 1; + m: 1; +}; +export = f; +//// [use.d.ts] +type C = import('./typedefModuleExportsIndirect2').C; +/** @typedef {import('./typedefModuleExportsIndirect2').C} C */ +/** @type {C} */ +declare var c: C; + + +//// [DtsFileErrors] + + +dist/typedefModuleExportsIndirect2.d.ts(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +dist/typedefModuleExportsIndirect2.d.ts(5,10): error TS2304: Cannot find name 'f'. +dist/use.d.ts(1,52): error TS2694: Namespace 'unknown' has no exported member 'C'. + + +==== dist/typedefModuleExportsIndirect2.d.ts (2 errors) ==== + export type C = { + a: 1; + m: 1; + }; + export = f; + ~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + ~ +!!! error TS2304: Cannot find name 'f'. + +==== dist/use.d.ts (1 errors) ==== + type C = import('./typedefModuleExportsIndirect2').C; + ~ +!!! error TS2694: Namespace 'unknown' has no exported member 'C'. + /** @typedef {import('./typedefModuleExportsIndirect2').C} C */ + /** @type {C} */ + declare var c: C; + \ No newline at end of file diff --git a/testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.symbols b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.symbols new file mode 100644 index 00000000..66b77d9c --- /dev/null +++ b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.symbols @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/salsa/typedefModuleExportsIndirect2.ts] //// + +=== typedefModuleExportsIndirect2.js === +/** @typedef {{ a: 1, m: 1 }} C */ +const f = function() {}; +>f : Symbol(f, Decl(typedefModuleExportsIndirect2.js, 1, 5)) + +module.exports = f; +>module.exports : Symbol(f, Decl(typedefModuleExportsIndirect2.js, 1, 5)) +>module : Symbol("typedefModuleExportsIndirect2", Decl(typedefModuleExportsIndirect2.js, 0, 0)) +>exports : Symbol(f, Decl(typedefModuleExportsIndirect2.js, 1, 5)) +>f : Symbol(f, Decl(typedefModuleExportsIndirect2.js, 1, 5)) + +=== use.js === +/** @typedef {import('./typedefModuleExportsIndirect2').C} C */ +/** @type {C} */ +var c +>c : Symbol(c, Decl(use.js, 2, 3)) + diff --git a/testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.types b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.types new file mode 100644 index 00000000..979ef242 --- /dev/null +++ b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.types @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/salsa/typedefModuleExportsIndirect2.ts] //// + +=== typedefModuleExportsIndirect2.js === +/** @typedef {{ a: 1, m: 1 }} C */ +const f = function() {}; +>f : () => void +>function() {} : () => void + +module.exports = f; +>module.exports = f : () => void +>module.exports : () => void +>module : { readonly f: () => void; } +>exports : () => void +>f : () => void + +=== use.js === +/** @typedef {import('./typedefModuleExportsIndirect2').C} C */ +/** @type {C} */ +var c +>c : import("typedefModuleExportsIndirect2").C + diff --git a/testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.js b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.js new file mode 100644 index 00000000..2daa0075 --- /dev/null +++ b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.js @@ -0,0 +1,64 @@ +//// [tests/cases/conformance/salsa/typedefModuleExportsIndirect3.ts] //// + +//// [typedefModuleExportsIndirect3.js] +/** @typedef {{ a: 1, m: 1 }} C */ +const o = {}; +module.exports = o; +//// [use.js] +/** @typedef {import('./typedefModuleExportsIndirect3').C} C */ +/** @type {C} */ +var c + + +//// [typedefModuleExportsIndirect3.js] +"use strict"; +/** @typedef {{ a: 1, m: 1 }} C */ +const o = {}; +module.exports = o; +//// [use.js] +"use strict"; +/** @typedef {import('./typedefModuleExportsIndirect3').C} C */ +/** @type {C} */ +var c; + + +//// [typedefModuleExportsIndirect3.d.ts] +export type C = { + a: 1; + m: 1; +}; +export = o; +//// [use.d.ts] +type C = import('./typedefModuleExportsIndirect3').C; +/** @typedef {import('./typedefModuleExportsIndirect3').C} C */ +/** @type {C} */ +declare var c: C; + + +//// [DtsFileErrors] + + +dist/typedefModuleExportsIndirect3.d.ts(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +dist/typedefModuleExportsIndirect3.d.ts(5,10): error TS2304: Cannot find name 'o'. +dist/use.d.ts(1,52): error TS2694: Namespace 'unknown' has no exported member 'C'. + + +==== dist/typedefModuleExportsIndirect3.d.ts (2 errors) ==== + export type C = { + a: 1; + m: 1; + }; + export = o; + ~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + ~ +!!! error TS2304: Cannot find name 'o'. + +==== dist/use.d.ts (1 errors) ==== + type C = import('./typedefModuleExportsIndirect3').C; + ~ +!!! error TS2694: Namespace 'unknown' has no exported member 'C'. + /** @typedef {import('./typedefModuleExportsIndirect3').C} C */ + /** @type {C} */ + declare var c: C; + \ No newline at end of file diff --git a/testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.symbols b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.symbols new file mode 100644 index 00000000..0f1a451f --- /dev/null +++ b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.symbols @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/salsa/typedefModuleExportsIndirect3.ts] //// + +=== typedefModuleExportsIndirect3.js === +/** @typedef {{ a: 1, m: 1 }} C */ +const o = {}; +>o : Symbol(o, Decl(typedefModuleExportsIndirect3.js, 1, 5)) + +module.exports = o; +>module.exports : Symbol(o, Decl(typedefModuleExportsIndirect3.js, 1, 5)) +>module : Symbol("typedefModuleExportsIndirect3", Decl(typedefModuleExportsIndirect3.js, 0, 0)) +>exports : Symbol(o, Decl(typedefModuleExportsIndirect3.js, 1, 5)) +>o : Symbol(o, Decl(typedefModuleExportsIndirect3.js, 1, 5)) + +=== use.js === +/** @typedef {import('./typedefModuleExportsIndirect3').C} C */ +/** @type {C} */ +var c +>c : Symbol(c, Decl(use.js, 2, 3)) + diff --git a/testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.types b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.types new file mode 100644 index 00000000..be9e0ac1 --- /dev/null +++ b/testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.types @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/salsa/typedefModuleExportsIndirect3.ts] //// + +=== typedefModuleExportsIndirect3.js === +/** @typedef {{ a: 1, m: 1 }} C */ +const o = {}; +>o : {} +>{} : {} + +module.exports = o; +>module.exports = o : {} +>module.exports : {} +>module : { readonly o: {}; } +>exports : {} +>o : {} + +=== use.js === +/** @typedef {import('./typedefModuleExportsIndirect3').C} C */ +/** @type {C} */ +var c +>c : import("typedefModuleExportsIndirect3").C + diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc index 479db505..69f271df 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsImportType.baseline.jsonc @@ -19,5 +19,9 @@ // === findAllReferences === +// === /a.js === +// module.exports = 0; +// export type [|N|] = number; + // === /b.js === -// type T = import("./a")./*FIND ALL REFS*/N; \ No newline at end of file +// type T = import("./a")./*FIND ALL REFS*/[|N|]; \ No newline at end of file diff --git a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsTypedef_importType.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsTypedef_importType.baseline.jsonc index d58e4feb..92b33590 100644 --- a/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsTypedef_importType.baseline.jsonc +++ b/testdata/baselines/reference/fourslash/findAllReferences/findAllRefsTypedef_importType.baseline.jsonc @@ -19,6 +19,11 @@ // === findAllReferences === +// === /a.js === +// module.exports = 0; +// /** @typedef {number} [|Foo|] */ +// const dummy = 0; + // === /b.js === -// /** @type {import('./a')./*FIND ALL REFS*/Foo} */ +// /** @type {import('./a')./*FIND ALL REFS*/[|Foo|]} */ // const x = 0; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt deleted file mode 100644 index 855d7577..00000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -something.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== file.ts (0 errors) ==== - class Foo { - x: number; - } - - declare global { - var module: any; // Just here to remove unrelated error from test - } - - export = Foo; -==== something.js (1 errors) ==== - /** @typedef {typeof import("./file")} Foo */ - - /** @typedef {(foo: Foo) => string} FooFun */ - - module.exports = /** @type {FooFun} */(void 0); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt.diff deleted file mode 100644 index af290d6f..00000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.checkJsTypeDefNoUnusedLocalMarked.errors.txt -+++ new.checkJsTypeDefNoUnusedLocalMarked.errors.txt -@@= skipped -0, +0 lines =@@ -- -+something.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== file.ts (0 errors) ==== -+ class Foo { -+ x: number; -+ } -+ -+ declare global { -+ var module: any; // Just here to remove unrelated error from test -+ } -+ -+ export = Foo; -+==== something.js (1 errors) ==== -+ /** @typedef {typeof import("./file")} Foo */ -+ -+ /** @typedef {(foo: Foo) => string} FooFun */ -+ -+ module.exports = /** @type {FooFun} */(void 0); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt deleted file mode 100644 index 26762126..00000000 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt +++ /dev/null @@ -1,61 +0,0 @@ -input.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== input.js (1 errors) ==== - /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ - - /** - * @template P - * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ - - /** - * @type {StatelessComponent} - */ - const MyComponent = () => /* @type {any} */(null); - - MyComponent.defaultProps = { - color: "red" - }; - - const MyComponent2 = () => null; - - /** - * @type {MyComponentProps} - */ - MyComponent2.defaultProps = { - color: "red" - } - - /** - * @type {StatelessComponent} - */ - const check = MyComponent2; - - /** - * - * @param {{ props: MyComponentProps }} p - */ - function expectLiteral(p) {} - - function foo() { - /** - * @type {MyComponentProps} - */ - this.props = { color: "red" }; - - expectLiteral(this); - } - - /** - * @type {MyComponentProps} - */ - module.exports = { - ~~~~~~~~~~~~~~~~~~ - color: "red" - ~~~~~~~~~~~~~~~~ - } - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - expectLiteral({ props: module.exports }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff deleted file mode 100644 index 6569dcf3..00000000 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt.diff +++ /dev/null @@ -1,65 +0,0 @@ ---- old.expandoFunctionContextualTypesJs.errors.txt -+++ new.expandoFunctionContextualTypesJs.errors.txt -@@= skipped -0, +0 lines =@@ -- -+input.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== input.js (1 errors) ==== -+ /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ -+ -+ /** -+ * @template P -+ * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ -+ -+ /** -+ * @type {StatelessComponent} -+ */ -+ const MyComponent = () => /* @type {any} */(null); -+ -+ MyComponent.defaultProps = { -+ color: "red" -+ }; -+ -+ const MyComponent2 = () => null; -+ -+ /** -+ * @type {MyComponentProps} -+ */ -+ MyComponent2.defaultProps = { -+ color: "red" -+ } -+ -+ /** -+ * @type {StatelessComponent} -+ */ -+ const check = MyComponent2; -+ -+ /** -+ * -+ * @param {{ props: MyComponentProps }} p -+ */ -+ function expectLiteral(p) {} -+ -+ function foo() { -+ /** -+ * @type {MyComponentProps} -+ */ -+ this.props = { color: "red" }; -+ -+ expectLiteral(this); -+ } -+ -+ /** -+ * @type {MyComponentProps} -+ */ -+ module.exports = { -+ ~~~~~~~~~~~~~~~~~~ -+ color: "red" -+ ~~~~~~~~~~~~~~~~ -+ } -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ expectLiteral({ props: module.exports }); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt index 824d5e4f..9da858c2 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt @@ -1,8 +1,7 @@ -index.js(9,1): error TS2309: An export assignment cannot be used in a module with other exported elements. index.js(9,34): error TS7006: Parameter 'options' implicitly has an 'any' type. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== /** * @typedef Options * @property {string} opt @@ -12,8 +11,6 @@ index.js(9,34): error TS7006: Parameter 'options' implicitly has an 'any' type. * @param {Options} options */ module.exports = function loader(options) {} - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ~~~~~~~ !!! error TS7006: Parameter 'options' implicitly has an 'any' type. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff index 6b73aa24..c67d7cf3 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff @@ -2,11 +2,10 @@ +++ new.jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt @@= skipped -0, +0 lines =@@ - -+index.js(9,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +index.js(9,34): error TS7006: Parameter 'options' implicitly has an 'any' type. + + -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + /** + * @typedef Options + * @property {string} opt @@ -16,8 +15,6 @@ + * @param {Options} options + */ + module.exports = function loader(options) {} -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + ~~~~~~~ +!!! error TS7006: Parameter 'options' implicitly has an 'any' type. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt deleted file mode 100644 index 3d859304..00000000 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt +++ /dev/null @@ -1,45 +0,0 @@ -typescript-eslint.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== eslint.config.js (0 errors) ==== - const eslintReact = require('./eslint-plugin-react.js'); - const tseslint = require('./typescript-eslint.js'); - - tseslint.config(eslintReact) - -==== eslint-plugin-react.js (0 errors) ==== - const deprecatedRules = { - "jsx-sort-default-props": true - } - - const allRules = { - 'no-unsafe': true - } - - module.exports = { - plugins: { - react: { - deprecatedRules, - rules: allRules, - }, - }, - }; - -==== typescript-eslint.js (1 errors) ==== - /** - * @typedef {{ rules: Record }} Plugin - */ - - /** - * @typedef {{ plugins: Record }} Config - */ - - /** - * @type {(...configs: Config[]) => void} - */ - function config(...configs) { } - - module.exports = { config }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff deleted file mode 100644 index b30aabfa..00000000 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff +++ /dev/null @@ -1,49 +0,0 @@ ---- old.moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt -+++ new.moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt -@@= skipped -0, +0 lines =@@ -- -+typescript-eslint.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== eslint.config.js (0 errors) ==== -+ const eslintReact = require('./eslint-plugin-react.js'); -+ const tseslint = require('./typescript-eslint.js'); -+ -+ tseslint.config(eslintReact) -+ -+==== eslint-plugin-react.js (0 errors) ==== -+ const deprecatedRules = { -+ "jsx-sort-default-props": true -+ } -+ -+ const allRules = { -+ 'no-unsafe': true -+ } -+ -+ module.exports = { -+ plugins: { -+ react: { -+ deprecatedRules, -+ rules: allRules, -+ }, -+ }, -+ }; -+ -+==== typescript-eslint.js (1 errors) ==== -+ /** -+ * @typedef {{ rules: Record }} Plugin -+ */ -+ -+ /** -+ * @typedef {{ plugins: Record }} Config -+ */ -+ -+ /** -+ * @type {(...configs: Config[]) => void} -+ */ -+ function config(...configs) { } -+ -+ module.exports = { config }; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt deleted file mode 100644 index 5a59e1a4..00000000 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -mod1.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -use.js(1,30): error TS2694: Namespace 'C' has no exported member 'Con'. - - -==== mod1.js (1 errors) ==== - /** @callback Con - some kind of continuation - * @param {object | undefined} error - * @return {any} I don't even know what this should return - */ - module.exports = C - ~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - function C() { - this.p = 1 - } - -==== use.js (1 errors) ==== - /** @param {import('./mod1').Con} k */ - ~~~ -!!! error TS2694: Namespace 'C' has no exported member 'Con'. - function f(k) { - if (1 === 2 - 1) { - // I guess basic math works! - } - return k({ ok: true}) - } - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff deleted file mode 100644 index b3e507b5..00000000 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.callbackCrossModule.errors.txt -+++ new.callbackCrossModule.errors.txt -@@= skipped -0, +0 lines =@@ -- -+mod1.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+use.js(1,30): error TS2694: Namespace 'C' has no exported member 'Con'. -+ -+ -+==== mod1.js (1 errors) ==== -+ /** @callback Con - some kind of continuation -+ * @param {object | undefined} error -+ * @return {any} I don't even know what this should return -+ */ -+ module.exports = C -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ function C() { -+ this.p = 1 -+ } -+ -+==== use.js (1 errors) ==== -+ /** @param {import('./mod1').Con} k */ -+ ~~~ -+!!! error TS2694: Namespace 'C' has no exported member 'Con'. -+ function f(k) { -+ if (1 === 2 - 1) { -+ // I guess basic math works! -+ } -+ return k({ ok: true}) -+ } -+ -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types index 675bc528..5b6eb1ef 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types @@ -26,8 +26,8 @@ function C() { === use.js === /** @param {import('./mod1').Con} k */ function f(k) { ->f : (k: any) => any ->k : any +>f : (k: import("mod1").Con) => any +>k : import("mod1").Con if (1 === 2 - 1) { >1 === 2 - 1 : boolean @@ -40,7 +40,7 @@ function f(k) { } return k({ ok: true}) >k({ ok: true}) : any ->k : any +>k : import("mod1").Con >{ ok: true} : { ok: boolean; } >ok : boolean >true : true diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types.diff b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types.diff index c2187ec4..3464d0cb 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types.diff +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types.diff @@ -32,18 +32,7 @@ /** @param {import('./mod1').Con} k */ function f(k) { ->f : (k: import("./mod1").Con) => any -->k : import("mod1").Con -+>f : (k: any) => any -+>k : any ++>f : (k: import("mod1").Con) => any + >k : import("mod1").Con - if (1 === 2 - 1) { - >1 === 2 - 1 : boolean -@@= skipped -14, +14 lines =@@ - } - return k({ ok: true}) - >k({ ok: true}) : any -->k : import("mod1").Con -+>k : any - >{ ok: true} : { ok: boolean; } - >ok : boolean - >true : true \ No newline at end of file + if (1 === 2 - 1) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/emitModuleCommonJS(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/emitModuleCommonJS(module=nodenext).js index 9911f4cb..73c169d2 100644 --- a/testdata/baselines/reference/submodule/conformance/emitModuleCommonJS(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/emitModuleCommonJS(module=nodenext).js @@ -25,7 +25,6 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte } return path; }; -Object.defineProperty(exports, "__esModule", { value: true }); { require(__rewriteRelativeImportExtension("" + "./foo.ts")); import(__rewriteRelativeImportExtension("" + "./foo.ts")); diff --git a/testdata/baselines/reference/submodule/conformance/emitModuleCommonJS(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/emitModuleCommonJS(module=nodenext).js.diff deleted file mode 100644 index 764495c4..00000000 --- a/testdata/baselines/reference/submodule/conformance/emitModuleCommonJS(module=nodenext).js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.emitModuleCommonJS(module=nodenext).js -+++ new.emitModuleCommonJS(module=nodenext).js -@@= skipped -24, +24 lines =@@ - } - return path; - }; -+Object.defineProperty(exports, "__esModule", { value: true }); - { - require(__rewriteRelativeImportExtension("" + "./foo.ts")); - import(__rewriteRelativeImportExtension("" + "./foo.ts")); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt index 3331f7cf..92201af3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt @@ -1,10 +1,7 @@ context.js(4,14): error TS1340: Module './timer' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./timer')'? context.js(5,14): error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? -context.js(6,31): error TS2694: Namespace 'Hook' has no exported member 'HookHandler'. context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. -context.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. hook.js(2,20): error TS1340: Module './context' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./context')'? -hook.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ==== timer.js (0 errors) ==== @@ -15,7 +12,7 @@ hook.js(10,1): error TS2309: An export assignment cannot be used in a module wit this.timeout = timeout; } module.exports = Timer; -==== hook.js (2 errors) ==== +==== hook.js (1 errors) ==== /** * @typedef {(arg: import("./context")) => void} HookHandler ~~~~~~~~~~~~~~~~~~~ @@ -28,10 +25,8 @@ hook.js(10,1): error TS2309: An export assignment cannot be used in a module wit this.handle = handle; } module.exports = Hook; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== context.js (5 errors) ==== +==== context.js (3 errors) ==== /** * Imports * @@ -42,8 +37,6 @@ hook.js(10,1): error TS2309: An export assignment cannot be used in a module wit ~~~~~~~~~~~~~~~~ !!! error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? * @typedef {import("./hook").HookHandler} HookHandler - ~~~~~~~~~~~ -!!! error TS2694: Namespace 'Hook' has no exported member 'HookHandler'. */ /** @@ -88,6 +81,4 @@ hook.js(10,1): error TS2309: An export assignment cannot be used in a module wit } } module.exports = Context; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff index be95625d..f81fa8ea 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff @@ -4,11 +4,8 @@ - +context.js(4,14): error TS1340: Module './timer' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./timer')'? +context.js(5,14): error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? -+context.js(6,31): error TS2694: Namespace 'Hook' has no exported member 'HookHandler'. +context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. -+context.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +hook.js(2,20): error TS1340: Module './context' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./context')'? -+hook.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + +==== timer.js (0 errors) ==== @@ -19,7 +16,7 @@ + this.timeout = timeout; + } + module.exports = Timer; -+==== hook.js (2 errors) ==== ++==== hook.js (1 errors) ==== + /** + * @typedef {(arg: import("./context")) => void} HookHandler + ~~~~~~~~~~~~~~~~~~~ @@ -32,10 +29,8 @@ + this.handle = handle; + } + module.exports = Hook; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + -+==== context.js (5 errors) ==== ++==== context.js (3 errors) ==== + /** + * Imports + * @@ -46,8 +41,6 @@ + ~~~~~~~~~~~~~~~~ +!!! error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? + * @typedef {import("./hook").HookHandler} HookHandler -+ ~~~~~~~~~~~ -+!!! error TS2694: Namespace 'Hook' has no exported member 'HookHandler'. + */ + + /** @@ -92,6 +85,4 @@ + } + } + module.exports = Context; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js index f61783ef..1bc0d198 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js @@ -186,7 +186,7 @@ declare namespace Context { * @param {HookHandler=} handle * @returns {State} */ - construct(input: Input, handle?: any): State; + construct(input: Input, handle?: import("./hook").HookHandler): State; }; } export = Context; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff index 6e7301f2..a3000e6d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff @@ -89,7 +89,7 @@ + * @param {HookHandler=} handle + * @returns {State} + */ -+ construct(input: Input, handle?: any): State; ++ construct(input: Input, handle?: import("./hook").HookHandler): State; + }; } -/** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types index fbaba501..b67917b6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types @@ -80,7 +80,7 @@ module.exports = Hook; */ function Context(input) { ->Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } +>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } >input : Input if (!(this instanceof Context)) { @@ -88,11 +88,11 @@ function Context(input) { >(this instanceof Context) : boolean >this instanceof Context : boolean >this : any ->Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } +>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } return new Context(input) >new Context(input) : any ->Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } +>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } >input : Input } this.state = this.construct(input); @@ -107,11 +107,11 @@ function Context(input) { >input : Input } Context.prototype = { ->Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: any): State; } ->Context.prototype : { construct(input: Input, handle?: any): State; } ->Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } ->prototype : { construct(input: Input, handle?: any): State; } ->{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: any): State; } +>Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: import("hook").HookHandler): State; } +>Context.prototype : { construct(input: Input, handle?: import("hook").HookHandler): State; } +>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } +>prototype : { construct(input: Input, handle?: import("hook").HookHandler): State; } +>{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: import("hook").HookHandler): State; } /** * @param {Input} input @@ -119,9 +119,9 @@ Context.prototype = { * @returns {State} */ construct(input, handle = () => void 0) { ->construct : (input: Input, handle?: any) => State +>construct : (input: Input, handle?: import("hook").HookHandler) => State >input : Input ->handle : any +>handle : import("hook").HookHandler >() => void 0 : () => any >void 0 : undefined >0 : 0 @@ -131,9 +131,9 @@ Context.prototype = { } } module.exports = Context; ->module.exports = Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } ->module.exports : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } ->module : { Context: { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; }; } ->exports : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } ->Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } +>module.exports = Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } +>module.exports : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } +>module : { Context: { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; }; } +>exports : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } +>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff index 0158bec3..81626dc8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff @@ -65,7 +65,7 @@ function Context(input) { ->Context : typeof Context -+>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } ++>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } >input : Input if (!(this instanceof Context)) { @@ -75,13 +75,13 @@ ->this : this ->Context : typeof Context +>this : any -+>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } ++>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } return new Context(input) ->new Context(input) : Context ->Context : typeof Context +>new Context(input) : any -+>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } ++>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } >input : Input } this.state = this.construct(input); @@ -107,11 +107,11 @@ ->Context : typeof Context ->prototype : { construct(input: Input, handle?: HookHandler | undefined): State; } ->{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: HookHandler | undefined): State; } -+>Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: any): State; } -+>Context.prototype : { construct(input: Input, handle?: any): State; } -+>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } -+>prototype : { construct(input: Input, handle?: any): State; } -+>{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: any): State; } ++>Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: import("hook").HookHandler): State; } ++>Context.prototype : { construct(input: Input, handle?: import("hook").HookHandler): State; } ++>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } ++>prototype : { construct(input: Input, handle?: import("hook").HookHandler): State; } ++>{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: import("hook").HookHandler): State; } /** * @param {Input} input @@ -120,13 +120,10 @@ */ construct(input, handle = () => void 0) { ->construct : (input: Input, handle?: HookHandler | undefined) => State -+>construct : (input: Input, handle?: any) => State ++>construct : (input: Input, handle?: import("hook").HookHandler) => State >input : Input -->handle : import("hook").HookHandler -+>handle : any + >handle : import("hook").HookHandler >() => void 0 : () => any - >void 0 : undefined - >0 : 0 @@= skipped -12, +12 lines =@@ } } @@ -136,8 +133,8 @@ ->module : { exports: { (input: Input): Context; new (input: Input): Context; prototype: { construct(input: Input, handle?: HookHandler | undefined): State; }; }; } ->exports : { (input: Input): Context; new (input: Input): Context; prototype: { construct(input: Input, handle?: HookHandler | undefined): State; }; } ->Context : typeof Context -+>module.exports = Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } -+>module.exports : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } -+>module : { Context: { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; }; } -+>exports : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } -+>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: any): State; }; } ++>module.exports = Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } ++>module.exports : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } ++>module : { Context: { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; }; } ++>exports : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } ++>Context : { (input: Input): any; prototype: { construct(input: Input, handle?: import("hook").HookHandler): State; }; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt deleted file mode 100644 index 0b7c06dc..00000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -source.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== source.js (1 errors) ==== - module.exports = MyClass; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - function MyClass() {} - MyClass.staticMethod = function() {} - MyClass.prototype.method = function() {} - MyClass.staticProperty = 123; - - /** - * Callback to be invoked when test execution is complete. - * - * @callback DoneCB - * @param {number} failures - Number of failures that occurred. - */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt.diff deleted file mode 100644 index bf29d066..00000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.jsDeclarationsFunctionPrototypeStatic.errors.txt -+++ new.jsDeclarationsFunctionPrototypeStatic.errors.txt -@@= skipped -0, +0 lines =@@ -- -+source.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== source.js (1 errors) ==== -+ module.exports = MyClass; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ function MyClass() {} -+ MyClass.staticMethod = function() {} -+ MyClass.prototype.method = function() {} -+ MyClass.staticProperty = 123; -+ -+ /** -+ * Callback to be invoked when test execution is complete. -+ * -+ * @callback DoneCB -+ * @param {number} failures - Number of failures that occurred. -+ */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js index 85050d43..eb17c3c0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js @@ -45,3 +45,30 @@ export type DoneCB = (failures: number) => any; * @callback DoneCB * @param {number} failures - Number of failures that occurred. */ + + +//// [DtsFileErrors] + + +out/source.d.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + +==== out/source.d.ts (1 errors) ==== + export = MyClass; + ~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + declare function MyClass(): void; + declare namespace MyClass { + var staticMethod: () => void; + } + declare namespace MyClass { + var staticProperty: number; + } + export type DoneCB = (failures: number) => any; + /** + * Callback to be invoked when test execution is complete. + * + * @callback DoneCB + * @param {number} failures - Number of failures that occurred. + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff index 3a136c55..36259d76 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff @@ -26,4 +26,31 @@ + * + * @callback DoneCB + * @param {number} failures - Number of failures that occurred. -+ */ \ No newline at end of file ++ */ ++ ++ ++//// [DtsFileErrors] ++ ++ ++out/source.d.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++ ++ ++==== out/source.d.ts (1 errors) ==== ++ export = MyClass; ++ ~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ++ declare function MyClass(): void; ++ declare namespace MyClass { ++ var staticMethod: () => void; ++ } ++ declare namespace MyClass { ++ var staticProperty: number; ++ } ++ export type DoneCB = (failures: number) => any; ++ /** ++ * Callback to be invoked when test execution is complete. ++ * ++ * @callback DoneCB ++ * @param {number} failures - Number of failures that occurred. ++ */ ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt index e25ccebe..927cd65f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@ -7,10 +7,9 @@ file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. file2.js(6,11): error TS2315: Type 'Object' is not generic. file2.js(12,23): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. -file2.js(28,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== file2.js (4 errors) ==== +==== file2.js (3 errors) ==== const {myTypes} = require('./file.js'); /** @@ -45,8 +44,6 @@ file2.js(28,1): error TS2309: An export assignment cannot be used in a module wi } module.exports = {testFn, testFnTypes}; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ==== file.js (6 errors) ==== /** * @namespace myTypes diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff index 516be886..e1c0b8a4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff @@ -11,10 +11,9 @@ +file2.js(6,11): error TS2315: Type 'Object' is not generic. +file2.js(12,23): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. +file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. -+file2.js(28,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== file2.js (4 errors) ==== ++==== file2.js (3 errors) ==== + const {myTypes} = require('./file.js'); + + /** @@ -49,8 +48,6 @@ + } + + module.exports = {testFn, testFnTypes}; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. +==== file.js (6 errors) ==== + /** + * @namespace myTypes diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt deleted file mode 100644 index 324fb0ae..00000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt +++ /dev/null @@ -1,58 +0,0 @@ -mixed.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== index.js (0 errors) ==== - export {}; // flag file as module - /** - * @typedef {string | number | symbol} PropName - */ - - /** - * Callback - * - * @callback NumberToStringCb - * @param {number} a - * @returns {string} - */ - - /** - * @template T - * @typedef {T & {name: string}} MixinName - */ - - /** - * Identity function - * - * @template T - * @callback Identity - * @param {T} x - * @returns {T} - */ - -==== mixed.js (1 errors) ==== - /** - * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType - */ - /** - * @param {number} x - * @returns {SomeType} - */ - function doTheThing(x) { - return {x: ""+x}; - } - class ExportedThing { - z = "ok" - } - module.exports = { - ~~~~~~~~~~~~~~~~~~ - doTheThing, - ~~~~~~~~~~~~~~~ - ExportedThing, - ~~~~~~~~~~~~~~~~~~ - }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - class LocalThing { - y = "ok" - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff deleted file mode 100644 index 87be54e9..00000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt.diff +++ /dev/null @@ -1,62 +0,0 @@ ---- old.jsDeclarationsTypeAliases.errors.txt -+++ new.jsDeclarationsTypeAliases.errors.txt -@@= skipped -0, +0 lines =@@ -- -+mixed.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== index.js (0 errors) ==== -+ export {}; // flag file as module -+ /** -+ * @typedef {string | number | symbol} PropName -+ */ -+ -+ /** -+ * Callback -+ * -+ * @callback NumberToStringCb -+ * @param {number} a -+ * @returns {string} -+ */ -+ -+ /** -+ * @template T -+ * @typedef {T & {name: string}} MixinName -+ */ -+ -+ /** -+ * Identity function -+ * -+ * @template T -+ * @callback Identity -+ * @param {T} x -+ * @returns {T} -+ */ -+ -+==== mixed.js (1 errors) ==== -+ /** -+ * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType -+ */ -+ /** -+ * @param {number} x -+ * @returns {SomeType} -+ */ -+ function doTheThing(x) { -+ return {x: ""+x}; -+ } -+ class ExportedThing { -+ z = "ok" -+ } -+ module.exports = { -+ ~~~~~~~~~~~~~~~~~~ -+ doTheThing, -+ ~~~~~~~~~~~~~~~ -+ ExportedThing, -+ ~~~~~~~~~~~~~~~~~~ -+ }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ class LocalThing { -+ y = "ok" -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js index 5655e386..3b8a96a2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js @@ -152,3 +152,68 @@ export = _default; declare class LocalThing { y: string; } + + +//// [DtsFileErrors] + + +out/mixed.d.ts(19,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + +==== out/index.d.ts (0 errors) ==== + export {}; + export type PropName = string | number | symbol; + export type NumberToStringCb = (a: number) => string; + export type MixinName = T & { + name: string; + }; + export type Identity = (x: T) => T; + /** + * @typedef {string | number | symbol} PropName + */ + /** + * Callback + * + * @callback NumberToStringCb + * @param {number} a + * @returns {string} + */ + /** + * @template T + * @typedef {T & {name: string}} MixinName + */ + /** + * Identity function + * + * @template T + * @callback Identity + * @param {T} x + * @returns {T} + */ + +==== out/mixed.d.ts (1 errors) ==== + export type SomeType = { + x: string; + } | number | LocalThing | ExportedThing; + /** + * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType + */ + /** + * @param {number} x + * @returns {SomeType} + */ + declare function doTheThing(x: number): SomeType; + declare class ExportedThing { + z: string; + } + declare const _default: { + doTheThing: typeof doTheThing; + ExportedThing: typeof ExportedThing; + }; + export = _default; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + declare class LocalThing { + y: string; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js.diff index e04dd665..436a6c6d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js.diff @@ -78,4 +78,69 @@ declare class LocalThing { y: string; } --export {}; \ No newline at end of file +-export {}; ++ ++ ++//// [DtsFileErrors] ++ ++ ++out/mixed.d.ts(19,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++ ++ ++==== out/index.d.ts (0 errors) ==== ++ export {}; ++ export type PropName = string | number | symbol; ++ export type NumberToStringCb = (a: number) => string; ++ export type MixinName = T & { ++ name: string; ++ }; ++ export type Identity = (x: T) => T; ++ /** ++ * @typedef {string | number | symbol} PropName ++ */ ++ /** ++ * Callback ++ * ++ * @callback NumberToStringCb ++ * @param {number} a ++ * @returns {string} ++ */ ++ /** ++ * @template T ++ * @typedef {T & {name: string}} MixinName ++ */ ++ /** ++ * Identity function ++ * ++ * @template T ++ * @callback Identity ++ * @param {T} x ++ * @returns {T} ++ */ ++ ++==== out/mixed.d.ts (1 errors) ==== ++ export type SomeType = { ++ x: string; ++ } | number | LocalThing | ExportedThing; ++ /** ++ * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType ++ */ ++ /** ++ * @param {number} x ++ * @returns {SomeType} ++ */ ++ declare function doTheThing(x: number): SomeType; ++ declare class ExportedThing { ++ z: string; ++ } ++ declare const _default: { ++ doTheThing: typeof doTheThing; ++ ExportedThing: typeof ExportedThing; ++ }; ++ export = _default; ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ++ declare class LocalThing { ++ y: string; ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt deleted file mode 100644 index 23837dfb..00000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt +++ /dev/null @@ -1,46 +0,0 @@ -conn.js(11,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -usage.js(11,37): error TS2694: Namespace 'Conn' has no exported member 'Whatever'. -usage.js(16,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== conn.js (1 errors) ==== - /** - * @typedef {string | number} Whatever - */ - - class Conn { - constructor() {} - item = 3; - method() {} - } - - module.exports = Conn; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - -==== usage.js (2 errors) ==== - /** - * @typedef {import("./conn")} Conn - */ - - class Wrap { - /** - * @param {Conn} c - */ - constructor(c) { - this.connItem = c.item; - /** @type {import("./conn").Whatever} */ - ~~~~~~~~ -!!! error TS2694: Namespace 'Conn' has no exported member 'Whatever'. - this.another = ""; - } - } - - module.exports = { - ~~~~~~~~~~~~~~~~~~ - Wrap - ~~~~~~~~ - }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff deleted file mode 100644 index 63315a78..00000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff +++ /dev/null @@ -1,50 +0,0 @@ ---- old.jsDeclarationsTypedefAndImportTypes.errors.txt -+++ new.jsDeclarationsTypedefAndImportTypes.errors.txt -@@= skipped -0, +0 lines =@@ -- -+conn.js(11,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+usage.js(11,37): error TS2694: Namespace 'Conn' has no exported member 'Whatever'. -+usage.js(16,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== conn.js (1 errors) ==== -+ /** -+ * @typedef {string | number} Whatever -+ */ -+ -+ class Conn { -+ constructor() {} -+ item = 3; -+ method() {} -+ } -+ -+ module.exports = Conn; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+==== usage.js (2 errors) ==== -+ /** -+ * @typedef {import("./conn")} Conn -+ */ -+ -+ class Wrap { -+ /** -+ * @param {Conn} c -+ */ -+ constructor(c) { -+ this.connItem = c.item; -+ /** @type {import("./conn").Whatever} */ -+ ~~~~~~~~ -+!!! error TS2694: Namespace 'Conn' has no exported member 'Whatever'. -+ this.another = ""; -+ } -+ } -+ -+ module.exports = { -+ ~~~~~~~~~~~~~~~~~~ -+ Wrap -+ ~~~~~~~~ -+ }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js index d323fab0..a410b3a1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js @@ -84,3 +84,45 @@ declare const _default: { Wrap: typeof Wrap; }; export = _default; + + +//// [DtsFileErrors] + + +out/conn.d.ts(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +out/conn.d.ts(5,10): error TS2304: Cannot find name 'Conn'. +out/usage.d.ts(4,20): error TS1340: Module './conn' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./conn')'? +out/usage.d.ts(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + +==== out/conn.d.ts (2 errors) ==== + /** + * @typedef {string | number} Whatever + */ + export type Whatever = string | number; + export = Conn; + ~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + ~~~~ +!!! error TS2304: Cannot find name 'Conn'. + +==== out/usage.d.ts (2 errors) ==== + /** + * @typedef {import("./conn")} Conn + */ + export type Conn = import("./conn"); + ~~~~~~~~~~~~~~~~ +!!! error TS1340: Module './conn' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./conn')'? + declare class Wrap { + /** + * @param {Conn} c + */ + constructor(c: Conn); + } + declare const _default: { + Wrap: typeof Wrap; + }; + export = _default; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff index 9a56e87f..490a93b4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff @@ -51,4 +51,46 @@ +declare const _default: { + Wrap: typeof Wrap; +}; -+export = _default; \ No newline at end of file ++export = _default; ++ ++ ++//// [DtsFileErrors] ++ ++ ++out/conn.d.ts(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++out/conn.d.ts(5,10): error TS2304: Cannot find name 'Conn'. ++out/usage.d.ts(4,20): error TS1340: Module './conn' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./conn')'? ++out/usage.d.ts(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++ ++ ++==== out/conn.d.ts (2 errors) ==== ++ /** ++ * @typedef {string | number} Whatever ++ */ ++ export type Whatever = string | number; ++ export = Conn; ++ ~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ++ ~~~~ ++!!! error TS2304: Cannot find name 'Conn'. ++ ++==== out/usage.d.ts (2 errors) ==== ++ /** ++ * @typedef {import("./conn")} Conn ++ */ ++ export type Conn = import("./conn"); ++ ~~~~~~~~~~~~~~~~ ++!!! error TS1340: Module './conn' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./conn')'? ++ declare class Wrap { ++ /** ++ * @param {Conn} c ++ */ ++ constructor(c: Conn); ++ } ++ declare const _default: { ++ Wrap: typeof Wrap; ++ }; ++ export = _default; ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types index 09d2acf0..4c335321 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types @@ -50,9 +50,9 @@ class Wrap { /** @type {import("./conn").Whatever} */ this.another = ""; >this.another = "" : "" ->this.another : any +>this.another : import("conn").Whatever >this : this ->another : any +>another : import("conn").Whatever >"" : "" } } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types.diff index 7a952808..993f6185 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types.diff @@ -9,17 +9,7 @@ >exports : typeof Conn >Conn : typeof Conn -@@= skipped -30, +30 lines =@@ - /** @type {import("./conn").Whatever} */ - this.another = ""; - >this.another = "" : "" -->this.another : import("conn").Whatever -+>this.another : any - >this : this -->another : import("conn").Whatever -+>another : any - >"" : "" - } +@@= skipped -38, +38 lines =@@ } module.exports = { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt deleted file mode 100644 index 4c105d69..00000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -LazySet.js(13,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== index.js (0 errors) ==== - const LazySet = require("./LazySet"); - - /** @type {LazySet} */ - const stringSet = undefined; - stringSet.addAll(stringSet); - - -==== LazySet.js (1 errors) ==== - // Comment out this JSDoc, and note that the errors index.js go away. - /** - * @typedef {Object} SomeObject - */ - class LazySet { - /** - * @param {LazySet} iterable - */ - addAll(iterable) {} - [Symbol.iterator]() {} - } - - module.exports = LazySet; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff deleted file mode 100644 index cbea1dc7..00000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.jsDeclarationsTypedefAndLatebound.errors.txt -+++ new.jsDeclarationsTypedefAndLatebound.errors.txt -@@= skipped -0, +0 lines =@@ -- -+LazySet.js(13,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== index.js (0 errors) ==== -+ const LazySet = require("./LazySet"); -+ -+ /** @type {LazySet} */ -+ const stringSet = undefined; -+ stringSet.addAll(stringSet); -+ -+ -+==== LazySet.js (1 errors) ==== -+ // Comment out this JSDoc, and note that the errors index.js go away. -+ /** -+ * @typedef {Object} SomeObject -+ */ -+ class LazySet { -+ /** -+ * @param {LazySet} iterable -+ */ -+ addAll(iterable) {} -+ [Symbol.iterator]() {} -+ } -+ -+ module.exports = LazySet; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt index 0bb4eb94..c9b3566f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@ -1,15 +1,10 @@ -index.js(3,37): error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. -index.js(21,1): error TS2309: An export assignment cannot be used in a module with other exported elements. module.js(24,12): error TS2315: Type 'Object' is not generic. -module.js(27,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== index.js (2 errors) ==== +==== index.js (0 errors) ==== const {taskGroups, taskNameToGroup} = require('./module.js'); /** @typedef {import('./module.js').TaskGroup} TaskGroup */ - ~~~~~~~~~ -!!! error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. /** * @typedef TaskNode @@ -28,9 +23,7 @@ module.js(27,1): error TS2309: An export assignment cannot be used in a module w } module.exports = MainThreadTasks; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== module.js (2 errors) ==== +==== module.js (1 errors) ==== /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ /** @@ -60,11 +53,6 @@ module.js(27,1): error TS2309: An export assignment cannot be used in a module w const taskNameToGroup = {}; module.exports = { - ~~~~~~~~~~~~~~~~~~ taskGroups, - ~~~~~~~~~~~~~~~ taskNameToGroup, - ~~~~~~~~~~~~~~~~~~~~ - }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file + }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff index a95ad05e..7225b551 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff @@ -2,18 +2,13 @@ +++ new.jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@= skipped -0, +0 lines =@@ - -+index.js(3,37): error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. -+index.js(21,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +module.js(24,12): error TS2315: Type 'Object' is not generic. -+module.js(27,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== index.js (2 errors) ==== ++==== index.js (0 errors) ==== + const {taskGroups, taskNameToGroup} = require('./module.js'); + + /** @typedef {import('./module.js').TaskGroup} TaskGroup */ -+ ~~~~~~~~~ -+!!! error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. + + /** + * @typedef TaskNode @@ -32,9 +27,7 @@ + } + + module.exports = MainThreadTasks; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== module.js (2 errors) ==== ++==== module.js (1 errors) ==== + /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ + + /** @@ -64,11 +57,6 @@ + const taskNameToGroup = {}; + + module.exports = { -+ ~~~~~~~~~~~~~~~~~~ + taskGroups, -+ ~~~~~~~~~~~~~~~ + taskNameToGroup, -+ ~~~~~~~~~~~~~~~~~~~~ -+ }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file ++ }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types index 02e415dd..f0c4cfcd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types @@ -26,7 +26,7 @@ class MainThreadTasks { * @param {TaskNode} y */ constructor(x, y){} ->x : any +>x : import("module").TaskGroup >y : TaskNode } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff index 811f187d..9d25d4d5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff @@ -11,15 +11,7 @@ >require : any >'./module.js' : "./module.js" -@@= skipped -23, +23 lines =@@ - * @param {TaskNode} y - */ - constructor(x, y){} -->x : import("module").TaskGroup -+>x : any - >y : TaskNode - } - +@@= skipped -30, +30 lines =@@ module.exports = MainThreadTasks; >module.exports = MainThreadTasks : typeof MainThreadTasks >module.exports : typeof MainThreadTasks @@ -28,7 +20,7 @@ >exports : typeof MainThreadTasks >MainThreadTasks : typeof MainThreadTasks -@@= skipped -58, +58 lines =@@ +@@= skipped -51, +51 lines =@@ /** @type {Object} */ const taskNameToGroup = {}; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt deleted file mode 100644 index d5614f6c..00000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -MC.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== MC.js (1 errors) ==== - const MW = require("./MW"); - - /** @typedef {number} Cictema */ - - module.exports = class MC { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - watch() { - ~~~~~~~~~~~ - return new MW(this); - ~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~ - }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - -==== MW.js (1 errors) ==== - /** @typedef {import("./MC")} MC */ - - class MW { - /** - * @param {MC} compiler the compiler - */ - constructor(compiler) { - this.compiler = compiler; - } - } - - module.exports = MW; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff deleted file mode 100644 index 9e66ced2..00000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.jsdocTypeReferenceToImportOfClassExpression.errors.txt -+++ new.jsdocTypeReferenceToImportOfClassExpression.errors.txt -@@= skipped -0, +0 lines =@@ -- -+MC.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== MC.js (1 errors) ==== -+ const MW = require("./MW"); -+ -+ /** @typedef {number} Cictema */ -+ -+ module.exports = class MC { -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ watch() { -+ ~~~~~~~~~~~ -+ return new MW(this); -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+ } -+ ~~~ -+ }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+==== MW.js (1 errors) ==== -+ /** @typedef {import("./MC")} MC */ -+ -+ class MW { -+ /** -+ * @param {MC} compiler the compiler -+ */ -+ constructor(compiler) { -+ this.compiler = compiler; -+ } -+ } -+ -+ module.exports = MW; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt index 38ff7cb9..c417b8fb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt @@ -1,27 +1,19 @@ -MC.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. MW.js(1,15): error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? -MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== MC.js (1 errors) ==== +==== MC.js (0 errors) ==== const MW = require("./MW"); /** @typedef {number} Meyerhauser */ /** @class */ module.exports = function MC() { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @type {any} */ - ~~~~~~~~~~~~~~~~~~~~~~ var x = {} - ~~~~~~~~~~~~~~ return new MW(x); - ~~~~~~~~~~~~~~~~~~~~~ }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== MW.js (2 errors) ==== +==== MW.js (1 errors) ==== /** @typedef {import("./MC")} MC */ ~~~~~~~~~~~~~~ !!! error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? @@ -36,6 +28,4 @@ MW.js(12,1): error TS2309: An export assignment cannot be used in a module with } module.exports = MW; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff index b9969a5c..9bfe5f46 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff @@ -2,30 +2,22 @@ +++ new.jsdocTypeReferenceToImportOfFunctionExpression.errors.txt @@= skipped -0, +0 lines =@@ - -+MC.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +MW.js(1,15): error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? -+MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== MC.js (1 errors) ==== ++==== MC.js (0 errors) ==== + const MW = require("./MW"); + + /** @typedef {number} Meyerhauser */ + + /** @class */ + module.exports = function MC() { -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /** @type {any} */ -+ ~~~~~~~~~~~~~~~~~~~~~~ + var x = {} -+ ~~~~~~~~~~~~~~ + return new MW(x); -+ ~~~~~~~~~~~~~~~~~~~~~ + }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + -+==== MW.js (2 errors) ==== ++==== MW.js (1 errors) ==== + /** @typedef {import("./MC")} MC */ + ~~~~~~~~~~~~~~ +!!! error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? @@ -40,6 +32,4 @@ + } + + module.exports = MW; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt index 88bbc580..7282ad6b 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt @@ -3,7 +3,6 @@ index.ts(3,24): error TS2694: Namespace '"mod".export=' has no exported member ' index.ts(4,24): error TS2694: Namespace '"mod".export=' has no exported member 'foo'. index.ts(5,24): error TS2694: Namespace '"mod".export=' has no exported member 'qux'. index.ts(6,24): error TS2694: Namespace '"mod".export=' has no exported member 'baz'. -index.ts(7,24): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. index.ts(8,24): error TS2694: Namespace '"mod".export=' has no exported member 'literal'. index.ts(19,31): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. main.js(2,28): error TS2694: Namespace '"mod".export=' has no exported member 'Thing'. @@ -11,36 +10,25 @@ main.js(3,28): error TS2694: Namespace '"mod".export=' has no exported member 'A main.js(4,28): error TS2694: Namespace '"mod".export=' has no exported member 'foo'. main.js(5,28): error TS2694: Namespace '"mod".export=' has no exported member 'qux'. main.js(6,28): error TS2694: Namespace '"mod".export=' has no exported member 'baz'. -main.js(7,28): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. main.js(8,28): error TS2694: Namespace '"mod".export=' has no exported member 'literal'. main.js(20,35): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. -mod.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== mod.js (1 errors) ==== +==== mod.js (0 errors) ==== class Thing { x = 1 } class AnotherThing { y = 2 } function foo() { return 3 } function bar() { return 4 } /** @typedef {() => number} buz */ module.exports = { - ~~~~~~~~~~~~~~~~~~ Thing, - ~~~~~~~~~~ AnotherThing, - ~~~~~~~~~~~~~~~~~ foo, - ~~~~~~~~ qux: bar, - ~~~~~~~~~~~~~ baz() { return 5 }, - ~~~~~~~~~~~~~~~~~~~~~~~ literal: "", - ~~~~~~~~~~~~~~~~ } - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== main.js (8 errors) ==== +==== main.js (7 errors) ==== /** * @param {import("./mod").Thing} a ~~~~~ @@ -58,8 +46,6 @@ mod.js(6,1): error TS2309: An export assignment cannot be used in a module with ~~~ !!! error TS2694: Namespace '"mod".export=' has no exported member 'baz'. * @param {import("./mod").buz} f - ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. * @param {import("./mod").literal} g ~~~~~~~ !!! error TS2694: Namespace '"mod".export=' has no exported member 'literal'. @@ -83,7 +69,7 @@ mod.js(6,1): error TS2309: An export assignment cannot be used in a module with return a.length + b.length + c() + d() + e() + f() + g.length } -==== index.ts (8 errors) ==== +==== index.ts (7 errors) ==== function types( a: import('./mod').Thing, ~~~~~ @@ -101,8 +87,6 @@ mod.js(6,1): error TS2309: An export assignment cannot be used in a module with ~~~ !!! error TS2694: Namespace '"mod".export=' has no exported member 'baz'. f: import('./mod').buz, - ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. g: import('./mod').literal, ~~~~~~~ !!! error TS2694: Namespace '"mod".export=' has no exported member 'literal'. diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff index db60a683..d14e966a 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff @@ -1,10 +1,7 @@ --- old.moduleExportAssignment7.errors.txt +++ new.moduleExportAssignment7.errors.txt -@@= skipped -2, +2 lines =@@ - index.ts(4,24): error TS2694: Namespace '"mod".export=' has no exported member 'foo'. - index.ts(5,24): error TS2694: Namespace '"mod".export=' has no exported member 'qux'. +@@= skipped -4, +4 lines =@@ index.ts(6,24): error TS2694: Namespace '"mod".export=' has no exported member 'baz'. -+index.ts(7,24): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. index.ts(8,24): error TS2694: Namespace '"mod".export=' has no exported member 'literal'. index.ts(19,31): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. +main.js(2,28): error TS2694: Namespace '"mod".export=' has no exported member 'Thing'. @@ -12,40 +9,16 @@ +main.js(4,28): error TS2694: Namespace '"mod".export=' has no exported member 'foo'. +main.js(5,28): error TS2694: Namespace '"mod".export=' has no exported member 'qux'. +main.js(6,28): error TS2694: Namespace '"mod".export=' has no exported member 'baz'. -+main.js(7,28): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. +main.js(8,28): error TS2694: Namespace '"mod".export=' has no exported member 'literal'. main.js(20,35): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. -- -- --==== mod.js (0 errors) ==== -+mod.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== mod.js (1 errors) ==== - class Thing { x = 1 } - class AnotherThing { y = 2 } - function foo() { return 3 } - function bar() { return 4 } - /** @typedef {() => number} buz */ - module.exports = { -+ ~~~~~~~~~~~~~~~~~~ - Thing, -+ ~~~~~~~~~~ - AnotherThing, -+ ~~~~~~~~~~~~~~~~~ - foo, -+ ~~~~~~~~ - qux: bar, -+ ~~~~~~~~~~~~~ + + +@@= skipped -17, +23 lines =@@ baz() { return 5 }, -+ ~~~~~~~~~~~~~~~~~~~~~~~ literal: "", -+ ~~~~~~~~~~~~~~~~ } -==== main.js (1 errors) ==== -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== main.js (8 errors) ==== ++==== main.js (7 errors) ==== /** * @param {import("./mod").Thing} a + ~~~~~ @@ -63,29 +36,9 @@ + ~~~ +!!! error TS2694: Namespace '"mod".export=' has no exported member 'baz'. * @param {import("./mod").buz} f -+ ~~~ -+!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. * @param {import("./mod").literal} g + ~~~~~~~ +!!! error TS2694: Namespace '"mod".export=' has no exported member 'literal'. */ function jstypes(a, b, c, d, e, f, g) { - return a.x + b.y + c() + d() + e() + f() + g.length -@@= skipped -48, +80 lines =@@ - return a.length + b.length + c() + d() + e() + f() + g.length - } - --==== index.ts (7 errors) ==== -+==== index.ts (8 errors) ==== - function types( - a: import('./mod').Thing, - ~~~~~ -@@= skipped -18, +18 lines =@@ - ~~~ - !!! error TS2694: Namespace '"mod".export=' has no exported member 'baz'. - f: import('./mod').buz, -+ ~~~ -+!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. - g: import('./mod').literal, - ~~~~~~~ - !!! error TS2694: Namespace '"mod".export=' has no exported member 'literal'. \ No newline at end of file + return a.x + b.y + c() + d() + e() + f() + g.length \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols index 02c9e60d..09a4648b 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols @@ -126,6 +126,7 @@ function types( f: import('./mod').buz, >f : Symbol(f, Decl(index.ts, 5, 27)) +>buz : Symbol(buz, Decl(mod.js, 4, 4)) g: import('./mod').literal, >g : Symbol(g, Decl(index.ts, 6, 27)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff index 63cbc827..c7c17fd8 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff @@ -30,12 +30,4 @@ ->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } - /** -@@= skipped -71, +65 lines =@@ - - f: import('./mod').buz, - >f : Symbol(f, Decl(index.ts, 5, 27)) -->buz : Symbol(buz, Decl(mod.js, 4, 4)) - - g: import('./mod').literal, - >g : Symbol(g, Decl(index.ts, 6, 27)) \ No newline at end of file + /** \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types index 666bc822..6d017dd7 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types @@ -59,13 +59,13 @@ module.exports = { * @param {import("./mod").literal} g */ function jstypes(a, b, c, d, e, f, g) { ->jstypes : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any +>jstypes : (a: any, b: any, c: any, d: any, e: any, f: import("mod").buz, g: any) => any >a : any >b : any >c : any >d : any >e : any ->f : any +>f : import("mod").buz >g : any return a.x + b.y + c() + d() + e() + f() + g.length @@ -87,8 +87,8 @@ function jstypes(a, b, c, d, e, f, g) { >d : any >e() : any >e : any ->f() : any ->f : any +>f() : number +>f : import("mod").buz >g.length : any >g : any >length : any @@ -141,7 +141,7 @@ function jsvalues(a, b, c, d, e, f, g) { === index.ts === function types( ->types : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any +>types : (a: any, b: any, c: any, d: any, e: any, f: import("mod").buz, g: any) => any a: import('./mod').Thing, >a : any @@ -159,7 +159,7 @@ function types( >e : any f: import('./mod').buz, ->f : any +>f : import("mod").buz g: import('./mod').literal, >g : any @@ -184,8 +184,8 @@ function types( >d : any >e() : any >e : any ->f() : any ->f : any +>f() : number +>f : import("mod").buz >g.length : any >g : any >length : any diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types.diff index 8f88508c..e8567821 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types.diff @@ -19,15 +19,14 @@ ->c : () => number ->d : () => number ->e : () => number -->f : import("mod").buz -->g : string -+>jstypes : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any ++>jstypes : (a: any, b: any, c: any, d: any, e: any, f: import("mod").buz, g: any) => any +>a : any +>b : any +>c : any +>d : any +>e : any -+>f : any + >f : import("mod").buz +->g : string +>g : any return a.x + b.y + c() + d() + e() + f() + g.length @@ -49,11 +48,6 @@ ->d : () => number ->e() : number ->e : () => number -->f() : number -->f : import("mod").buz -->g.length : number -->g : string -->length : number +>a.x + b.y + c() + d() + e() + f() + g.length : any +>a.x + b.y + c() + d() + e() + f() : any +>a.x + b.y + c() + d() + e() : any @@ -72,8 +66,11 @@ +>d : any +>e() : any +>e : any -+>f() : any -+>f : any + >f() : number + >f : import("mod").buz +->g.length : number +->g : string +->length : number +>g.length : any +>g : any +>length : any @@ -94,30 +91,11 @@ === index.ts === function types( ->types : (a: import("./mod").Thing, b: import("./mod").AnotherThing, c: import("./mod").foo, d: import("./mod").qux, e: import("./mod").baz, f: import("./mod").buz, g: import("./mod").literal) => any -+>types : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any ++>types : (a: any, b: any, c: any, d: any, e: any, f: import("mod").buz, g: any) => any a: import('./mod').Thing, >a : any -@@= skipped -18, +18 lines =@@ - >e : any - - f: import('./mod').buz, -->f : import("mod").buz -+>f : any - - g: import('./mod').literal, - >g : any -@@= skipped -25, +25 lines =@@ - >d : any - >e() : any - >e : any -->f() : number -->f : import("mod").buz -+>f() : any -+>f : any - >g.length : any - >g : any - >length : any +@@= skipped -51, +51 lines =@@ } function values( diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).errors.txt deleted file mode 100644 index 2341cc6d..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? - - -==== foo.cjs (0 errors) ==== - exports.foo = "foo" -==== bar.ts (1 errors) ==== - import foo from "./foo.cjs" - ~~~ -!!! error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? - foo.foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).errors.txt.diff deleted file mode 100644 index a23640d3..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesAllowJsCjsFromJs(module=node16).errors.txt -+++ new.nodeModulesAllowJsCjsFromJs(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ -- -+bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? -+ -+ -+==== foo.cjs (0 errors) ==== -+ exports.foo = "foo" -+==== bar.ts (1 errors) ==== -+ import foo from "./foo.cjs" -+ ~~~ -+!!! error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? -+ foo.foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).symbols index e0dacb40..897bc4c9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).symbols @@ -11,5 +11,7 @@ import foo from "./foo.cjs" >foo : Symbol(foo, Decl(bar.ts, 0, 6)) foo.foo; +>foo.foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) >foo : Symbol(foo, Decl(bar.ts, 0, 6)) +>foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).symbols.diff index 60f85982..291a89e2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).symbols.diff @@ -8,11 +8,4 @@ +>exports : Symbol("foo", Decl(foo.cjs, 0, 0)) >foo : Symbol(foo, Decl(foo.cjs, 0, 0)) - === bar.ts === -@@= skipped -8, +8 lines =@@ - >foo : Symbol(foo, Decl(bar.ts, 0, 6)) - - foo.foo; -->foo.foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) - >foo : Symbol(foo, Decl(bar.ts, 0, 6)) -->foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) + === bar.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).types index 44070dc1..6a7052f1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).types @@ -10,10 +10,10 @@ exports.foo = "foo" === bar.ts === import foo from "./foo.cjs" ->foo : any +>foo : typeof foo foo.foo; ->foo.foo : any ->foo : any ->foo : any +>foo.foo : "foo" +>foo : typeof foo +>foo : "foo" diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).types.diff deleted file mode 100644 index 6a619455..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node16).types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesAllowJsCjsFromJs(module=node16).types -+++ new.nodeModulesAllowJsCjsFromJs(module=node16).types -@@= skipped -9, +9 lines =@@ - - === bar.ts === - import foo from "./foo.cjs" -->foo : typeof foo -+>foo : any - - foo.foo; -->foo.foo : "foo" -->foo : typeof foo -->foo : "foo" -+>foo.foo : any -+>foo : any -+>foo : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt deleted file mode 100644 index 2341cc6d..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? - - -==== foo.cjs (0 errors) ==== - exports.foo = "foo" -==== bar.ts (1 errors) ==== - import foo from "./foo.cjs" - ~~~ -!!! error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? - foo.foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt.diff deleted file mode 100644 index 17c98e1a..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesAllowJsCjsFromJs(module=node18).errors.txt -+++ new.nodeModulesAllowJsCjsFromJs(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? -+ -+ -+==== foo.cjs (0 errors) ==== -+ exports.foo = "foo" -+==== bar.ts (1 errors) ==== -+ import foo from "./foo.cjs" -+ ~~~ -+!!! error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? -+ foo.foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).symbols index e0dacb40..897bc4c9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).symbols @@ -11,5 +11,7 @@ import foo from "./foo.cjs" >foo : Symbol(foo, Decl(bar.ts, 0, 6)) foo.foo; +>foo.foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) >foo : Symbol(foo, Decl(bar.ts, 0, 6)) +>foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).symbols.diff index a8478e44..5cca1b54 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).symbols.diff @@ -8,11 +8,4 @@ +>exports : Symbol("foo", Decl(foo.cjs, 0, 0)) >foo : Symbol(foo, Decl(foo.cjs, 0, 0)) - === bar.ts === -@@= skipped -8, +8 lines =@@ - >foo : Symbol(foo, Decl(bar.ts, 0, 6)) - - foo.foo; -->foo.foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) - >foo : Symbol(foo, Decl(bar.ts, 0, 6)) -->foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) + === bar.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).types index 44070dc1..6a7052f1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).types @@ -10,10 +10,10 @@ exports.foo = "foo" === bar.ts === import foo from "./foo.cjs" ->foo : any +>foo : typeof foo foo.foo; ->foo.foo : any ->foo : any ->foo : any +>foo.foo : "foo" +>foo : typeof foo +>foo : "foo" diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).types.diff deleted file mode 100644 index 864c2f58..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node18).types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesAllowJsCjsFromJs(module=node18).types -+++ new.nodeModulesAllowJsCjsFromJs(module=node18).types -@@= skipped -9, +9 lines =@@ - - === bar.ts === - import foo from "./foo.cjs" -->foo : typeof foo -+>foo : any - - foo.foo; -->foo.foo : "foo" -->foo : typeof foo -->foo : "foo" -+>foo.foo : any -+>foo : any -+>foo : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt deleted file mode 100644 index 2341cc6d..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? - - -==== foo.cjs (0 errors) ==== - exports.foo = "foo" -==== bar.ts (1 errors) ==== - import foo from "./foo.cjs" - ~~~ -!!! error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? - foo.foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff deleted file mode 100644 index a627b9e8..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesAllowJsCjsFromJs(module=node20).errors.txt -+++ new.nodeModulesAllowJsCjsFromJs(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? -+ -+ -+==== foo.cjs (0 errors) ==== -+ exports.foo = "foo" -+==== bar.ts (1 errors) ==== -+ import foo from "./foo.cjs" -+ ~~~ -+!!! error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? -+ foo.foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).symbols index e0dacb40..897bc4c9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).symbols @@ -11,5 +11,7 @@ import foo from "./foo.cjs" >foo : Symbol(foo, Decl(bar.ts, 0, 6)) foo.foo; +>foo.foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) >foo : Symbol(foo, Decl(bar.ts, 0, 6)) +>foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).symbols.diff index 1fb8a2a3..6abbea03 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).symbols.diff @@ -8,11 +8,4 @@ +>exports : Symbol("foo", Decl(foo.cjs, 0, 0)) >foo : Symbol(foo, Decl(foo.cjs, 0, 0)) - === bar.ts === -@@= skipped -8, +8 lines =@@ - >foo : Symbol(foo, Decl(bar.ts, 0, 6)) - - foo.foo; -->foo.foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) - >foo : Symbol(foo, Decl(bar.ts, 0, 6)) -->foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) + === bar.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).types index 44070dc1..6a7052f1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).types @@ -10,10 +10,10 @@ exports.foo = "foo" === bar.ts === import foo from "./foo.cjs" ->foo : any +>foo : typeof foo foo.foo; ->foo.foo : any ->foo : any ->foo : any +>foo.foo : "foo" +>foo : typeof foo +>foo : "foo" diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).types.diff deleted file mode 100644 index 53d48aed..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesAllowJsCjsFromJs(module=node20).types -+++ new.nodeModulesAllowJsCjsFromJs(module=node20).types -@@= skipped -9, +9 lines =@@ - - === bar.ts === - import foo from "./foo.cjs" -->foo : typeof foo -+>foo : any - - foo.foo; -->foo.foo : "foo" -->foo : typeof foo -->foo : "foo" -+>foo.foo : any -+>foo : any -+>foo : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).errors.txt deleted file mode 100644 index 2341cc6d..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? - - -==== foo.cjs (0 errors) ==== - exports.foo = "foo" -==== bar.ts (1 errors) ==== - import foo from "./foo.cjs" - ~~~ -!!! error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? - foo.foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).errors.txt.diff deleted file mode 100644 index 088b216a..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesAllowJsCjsFromJs(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsCjsFromJs(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? -+ -+ -+==== foo.cjs (0 errors) ==== -+ exports.foo = "foo" -+==== bar.ts (1 errors) ==== -+ import foo from "./foo.cjs" -+ ~~~ -+!!! error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? -+ foo.foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).symbols index e0dacb40..897bc4c9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).symbols @@ -11,5 +11,7 @@ import foo from "./foo.cjs" >foo : Symbol(foo, Decl(bar.ts, 0, 6)) foo.foo; +>foo.foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) >foo : Symbol(foo, Decl(bar.ts, 0, 6)) +>foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).symbols.diff index 2a232eef..ce3c33d5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).symbols.diff @@ -8,11 +8,4 @@ +>exports : Symbol("foo", Decl(foo.cjs, 0, 0)) >foo : Symbol(foo, Decl(foo.cjs, 0, 0)) - === bar.ts === -@@= skipped -8, +8 lines =@@ - >foo : Symbol(foo, Decl(bar.ts, 0, 6)) - - foo.foo; -->foo.foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) - >foo : Symbol(foo, Decl(bar.ts, 0, 6)) -->foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) + === bar.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).types index 44070dc1..6a7052f1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).types @@ -10,10 +10,10 @@ exports.foo = "foo" === bar.ts === import foo from "./foo.cjs" ->foo : any +>foo : typeof foo foo.foo; ->foo.foo : any ->foo : any ->foo : any +>foo.foo : "foo" +>foo : typeof foo +>foo : "foo" diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).types.diff deleted file mode 100644 index 336e608d..00000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=nodenext).types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesAllowJsCjsFromJs(module=nodenext).types -+++ new.nodeModulesAllowJsCjsFromJs(module=nodenext).types -@@= skipped -9, +9 lines =@@ - - === bar.ts === - import foo from "./foo.cjs" -->foo : typeof foo -+>foo : any - - foo.foo; -->foo.foo : "foo" -->foo : typeof foo -->foo : "foo" -+>foo.foo : any -+>foo : any -+>foo : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node18).errors.txt index 68c11a8b..b45fab9f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node18).errors.txt @@ -1,4 +1,3 @@ -/5.cjs(1,8): error TS1192: Module '"/2"' has no default export. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. @@ -15,10 +14,8 @@ ==== /4.cjs (0 errors) ==== ; -==== /5.cjs (2 errors) ==== +==== /5.cjs (1 errors) ==== import two from "./2.cjs"; // ok - ~~~ -!!! error TS1192: Module '"/2"' has no default export. import three from "./3.cjs"; // error ~~~~~ !!! error TS1192: Module '"/3"' has no default export. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node18).errors.txt.diff index 38143f0c..7c2f8c31 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node18).errors.txt.diff @@ -2,11 +2,10 @@ +++ new.nodeModulesCJSEmit1(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -/3.cjs(2,1): error TS2304: Cannot find name 'exports'. -+/5.cjs(1,8): error TS1192: Module '"/2"' has no default export. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. -@@= skipped -7, +7 lines =@@ +@@= skipped -7, +6 lines =@@ ==== /2.cjs (0 errors) ==== exports.foo = 0; @@ -18,13 +17,4 @@ -!!! error TS2304: Cannot find name 'exports'. ==== /4.cjs (0 errors) ==== - ; - --==== /5.cjs (1 errors) ==== -+==== /5.cjs (2 errors) ==== - import two from "./2.cjs"; // ok -+ ~~~ -+!!! error TS1192: Module '"/2"' has no default export. - import three from "./3.cjs"; // error - ~~~~~ - !!! error TS1192: Module '"/3"' has no default export. \ No newline at end of file + ; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt index 68c11a8b..b45fab9f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt @@ -1,4 +1,3 @@ -/5.cjs(1,8): error TS1192: Module '"/2"' has no default export. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. @@ -15,10 +14,8 @@ ==== /4.cjs (0 errors) ==== ; -==== /5.cjs (2 errors) ==== +==== /5.cjs (1 errors) ==== import two from "./2.cjs"; // ok - ~~~ -!!! error TS1192: Module '"/2"' has no default export. import three from "./3.cjs"; // error ~~~~~ !!! error TS1192: Module '"/3"' has no default export. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff index 6e13ad03..1d9299e9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff @@ -2,11 +2,10 @@ +++ new.nodeModulesCJSEmit1(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -/3.cjs(2,1): error TS2304: Cannot find name 'exports'. -+/5.cjs(1,8): error TS1192: Module '"/2"' has no default export. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. -@@= skipped -7, +7 lines =@@ +@@= skipped -7, +6 lines =@@ ==== /2.cjs (0 errors) ==== exports.foo = 0; @@ -18,13 +17,4 @@ -!!! error TS2304: Cannot find name 'exports'. ==== /4.cjs (0 errors) ==== - ; - --==== /5.cjs (1 errors) ==== -+==== /5.cjs (2 errors) ==== - import two from "./2.cjs"; // ok -+ ~~~ -+!!! error TS1192: Module '"/2"' has no default export. - import three from "./3.cjs"; // error - ~~~~~ - !!! error TS1192: Module '"/3"' has no default export. \ No newline at end of file + ; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=nodenext).errors.txt index 68c11a8b..b45fab9f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=nodenext).errors.txt @@ -1,4 +1,3 @@ -/5.cjs(1,8): error TS1192: Module '"/2"' has no default export. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. @@ -15,10 +14,8 @@ ==== /4.cjs (0 errors) ==== ; -==== /5.cjs (2 errors) ==== +==== /5.cjs (1 errors) ==== import two from "./2.cjs"; // ok - ~~~ -!!! error TS1192: Module '"/2"' has no default export. import three from "./3.cjs"; // error ~~~~~ !!! error TS1192: Module '"/3"' has no default export. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=nodenext).errors.txt.diff index 040e7289..ad48066f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=nodenext).errors.txt.diff @@ -2,11 +2,10 @@ +++ new.nodeModulesCJSEmit1(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -/3.cjs(2,1): error TS2304: Cannot find name 'exports'. -+/5.cjs(1,8): error TS1192: Module '"/2"' has no default export. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. -@@= skipped -7, +7 lines =@@ +@@= skipped -7, +6 lines =@@ ==== /2.cjs (0 errors) ==== exports.foo = 0; @@ -18,13 +17,4 @@ -!!! error TS2304: Cannot find name 'exports'. ==== /4.cjs (0 errors) ==== - ; - --==== /5.cjs (1 errors) ==== -+==== /5.cjs (2 errors) ==== - import two from "./2.cjs"; // ok -+ ~~~ -+!!! error TS1192: Module '"/2"' has no default export. - import three from "./3.cjs"; // error - ~~~~~ - !!! error TS1192: Module '"/3"' has no default export. \ No newline at end of file + ; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node16).errors.txt index cd6427d4..e75e2ebe 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node16).errors.txt @@ -1,8 +1,11 @@ +/index.ts(1,45): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -==== /index.ts (1 errors) ==== +==== /index.ts (2 errors) ==== /// + ~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. foo; // bad resolution mode, which resolves is arbitrary ~~~ !!! error TS2304: Cannot find name 'foo'. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node16).errors.txt.diff index 48809371..0da994ce 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node16).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node16).errors.txt.diff @@ -2,14 +2,14 @@ +++ new.nodeModulesTripleSlashReferenceModeOverrideModeError(module=node16).errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(1,23): error TS1453: `resolution-mode` should be either `require` or `import`. ++/index.ts(1,45): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(2,1): error TS2304: Cannot find name 'foo'. --==== /index.ts (2 errors) ==== -+==== /index.ts (1 errors) ==== + ==== /index.ts (2 errors) ==== /// - ~~~ --!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~ + !!! error TS1453: `resolution-mode` should be either `require` or `import`. foo; // bad resolution mode, which resolves is arbitrary - ~~~ - !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file + ~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt index cd6427d4..e75e2ebe 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt @@ -1,8 +1,11 @@ +/index.ts(1,45): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -==== /index.ts (1 errors) ==== +==== /index.ts (2 errors) ==== /// + ~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. foo; // bad resolution mode, which resolves is arbitrary ~~~ !!! error TS2304: Cannot find name 'foo'. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt.diff index 12678876..190fefa1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt.diff @@ -2,14 +2,14 @@ +++ new.nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(1,23): error TS1453: `resolution-mode` should be either `require` or `import`. ++/index.ts(1,45): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(2,1): error TS2304: Cannot find name 'foo'. --==== /index.ts (2 errors) ==== -+==== /index.ts (1 errors) ==== + ==== /index.ts (2 errors) ==== /// - ~~~ --!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~ + !!! error TS1453: `resolution-mode` should be either `require` or `import`. foo; // bad resolution mode, which resolves is arbitrary - ~~~ - !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file + ~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt index cd6427d4..e75e2ebe 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt @@ -1,8 +1,11 @@ +/index.ts(1,45): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -==== /index.ts (1 errors) ==== +==== /index.ts (2 errors) ==== /// + ~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. foo; // bad resolution mode, which resolves is arbitrary ~~~ !!! error TS2304: Cannot find name 'foo'. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff index 7302a4c5..8dfde3b0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff @@ -2,14 +2,14 @@ +++ new.nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(1,23): error TS1453: `resolution-mode` should be either `require` or `import`. ++/index.ts(1,45): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(2,1): error TS2304: Cannot find name 'foo'. --==== /index.ts (2 errors) ==== -+==== /index.ts (1 errors) ==== + ==== /index.ts (2 errors) ==== /// - ~~~ --!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~ + !!! error TS1453: `resolution-mode` should be either `require` or `import`. foo; // bad resolution mode, which resolves is arbitrary - ~~~ - !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file + ~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=nodenext).errors.txt index cd6427d4..e75e2ebe 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=nodenext).errors.txt @@ -1,8 +1,11 @@ +/index.ts(1,45): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -==== /index.ts (1 errors) ==== +==== /index.ts (2 errors) ==== /// + ~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. foo; // bad resolution mode, which resolves is arbitrary ~~~ !!! error TS2304: Cannot find name 'foo'. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=nodenext).errors.txt.diff index d088df75..ed7b37ce 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=nodenext).errors.txt.diff @@ -2,14 +2,14 @@ +++ new.nodeModulesTripleSlashReferenceModeOverrideModeError(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(1,23): error TS1453: `resolution-mode` should be either `require` or `import`. ++/index.ts(1,45): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(2,1): error TS2304: Cannot find name 'foo'. --==== /index.ts (2 errors) ==== -+==== /index.ts (1 errors) ==== + ==== /index.ts (2 errors) ==== /// - ~~~ --!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~ + !!! error TS1453: `resolution-mode` should be either `require` or `import`. foo; // bad resolution mode, which resolves is arbitrary - ~~~ - !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file + ~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt deleted file mode 100644 index cec76975..00000000 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt +++ /dev/null @@ -1,50 +0,0 @@ -mod1.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -use.js(1,29): error TS2694: Namespace 'C' has no exported member 'Both'. - - -==== commonjs.d.ts (0 errors) ==== - declare var module: { exports: any}; -==== mod1.js (1 errors) ==== - /// - /** @typedef {{ type: "a", x: 1 }} A */ - /** @typedef {{ type: "b", y: 1 }} B */ - /** @typedef {A | B} Both */ - module.exports = C - ~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - function C() { - this.p = 1 - } - -==== mod2.js (0 errors) ==== - /// - /** @typedef {{ type: "a", x: 1 }} A */ - /** @typedef {{ type: "b", y: 1 }} B */ - /** @typedef {A | B} Both */ - - export function C() { - this.p = 1 - } - -==== mod3.js (0 errors) ==== - /// - /** @typedef {{ type: "a", x: 1 }} A */ - /** @typedef {{ type: "b", y: 1 }} B */ - /** @typedef {A | B} Both */ - - exports.C = function() { - this.p = 1 - } - -==== use.js (1 errors) ==== - /** @type {import('./mod1').Both} */ - ~~~~ -!!! error TS2694: Namespace 'C' has no exported member 'Both'. - var both1 = { type: 'a', x: 1 }; - /** @type {import('./mod2').Both} */ - var both2 = both1; - /** @type {import('./mod3').Both} */ - var both3 = both2; - - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff deleted file mode 100644 index 09af25bc..00000000 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff +++ /dev/null @@ -1,54 +0,0 @@ ---- old.typedefCrossModule.errors.txt -+++ new.typedefCrossModule.errors.txt -@@= skipped -0, +0 lines =@@ -- -+mod1.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+use.js(1,29): error TS2694: Namespace 'C' has no exported member 'Both'. -+ -+ -+==== commonjs.d.ts (0 errors) ==== -+ declare var module: { exports: any}; -+==== mod1.js (1 errors) ==== -+ /// -+ /** @typedef {{ type: "a", x: 1 }} A */ -+ /** @typedef {{ type: "b", y: 1 }} B */ -+ /** @typedef {A | B} Both */ -+ module.exports = C -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ function C() { -+ this.p = 1 -+ } -+ -+==== mod2.js (0 errors) ==== -+ /// -+ /** @typedef {{ type: "a", x: 1 }} A */ -+ /** @typedef {{ type: "b", y: 1 }} B */ -+ /** @typedef {A | B} Both */ -+ -+ export function C() { -+ this.p = 1 -+ } -+ -+==== mod3.js (0 errors) ==== -+ /// -+ /** @typedef {{ type: "a", x: 1 }} A */ -+ /** @typedef {{ type: "b", y: 1 }} B */ -+ /** @typedef {A | B} Both */ -+ -+ exports.C = function() { -+ this.p = 1 -+ } -+ -+==== use.js (1 errors) ==== -+ /** @type {import('./mod1').Both} */ -+ ~~~~ -+!!! error TS2694: Namespace 'C' has no exported member 'Both'. -+ var both1 = { type: 'a', x: 1 }; -+ /** @type {import('./mod2').Both} */ -+ var both2 = both1; -+ /** @type {import('./mod3').Both} */ -+ var both3 = both2; -+ -+ -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types index 2df8da37..8c1620c5 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types @@ -69,22 +69,22 @@ exports.C = function() { === use.js === /** @type {import('./mod1').Both} */ var both1 = { type: 'a', x: 1 }; ->both1 : any ->{ type: 'a', x: 1 } : { type: string; x: number; } ->type : string +>both1 : import("mod1").Both +>{ type: 'a', x: 1 } : { type: "a"; x: 1; } +>type : "a" >'a' : "a" ->x : number +>x : 1 >1 : 1 /** @type {import('./mod2').Both} */ var both2 = both1; >both2 : import("mod2").Both ->both1 : any +>both1 : import("mod1").A /** @type {import('./mod3').Both} */ var both3 = both2; >both3 : import("mod3").Both ->both2 : import("mod2").Both +>both2 : import("mod2").A diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types.diff index a35eb7c1..d4e725b6 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types.diff @@ -63,32 +63,4 @@ +>this : any >p : any >1 : 1 - } -@@= skipped -17, +17 lines =@@ - === use.js === - /** @type {import('./mod1').Both} */ - var both1 = { type: 'a', x: 1 }; -->both1 : import("mod1").Both -->{ type: 'a', x: 1 } : { type: "a"; x: 1; } -->type : "a" -+>both1 : any -+>{ type: 'a', x: 1 } : { type: string; x: number; } -+>type : string - >'a' : "a" -->x : 1 -+>x : number - >1 : 1 - - /** @type {import('./mod2').Both} */ - var both2 = both1; - >both2 : import("mod2").Both -->both1 : import("mod1").A -+>both1 : any - - /** @type {import('./mod3').Both} */ - var both3 = both2; - >both3 : import("mod3").Both -->both2 : import("mod2").A -+>both2 : import("mod2").Both - - + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt index 88c64603..b5932b5e 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -1,18 +1,13 @@ -mod1.js(7,9): error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. mod1.js(10,1): error TS2300: Duplicate identifier 'export='. mod1.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -mod1.js(20,9): error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. mod1.js(23,1): error TS2741: Property 'Baz' is missing in type '{ Quack: number; }' but required in type '{ Baz: typeof Baz; }'. mod1.js(23,1): error TS2300: Duplicate identifier 'export='. -use.js(2,32): error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (2 errors) ==== +==== use.js (1 errors) ==== var mod = require('./mod1.js'); /** @type {import("./mod1.js").Baz} */ - ~~~ -!!! error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. var b; /** @type {mod.Baz} */ ~~~ @@ -20,7 +15,7 @@ use.js(4,12): error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); -==== mod1.js (6 errors) ==== +==== mod1.js (4 errors) ==== // error /** @typedef {number} Foo */ @@ -28,8 +23,6 @@ use.js(4,12): error TS2503: Cannot find namespace 'mod'. /** @typedef {number} Bar */ exports.Bar = class { } - ~~~ -!!! error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. /** @typedef {number} Baz */ module.exports = { @@ -51,8 +44,6 @@ use.js(4,12): error TS2503: Cannot find namespace 'mod'. /** @typedef {number} Quid */ exports.Quid = 2; - ~~~~ -!!! error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. /** @typedef {number} Quack */ module.exports = { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff index 42d0aaf0..61cd60d2 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt.diff @@ -8,21 +8,16 @@ - - -==== use.js (0 errors) ==== -+mod1.js(7,9): error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. +mod1.js(10,1): error TS2300: Duplicate identifier 'export='. +mod1.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+mod1.js(20,9): error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. +mod1.js(23,1): error TS2741: Property 'Baz' is missing in type '{ Quack: number; }' but required in type '{ Baz: typeof Baz; }'. +mod1.js(23,1): error TS2300: Duplicate identifier 'export='. -+use.js(2,32): error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. +use.js(4,12): error TS2503: Cannot find namespace 'mod'. + + -+==== use.js (2 errors) ==== ++==== use.js (1 errors) ==== var mod = require('./mod1.js'); /** @type {import("./mod1.js").Baz} */ -+ ~~~ -+!!! error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. var b; /** @type {mod.Baz} */ + ~~~ @@ -30,8 +25,7 @@ var bb; var bbb = new mod.Baz(); --==== mod1.js (4 errors) ==== -+==== mod1.js (6 errors) ==== +@@= skipped -15, +18 lines =@@ // error /** @typedef {number} Foo */ @@ -43,8 +37,6 @@ /** @typedef {number} Bar */ exports.Bar = class { } -+ ~~~ -+!!! error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. /** @typedef {number} Baz */ - ~~~ @@ -67,12 +59,7 @@ // ok -@@= skipped -42, +50 lines =@@ - - /** @typedef {number} Quid */ - exports.Quid = 2; -+ ~~~~ -+!!! error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. +@@= skipped -30, +28 lines =@@ /** @typedef {number} Quack */ module.exports = { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols index 9d110aa5..867c83ab 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols @@ -29,7 +29,9 @@ class Foo { } // should error /** @typedef {number} Bar */ exports.Bar = class { } +>exports.Bar : Symbol(Bar, Decl(mod1.js, 5, 4), Decl(mod1.js, 3, 13)) >exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>Bar : Symbol(Bar, Decl(mod1.js, 5, 4), Decl(mod1.js, 3, 13)) /** @typedef {number} Baz */ module.exports = { @@ -49,7 +51,9 @@ var Qux = 2; /** @typedef {number} Quid */ exports.Quid = 2; +>exports.Quid : Symbol(Quid, Decl(mod1.js, 18, 4), Decl(mod1.js, 16, 12)) >exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>Quid : Symbol(Quid, Decl(mod1.js, 18, 4), Decl(mod1.js, 16, 12)) /** @typedef {number} Quack */ module.exports = { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff index 056aa427..5dc7be7e 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff @@ -23,7 +23,9 @@ ->exports.Bar : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) ->exports : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) ->Bar : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) ++>exports.Bar : Symbol(Bar, Decl(mod1.js, 5, 4), Decl(mod1.js, 3, 13)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>Bar : Symbol(Bar, Decl(mod1.js, 5, 4), Decl(mod1.js, 3, 13)) /** @typedef {number} Baz */ module.exports = { @@ -36,7 +38,7 @@ Baz: class { } >Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) -@@= skipped -31, +29 lines =@@ +@@= skipped -31, +31 lines =@@ /** @typedef {number} Qux */ var Qux = 2; @@ -48,7 +50,9 @@ ->exports.Quid : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) ->exports : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) ->Quid : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) ++>exports.Quid : Symbol(Quid, Decl(mod1.js, 18, 4), Decl(mod1.js, 16, 12)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>Quid : Symbol(Quid, Decl(mod1.js, 18, 4), Decl(mod1.js, 16, 12)) /** @typedef {number} Quack */ module.exports = { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types index 9318e46c..e5f7b574 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types @@ -9,7 +9,7 @@ var mod = require('./mod1.js'); /** @type {import("./mod1.js").Baz} */ var b; ->b : any +>b : number /** @type {mod.Baz} */ var bb; @@ -32,9 +32,9 @@ class Foo { } // should error /** @typedef {number} Bar */ exports.Bar = class { } >exports.Bar = class { } : typeof Bar ->exports.Bar : any +>exports.Bar : typeof Bar >exports : typeof import("mod1") ->Bar : any +>Bar : typeof Bar >class { } : typeof Bar /** @typedef {number} Baz */ @@ -60,9 +60,9 @@ var Qux = 2; /** @typedef {number} Quid */ exports.Quid = 2; >exports.Quid = 2 : 2 ->exports.Quid : any +>exports.Quid : 2 >exports : typeof import("mod1") ->Quid : any +>Quid : 2 >2 : 2 /** @typedef {number} Quack */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types.diff index 177416b7..4b5565b7 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types.diff @@ -11,10 +11,7 @@ >require : any >'./mod1.js' : "./mod1.js" - /** @type {import("./mod1.js").Baz} */ - var b; -->b : number -+>b : any +@@= skipped -11, +11 lines =@@ /** @type {mod.Baz} */ var bb; @@ -30,16 +27,13 @@ >Baz : typeof Baz === mod1.js === -@@= skipped -30, +30 lines =@@ - /** @typedef {number} Bar */ +@@= skipped -20, +20 lines =@@ exports.Bar = class { } >exports.Bar = class { } : typeof Bar -->exports.Bar : typeof Bar + >exports.Bar : typeof Bar ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } -->Bar : typeof Bar -+>exports.Bar : any +>exports : typeof import("mod1") -+>Bar : any + >Bar : typeof Bar >class { } : typeof Bar /** @typedef {number} Baz */ @@ -56,15 +50,12 @@ Baz: class { } @@= skipped -28, +28 lines =@@ - /** @typedef {number} Quid */ exports.Quid = 2; >exports.Quid = 2 : 2 -->exports.Quid : 2 + >exports.Quid : 2 ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } -->Quid : 2 -+>exports.Quid : any +>exports : typeof import("mod1") -+>Quid : any + >Quid : 2 >2 : 2 /** @typedef {number} Quack */ diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt deleted file mode 100644 index cb8b1e13..00000000 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -mod2.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== mod2.js (1 errors) ==== - /** @typedef {number} Foo */ - const ns = {}; - ns.Foo = class {} - module.exports = ns; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt.diff index 36296f2c..ae9af081 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt.diff @@ -6,21 +6,16 @@ - - -==== mod2.js (2 errors) ==== -+mod2.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== mod2.js (1 errors) ==== - /** @typedef {number} Foo */ +- /** @typedef {number} Foo */ - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -!!! related TS6203 mod2.js:3:4: 'Foo' was also declared here. - const ns = {}; - ns.Foo = class {} +- const ns = {}; +- ns.Foo = class {} - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -!!! related TS6203 mod2.js:1:23: 'Foo' was also declared here. - module.exports = ns; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - \ No newline at end of file +- module.exports = ns; +- +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt deleted file mode 100644 index a7d9cbb9..00000000 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -mod3.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== mod3.js (1 errors) ==== - /** @typedef {number} Foo */ - class Bar { } - module.exports = { Foo: Bar }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt.diff index d4e73b5e..06306031 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt.diff @@ -6,20 +6,15 @@ - - -==== mod3.js (2 errors) ==== -+mod3.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== mod3.js (1 errors) ==== - /** @typedef {number} Foo */ +- /** @typedef {number} Foo */ - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -!!! related TS6203 mod3.js:3:20: 'Foo' was also declared here. - class Bar { } - module.exports = { Foo: Bar }; +- class Bar { } +- module.exports = { Foo: Bar }; - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -!!! related TS6203 mod3.js:1:23: 'Foo' was also declared here. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - \ No newline at end of file +- +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js b/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js index ecb6d688..bbd565a6 100644 --- a/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js +++ b/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js @@ -106,11 +106,6 @@ import { Nominal } from '../common/nominal'; tsgo --b ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: -common/nominal.js:5:1 - error TS2309: An export assignment cannot be used in a module with other exported elements. - -5 module.exports = {}; -  ~~~~~~~~~~~~~~~~~~~ - sub-project/index.js:1:10 - error TS2305: Module '"../../lib/common/nominal"' has no exported member 'Nominal'. 1 import { Nominal } from '../common/nominal'; @@ -122,10 +117,9 @@ Output::    ~~~~~~~~~ -Found 3 errors in 3 files. +Found 2 errors in 2 files. Errors Files - 1 common/nominal.js:5 1 sub-project-2/index.js:1 1 sub-project/index.js:1 @@ -144,7 +138,7 @@ export = _default; module.exports = {}; //// [/home/src/workspaces/lib/common/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[2],"fileNames":["lib.d.ts","../../solution/common/nominal.js"],"fileInfos":[{"version":"24b4796cd50d1a9aabad1583878c494d-/// \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 readonly species: symbol;\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":"a19075dfba5b2d593b761ed8d8cd526f-/**\n * @template T, Name\n * @typedef {T & {[Symbol.species]: Name}} Nominal\n */\nmodule.exports = {};","signature":"de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n","impliedNodeFormat":1}],"options":{"allowJs":true,"checkJs":true,"composite":true,"declaration":true,"outDir":"..","rootDir":"../../solution","skipLibCheck":true},"semanticDiagnosticsPerFile":[[2,[{"pos":80,"end":99,"code":2309,"category":1,"message":"An export assignment cannot be used in a module with other exported elements."}]]],"latestChangedDtsFile":"./nominal.d.ts"} +{"version":"FakeTSVersion","root":[2],"fileNames":["lib.d.ts","../../solution/common/nominal.js"],"fileInfos":[{"version":"24b4796cd50d1a9aabad1583878c494d-/// \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 readonly species: symbol;\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":"a19075dfba5b2d593b761ed8d8cd526f-/**\n * @template T, Name\n * @typedef {T & {[Symbol.species]: Name}} Nominal\n */\nmodule.exports = {};","signature":"de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n","impliedNodeFormat":1}],"options":{"allowJs":true,"checkJs":true,"composite":true,"declaration":true,"outDir":"..","rootDir":"../../solution","skipLibCheck":true},"latestChangedDtsFile":"./nominal.d.ts"} //// [/home/src/workspaces/lib/common/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -194,22 +188,8 @@ module.exports = {}; "rootDir": "../../solution", "skipLibCheck": true }, - "semanticDiagnosticsPerFile": [ - [ - "../../solution/common/nominal.js", - [ - { - "pos": 80, - "end": 99, - "code": 2309, - "category": 1, - "message": "An export assignment cannot be used in a module with other exported elements." - } - ] - ] - ], "latestChangedDtsFile": "./nominal.d.ts", - "size": 1606 + "size": 1434 } //// [/home/src/workspaces/lib/sub-project-2/index.d.ts] *new* declare const variable: { diff --git a/testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect1.ts b/testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect1.ts new file mode 100644 index 00000000..3dc1a2e4 --- /dev/null +++ b/testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect1.ts @@ -0,0 +1,12 @@ +// @filename: typedefModuleExportsIndirect1.js +// @checkJs: true +// @strict: true +// @outdir: dist +// @declaration: true +/** @typedef {{ a: 1, m: 1 }} C */ +const dummy = 0; +module.exports = dummy; +// @filename: use.js +/** @typedef {import('./typedefModuleExportsIndirect1').C} C */ +/** @type {C} */ +var c diff --git a/testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect2.ts b/testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect2.ts new file mode 100644 index 00000000..bdda5778 --- /dev/null +++ b/testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect2.ts @@ -0,0 +1,12 @@ +// @filename: typedefModuleExportsIndirect2.js +// @checkJs: true +// @strict: true +// @outdir: dist +// @declaration: true +/** @typedef {{ a: 1, m: 1 }} C */ +const f = function() {}; +module.exports = f; +// @filename: use.js +/** @typedef {import('./typedefModuleExportsIndirect2').C} C */ +/** @type {C} */ +var c diff --git a/testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect3.ts b/testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect3.ts new file mode 100644 index 00000000..84c8b573 --- /dev/null +++ b/testdata/tests/cases/conformance/salsa/typedefModuleExportsIndirect3.ts @@ -0,0 +1,12 @@ +// @filename: typedefModuleExportsIndirect3.js +// @checkJs: true +// @strict: true +// @outdir: dist +// @declaration: true +/** @typedef {{ a: 1, m: 1 }} C */ +const o = {}; +module.exports = o; +// @filename: use.js +/** @typedef {import('./typedefModuleExportsIndirect3').C} C */ +/** @type {C} */ +var c