4

I am trying to create a shared project / NPM package that will contain shared typescript models across a couple different projects. I managed to get the package published to GitHub and am able to install it. I can't seem to figure out the correct folder structure and .tsconfig values.

I want to be able to import my models based on the folder they reside in. For example: import { User } from @org/project-name/users

My current folder structure looks like this. enter image description here

Where each model contains something like this export type Organization = {...}

And the index.ts file in each folder aggregates the individual model exports. Like export { Organization } from './organization';

My .tsconfig has the following options set:tsconfig

How can I build the typescript project and publish the npm package in such a way that I can import the correct model based on it's parent folder like mentioned above?

Tristan
  • 1,608
  • 1
  • 20
  • 34

0 Answers0