Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

127
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda