0

I've created a server-side library to consume Yelp Fusion API in TypeScript. the library references a bunch of types/interfaces which I would like to expose to client-side applications, but in a way that is not requiring the npm install of the server-side library.

I am thinking to separate the types to their own published package and reference that in both the server and client applications but this seems hard to maintain and I am wondering if there is a built-in or otherwise more efficient way to approach this?

kob490
  • 3,177
  • 4
  • 25
  • 40

1 Answers1

0

You could separate the types to a different module which you could then reference from both the client and server package.json.

You can add it as a local dependency like so:

{
  "dependencies": {
    "myTypes": "file:../path/to/module"
  }
}

The only downside is that you need to reinstall the node_modules every time you recompile the types.

jmpargana
  • 151
  • 7