Using Global Types With Lerna

52 Views Asked by At

I have a Lerna project using Typescript with the following structure:

  • packages/
    • commons/
      • types/
        • global.d.ts
    • partner/
    • user/

partner and user are both Express.js apps.

Inside commons I have a types folder with a global.d.ts file:

export {};

declare global {
    type UserInformation = {
        givenName: string;
        familyName: string;
        email: string;
        id: string;
        birthDate: string;
    }
}

I want to use this type across all packages (in commons, user and partner).
What is the best way to do it?

0

There are 0 best solutions below