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

196
Vistas
How to shield the internals of a Lerna package, so other packages cannot import them?

I am working with a Lerna monorepo. I often see one package make imports from deep inside another package, for example:

import { SomeType } from "@schema/folder/folder/file.ts"

This is undesirable, because sometimes we need to transform auto-generated types before exporting them via index.d.ts. This sometimes results in the wrong, non-transformed type being imported from deep inside the package.

I would like to somehow constrain the files/folders that one package exposes to the others, so such imports would not be possible:

import { SomeType } from "@schema" // valid
import { SomeType2 } from "@schema/folder/folder/file.ts" // invalid

What are my options?

I am not sure what other info I can provide since I have little to no experience with this stuff.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

When you use eslint, you can add a no-restricted-imports rule to the eslint settings of the package:

    "no-restricted-imports": [
      "error",
      {
        "patterns": ["@schema/folder/*"]
      }
    ],
about 4 years ago · Juan Pablo Isaza Denunciar
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