Releases: triggerdotdev/json-infer-types
Releases · triggerdotdev/json-infer-types
v1.0.3
Removed "type": "module"
from the package.json
v1.0.2
Updated tsconfig to target es5
Use recommended/tsconfig.json
v1.0.1 Switch to recommended tsconfig
Type Narrowing and v1.0
JSON Type Infer no longer tries to infer the types of object properties or array items. This is better handled in a different way (coming soon!). We are also now returning the value passed in which means you can use this library for type narrowing of an unknown
or any
value if you are using typescript:
const unknownInfer = (value: unknown): number | undefined => {
const result = inferType(value);
if (result.name === "int") {
return result.value;
}
};
const narrowedValue = unknownInfer(1);