Skip to content

Fix export= class visibility alongside top-level export type - #64573

Merged
Wesley Wigham (weswigham) merged 3 commits into
microsoft:mainfrom
weswigham:zodish-class-export-visibility
Oct 1, 2026
Merged

Wesley Wigham (weswigham) merged 3 commits into
microsoft:mainfrom
weswigham:zodish-class-export-visibility

Conversation

@weswigham

Copy link
Copy Markdown
Member

By doing some recursive alias resolution comparison, to handle our now non-terminal aliases.

Fixes #64249

I don't think this is actually a regression, since the declaration file in question was actually an error prior to TS7 and it was just being suppressed by skipLibCheck so it sorta-kinda worked. But! It's supported first-class now (export= merging with top level export type, anyway), so it does actually need fixing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The implementation unwraps only one additional merged alias, leaving longer valid alias chains inaccessible.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

This PR updates symbol accessibility to support export = classes merged with top-level type exports, addressing TS4094.

Changes:

  • Resolves an additional alias during accessibility checks.
  • Adds declaration-emit regression tests across three module modes.
  • Updates affected symbol and type baselines.
File Description
tsc/​internal/​checker/​symbolaccessibility.go Extends alias comparison.
tsc/​testdata/​tests/​cases/​compiler/​declarationEmitDefaultImportPrivateClass.ts Tests default-import visibility.
tsc/​testdata/​tests/​cases/​compiler/​declarationEmitExportAssignmentWithTypeExports.ts Tests export-assignment import forms.
tsc/​testdata/​tests/​cases/​compiler/​declarationEmitMergedExportAlias.ts Tests merged re-export aliases.
tsc/​testdata/​baselines/​reference/​compiler/​cjsExportGenericTypes.types Updates inferred alias names.
tsc/​testdata/​baselines/​reference/​compiler/​exportAssignmentMerging2.symbols Updates symbol names.
tsc/​testdata/​baselines/​reference/​compiler/​exportAssignmentMerging2.types Updates type names.
tsc/​testdata/​baselines/​reference/​compiler/​exportAssignmentMerging3.symbols Updates symbol names.
tsc/​testdata/​baselines/​reference/​compiler/​exportAssignmentMerging3.types Updates type names.
tsc/​testdata/​baselines/​reference/​compiler/​noCrashOnImportShadowing.types Updates inferred aliases.
tsc/​testdata/​baselines/​reference/​conformance/​exportTypeMergedWithExportStarAsNamespace.symbols Updates merged symbols.
tsc/​testdata/​baselines/​reference/​conformance/​exportTypeMergedWithExportStarAsNamespace.types Updates merged types.
tsc/​testdata/​baselines/​reference/​conformance/​importElisionConstEnumMerge1.types Updates enum alias types.
tsc/​testdata/​baselines/​reference/​conformance/​typeAndNamespaceExportMerge.symbols Updates merged symbols.
tsc/​testdata/​baselines/​reference/​conformance/​typeAndNamespaceExportMerge.types Updates merged types.
tsc/​testdata/​baselines/​reference/​compiler/​declarationEmitDefaultImportPrivateClass(module=commonjs).js Adds CommonJS emit baseline.
…(module=commonjs).symbols Adds CommonJS symbol baseline.
…(module=commonjs).types Adds CommonJS type baseline.
…(module=nodenext).js Adds NodeNext emit baseline.
…(module=nodenext).symbols Adds NodeNext symbol baseline.
…(module=nodenext).types Adds NodeNext type baseline.
…(module=preserve).js Adds preserve emit baseline.
…(module=preserve).symbols Adds preserve symbol baseline.
…(module=preserve).types Adds preserve type baseline.
tsc/​testdata/​baselines/​reference/​compiler/​declarationEmitExportAssignmentWithTypeExports(module=commonjs).js Adds CommonJS emit baseline.
…(module=commonjs).symbols Adds CommonJS symbol baseline.
…(module=commonjs).types Adds CommonJS type baseline.
…(module=nodenext).js Adds NodeNext emit baseline.
…(module=nodenext).symbols Adds NodeNext symbol baseline.
…(module=nodenext).types Adds NodeNext type baseline.
…(module=preserve).js Adds preserve emit baseline.
…(module=preserve).symbols Adds preserve symbol baseline.
…(module=preserve).types Adds preserve type baseline.
tsc/​testdata/​baselines/​reference/​compiler/​declarationEmitMergedExportAlias(module=commonjs).js Adds CommonJS emit baseline.
…(module=commonjs).symbols Adds CommonJS symbol baseline.
…(module=commonjs).types Adds CommonJS type baseline.
…(module=nodenext).js Adds NodeNext emit baseline.
…(module=nodenext).symbols Adds NodeNext symbol baseline.
…(module=nodenext).types Adds NodeNext type baseline.
…(module=preserve).js Adds preserve emit baseline.
…(module=preserve).symbols Adds preserve symbol baseline.
…(module=preserve).types Adds preserve type baseline.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread tsc/internal/checker/symbolaccessibility.go Outdated
Comment thread tsc/internal/checker/symbolaccessibility.go Outdated

@jakebailey Jake Bailey (jakebailey) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's actually an AddIfPresent func for these that would work but it's equivalent enough

@weswigham
Wesley Wigham (weswigham) added this pull request to the merge queue Oct 1, 2026
Merged via the queue into microsoft:main with commit af36d53 Oct 1, 2026
29 checks passed
@weswigham
Wesley Wigham (weswigham) deleted the zodish-class-export-visibility branch October 1, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Spurious TS4094 "exported anonymous class type may not be private" error after upgrading from TS6 to TS7

3 participants