1.5.2 • Published 5 years ago
typify-gen v1.5.2
Resume
Generates dynamic types in TypeScript
npm i typify-gen --save
const myArray: <any extends object>[] = [...];
const { objects } = typifyGen(myArray);
const myArrayTyped = objects;
// myArray has been typed using the union
// of properties given by the objects in the array
// if you set up the intersection generation, you will
// be warned that your optional properties will still be displayed
// by autocompletion due to TypeScript's behaviour, which cannot
// infer the dynamic generation
API
typifyGen<T>(objects: T, logic?: "union" | "intersection") => {
objects : GenType[]
isGenType : (val: object) => object is GenType
isGenTypeInherited : (val: object) => boolean
genTypeCoercion : (val: object, byDefault?: object) => GenType
genTypeKeys : string[]
genTypeOptionalKeys : string[]
}
1.5.2
5 years ago
1.5.1
5 years ago
1.5.0
5 years ago
1.4.9
5 years ago
1.4.8
5 years ago
1.4.6
5 years ago
1.4.7
5 years ago
1.4.5
5 years ago
1.4.4
5 years ago
1.4.3
5 years ago
1.4.2
5 years ago
1.4.1
5 years ago
1.4.0
5 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.3
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago