red5seeker7-custom-package
v1.0.15
Published
Learning how to share data types across projects
Downloads
5
Readme
To Add A New Type
Navigate to
src
Create a folder for the feature that your type most belongs to
Note: If your new type belongs to a feature that's already in here, navigate to that folder
Inside that folder, create a new file whose name follows the pattern
i-<name-of-feature>.ts
src |__ FeatureA | |__ i-feature-a.ts |__ FeatureB |__ i-feature-b.ts
Note: The names of these files are not visible when importing the types into another project, so their names don't need to be perfect
In the newly created file, add your new type(s)
export type MyNewType = { prop1: string; prop2: number; prop3: boolean; };
OR
export interface MyNewType { prop1: string; prop2: number; prop3: boolean; };
Export your new file in
src/index.ts
export * from './FeatureA/i-feature-a';