1.5.2 • Published 4 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
4 years ago
1.5.1
4 years ago
1.5.0
4 years ago
1.4.9
4 years ago
1.4.8
4 years ago
1.4.6
4 years ago
1.4.7
4 years ago
1.4.5
4 years ago
1.4.4
4 years ago
1.4.3
4 years ago
1.4.2
4 years ago
1.4.1
4 years ago
1.4.0
4 years ago
1.3.2
4 years ago
1.3.1
4 years ago
1.3.0
4 years ago
1.2.3
4 years ago
1.2.2
4 years ago
1.2.1
4 years ago
1.2.0
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago