Skip to content

Augment module types #575

@chrisjansky

Description

@chrisjansky

Describe the feature

Hi,

I am attempting to extend the templateParams property of ReactiveHead to get type safety in nuxt:

useHead({
  foo: true, // <--- Works fine (see below)
  templateParams: {
    foo: true, // <--- I want to get IDE type checking here
  },
})

With a lot of guesswork, I got so far:

declare module "@unhead/vue/types" {
  interface ReactiveHead {
    foo: boolean // <--- This works
    templateParams: {
      foo: never // <--- This doesn’t work
    }
  }
}

The strange thing is the root foo property is correctly typed, but I can’t change the templateParams prop at all. I tried different combinations but I wonder if it’s possible at all as it’s typed as internal ResolvableProperties type.

Thank you for any pointers!

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions