fix(types): export new link rel types from #744#745
Conversation
…chStartupImageLink` Follow-up to #744. The new link rel types were added to the discriminated union but were not re-exported from the schema entry, so consumers could not import them directly. Adds tests guarding the `href` requirement.
📝 WalkthroughWalkthroughThe PR extends unhead's link type exports by re-exporting four additional narrowed link types (AmpHtmlLink, AppleTouchStartupImageLink, HubLink, SitemapLink), adds corresponding test coverage with type-enforcement assertions, and updates documentation references. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Bundle Size Analysis
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/unhead/test/unit/define.test.ts (1)
6-15:rel: 'hub'no longer belongs in the "non-standard rels" test.With
HubLinknow part of the discriminatedLinkunion (and tested as a standard rel on line 30), thedefineLink({ rel: 'hub', ... })case on line 12 no longer demonstrates non-standard behavior — it's now redundant with the standard-rels test and misleading under thisitblock's title. Consider removing it here, or swapping in a genuinely non-standard rel to keep the test's intent clear.✏️ Proposed tweak
link: [ defineLink({ rel: 'openid2.provider', href: 'https://example.com/openid' }), defineLink({ rel: 'EditURI', href: '/rsd.xml', type: 'application/rsd+xml' }), - defineLink({ rel: 'hub', href: 'https://pubsubhubbub.appspot.com/' }), ],🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/unhead/test/unit/define.test.ts` around lines 6 - 15, The test titled "accepts non-standard rel values without a cast" includes defineLink({ rel: 'hub', ... }) which is now a standard HubLink and makes the test misleading; update the test by removing the 'hub' case or replacing it with a truly non-standard rel (e.g., 'example-rel' or 'x-custom') so the createHead/useHead/defineLink combination still demonstrates non-standard rel handling without duplicating the standard-rel HubLink covered in the other test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/unhead/test/unit/define.test.ts`:
- Around line 6-15: The test titled "accepts non-standard rel values without a
cast" includes defineLink({ rel: 'hub', ... }) which is now a standard HubLink
and makes the test misleading; update the test by removing the 'hub' case or
replacing it with a truly non-standard rel (e.g., 'example-rel' or 'x-custom')
so the createHead/useHead/defineLink combination still demonstrates non-standard
rel handling without duplicating the standard-rel HubLink covered in the other
test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b65af5f1-7602-47c7-ad75-f029004b4a5b
📒 Files selected for processing (3)
docs/7.releases/1.v3.mdpackages/unhead/src/types/schema/head.tspackages/unhead/test/unit/define.test.ts
🔗 Linked issue
Related to #744
❓ Type of change
📚 Description
Follow-up to #744. The new
AmpHtmlLink,HubLink,SitemapLink, andAppleTouchStartupImageLinktypes were added to the discriminatedLinkunion but were never re-exported from the schema entry, so consumers could not import them directly. Adds them to the imports/exports list and tests thathrefis required for each new rel.Summary by CodeRabbit
New Features
Tests
Documentation