How to create a TypeScript library that

I am stuck with the beginners problem: I have two projects: A and B and a local Lib module, which are used by both A and B. Everything is written in TypeScript.

A/
    package.json
B/
    package.json
Lib/
    package.json
    index.ts

Is there an example of this? This question describes the problem ... 2 years ago.

This answer describes four ways to solve this problem. I choose option 2, create the npm package because it is the only one that allows me to use modules in a reasonable way.

Here's the problem : the lib module depends on the C.js file that I wrote the Cdts file for.

Lib/
    package.json
    index.ts
    C.js
    C.d.ts

TypeScript? Lib/src/, , , C.d.ts C.js , . Lib/, index.ts index.d.ts.

TypeScript w/npm?

+1

Source: https://habr.com/ru/post/1675642/


All Articles