Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!