Skip to content

Fix Release Tag Inheritance and Enable Default Tag Insertion#7

Merged
thasso merged 3 commits intomainfrom
more-release-annotations
Nov 27, 2025
Merged

Fix Release Tag Inheritance and Enable Default Tag Insertion#7
thasso merged 3 commits intomainfrom
more-release-annotations

Conversation

@thasso
Copy link
Contributor

@thasso thasso commented Nov 27, 2025

This PR resolves critical issues with TSDoc release tag handling that were causing non-deterministic formatting and API Extractor compatibility problems. The changes enable proper inheritance detection for interface members and automatic default tag insertion for exported APIs with empty comments.

Issues Resolved:

  • 🐛 Non-deterministic Interface Member Tagging
    • Problem: Interface properties incorrectly received @internal tags instead of inheriting from their @public parent interfaces
    • Root Cause: AST analyzer wasn't detecting that interface members should inherit export status from their containers
    • Impact: Formatting was non-idempotent and produced inconsistent results across runs
  • 🚨 Missing Release Tags on Exported APIs
    • Problem: Empty /** */ comments on exported declarations caused API Extractor warnings about missing release annotations
    • Root Cause: TSDoc candidate detection was rejecting empty comments, preventing default tag insertion
    • Impact: API documentation pipelines failed validation

Resolves non-deterministic formatting where interface members incorrectly
received @internal tags instead of inheriting release tags from their parent
interfaces. This issue only occurred in files with multiple exports and
caused formatting to be non-idempotent.

Key changes:
- Enhanced ast-analyzer.ts to properly detect container members and inherit
  export status from parent interfaces/classes
- Fixed format.ts to preserve original release tag state and prevent
  incorrect tag removal from explicitly tagged members
- Added comprehensive inheritance detection with fallback to heuristics
- Ensured formatting operations are deterministic across multiple runs

Includes new test coverage for idempotence scenarios and interface member
inheritance behavior. All existing functionality remains intact.
…rted APIs

Resolves API Extractor compatibility issues where exported declarations with
empty /** */ comments were missing required release annotations. This enables
automatic insertion of default release tags (like @internal) for exported APIs.

Key changes:
- Enhanced TSDoc candidate detection in tsdoc-preprocess.ts to process empty
  comments on exported declarations when defaultReleaseTag is configured
- Added comprehensive example testing pipeline with API Extractor validation
- Created release-annotations.ts example demonstrating automatic tag insertion
- Maintains backward compatibility while enabling full API documentation workflows

The plugin now supports complete TypeScript library documentation pipelines
from empty TSDoc comments to properly annotated APIs that pass API Extractor
validation without warnings.
@thasso thasso merged commit ff980d9 into main Nov 27, 2025
1 check passed
@thasso thasso deleted the more-release-annotations branch November 27, 2025 09:28
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.

1 participant