S
S
Sergey Erzhovich2022-02-27 07:14:12
npm
Sergey Erzhovich, 2022-02-27 07:14:12

How to properly use TS in a monorep?

For example, there are 2 packages in the turnip, @company/core and @company/lol, each is rolled up in /dist/index.js.
in @company/core there is, for example, an interface /src/my-interface.ts, and in @company/lol I import it in this way, for example import Imu from "@company/core/src/my-interface"; then, after compilation in d.ts files, the import comes from src, and when publishing the src package, there will be no directory ..
you can, of course, compile and take from the types folder: Well, it's not very convenient, because you have to compile.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2022-02-27
@Drilled-prog

All interfaces that need to be public must be exported at the @company/core root, just like all modules.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question