Skip to content

fix(types): export new link rel types from #744#745

Merged
harlan-zw merged 1 commit into
mainfrom
fix/types-export-link-rels
Apr 21, 2026
Merged

fix(types): export new link rel types from #744#745
harlan-zw merged 1 commit into
mainfrom
fix/types-export-link-rels

Conversation

@harlan-zw

@harlan-zw harlan-zw commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Related to #744

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

Follow-up to #744. The new AmpHtmlLink, HubLink, SitemapLink, and AppleTouchStartupImageLink types were added to the discriminated Link union 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 that href is required for each new rel.

Summary by CodeRabbit

  • New Features

    • Extended the available link type exports in the public API, providing improved type checking, narrowing capabilities, and enhanced developer experience through better IDE support and autocomplete features.
  • Tests

    • Added comprehensive test coverage for newly supported link types, including type constraint validation scenarios.
  • Documentation

    • Updated release notes to include additional acknowledgements for related type narrowing improvements.

…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.
@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Type Exports
packages/unhead/src/types/schema/head.ts
Added re-exports for four narrowed link types: AmpHtmlLink, AppleTouchStartupImageLink, HubLink, and SitemapLink to the public API.
Test Coverage
packages/unhead/test/unit/define.test.ts
Extended defineLink tests by adding the four new rel link objects to existing test scenarios and introducing type-enforcement tests asserting href is required for each new rel type.
Documentation
docs/7.releases/1.v3.md
Updated "useHead() Type Narrowing" section to reference PR #744 in the acknowledgements.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Four new link types, hopping into sight,
Re-exported with care, the types feel so right,
Tests validate each rel with precision so keen,
The cleanest link schema you've ever seen! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: exporting new link rel types from PR #744.
Description check ✅ Passed The description covers all required sections from the template including linked issue, type of change, and detailed explanation of the fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/types-export-link-rels

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Bundle Size Gzipped
Client (Minimal) 10.7 kB 4.4 kB
Server (Minimal) 10.6 kB 4.3 kB
Vue Client (Minimal) 11.8 kB 4.9 kB
Vue Server (Minimal) 11.6 kB 4.7 kB

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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 HubLink now part of the discriminated Link union (and tested as a standard rel on line 30), the defineLink({ rel: 'hub', ... }) case on line 12 no longer demonstrates non-standard behavior — it's now redundant with the standard-rels test and misleading under this it block'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

📥 Commits

Reviewing files that changed from the base of the PR and between be43a70 and 293231b.

📒 Files selected for processing (3)
  • docs/7.releases/1.v3.md
  • packages/unhead/src/types/schema/head.ts
  • packages/unhead/test/unit/define.test.ts

@harlan-zw harlan-zw merged commit af54923 into main Apr 21, 2026
8 checks passed
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