Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

279
Visualizações
npm linking vue library in a nuxt project breaks typings

I have a vue library that if I install it from its github repository works well, however, when I'm in my nuxt project and make an npm link to the library I get the following type error when I import the component from the library and use it inside the components object:

No overload matches this call.
  The last overload gave the following error.
    Type 'typeof MdButton' is not assignable to type 'Component<any, any, any, any> | AsyncComponent<any, any, any, any>'.
      Property 'util' is missing in type 'typeof MdButton' but required in type 'VueConstructor<Vue>'

And that same error over and over again with each component that I import from the library

The library is made in JS and compiled with rollup and the nuxt project is in TS. To use the library in TS I created a d.ts file that exports the definitions of all the components like this:

export class MdButton extends Vue {}
export class MdButton extends Vue {
  click: () => void
}

Which allows me to put inside the brackets the component methods that I want to use in the repository. I've tried several ways to fix the error (even setting the declarations like: export const MdButton: Component<any, any, any, any>) but none of them worked

This is how I declare the library files in the package.json

"main": "dist/material.ssr.js",
"browser": "dist/material.esm.js",
"module": "dist/material.esm.js",
"unpkg": "dist/material.min.js",
"types": "material.d.ts",
"files": [
  "dist/*",
  "src/**/*.vue",
  "!src/serve-dev.*",
  "material.d.ts",
  "static/*"
],

Any help or clue of what the problem could be is highly appreciated

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda