Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands CommonJS export = / module.exports support by merging type/namespace-only exports into the export-assignment namespace, relaxing/aligning some restrictions, and updating tests/baselines to reflect the new behavior.
Changes:
- Add new compiler tests covering export-assignment merging in
.tsand@checkJs.jsscenarios. - Update many conformance/compiler baselines to reflect relaxed
module.exportshandling (e.g., removing prior TS1203 errors and updating symbol/type displays). - Add/update baselines for multiple
module.exportsassignments and export-assignment namespace merging.
Reviewed changes
Copilot reviewed 300 out of 302 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| testdata/tests/cases/compiler/exportAssignmentMerging1.ts | New test covering type/namespace merging with export = |
| testdata/tests/cases/compiler/exportAssignmentMerging2.ts | New test covering merging with exported uninstantiated namespace assigned via export = |
| testdata/tests/cases/compiler/exportAssignmentMerging3.ts | New negative test for conflicting type members when merging into exported namespace |
| testdata/tests/cases/compiler/exportAssignmentMerging4.ts | New negative test for value exports alongside export = |
| testdata/tests/cases/compiler/exportAssignmentMerging5.ts | New @checkJs test for typedef merging into module.exports |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt.diff | Baseline update reflecting changed export-assignment error reporting |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt | Baseline removal/update reflecting changed export-assignment errors |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types.diff | Baseline update for module symbol/type display ("export=") |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt.diff | Baseline update removing TS1203 export-assignment errors |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt | Baseline removal/update removing TS1203 export-assignment errors |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule.types.diff | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule.types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt.diff | Baseline update removing TS1203 export-assignment errors |
| testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt | Baseline update removing TS1203 export-assignment errors |
| testdata/baselines/reference/submodule/conformance/typeTagModuleExports.errors.txt.diff | Baseline update for export-assignment error set |
| testdata/baselines/reference/submodule/conformance/typeTagModuleExports.errors.txt | Baseline update for export-assignment error set |
| testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt.diff | Baseline update for export-assignment error set |
| testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt | Baseline update for export-assignment error set |
| testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.errors.txt.diff | Baseline update for export-assignment error set |
| testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.errors.txt | Baseline update for export-assignment error set |
| testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.errors.txt.diff | Baseline update for export-assignment error set |
| testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.errors.txt | Baseline update for export-assignment error set |
| testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt | Baseline update removing TS1203 in file.js path |
| testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt | Baseline update removing TS1203 in file.js path |
| testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node18).errors.txt | Baseline update removing TS1203 in file.js path |
| testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt | Baseline update removing TS1203 in file.js path |
| testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt.diff | Baseline update removing TS1203 in mod.js |
| testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt | Baseline update removing TS1203 in mod.js |
| testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.errors.txt.diff | Baseline update removing TS1203-only failure |
| testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.errors.txt | Baseline update removing TS1203-only failure |
| testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt.diff | Baseline update removing TS1231 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt | Baseline update removing TS1231 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAlias4.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAlias4.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/moduleExportAlias3.errors.txt.diff | Baseline update removing TS1203-only failure |
| testdata/baselines/reference/submodule/conformance/moduleExportAlias3.errors.txt | Baseline update removing TS1203-only failure |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceExports.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsdocImportType2.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsdocImportType.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types.diff | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types.diff | Baseline update for module type display and import typedef resolution |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types | Baseline update for module type display and import typedef resolution |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences(target=es2015).js.diff | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences(target=es2015).js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences(target=es2015).errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReferences(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.js.diff | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.errors.txt.diff | Baseline update (error output removed) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.errors.txt | Baseline update (error output removed) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.js.diff | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.js.diff | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson(target=es2015).js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).js.diff | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt | Baseline update removing TS18042 error line |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic(target=es2015).types.diff | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic(target=es2015).types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic(target=es2015).symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic(target=es2015).symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic(target=es2015).errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment(target=es2015).types.diff | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment(target=es2015).types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment(target=es2015).symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment(target=es2015).symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments(target=es2015).errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments(target=es2015).errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentWithKeywordName(target=es2015).errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentWithKeywordName(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary(target=es2015).errors.txt | Baseline update removing TS1203 and adjusting caret output |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility(target=es2015).js.diff | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility(target=es2015).js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility(target=es2015).errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3(target=es2015).errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3(target=es2015).errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance2(target=es2015).errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance2(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance1(target=es2015).errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance1(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing(target=es2015).errors.txt.diff | Baseline update removing TS1203 and adjusting caret output |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing(target=es2015).errors.txt | Baseline update removing TS1203 and adjusting caret output |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub(target=es2015).errors.txt | Baseline update removing TS1203 and adjusting caret output |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous(target=es2015).errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression(target=es2015).errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsDocCommentsOnConsts(target=es2015).errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsDocCommentsOnConsts(target=es2015).errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic(target=es2015).types.diff | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic(target=es2015).types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic(target=es2015).symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic(target=es2015).symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic(target=es2015).errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic(target=es2015).errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility(target=es2015).errors.txt | Baseline update removing TS1203 in bar.js and adjusting counts |
| testdata/baselines/reference/submodule/conformance/importAliasModuleExports.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/importAliasModuleExports.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/globalMergeWithCommonJSAssignmentDeclaration.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/globalMergeWithCommonJSAssignmentDeclaration.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/enumTagOnExports2.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/enumTagOnExports2.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.errors.txt.diff | Baseline update removing TS1203 and adjusting caret output |
| testdata/baselines/reference/submodule/conformance/contextualTypedSpecialAssignment.errors.txt | Baseline update removing TS1203 and adjusting caret output |
| testdata/baselines/reference/submodule/conformance/conflictingCommonJSES2015Exports.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/conflictingCommonJSES2015Exports.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/commonJSReexport.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/commonJSReexport.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/callbackCrossModule.types.diff | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/callbackCrossModule.types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols.diff | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.errors.txt.diff | Baseline update removing TS1231 nested export-assignment error |
| testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.errors.txt | Baseline update removing TS1231 nested export-assignment error |
| testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types.diff | Baseline update for symbol self-references in type printing |
| testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types | Baseline update for symbol self-references in type printing |
| testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation2.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation2.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation.errors.txt.diff | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation.errors.txt | Baseline update removing TS1203 and adjusting error counts |
| testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedArray.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedArray.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/incompatibleExports2.errors.txt.diff | Baseline update (now empty) |
| testdata/baselines/reference/submodule/compiler/incompatibleExports2.errors.txt | Baseline update (removed) |
| testdata/baselines/reference/submodule/compiler/incompatibleExports1.types.diff | Baseline update for namespace type display |
| testdata/baselines/reference/submodule/compiler/incompatibleExports1.types | Baseline update for namespace type display |
| testdata/baselines/reference/submodule/compiler/incompatibleExports1.errors.txt.diff | Baseline update removing one TS2309 instance |
| testdata/baselines/reference/submodule/compiler/incompatibleExports1.errors.txt | Baseline update removing one TS2309 instance |
| testdata/baselines/reference/submodule/compiler/importNonExportedMember12.errors.txt.diff | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/importNonExportedMember12.errors.txt | Baseline update removing TS1203-only failures |
| testdata/baselines/reference/submodule/compiler/importDeclWithExportModifierAndExportAssignmentInAmbientContext.errors.txt.diff | Baseline update (now empty) |
| testdata/baselines/reference/submodule/compiler/importDeclWithExportModifierAndExportAssignmentInAmbientContext.errors.txt | Baseline update (removed) |
| testdata/baselines/reference/submodule/compiler/importDeclWithExportModifierAndExportAssignment.errors.txt.diff | Baseline update removing TS2309 instance |
| testdata/baselines/reference/submodule/compiler/importDeclWithExportModifierAndExportAssignment.errors.txt | Baseline update removing TS2309 instance |
| testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt.diff | Baseline update removing TS1231-only failure |
| testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt | Baseline update removing TS1231-only failure |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect3.errors.txt | Baseline update removing TS1203-only failure |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect2.errors.txt | Baseline update removing TS1203-only failure |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.types | Baseline update for module type display ("export=") |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.symbols | Baseline update for symbol binding locations |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.js | Baseline update (now includes DtsFileErrors segment) |
| testdata/baselines/reference/conformance/typedefModuleExportsIndirect1.errors.txt | Baseline update removing TS1203-only failure |
| testdata/baselines/reference/compiler/nestedJSDocImportType.errors.txt | Baseline update removing TS1203 and adjusting caret output |
| testdata/baselines/reference/compiler/multipleModuleExportsAssignments.js | New baseline for multiple module.exports assignments |
| testdata/baselines/reference/compiler/exportAssignmentMerging6.js | New baseline output for JS export-assignment merging with value export error |
| testdata/baselines/reference/compiler/exportAssignmentMerging6.errors.txt | New baseline error output for export-assignment + value export conflict |
| testdata/baselines/reference/compiler/exportAssignmentMerging5.types | New baseline types output for @checkJs typedef merge with module.exports |
| testdata/baselines/reference/compiler/exportAssignmentMerging5.symbols | New baseline symbols output for @checkJs typedef merge with module.exports |
| testdata/baselines/reference/compiler/exportAssignmentMerging5.js | New baseline output for @checkJs typedef merge with module.exports |
| testdata/baselines/reference/compiler/exportAssignmentMerging4.js | New baseline output for negative TS export/value conflict case |
| testdata/baselines/reference/compiler/exportAssignmentMerging4.errors.txt | New baseline error output for negative TS export/value conflict case |
| testdata/baselines/reference/compiler/exportAssignmentMerging3.errors.txt | New baseline error output for negative merge conflict case |
| testdata/baselines/reference/compiler/exportAssignmentMerging2.types | New baseline types output for namespace assigned via export = |
| testdata/baselines/reference/compiler/exportAssignmentMerging2.js | New baseline output for namespace assigned via export = |
| testdata/baselines/reference/compiler/exportAssignmentMerging1.types | New baseline types output for type/namespace merging into export assignment |
| testdata/baselines/reference/compiler/exportAssignmentMerging1.js | New baseline output for type/namespace merging into export assignment |
| testdata/baselines/reference/compiler/erasableSyntaxOnlyJS.errors.txt | Baseline update removing TS1203 export-assignment error in JS |
| @@ -0,0 +1,14 @@ | |||
| // @module: commonjs | |||
| // @declaration: true | |||
There was a problem hiding this comment.
New compiler tests should generally enable // @strict: true unless the behavior under test is specifically about non-strict mode. Please add // @strict: true near the top (and consider applying the same update to the other newly added exportAssignmentMerging*.ts tests in this PR).
| // @declaration: true | |
| // @declaration: true | |
| // @strict: true |
There was a problem hiding this comment.
No need, // @strict: true is the default in Corsa.
| @@ -0,0 +1,15 @@ | |||
| // @module: commonjs | |||
| // @declaration: true | |||
There was a problem hiding this comment.
This new test runs in @checkJs mode but doesn't enable // @strict: true. To keep new coverage consistent and to catch regressions earlier, add // @strict: true unless this scenario is intentionally exercising non-strict behavior.
| // @declaration: true | |
| // @declaration: true | |
| // @strict: true |
| out/conn.d.ts(5,10): error TS2304: Cannot find name 'Conn'. | ||
|
|
||
|
|
||
| ==== out/conn.d.ts (1 errors) ==== |
There was a problem hiding this comment.
The updated baseline now reports a declaration-emit error where the generated .d.ts contains export = Conn; but no corresponding declare class Conn/declare const Conn in that output. That strongly suggests the binder/emitter lost the value declaration for the export-assigned symbol (or is emitting export = <identifier> without emitting the identifier’s declaration). Consider ensuring the export assignment keeps a usable ValueDeclaration for the exported entity (e.g., preserve the original class/function/var declaration as the value declaration) so the declaration emitter can emit the exported symbol before export =.
| export type Whatever = string | number; | ||
| export = Conn; | ||
| ~~~~ | ||
| !!! error TS2304: Cannot find name 'Conn'. |
There was a problem hiding this comment.
The updated baseline now reports a declaration-emit error where the generated .d.ts contains export = Conn; but no corresponding declare class Conn/declare const Conn in that output. That strongly suggests the binder/emitter lost the value declaration for the export-assigned symbol (or is emitting export = <identifier> without emitting the identifier’s declaration). Consider ensuring the export assignment keeps a usable ValueDeclaration for the exported entity (e.g., preserve the original class/function/var declaration as the value declaration) so the declaration emitter can emit the exported symbol before export =.
| dist/typedefModuleExportsIndirect1.d.ts(5,10): error TS2304: Cannot find name 'dummy'. | ||
|
|
||
|
|
||
| ==== dist/typedefModuleExportsIndirect1.d.ts (1 errors) ==== | ||
| export type C = { |
There was a problem hiding this comment.
Similar to the Conn case, this baseline introduces a .d.ts emit error where export = dummy; is emitted without any declaration for dummy in the .d.ts. If this PR’s export-assignment merging changes alter how the exported symbol’s declaration is selected (e.g., preferring the assignment node over the original variable/function declaration), the declaration emitter may no longer have a declaration to print. A concrete fix is to make sure the emitted .d.ts declares the exported binding (e.g., declare const dummy: ...;) or to emit an anonymous _default symbol for object/function/class exports when the original name isn’t directly emit-able.
| export = dummy; | ||
| ~~~~~ | ||
| !!! error TS2304: Cannot find name 'dummy'. |
There was a problem hiding this comment.
Similar to the Conn case, this baseline introduces a .d.ts emit error where export = dummy; is emitted without any declaration for dummy in the .d.ts. If this PR’s export-assignment merging changes alter how the exported symbol’s declaration is selected (e.g., preferring the assignment node over the original variable/function declaration), the declaration emitter may no longer have a declaration to print. A concrete fix is to make sure the emitted .d.ts declares the exported binding (e.g., declare const dummy: ...;) or to emit an anonymous _default symbol for object/function/class exports when the original name isn’t directly emit-able.
|
@weswigham We already have an issue around declaration file generation for CommonJS modules with const dummy = 0;
module.exports = dummy;generates an invalid declaration file (an actual declaration of export = dummy;(EDIT: The above has now been fixed.) Furthermore, with this PR we'll permit multiple |
internal/binder/binder.go
Outdated
| symbol := b.declareSymbol(ast.GetExports(container.Symbol()), container.Symbol(), node, flags, ast.SymbolFlagsAll) | ||
| symbol := b.declareSymbol(ast.GetExports(container.Symbol()), container.Symbol(), node, flags, core.IfElse(ast.IsJSExportAssignment(node), 0, ast.SymbolFlagsAll)) | ||
| if ast.IsJSExportAssignment(node) || node.AsExportAssignment().IsExportEquals { | ||
| // Will be an error later, since the module already has other exports. Just make sure this has a valueDeclaration set. |
There was a problem hiding this comment.
I think this is no longer true for JSExportAssignments, right?
| // Will be an error later, since the module already has other exports. Just make sure this has a valueDeclaration set. | |
| // This may be an error later, since the module already has other exports. | |
| // Just make sure this has a valueDeclaration set. |
|
Latest commits fixes the issue in the example here. However, as can be seen in this test, the declaration emitter doesn't properly handle nested |
|
That's incorrect - that's a stub in corsa because it's unused, and should continue to be, since we don't do semantic js declaration emit, but syntactic emit, same as TS, now. If we want to support non-top-level export assignments in corsa, we need to add a non-top-level visitor to the declaration emitter transform - it's new logic, and should be part of the initial implementation of the checker logic, too - that's what I've been saying about how "some js checker work has included declaration emit logic and some hasn't, and we'll need to audit what's missing". We're not "waiting to port something" - the strategy is entirely different. Originally, the hope was we'd need no new declaration emitter logic since the reparser was going to handle all those transforms. If we back off that approach, that means you need declaration emitter logic to mimic the checker logic. |
|
I think we have been gradually backing off on that logic, as we discover more things that the reparser can't do (e.g., the defineProperties stuff). |
|
Just to recap, in the design meeting we agreed to merge this PR and create a separate PR to issue errors when generating declaration files for CommonJS modules with constructs that aren't supported by the emitter. Specifically, the following aren't supported when generating declaration files:
|
With this PR, in a CommonJS module with an export assignment (
export =in TS ormodule.exports =in JS) we now overlay type and uninstantiated namespace declarations in the module onto the namespace of the exported entity. An export assignment is in error if (a) the module exports value members or (b) if the module exports type or namespace members and the exported entity also exports type or namespace members.With these changes, the following is now permitted:
This PR furthermore aligns Corsa more closely with Strada as follows:
module.exportsassignments in a file and union the assigned types.module.exportsassignments from stricter checking of TypeScriptexport =declarations.This PR supersedes #2893.