Currently, I am in the process of developing an npm package using Typescript that includes a variety of functions.
Right now, all the functions are being imported into a file called index.ts
and then re-exported immediately:
import { functionA, functionB } from "./file1";
import { functionC, functionD } from "./file2";
export {
function A,
function B,
function C,
function D,
}
In my other projects, I can access these functions by importing them like this:
import { functionA } from "package";
However, I aim to export these functions in such a way that I can use the package without needing to utilize a class structure in another project, similar to how Lodash is implemented. Despite researching extensively on the topic, exporting items in Typescript remains perplexing (for example, lodash’s index.d.ts
contains two exports for _
along with various declare const
, declare namespace
structures).