Skip to content

fix: don't lint private-type-ref for pure type alias re-exports#816

Open
crowlbot wants to merge 1 commit into
mainfrom
fix/private-type-ref-type-alias
Open

fix: don't lint private-type-ref for pure type alias re-exports#816
crowlbot wants to merge 1 commit into
mainfrom
fix/private-type-ref-type-alias

Conversation

@crowlbot

@crowlbot crowlbot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Problem

deno doc --lint reports a spurious private-type-ref diagnostic for a type
alias that simply re-names another type:

interface DumperStateOptions {}

export type DumpOptions = DumperStateOptions;
Type 'DumpOptions' references type 'DumperStateOptions' which is not exported
from a root module.

A type alias whose body is just another type reference (export type A = B) is
effectively another name for the referenced type — B is re-exposed through the
alias and should be considered part of the public API, not a private type leaked
into it.

Fix

When collecting the dependencies of an exported symbol, detect declarations that
are pure type aliases — a type X = Y whose body is a bare TsTypeRef with no
type arguments — and flag their references as alias re-exports
(SymbolDeclDeps::is_alias_reexport). The diagnostics collector then skips
emitting private-type-ref for those references.

The referenced type is still included in the generated documentation (it remains
a non-exported public type), so only the spurious lint diagnostic is suppressed.

Tests

  • New spec tests/specs/private_type_via_type_alias.txt pins the reproduction
    from the issue: no diagnostic, with the referenced interface still documented.
  • Updated tests/specs/reexport_deep.txt, which exercises the same
    export type A = B pattern across re-exported modules — its private-type-ref
    diagnostics are now correctly suppressed (the deep re-export resolution it
    primarily tests is unchanged).

Fixes #429

A type alias whose body is just another type reference (e.g.
`export type A = B`) is effectively another name for the referenced
type, re-exposing it through the alias. Treat such a reference as a
re-export rather than a reference to a private type, so it no longer
triggers a spurious `private-type-ref` lint diagnostic. The referenced
type is still included in the generated documentation.
@crowlbot crowlbot requested a review from crowlKats June 9, 2026 20:53
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deno doc --lint should not have diagnostic for type that is exported via type alias

2 participants