Skip to content

Releases: triggerdotdev/json-infer-types

v1.0.3

02 Jan 17:46
Compare
Choose a tag to compare

Removed "type": "module" from the package.json

v1.0.2

02 Jan 16:47
Compare
Choose a tag to compare

Updated tsconfig to target es5

Use recommended/tsconfig.json

02 Jan 15:55
Compare
Choose a tag to compare
v1.0.1

Switch to recommended tsconfig

Type Narrowing and v1.0

02 Jan 15:43
Compare
Choose a tag to compare

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);