chore(message-parser): align ASTNode union with parser output#39058
chore(message-parser): align ASTNode union with parser output#39058Shreyas2004wagh wants to merge 2 commits intoRocketChat:developfrom
Conversation
Ensure ASTNode includes all parser-emitted node types via Types map and improve isNodeOfType narrowing.\n\nAdd guard tests for TIMESTAMP, ORDERED_LIST, and IMAGE nodes.\n\nRefs RocketChat#39057
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
WalkthroughThe PR addresses an incomplete ASTNode union in the message parser by adding missing node types (KATEX, INLINE_KATEX, TIMESTAMP) to the central Types registry, deriving ASTNode automatically from it using a generic alias pattern, and refining the isNodeOfType guard's type signature for more precise type narrowing. Tests validate the corrections. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #39058 +/- ##
========================================
Coverage 70.64% 70.64%
========================================
Files 3190 3190
Lines 112732 112732
Branches 20421 20440 +19
========================================
+ Hits 79642 79645 +3
+ Misses 31047 31040 -7
- Partials 2043 2047 +4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Summary
ASTNodewith runtime parser output by deriving it fromTypes[keyof Types]Types(KATEX,INLINE_KATEX,TIMESTAMP)isNodeOfTypetyping to narrow viaExtract<ASTNode, { type: T }>TIMESTAMP,ORDERED_LIST, andIMAGEnodesTesting
yarn workspace '@rocket.chat/message-parser' exec eslint src/definitions.ts src/guards.ts tests/guards.test.tsFix #39057
Fix #39295
Summary by CodeRabbit
New Features
Refactor
Tests
COMM-144