typescript-factory-foundry
TypeScript icon, indicating that this package has built-in type declarations

1.5.7 • Public • Published

Typescript Factory Foundry

Generate definitely typed builders based on typescript interface and type.

☝ For more examples check this readme file.

Install

Install using npm or yarn:

npm i --save-dev typescript-factory-foundry

Getting Started

Create a simple typescript file (e.g. myTypes.ts) with interfaces/types:

export interface SimpleInterface {
  prop1: string;
  prop2: number;
  prop3: {
    innerProp: string;
  };
}

run the command:

npx typescript-factory-foundry ./src/myTypes.ts ./src/generated

and use the generated builders:

import {aSimpleInterfaceBuilder} from './generated';

const builder = aSimpleInterfaceBuilder().withProp1('my prop').withProp3({innerProp: 'an inner prop'});

// item contains the data we defined in the builder
const item = builder.get();

Additional Options

Code Command Line Description
useNullInitializer -n, --use-default-nulls use null as default value in builder properties initializer

Additional Info

Here you can find a more in-depth explanation of how the library can be used and what kind of problems it can solve.

Readme

Keywords

none

Package Sidebar

Install

npm i typescript-factory-foundry

Weekly Downloads

45

Version

1.5.7

License

MIT

Unpacked Size

44.3 kB

Total Files

36

Last publish

Collaborators

  • oripi
  • wix-oss