Skip to content

fix(types): make templateParams extensible via module augmentation - #684

Merged
harlan-zw merged 2 commits into
fix/575-augment-module-typesfrom
copilot/sub-pr-679
Mar 10, 2026
Merged

harlan-zw merged 2 commits into
fix/575-augment-module-typesfrom
copilot/sub-pr-679

Conversation

Copilot AI commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #575

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

The original approach of adding templateParams: object to SchemaAugmentations would trigger TS2717 ("Subsequent property declarations must have the same type") when users attempted module augmentation with a narrower type—making the feature non-functional as documented.

Changes:

  • Replaces templateParams: object on SchemaAugmentations with a dedicated empty TemplateParamsAugmentations interface
  • ResolvableTemplateParams now intersects TemplateParamsAugmentations directly

Users augment TemplateParamsAugmentations directly:

declare module 'unhead/types' {
  interface TemplateParamsAugmentations {
    siteName: string
    foo?: string
  }
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix types to make templateParams extensible via module augmentation fix(types): make templateParams extensible via module augmentation Mar 10, 2026
@harlan-zw
harlan-zw marked this pull request as ready for review March 10, 2026 12:20
@harlan-zw
harlan-zw merged commit 1ec203c into fix/575-augment-module-types Mar 10, 2026
harlan-zw added a commit that referenced this pull request Mar 10, 2026
)

* fix(types): make templateParams extensible via module augmentation

Add `templateParams` to `SchemaAugmentations` and intersect it into
`ResolvableTemplateParams`, allowing users to extend templateParams
via `declare module 'unhead/types' { interface SchemaAugmentations { templateParams: { foo: string } } }`.
Also updates `ReactiveHead.templateParams` in the Vue package to use
the shared `ResolvableTemplateParams` type.

Closes #575

* fix(types): make templateParams extensible via module augmentation (#684)

* Initial plan

* fix(types): use dedicated TemplateParamsAugmentations interface to avoid TS2717

Co-authored-by: harlan-zw <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: harlan-zw <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: harlan-zw <[email protected]>
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.

2 participants