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

125
Visualizações
Lerna + TS: how to create type declaration using type declaration from another package

I'm using lerna + typescript to build an NPM package.

I have the following structure

.
├── lerna.json
├── package.json
├── packages
│   ├── darpi
│   │   ├── dist
│   │   │   └── index.d.ts
│   └── schema
│       └── dist
│           └── index.d.ts
└── tsconfig.json

The darpi package depends on the schema package types

packages/schema/dist/index.d.ts

// import types
import schema from './rules/schema'
import validate from './functions/validate'
import configure from './configure'

// and export
export { schema, validate, configure }

packages/darpi/dist/index.d.ts

import { defineComponent } from 'vue'
import type { schema, configure } from '@cataline.io/schema'

declare let Form: typeof defineComponent
declare let Field: typeof defineComponent
declare let Button: typeof defineComponent

export { Form, Field, Button, schema, configure }

the only package that actually goes to NPM is darpi

that is

packages/darpi/package.json

{
  "types": "dist/index.d.ts"
  // ...
}

and then it gets published on NPM, when trying to make use of

Form, Field, Button they are OK

alt text

configure or schema, although they work fine, don't have type declarations

alt text

Typescript can't know the types that came from @cataline.io/schema, clearly because this is a private package resolved by lerna at development time

alt text

my question is:

How to export types to NPM that comes from the private sibling packge?

I couldn't think of anything to fix it.

schema must not be made a public package in NPM and then installed together with darpi, no. darpi works perfectly, I just need to solve the typing problem that comes from the sibling package.

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