-
Notifications
You must be signed in to change notification settings - Fork 549
refactor(api-markdown-documenter): Remove DocumentationNodeType
#24769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(api-markdown-documenter): Remove DocumentationNodeType
#24769
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes the DocumentationNodeType enum and replaces its usage with string literal types to simplify type definitions and align with unist patterns.
- Removed all imports and references to DocumentationNodeType
- Updated all node “type” properties to use the corresponding string literal values
- Updated documentation and API reporting files to reflect these changes
Reviewed Changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tools/api-markdown-documenter/src/documentation-domain/OrderedListNode.ts | Replaced DocumentationNodeType.OrderedList with "orderedList" |
tools/api-markdown-documenter/src/documentation-domain/LinkNode.ts | Replaced DocumentationNodeType.Link with "link" |
tools/api-markdown-documenter/src/documentation-domain/LineBreakNode.ts | Replaced DocumentationNodeType.LineBreak with "lineBreak" |
tools/api-markdown-documenter/src/documentation-domain/HorizontalRuleNode.ts | Replaced DocumentationNodeType.HorizontalRule with "horizontalRule" |
tools/api-markdown-documenter/src/documentation-domain/HeadingNode.ts | Replaced DocumentationNodeType.Heading with "heading" |
tools/api-markdown-documenter/src/documentation-domain/FencedCodeBlockNode.ts | Replaced DocumentationNodeType.FencedCode with "fencedCode" |
tools/api-markdown-documenter/src/documentation-domain/DocumentationNodeType.ts | Removed file as enum is no longer used |
tools/api-markdown-documenter/src/documentation-domain/DocumentNode.ts | Replaced DocumentationNodeType.Document with "document" |
tools/api-markdown-documenter/src/documentation-domain/CodeSpanNode.ts | Replaced DocumentationNodeType.CodeSpan with "codeSpan" |
tools/api-markdown-documenter/src/documentation-domain/BlockQuoteNode.ts | Replaced DocumentationNodeType.BlockQuote with "blockQuote" |
tools/api-markdown-documenter/src/documentation-domain/BlockContent.ts | Updated key names (e.g., blockQuote, fencedCode) in BlockContentMap |
tools/api-markdown-documenter/src/documentation-domain-to-html/configuration/Transformation.ts | Updated transformation mapping to use string literal types |
tools/api-markdown-documenter/src/api-item-transforms/helpers/TableHelpers.ts | Replaced DocumentationNodeType.Paragraph with "paragraph" |
tools/api-markdown-documenter/src/api-item-transforms/helpers/Helpers.ts | Replaced several DocumentationNodeType references with literal types |
tools/api-markdown-documenter/src/api-item-transforms/TsdocNodeTransforms.ts | Replaced several DocumentationNodeType references with literal types |
tools/api-markdown-documenter/package.json | Updated version from 0.20.0 to 0.21.0 |
tools/api-markdown-documenter/api-report/*.api.md | Updated public API documentation to use new literal types |
tools/api-markdown-documenter/CHANGELOG.md | Documented the removal of DocumentationNodeType and version bump |
@@ -34,7 +34,7 @@ import type { UnorderedListNode } from "./UnorderedListNode.js"; | |||
* @public | |||
*/ | |||
export interface BlockContentMap { | |||
fencedCodeBlock: FencedCodeBlockNode; | |||
fencedCode: FencedCodeBlockNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewers: This better aligns with FencedCodeBlock.type
. These keys aren't actually used, so this change isn't strictly required, but aligning the keys with the node type
properties seems ideal.
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the unist pattern?
unist is the underlying AST representation used by |
The
DocumentationNodeType
enum has been removed.Enumerations of supported node kinds in various contexts is now handled via type unions like
BlockContent
andPhrasingContent
.String literal types makes typing much simpler to reason about, and more inline with
unist
patterns.