{"_id":"as-typed","_rev":"66-4d49e36c2de8820f9ea3aed2d165c02a","name":"as-typed","dist-tags":{"dev":"0.0.0-dev.20220912112845","latest":"1.3.2"},"versions":{"0.0.0-dev.20201126001345":{"name":"as-typed","version":"0.0.0-dev.20201126001345","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.8.2","@typescript-eslint/parser":"^4.8.2","@typescript-eslint/typescript-estree":"^4.8.2","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.1.3","prettier":"^2.2.0","spec.ts":"^1.1.3","ts-node":"^9.0.0","typescript":"^4.1.2"},"gitHead":"c902262f26e508cee2499ae71ce7f6993fb9c0a0","_id":"as-typed@0.0.0-dev.20201126001345","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-xhoZ0VUTxEtrhb4FmGUiko2QpLYM+zLLvsbilTIH1oMXNZ1n1w30YggGY704Zha5KJ7M+iUUDfUEWsiQ7D9uXA==","shasum":"f5722ffa92a95ed4e77e9b8bcb32c7cde868eda3","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201126001345.tgz","fileCount":10,"unpackedSize":32863,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfvvM8CRA9TVsSAnZWagAAWLQP/06N6SMk/ZgVdGUL0n6l\nGzqAgejYFlDvbP4/dWXk6kiJ/c7GAJm4JQ4nTPsaMst1KP06NUW2FM2gFD5u\ntn0cF2iuDJRywbfhWO61pdUehdVVHFwJM3Fo6M1VJVlVWxMUIKyJ/JIf/Z6A\nDHNCk9H375wmh/tFsBEMszpUKK3ULpsV/Nro8ci/rTFYKHLwAHjEJ142N4MN\n6rKb2Pn5KBozgFx8v+0rcQO5mCmbnH1XNaJ7Gw1h0NfTApCFd3/MEyf+q3oN\nORm6Egj2LQuTylmr4SUZMzcL4qN/IisqbF7N6KkbFnRNnxLGmY7noXq5Mosb\n7kuQFI+NAQwKlgNMW75YXBimaUq7T9+JMFQNBMVCGlwUjRsYM78AbPuH3zDf\nvYwmWSK8nXxQCaSYqP+Ak3unX3cVKBOoGPPWjJOtvFmLmoEABg1Z2JefZFza\nLE2I+BAA0MvDZpc0LtdL8/Y/XIFZ94z74xNw5KgaWfvj1aQO9QCbJwQVT3km\nspbr1a99Plm3695uQoGF+kXImCsfA55aojDC0G/LfWM470SY9eTdqD0M3ajQ\nnpwZww9eNzHPIN9kvdZUOEUuNKGuYk/tf3UnxtbyeGXbFQbeYnuqJA/pPSAT\n5UiwHJ4AMdQH0az1ttTU3P+jumbTzaIkjDOxee+86NA4e4bBaR0VjNf8Cocq\ntgWe\r\n=bcCN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHKpWHQCbC0MZ/pGcfpoSpT0UbJ8d/kc6kZEDV9GYpJjAiABPs1/MWkyRpXaVUYXjLO6+1NVAfxcOsko8qNlzVCUjg=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201126001345_1606349628080_0.14493692854437112"},"_hasShrinkwrap":false},"0.0.0-dev.20201126010257":{"name":"as-typed","version":"0.0.0-dev.20201126010257","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.8.2","@typescript-eslint/parser":"^4.8.2","@typescript-eslint/typescript-estree":"^4.8.2","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.1.3","prettier":"^2.2.0","spec.ts":"^1.1.3","ts-node":"^9.0.0","typescript":"^4.1.2"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n## Overview\n\nThere are many tools that convert between Typescript and JSON schema. Howewever, all of them do that with a transpilation step.\nAmbison uses the deep inference options in typescript 3 to infer the types directly from the JSON schema.\n\nThis is not a runtime library - it contains only a single generic type, AsTyped.\nAsTyped can take any Json schema and AsTypeds it to a typescript type.\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Limitations\n\nReference by URL (\"#/definitions/foo\", \"other.json/foo\") are not supported yet.\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"905f36768b5bf4f53127bacca833b6128bcd4df9","_id":"as-typed@0.0.0-dev.20201126010257","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-wZ3YUy++PCTQYb4XQrR+5rQtzidBwnPSfFtK1FO00fRrGjw6Mxp2ryA/PghiNFkD/Y5Zik4qGasx9mRPhc8Nhg==","shasum":"d11fc40508e300388a0db89ba28f547fba0aeec5","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201126010257.tgz","fileCount":10,"unpackedSize":32550,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfvv7DCRA9TVsSAnZWagAAHNUP/0ShTVp6l8E4ivpt6XvK\nx2wawy+vkYCLVT1J2DRqkyOsJvxerUoNkKzU6tPlS6fX+yu5EJiJyGn8cFhd\niERU8NreKxdIqHq7yDIyXvHItTg26Cy1BxtVpjyY9TNzh9vkusmeKE1w1io5\nvJ9HIX+ZldPb2ho/iDD0oF4b0aKyFpj9OlQPOzMxmkUhucDtgZd5QDCE9yYe\n3RKph6APlL9ok5TRYUK6whUb7OI4oMUmcV4abB9W44vPoSQ6wjkb6WfPodeD\nFC9WB1WClCitt3TppdYGGur+X8tDvkH8z9WADnkKjSekPvEGTM1ELhEhiaXs\nj7ACOwlZ9BsI+WXy177KVhcxCVGmi2LdL5XEGPsLDmhcYP29Wh2Di5iv6mMG\nFag+Qt5UH2AhhCsK7IS4RANACsBKCFAYQSyRINqeOQFn5PzCCWm3zozR+RoZ\n3rrBD+Zh55tT+SSfA+9oxktyFtNTgvhC0H1cINkvap3Iy6hhLHM8ZCyvX43X\n1MrSTg9IaQnq/vBbNrx3v5lQzPEUlyCksk+Nng87/hrWNqWSP2fTLFfIeg6l\n87UOnMKUB6zEO52Gos2AiN9OtLZuSp4u4worKB2kAkfgorxXsxryygkOzwU3\n4h2Jofu3FtSrSbvFcuv9dIwWuCRNrb3IeTqmYYB4++wyhaXq2kn4ClKQBcgs\nVqrl\r\n=tfrP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCh+Sh6+ouvrz8JUBqMK3k0OlX/ufLJLAavai7bql8nrgIhAKkjzY1NFz/9UFhfph35Igp4u3T6pvwl/f2ZAEvEXwGF"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201126010257_1606352579048_0.4337286526220838"},"_hasShrinkwrap":false},"0.0.0-dev.20201126011200":{"name":"as-typed","version":"0.0.0-dev.20201126011200","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.8.2","@typescript-eslint/parser":"^4.8.2","@typescript-eslint/typescript-estree":"^4.8.2","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.1.3","prettier":"^2.2.0","spec.ts":"^1.1.3","ts-node":"^9.0.0","typescript":"^4.1.2"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n## Overview\n\nThere are many tools that convert between Typescript and JSON schema. Howewever, all of them do that with a transpilation step.\nAmbison uses the deep inference options in typescript 3 to infer the types directly from the JSON schema.\n\nThis is not a runtime library - it contains only a single generic type, AsTyped.\nAsTyped can take any Json schema and AsTypeds it to a typescript type.\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Limitations\n\nReference by URL (\"#/definitions/foo\", \"other.json/foo\") are not supported yet.\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"883fa276ababfd88ab5840f46a9a48b5deb22662","_id":"as-typed@0.0.0-dev.20201126011200","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-fdvnqHqJosWH0PXiS8xsMoy9Ta7BWkLLIuS3Sp+sWUmvtejcMNGErmDa913h4ckAUVGBbOhS4yXVY+4Wam62Og==","shasum":"e987a2e8e1302ac9cc65a0bf413632e7d88cb2ea","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201126011200.tgz","fileCount":10,"unpackedSize":33280,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfvwDhCRA9TVsSAnZWagAA0l0P/ilCjj+GXOVjJJE3tbob\nsJHaQeT8r6R1YkKhsUlaZUjj5wzLKCPWSaNjcIo1MjmKp1Zi9GDswnglb6eF\nP0ZRLMx32V3QSVzF7OasQHOBxFmyOP8DPDF5/es/DWrUwHCIlo+ldI893Hf3\n13VFpWakh31lBCaDZKC99YxHb64ay/zVvrbHZJgzWEP/wR9WeuxG8Itffdf7\nDsvLz6cPna8HQcnqq71JQSz0jLR7xSY311R0awB0odjdHOHqgpmGkIFKVViH\noPt1QDSzTtq6Krw16vubp50WK+Vzk3ERQlfq527rEFyl/5QHfxbMfnEoHAfR\n7ZC79yU7ZxZcrQqtH0F8MTlZSjTFyHGhtbqyQliVN1qZcngjUMMHZTxpedqK\njn1zQXf1jtSKebMK9VOd4J7m/bzB3heBk/HqfmjBjPJZWnUw5+LT+YKCb6/E\nIlCfRttDeiPdNKJKHzCzu43ATXcZn4S0I8av6LufWIGZdUMEZ6xjsnJMyQeD\nr6RZaksZRKojrUGlaEqHp9A5PWbXmsLQ7l1g8taWGD43KQ0OIDGWy8/T633e\nFLIJ7mRC1G4O2pLY127z2kuaw0VTtre7OCgzXXgECr3K0zlD7agbYgjS71o0\nPXKVh1yWsRt/uxf0W+q33i8LSMA2M/zW6/RJnW9u/uU/MB/5BKHXdxf4jv0j\n3APr\r\n=3NGg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD0w0+p/IWdkS/oL4KlkRPDjt/lZh3BL5VRAJayTHo3UgIhANbj+DBok+k++MYKQ5mdrdoRtRkVQjX0vb87zk7W7ee0"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201126011200_1606353121543_0.9845304659387908"},"_hasShrinkwrap":false},"0.0.0-dev.20201127230609":{"name":"as-typed","version":"0.0.0-dev.20201127230609","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.8.2","@typescript-eslint/parser":"^4.8.2","@typescript-eslint/typescript-estree":"^4.8.2","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.1.3","prettier":"^2.2.0","spec.ts":"^1.1.3","ts-node":"^9.0.0","typescript":"^4.1.2"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n## Overview\n\nThere are many tools that convert between Typescript and JSON schema. Howewever, all of them do that with a transpilation step.\nAmbison uses the deep inference options in typescript 3 to infer the types directly from the JSON schema.\n\nThis is not a runtime library - it contains only a single generic type, AsTyped.\nAsTyped can take any Json schema and AsTypeds it to a typescript type.\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Limitations\n\nReference by URL (\"#/definitions/foo\", \"other.json/foo\") are not supported yet.\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"2b76c1ebea7cdecaa4336502dc58a90dbba5b3e6","_id":"as-typed@0.0.0-dev.20201127230609","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-VkHbk7tfgydZdbMfUMqTQKWo1uzDHimEw9mKB9Jms9CinGLgj8moHtiOCE1j1mwYykrujDCiUbgeBwrCAAe/9A==","shasum":"661743614451f67b2c815c20c69d872e389191a8","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201127230609.tgz","fileCount":11,"unpackedSize":33314,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfwYZjCRA9TVsSAnZWagAA4U0P/0zVqGcLqMrcT5pt5KrO\nE7WyahhBOMdzzd8qI/hWZNQ/v1Ssa9aNQqcrbjkBIIrPqJ5AiVlNcvVcDDjL\n/dkkljoOI5DLURN+VpEb3K8GhWMqhMKyD/kWlOX2QLFR9JTMuTic1CxLAmya\ncAkQ2jA05fQXo1AivyhGUJaHHBVSt15qEB55KIvU13RaJpvJ35jw0OplZYHF\nqgEbhSna+z2caim9FhvWuwC+TpNWZasMfbBuHV1nI+87vyRvdSO3Fb+ViuVJ\nb+tyG4jtaTL7PNo2f+5Mbp4ooOYjan0wb8LBsFX9cz0RiY5C2HRpVehPOYHi\nPyzuc1KvkEDPoIhQRZoWoAhhX4qMfA1OYGnkRI3M28pcar22T1lXOiLgVWiT\nK83Q8M8i8mcnoLYDrq9mUvruYoKRPCxBD2BU4YK3+c83kiKlEaGwle+YO+86\nsx+yFoPL73TNS5GoyKNUorL9FIE3+VV7h5YF1y/1759m7HR8crmefPEZEkep\nqVnjgylA2/N3Iy38VDwqF7HUxO2U1Jph1XbzwQn8j+ap37WkGPDlaJUgFAE3\nxml4WPeipsPvIDcxZpGTZAPsHqmOa2LYkNpodcPP2omqkBP0mpNLyX/hWFf5\n0dDvP4pEsbg2IzzABqNJ3v2iDfhAgOAoW7876g1PsxBpzhnwqPKyIUOKuuGI\nC7Wu\r\n=0TQW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHnfn7h66ozlmxlm9Wu15Zb8HpNNp1g5bHrcYlskwCAmAiEAhIHuKOumGk3jWQKKfrFaGxAq37tBmyIN4+jCE+ok6sg="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201127230609_1606518370594_0.5022030055660498"},"_hasShrinkwrap":false},"0.0.0-dev.20201127233233":{"name":"as-typed","version":"0.0.0-dev.20201127233233","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.8.2","@typescript-eslint/parser":"^4.8.2","@typescript-eslint/typescript-estree":"^4.8.2","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.1.3","prettier":"^2.2.0","spec.ts":"^1.1.3","ts-node":"^9.0.0","typescript":"^4.1.2"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"93213bc9e3919a8a94a4a25eb7b58fb72b496929","_id":"as-typed@0.0.0-dev.20201127233233","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-ffr6G+3gEHn7eb75QvS1u8unvqNYCSyB/dPVYqb+PeIUtVSYJ65Iq81CPr9LchUoXCgSvjn9pjU+wlkJkeKEzw==","shasum":"965ab8f7ce43c81f0635021ea5e9353a87700642","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201127233233.tgz","fileCount":11,"unpackedSize":34019,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfwYyTCRA9TVsSAnZWagAAWMAQAIRn1M99U/2Ra87/PU7b\nxbMgVtfp9XoBCauMZOX65SfUnB/K8VPIIbgYhT4IJQhtzjjPKc9QiQxn7Tb4\n/zA4wBhWhLM0d4mbfEFN3PqzTye+730Qqbo7E1B58dsmMgy7jZM0tqNqcWHH\n66ZUd1KbLphD8Mk2NvoE9F9bm9z64ybNEy1lg3JhzBWNkB1AGlnsGG+tzT4x\n6JCv50V8N60imAVpZthQzy5VZr33PN71L1ePRWxBWWG/jMJf18Cva8bGvz8x\nXI1gtr7MsCu9kSAct99Yv6F0pepg61eOR1uJa7RDMBHOvdpGam6GHrRCv9xG\nbhT7BiYrkrva70bEnB3EYqhY5G5dF0qGRzjtW3dO+/UahDvVPjZJdOGQhwBR\npXO0jOricIIANhrbwKpX+kxF9CWgt5JBKoVwHSGtvxx+Bac2N8o8IKd4k+68\nIfSxlC7qzKnAn2gcrlPyVooz2SfLKEy5ctHmICAagGiQSubmsJ2GpCzp+jnJ\ndq5zIokOOg8cotpoxp6yE94eV5RBSocN+HtmRz0WnIzZYvwU622LRwPAsssW\nCuS2qLGW/mPGhaDUgUFLsE1n8kE28t2cGpScif3ESB7zUHM9b53I24Cpljo+\noopGDg6lkiNcqMUQ8PqRI/xD8bZAW+cSvrcQukoFc2Ej4adFID/+odqF2FKj\nJ/7R\r\n=W28a\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGfjVV3OiA7Iz8UvdWLdmF9kicZhBu0QxKXoUKCSKuBOAiEAj/a1igOWwyKDXcq+RdlwFevV1g+I0/pdociMNINSCcc="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201127233233_1606519954826_0.23460679660376793"},"_hasShrinkwrap":false},"0.0.0-dev.20201127233601":{"name":"as-typed","version":"0.0.0-dev.20201127233601","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.8.2","@typescript-eslint/parser":"^4.8.2","@typescript-eslint/typescript-estree":"^4.8.2","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.1.3","prettier":"^2.2.0","spec.ts":"^1.1.3","ts-node":"^9.0.0","typescript":"^4.1.2"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"78d1a9117a45a7e8198ef1a16ce2ec1c51f708bd","_id":"as-typed@0.0.0-dev.20201127233601","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-tKlWytgIzRkd6u62G0YEcpddJ7NhFFSWZqkbIg2TqG/W7qgDkvsFpn0YR9luemdRa/9Ok6c2uy+nz5+xyzqxpw==","shasum":"8be580d5f7286000f3a0d86c2074c474d42e230a","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201127233601.tgz","fileCount":12,"unpackedSize":34544,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfwY1jCRA9TVsSAnZWagAAbFYP/0/2N1tsqp6K/CApsmA8\nzhdjwNsznRLSoJJAUT7UQ2cf1QX2NBPjsumQu6u79RSgvI/rwCbrPN3RqcEE\nsJYdkXwnZz/uirFH0KWhxuUsWWdsglZBdmqxK1DVBLSXrv0BfESbKNdSVtXN\nNlfeglV6RzCXY5Ucrm+f/LPgkcH1CHMdwI0WZYYTVgt2rppeeRg5w+DFaj9m\n7WpgtBk2DSG0AI0QPWeWfLEghw/gwSoYpH4fA7nvMjsQakqZi3vtM2B1W6qN\nnoWjWaaOgkhPtlJLpuH6i/IlGHhg/UtQ+KmEFibMcBOuMK7OUm25vfOjzSMI\n0I2iICR27evmc1dq9ExS+fKVgjfIgRaA157m3H0HvToic1V0dihee3SB4Q6/\nYlwl4CRRK3/UVOb1TJtfu5YdmMh3B/mFuyW/ESeWBrUPw4ws12LPZ5du1O2W\n6TJzlAcQltSY31yaaamS1wTjgDSxV7LXlYmuERE5zcGIELv8LVv7kxdDzY1C\nSh8VpFppARN+F94RGdMvqf/IfhF8inJ8vuAgoA0UsHqVLZQdm/FCIv+fFSKN\ngK5vsfd4U++Dg7cRtOO/L1PzrEp4HdDWx8XBkE7MBbNng94MIsp/QyhGPxQm\nvlg7LRwTMPCXfOydxvuqfbwH0rBq6i+2anQwVgoxW/aEWLPm98o/oNdrg22M\nYWnq\r\n=pCKd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF0oNGg9qR2PsLxW5WU2mX3ACfAL+q6a23gY7ERBqIAKAiAh2j/fHarWs3XlPqGAappI9won9Iq060OxPpohMpqL1w=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201127233601_1606520162939_0.21114778843862436"},"_hasShrinkwrap":false},"1.0.0":{"name":"as-typed","version":"1.0.0","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.8.2","@typescript-eslint/parser":"^4.8.2","@typescript-eslint/typescript-estree":"^4.8.2","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.1.3","prettier":"^2.2.0","spec.ts":"^1.1.3","ts-node":"^9.0.0","typescript":"^4.1.2"},"gitHead":"78d1a9117a45a7e8198ef1a16ce2ec1c51f708bd","_id":"as-typed@1.0.0","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-5n2CdyBlj9s/AIruNJ09S2Xq+1f+whWVAgE2lXMVQxEzknPvJ4qGkIjxHk0h+sZBA4/zSjHOUN3ZURpg16wD/Q==","shasum":"163ed6e82cfd0c4e8662d0b789ba903bc3828d11","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-1.0.0.tgz","fileCount":12,"unpackedSize":34525,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfwY1xCRA9TVsSAnZWagAA60QP/3W5bid7NLW1ql0oZ3uJ\nFNsUNyKO4fYfkDbF9fUfeUyv7tZ82qX3tmsi9oFeg83E07OLlEatIzpLp7vT\nU14Q+RmwFtJ9NJJmhfPyZxJLOjJDRje8JtaseYQDP3wMHmGMsV+6v8+x6D3n\nSgKp9pFLPt0WrTdLq5b+kS+ansH94b5HIXvNp1+o5FpDsfYeSB3AqtHREuts\nTPugv6hYdUJ5Du83EnxBAhmFl/cgovKb1qmrRZ4LGoidCJb8zY1nB150EfzR\nJ+BEog1oobu1crm1GbpyOKTGQTtSbaLVYB7s9PXo0ALVHZbqZa8xruB1rAaN\nFDRIzhWkdIpugMvvnF+RqyjXlcfPQjSUbda+qm7BKDNPpFS0V9qT6QsVwZJK\nmvW52PW9pgIP1yU8zK6b8HvogKJAxo81pxBwhSBMlt0PzYjgFc4WT1ME/akp\nHkesOzMdpdfC5sP+7gHeK/rhx7/+zve+nKW8CeJWwLhgXZzk5KJRQSkIvASg\nf3ul7aj/yCXSZFAHLS7HtK7rNvL1Gm6dqfb94NsPTjnhimovUeA+IBJefRHC\nrVdiGcWUdlNCMAMFrFzRXVKNyalEmu5qWesAlDhKEMP1W/+rd5xLmQDPbM9l\nCz170fFbwFwVywCqmZO7knIirXb391ae+yOHO/7bI8ZoPZSqVcA+vLuJ70ss\nY7vV\r\n=UZHP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCHySmmr4d50LsFLaAIZ71NdZqZ46Jfe//0a9Uz0N8ltoCIQDTBIE+EskPbebPxhjahaEM9A4YIqIj4StlTjuiHX+5SA=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_1.0.0_1606520176860_0.5809178178349934"},"_hasShrinkwrap":false},"0.0.0-dev.20201127235259":{"name":"as-typed","version":"0.0.0-dev.20201127235259","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.8.2","@typescript-eslint/parser":"^4.8.2","@typescript-eslint/typescript-estree":"^4.8.2","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.1.3","prettier":"^2.2.0","spec.ts":"^1.1.3","ts-node":"^9.0.0","typescript":"^4.1.2"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"2794b8087a50256ed206e061f423568b756ca7d5","_id":"as-typed@0.0.0-dev.20201127235259","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-ZY/cLyLsNQn8HnGIIa18rMJwDX66nc9ERsq/ZlipOZri0PO5I65+faj+/Rh30mwZO79jUqsW6/4jJlW4OQ2jlg==","shasum":"892b9cb87a9ad784261a39b42d04c920b437b294","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201127235259.tgz","fileCount":12,"unpackedSize":34544,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfwZFdCRA9TVsSAnZWagAAl4oP/1DHBlv7kqeVhhvQgbAF\n9IqsFS7IuBWrW/ZesTWLYYd0aOJZ+Uv8c41AhZkiuX6/5j2nPcWtAgQ7DZBU\nw2sSYgH7JnPjj68BP63cjGhSc3RmVncMOvrQMCa+J4P/ru4KfmsIgy7MkR3Z\nx4jXgNqri411KuDxuPd5tqh13x+ubfQ8tprrw2U7nOym4ngr/BwHXJ8FMqmq\n5WPMjgTHa2daIOk1aGs58TRrV4FU370vvko3XDidsGJ1T4N5tsMeEGehdsJR\nAZI5w3+HiOyNmWMJsMS9aEcmdAmlDtSch/ShMH8A1m5I9xqLclPR5IqxG72I\ntYzy558zwhhooBigf9jNoTPdVM5hpq0B6GLjpbQPxYJ0vQOM5o1DdZrOGPth\nHdE574gNgdLF2yCJv1uBL+2lmUvY9hJV8cFeJCfiRsAMWfM5PT8JMuroLgbG\n7v/NgmnH0VThghvjUR35WQs23aK3ske28stbByXi3sTKrgLvJU6GHV105lJN\nZL6sDa/rvxQuIZwUaEqPS3z+eMdwzV9Z5gu9qUIIAT6eFW4w1j8eercLH+jf\n3RTlR1OkrEUhhJQAfKhIcSfTLZIfq7NfgX6Rd4h4esiEVj/lyPMKaxhr66MU\nnwo7hdkSKMC2hIW3dzhWjnlD9Xp1VRMh1C7CtZeAscoqNgUrUWy8uHZB74/U\nDV22\r\n=Vyra\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGGkPx7HEtLYWucFnjWdlE5BCnz17HU/kms1nM/3xxivAiEArNuNenKqfKRw3b1NQKWabYtjoBuzabr+Byb0RGLF82Y="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201127235259_1606521180524_0.954465760890832"},"_hasShrinkwrap":false},"1.1.0":{"name":"as-typed","version":"1.1.0","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.8.2","@typescript-eslint/parser":"^4.8.2","@typescript-eslint/typescript-estree":"^4.8.2","eslint":"^7.14.0","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.1.3","prettier":"^2.2.0","spec.ts":"^1.1.3","ts-node":"^9.0.0","typescript":"^4.1.2"},"gitHead":"2794b8087a50256ed206e061f423568b756ca7d5","_id":"as-typed@1.1.0","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-CeSTThfBr/nfKR1R9b7mXiv6/1ApJDEfdpJI3QlfIAy9g9NBj39213aTaeiMK831PRo1KXqdY6PU6VwQAO+IvA==","shasum":"fa55910c8611a75347662521cf649ad6c4b4cbd9","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-1.1.0.tgz","fileCount":12,"unpackedSize":34525,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf4PeeCRA9TVsSAnZWagAAqosP/ipNXnTodvhcxHH/nUQL\n5uIPBEMwiEJc2kBvdf9j2gtPdA+VaLgIwEy19zy4y7B1FB7BKZiWl5WgyufF\naeveL7yYUcAQ9nONrKpJQtuVPvwPqvVUQO7x73fU6ED0IC6W283W+5bHWJ+x\nCduvCL9gsZ0j0d08MzvvSCt8Tk4I9TP9aJu2EK9C/G8aq9bjfckAw6gSEPgY\nHhE3Avtyn0X1xAo0qdxjwqf0rEQcVzLrZEIc2euIDbMjnYmAXJkJP7+GSKKw\n3mQUC9GjXp+8QmGm2ltSbVODqMVNDXpmpqdDUnMJhyW4+Ivw4uoxlJtlYc2v\nepvt8a2ahHRy2/R3ZuSRm6/VSvMXeMZV+bpr0GS1joXqL0ZF+LxpEFd/Kvxv\n1k+UdoIaQJjaHYHEcqwyijT/N5x8R4txGLeHB/tNd5v0N9/q7L4/vkPs1sZs\nNDNqL2BmhEDZ89opoEkWQ4j8NR+e/Sb3UnLpRDumlIw118b1xP2BIa/o3xjb\n2WBUcNRo+LG983tmMilFCkjbZo7iYFpH2G4LKf2vArVXEcmWwX5bh9oZRHDM\nojCPk1vga5Tb7mh9zCFeGzcoGkz33c/M/6C9c0edGpbjKkxJ/vPKKF0Pyp2z\nbeOyenjYFG2tJ0I/9oEa918KnOJ1bXpx++gOOBdbgciy4MWq/XJLCShGZYpD\n8+eY\r\n=Hveb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGCDY01VvG6t91FxKn8H9SzTfgfE747Ckh2sk78zNkK8AiAxQP6Rm7H1vJYqsSUruFQCCs3+cqc2qmeQFlp8FcjtAw=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_1.1.0_1608578973617_0.6721075498217395"},"_hasShrinkwrap":false},"0.0.0-dev.20201221193144":{"name":"as-typed","version":"0.0.0-dev.20201221193144","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"a280abdd1a566c5ca7958c03e7f4080661002805","_id":"as-typed@0.0.0-dev.20201221193144","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-ssU3GCZl8aop/r1cg/WESGhalySmE3BJ3yNrmNb1KWMIZ5qMLC2XV74gwfblFXi7W7oH7fUAwDXZrflCZoJlRQ==","shasum":"feba12c54ba60ab75586bef2cb2e10e853560f8e","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201221193144.tgz","fileCount":12,"unpackedSize":35585,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf4PgiCRA9TVsSAnZWagAAmx0QAI8AI47c2fEBFq0kHKKP\n7pvcWWPwpF82e92fIDAutYVCFGn+hQHfIVI9ebfqGDvu2kb9sZwnHuP0/aBX\nvSbsrJ7l1vw/j8PQOweiq9HIFg/MiT03QI1wYoVSyEokFMronQ8cbi3/qyBl\nEavi292Eii8cuMoy9BwzBo8TIitXb/UrKyeZjWLpZqUXXYRkvfRiE9W2ly7K\nYHAlhxZAWoQm7cacYQITIL9e1RE/9LFwC4TpQpR0thq/AByT8+2eCCEg4VQJ\nUAPFxfHkQyQ/l6+fFsSswXeQCmwhp2TX00UpPV7pFfr8IBLbTqtYqb2Uuyz4\n7+dpMdgXw0bWDdThPAs5RWEYguXvTKrYPT7z3M7WDvRGg9FA2Bid6MNo71c8\nVqIW/UySvWuOmP7nrB3yodlZmjKLHLsipJBGmQLXG9F2gzRSKpBnrs0YMBym\nXj2fyC6rJbkSXy+SG+LMpKEZPRXr+TmaIVoo2n/yaavkIYlCvpwuOjQ3Cl7c\nLYF7Tz+WeoxRmaqjMHzT1JJP6Cqkb+OiXlCj4ZHkMpPM3vhWjtWS6S/RAdFY\ne9q80ULMhrMhoL1+21mQNHGQoJ7V+jn4alp+ulFAB36f1FXErD/LAv+QJ2YX\nD7Ew2oHTG49si5Rv3YIhwTjShf6OP7UFg3lrUzKOODd7Rr4y20RJczJnfD7d\nrhlO\r\n=I9kX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDi/Dw3Gjjc6TQDjiVslQmOrfXuj6yxCq2ixxTQXxQUIwIhANMhAGrIFOw63EC+RRcWcwyyK/37gs0R8vl/7+lxWdsy"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201221193144_1608579106419_0.7661641564679935"},"_hasShrinkwrap":false},"1.1.1":{"name":"as-typed","version":"1.1.1","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"gitHead":"a280abdd1a566c5ca7958c03e7f4080661002805","_id":"as-typed@1.1.1","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-AQVJONlWtXNpeDviGn7aLI7ztHa8lZJVKs3V5tToiX/mmShMm7fsZQSlychPtclajm7gkoxE28N6Zv1kE4VXPg==","shasum":"46763d0b7df68f89afe459168107e100dd3f3ece","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-1.1.1.tgz","fileCount":12,"unpackedSize":35566,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf4PhECRA9TVsSAnZWagAACKoQAI+GePlNP1oRH9IBtWh+\nZ221fKFGIzsITobs3AS2F1U9wi2UCiBd09VmizcgB5Gnhn9GJ9cS3JKkRar7\nDazoEWpLG5s3ymV6J+VtEBf1JBZ8PfgsU6ajlJzeR9iOHGZI5jROqWKVjcaf\nXTXToW+wxhBPt1vbDHFo/azY//t6kzLyzTtV7OWAL6o3POH0sGFditHL58au\n7W5BW2j5jTVT1L+sis+1bONJfP4NYM1QpC5OyTr4uDZgvyUjeMn9bJXpsesB\nfpXC9u2BcigeGGBYn0bBZCgdR9IJbR3iLf1kDakZF4LYmAAF+/HrsHbGoLI7\nxrASh04bx8PVRalvnr3VGMyZvXfgSL9an5Ggraz5z/jlliODQgmPS3/2MS7p\nKeEJkJ8DGDl42Nlp74K3GDXI6zKRyc5M9boaimK/2X/NCSwXchcFFhLkk5kK\nruJk3EBwh8F8e95tYwZUX5RIypBLzcKOUCmWUG6dIrWF1Vu8RxlCq2tky8v5\nfzxlm0hCcjMleKMDKtssQ84BzUnED1ym2Xsath74fKRte5lX0aFpHOQw2r2Y\nHd9C0Dx7GnsfSiB8/LVNxr0TkHKg78uuovJYtCMNMyJVFw7j0HiZbOfnqk1j\nY7V3nrzvqo75TT3np/JmW8gAwI8r6NxbVKlQTPK8JDlfGluSdF0byfblmE5M\n+jUK\r\n=DKwT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKOmO6UoJ5d6gLtLOcBL3WYqJ5hCYbH6Os0QFaU1HqmQIhANX3p/XBrLSF6fDSl7boyKavWjsFVP3vNMugRDjaleca"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_1.1.1_1608579140297_0.30160413218792015"},"_hasShrinkwrap":false},"0.0.0-dev.20201223225551":{"name":"as-typed","version":"0.0.0-dev.20201223225551","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"9922499de9240bf31ceff03a039bbf21351f5a53","_id":"as-typed@0.0.0-dev.20201223225551","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-OZ7Tci7JJd6+ue4leC1FenlidNtPpkAXpnJ8+LqgCUSMESD3vZKUR2Eccy/+QJex3uB2BDVFAHphL79VJSqGIg==","shasum":"fdb200298d3b9aed1051c5d199cd13091ff01e92","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201223225551.tgz","fileCount":13,"unpackedSize":36014,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf48r5CRA9TVsSAnZWagAA6uEQAIHwAnnXosa6GLbOGs0C\nwrSsCOH1v/qJre6HqdwiMlQY8gdMZrOttgAzRd0E/aNRyhUIsXW9RYoQI3uX\nBcOtci5h9ndB+8TPiSzFSwtsh4XkGfg9wdhuWU9SxzMXzIF9Q2oKpVoTBezC\nfvdskgSo14Zx5oox82K3Y5FsC/OM01Ig6OkOLNiy4fU/KtQr6rapJrkxmOSK\n/4TYAM1fXb0MrSNMIQZhAB/nvsFaNxrLwcYO6hmZjDlhEb/wAVNNqif2eLVX\n5TSx4LgRvXaUj0QOnsxFiIgxeK1kjgkhMW1RN2DBL7JUmT2s/WDTHqku9j1S\nHBS6/KpwfEacx79FKga5LgRmTopsZFXjGwhAADXGaf0QV6rAhJbUhJRBsUEX\nAEWlGtCA70dq1iRKO+unMgahwYSmdvWYBCRuUltcoO+AK0mfFRsigqU12xs/\nufEc6bIEY6s511eTMLva5mi1lHw3/hzd5kWoBN3t7b0amM/8xVeLt86/Axx5\n/pLBMfCiaxyfVCx7s2zkap1OS6FZeVH17lVZtz3veCIwj6LrK+sCLtLu0P3h\nQ/0gaL1e6ptv2DmLX7Ze6Y/F7Y+mPZ/Uv3z0AX/VhnHNdhWlsnXaquK9dMzq\nUsBTiHT2sKzzX07eP6kmkhxDc4rg5y3agdL/g1LQ0b+TBLSDF2oZR93TB8T+\np9bW\r\n=G6iG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB3VQtSg7IpuFwQtMzKJfIhMthup7sC27R1dHa4dQcIuAiAHFi05RvCoQfSqTml+2Rs612C+sHttC1AcO/QlsQqiTg=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201223225551_1608764153099_0.7023943794593774"},"_hasShrinkwrap":false},"0.0.0-dev.20201224114510":{"name":"as-typed","version":"0.0.0-dev.20201224114510","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"start":"ts-node src/main.ts","test":"$(node spec/setup.js) && jest -w10","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'","build":"tsc"},"keywords":[],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"80a9cc03a235aedf36a13457f44d080178964f81","_id":"as-typed@0.0.0-dev.20201224114510","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-7Ot3zGTkAMrEeRVv3M63XJ0ZDwwBPFikq3odEUTBAUOa42YuTya2+/jVD/zdEs2ugnv/d3jzbUx5zVq4muYABw==","shasum":"f4ce527fc74ceb80fcf0e0516513d3338dd49b10","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201224114510.tgz","fileCount":13,"unpackedSize":35682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf5H9ICRA9TVsSAnZWagAAOrYP/1tewRrsbAyQe20h/7tG\nJHdCNYPFgNdapsrjLwO+bxAkhjB2oUdgqHo2kui1jZ1Mj6LUaYa+ibeXenHl\nHYnj/Wxw5q+YkjQYHbs4WVvaEesfVlFzd3jucp9EaxbEcrYdvRUzgChedUbH\nZL7DRHqQqO4JLnBxET/AncYi+vtQ3d3lThkgEBgJPMowSVSZN0eBze5/nTyP\n+oGbBIJF6qoFNRGdVbkPDJupr64gla8CyQwtnJRHYeJpJcPg4YYTPdYVm5Go\nTdTFOuoojIE4mcyzY0lKTyMxIT7N5N5WSLIrVm5jjW34MnobTT0J/BYxHZMA\nTliprouitKtOd0TOafov8LUsOyXmaEhPn4fQWb0tOGt01TVMP4tS7KjaQyXJ\nUVQeu5axmnAKpbTC/nbuYudm2JdYyx/AY2q2ff/oHP9V9J7zVZ6zIvkGD5H0\ntTXBI8CyvAxQ1boqVIuPoOQ05K+u6nM5jLryZgUow+ZdEtZsm2BzAwUN+4+c\nz1rTFeA5W7YN/q/vhvXB/WNR4jMuzQITyi0ODs4WSikKw1OcHMfPXFiGCbbJ\nGCasInj2QxXtQ96SNA7L8zGMhLhaeuqiDkvbyqkO3ZrZKEf/9MqggH5e1v0i\njpp/FyxXA9TK+JdauCQCUSVweJVIfAx9XcNnHpQgGykdi7ybhSpTcGEyeOyE\nRyI5\r\n=aezp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCH2/mEdvZ6J9ptW7OkZpGbgmmIDTaHOxQJbcm1T9+XyQCIFagQS0nONSBSJa0Ot9mg7K/uxTRVy/eMW/1cIekgb8s"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201224114510_1608810311762_0.8594221477631281"},"_hasShrinkwrap":false},"0.0.0-dev.20201226200227":{"name":"as-typed","version":"0.0.0-dev.20201226200227","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"8c705d3c595590501f281c555293f9891211677a","_id":"as-typed@0.0.0-dev.20201226200227","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-A/YV3ovPZhyeie2ICwPt6vCGbVqBa1DaYkInWNdPeZjj4oXeBzFGFUinlqxaGuRUQgd2y8McU313uMmvjx21vA==","shasum":"e1a129c40dbaa38b70f5273f51f1b470cd621c68","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201226200227.tgz","fileCount":13,"unpackedSize":35667,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf55bVCRA9TVsSAnZWagAAaoIP/i2L8Vh1NjXfv0ocqEj9\nx8ABz8emetP757EkqNMtw2XXScAexUbS8VFREC5HihxCDXrB/v2XNJCk5+/Y\nqC93fZ5ynnzKXo/lYD7can+pXnFxJc2Nd46T4gHSOt1C9Qv8xt3nRLOuPpVC\neDqQstqpvHbDSGvqGCc/9EPVmwOF0C+/FCcVC8CmP75RgxutRA9NtRkKXqOW\np+SNO2ZozalpZimbFXstTiHZN1csQxZ+6Xx5UI0dIcK0J9BS3sfVMl7PKALm\nQk/UARQZC7ZToyTDgz5akQg4NL2Mr22gIFnfJT38x/kHzVo/uzFwZLiweWYj\nu/BUOlPwDzUqKytcve4/renKchOz8qlTV9+3zYJuqH/ow2EtbzFM07wgip7/\nZQwnS/gvJZU6DlDdI8b3FTJZJmBvqn5JSsAZqUwg4+GMbXzvGGRJ28BlaEJp\nwrv3l2G31pp0v+hksbm8GUmwqSuD6o9FwGaFNoQ7Cb3x6+kW4fImzKtkckyt\ns3SQHS+7jSlRBNs16P5vCEQ1LkSGAocXsFSMKzoMNaMEZdzPQl53MR0ZVHMr\npA24/WbqRF4tM2Yb8FDDpKPBfrH8M9g2weQ2XavJWdtzYkraM2aovkoVhGeO\nN0abVZ5BUQQ1YXzm+5h+XUYu1Rxef1U/qr2/7u60POEamnU5Dp3wyp2SyTvr\nvqC0\r\n=cIRz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFXcLBtb6uC5sn4rJnkUT7abNuRxcrtb7KaNd77TI/t6AiACCKAVZBpyDBLtwdMyfB+I6LZBB3GupSRCksMrhyJw5Q=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201226200227_1609012949000_0.7983631833134921"},"_hasShrinkwrap":false},"0.0.0-dev.20201228213229":{"name":"as-typed","version":"0.0.0-dev.20201228213229","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"afa1c0b5996502ba3c795565b3cfd3dd830cadb8","_id":"as-typed@0.0.0-dev.20201228213229","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-CjI1rPpdxl0fhQvhr1oLgfBZb6+RFuSMguS62gIBw9Iw9xaxOMaszrDCBcHDgTAH0tkODuQBJ46yj4AdPyXdZA==","shasum":"30fab8970aff99cad6d3a2145b64260b7c576fe0","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201228213229.tgz","fileCount":13,"unpackedSize":36010,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf6k7vCRA9TVsSAnZWagAAZ9MQAJ0jTNh6A8EsSguQq/Fe\nFoIS+Sz5CvYLeySraWm53Z/tDVxjGZqTyVhyv/wWZkqYos/WC2UaDTuNKXyz\ntWHl41jCaOAeO4pnFFyzjnVEwXc9zYn2n2D0J5d2bBUF2W2fjXVphxY5boxT\nw8RKbZhStOU28XSivhFgT8SKoNH6ag+ivW0RiTeP4xisYZlP2LguKX6aP7J3\nLNRmTeon1VCzYkiuavJasQ5E4+VO5XQbVvgePd4wwzGYd68J38vNLaZoJcZD\nmrWMIo5y75Na7R8t2/IWaqbVzrKVCzeb1pyijKMC7FVIImIocGip5u2wtvtW\nbxVIRke99gLfbx/R7QlwS45zKIATLPJ0e8TvPpfC4qsuKfTh99/vk/noYWvY\nzCwVLZ6BWrtydPJ0U7VudYe0QAVXAY4J5PrQ1DrcySrPxj3+0e1foOUdXqRD\nvuFBdbzU2IYW0ItzmIeJDdYh5dGaY5s8Tz9cOfgLuHknkA18vq6FKaC/qp5x\nc/Pnos4inn1vihSU5j2dcRRdCbqwvwG+zsy4DqMl1yjwKzlADKUqvDrGLrvq\nYXwhHSu5J9ZM8hNf98IVlFY2mKgaXQ++gCRtRIRF6DROKiDDtO5kRqZblmDf\nr1/3cK5Y4V9RFnTimzbS0jb62gU7QO+Bvlr6Lea0JdiRxmchEeg1INwQ8YiQ\nLJDp\r\n=7oM4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDg2JWvAE2oMVtTU404StJkwqgwCk3xRqzqHJSsgWtSxQIgcs0MtkXSgReAjyeszvK06L60+hWsCVwPm5rk/Qy7BXg="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201228213229_1609191150678_0.2862442155468883"},"_hasShrinkwrap":false},"1.1.2":{"name":"as-typed","version":"1.1.2","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"gitHead":"afa1c0b5996502ba3c795565b3cfd3dd830cadb8","_id":"as-typed@1.1.2","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-Fev5CB5xoS6vxC1a5NVQoB+sVxWBpnfxLC0O6joPlqKMhjdg2gfTiM5GF4lZeMM+0WCbiF0tMXacJW3WNVm9Yw==","shasum":"a44f0e905f22d087af1d43c6791e14746208d8c3","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-1.1.2.tgz","fileCount":13,"unpackedSize":35991,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf6k+4CRA9TVsSAnZWagAAc7IP/j5mxxXFttNzsrbfcqOR\nQtSzr+VCSIW4Q9b+Jili2XeP2BMZK0JH8b8WEKHVu2n+OP5oYADqgLrTPfJd\nIB3RuhZpP+tcsxDKS8ggeAVTQ+96SS1FWrQb0GX5sOFI0BTnPrJAm181etiz\nkwo31uIN3iYiRCyAk0/j4ZJ4MGzjeoJ5mH3WD5z4tNE5emFUy6GQrcI9LXFV\namnYhosvNC2QEd4GSkKsQIDwJK2Pt8jnixQ4W7eoLfZsqnx59n/QTpuHc5Qi\noD6xWuYDoQX47bAIyUC8LqTBHdO/dIQIhcOimqdjEy56kJ3XeSExiy6xSk4e\nM3FohCvQwmCSMP9vNGnHcz7TNA6WGfhT2uFK1v1a/pBqmBmuLRKBiZi8YmCp\nkAa0Eyf8CcGgVO01lwlXAHQY5OZNMofm+6mf3LxLKHxq7I73vDujRk2lWA3g\nN0kANk6cfnrXhs7y7cHnVDwXhHvpbLTnvq5ferbuIsm4sWhjoFxXSb8oqFSq\nbYkLri0xvjZMG3HjP3bFU1BmFXwHOSzYViOb/vvMkN9Rw7TtGPMWzREhQbLS\nSb1x7sxK0uRuWEEm2U8FGJN1jK1mBN6uJw/BKPDULTAQnYLZULvpxYK7oJMU\nhs8ctKWTMThhQHx1qXmgEmsf7HQAW7f7zug8mZPUIQ8K2DmJSFoEZi0SMOeA\nje4s\r\n=pQCY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEza9jdlBgSuS1DBQdboTTEgU7QJOmVuhtm3o6ecV/kOAiBzN3CaKPqwo6DI3AUVzuD8MV3iHgLmfk8fKQ8BmciCrQ=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_1.1.2_1609191352247_0.3233216183291594"},"_hasShrinkwrap":false},"0.0.0-dev.20201229022322":{"name":"as-typed","version":"0.0.0-dev.20201229022322","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"7dd906411d1b1ae8ca3b18016ae32fd8181a8468","_id":"as-typed@0.0.0-dev.20201229022322","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-6QfhMnb0Ne5gm85EyeaD5twGVM5xMS415Qx/KQ7qW0nW5gf2eCyVg6xQF0CIzVBcOEt5BSXePsjLhW34xZq2xQ==","shasum":"71a852e6e5b038a727a49ba0ffaa07721f2f3824","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201229022322.tgz","fileCount":13,"unpackedSize":36187,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf6pMcCRA9TVsSAnZWagAA4lAP/i+rNEoPsAS56nKD9ROV\n0MtiziS5Zk2IfzBmrq/WrVqaVSxen/BCjM8EJ4MkqBYEJnX8/8BuKJuvuu+s\n3mKcGH/l84Cgjoh+tt1nQe2auv2SuXfSpErCcGbSziF5ebzhSIpk82iX4qhZ\nJSvgvvAr9zJb9dA/pst7Mu4Y2dUhRRp80LqV9PDzPIIh85J9p5xZr2UpnJtJ\nvIwHAFIkXko8BudMrPgL/I1JevDMineuWogzzT9RLjaONrTx8MFyVx95rfZx\n6pNQX5FfNLHQ8pOcE+LXJXZX5qAlBLv6FW+C/BS25Ifw/7gREUcr4vR63t9P\n7Yt5qqg22UfLpqPNVvG8/eReI93x5WBwBlmCrXbWwLl4toezOMZHXrU49BKp\nrtjlw7oY+5EwqQkfDPUYCluCgMgIgEQrUS5O27KLLx1kUjb86qlci0nXdOAx\nMcb90+tmiXnFsol9bxoBMj4nJ0vs99ek1r9v/nKcZXu6o5i+j6TjY9t3ky6N\njceH0KCHiwDqr7EjiiVD6+kVughlDinv1ZeO6iaTepEJ02txBAaRT33fN5Z/\nxWgEJEQ4H7NIxgQ65mQnz4i8WVepxaVksu7R7P35lb2A5ywLjMSk3cJg+54i\n//tkHIaDlUEIcmpjm+sKJjbvEviaT1+38hrjuXoH0/r7WhsB05hvkbGjwaN6\n+sAB\r\n=GJkk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC04bGJlUL9ckMD5PXGY9sdfnAjXQm1784/++hOa0ZkLQIgJHcV+1s+B8BPEBa9POMuRJ86TysTZ10wu9NkHXcCq44="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201229022322_1609208604106_0.2269288730549084"},"_hasShrinkwrap":false},"0.0.0-dev.20201229023359":{"name":"as-typed","version":"0.0.0-dev.20201229023359","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"ad13e37f85257e291744dfd6c4e4108cf25a6d64","_id":"as-typed@0.0.0-dev.20201229023359","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-Gpcyqo1iJhAMl0UGBdmvww+EVA7yNkyJK5Fw6rQNrTP1y2yf0/S3yupJhyDe3GS9zUAcoFJ06ONZSUK9X8e0NQ==","shasum":"5b6e83fd36862a90799abde7f28c5487070ebaa5","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20201229023359.tgz","fileCount":13,"unpackedSize":35754,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf6pWZCRA9TVsSAnZWagAAVtcP/2kmqk7Tt854fqj8BolC\nsGs6jzmN8LQBoGwaEYbunv8EcOqRHLnC8qs8eGdBEwnTB1OOvZPOV/as5MD8\nZsCF0b4p/jdfbRjo92IMhsYwdMgmA1SOHNC4VDEGE5OuXOdemdndCo4tWlnp\neJSaZq54Js3EBq131KqlvFvrKVBXnvXXfHqzYP6K2jlGI1xXdlz3eVa2FJru\nflr/WBuRV6B+g8rPXYo2KYkEbFv8laYpW3S1EsDbDvxWlJoFb7MGO/8533NZ\n62c5tLaKRzeJnKRjIPdlGE4VEvjxm8bcUIMSk4idaymrTESCmX0pqqkNDJfX\nzF90X+LHF3Zt9z87YcyZ3XZGX7hx8ll0/w78hPyCSxWS91SIKieh98Wo4bnw\nPloXi7OI0qTk6pm7PF2qviyuA+oj2eFxTSBFznLQuUDKH7cruDQPBSTHm7DN\n6Jm9SDLQU2Vo4VNRmKrhoL5HF7yKgAJtWAWzwpy0K9vR6VyAIXEL3FIHIqno\n8a79bydtFUF3JLfZVLqpiORQ1w82/KKM56sMvcA+9JKDNUfGAQRSwMl/dYgD\nh4ayxUCf53x5a4D+8OD8iBWwo+ViM/A2PcX4WGgEvigKKQ1cgd7bDOJ9MLnQ\nexLzyYEo6kjXtuppvCpn66vb3idipdgv2g9CUc/f8UKrr6Cvfh9n93Op1egN\neraD\r\n=pe9J\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBXXs7SkPJKF0/RMUi3tyj0PJaBA8kfj7/uTtCx9lcp0AiB+gRNZgk8FrT6ukgaKRnYnZVUoZZ2OB2xmuFocbpAeyg=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20201229023359_1609209241038_0.507372610210596"},"_hasShrinkwrap":false},"1.1.3":{"name":"as-typed","version":"1.1.3","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"gitHead":"ad13e37f85257e291744dfd6c4e4108cf25a6d64","_id":"as-typed@1.1.3","_nodeVersion":"10.23.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-Sw+7k1l463HdZDKA9PGThsFFzU37hlcnfSwc13M2T/USbLaHzdhGyxybza0b+XgFNuq8p8ne6k3EcBCD7YTZLA==","shasum":"0d271e46eb890691b0ec42efbd1f4a4f521ca2fa","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-1.1.3.tgz","fileCount":13,"unpackedSize":35735,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf6pXjCRA9TVsSAnZWagAACcYP/j4f6BOV8YC23W8QIQBE\nHlY84/dXreBVha6fnIxLkBKks3zjz0nP76BjXxlp2Elm/GTmz6xSNN3oOIlQ\nKGt3VkREQJcbqaBP0ctCse+6946o6ExPTirfaBTJ4Abr1bZUjvTubOeQLCDV\n2C1gJ0jgxpf6DuB7TmZZMYncZq/rL+bciGsey4SGpHIpO5bXqOWfhALz6KZK\nsb6GtTR28mhHv3I6wFkQEWeud8nzOXSDe7Zz/cM755H9Oy+oXOfui5oQ+0/X\nonvSvB4wn/Y9U8XFxoalFqVkhtkyA0mh9wi+V66H/nU1uOhBGdmzBp9mDZln\nUqbNbteiXiL6oaNYOsfgAA8yB3cIQBw6p/2l0tYPMcA+6ARpD8EdmrsWCD6A\nsg5QM90OJGtkrwYngHzU1/DOWe2aKK8Xutx6vQ+rw3S1Ff43duBR7DFlY7/a\nM74c7yvjtSQVfrHcYlh2kgQ7gUYcwuTe3EEWAytqX30Lr+vjhbltScpxTe7N\nQteVh/HH3NKNE10qRy6Li2JvktEfCd/ezv+5FqPmqOr188t0KaHzjEmtO1PA\n3QdwhzXOW/uguOf3i3WXrE8RCbHJwYeQokshOGM8YOhg+1yczzoAZFl7r3Fd\nWk3rMoybrJhkWmxp4S57yuHQmrXUtgWI0L4twBCrc8swYjCc09Yb+NTEqay2\ntB7D\r\n=5wla\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD57h2+8TiynUbpFn8TX2fyWjte3A5opZOeTkT+/nTKwwIhAPsWixMZBgGBj5gxSN3QR0RxSfcQIG3JGOakzMbQiF4D"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_1.1.3_1609209315046_0.026835379088687716"},"_hasShrinkwrap":false},"0.0.0-dev.20210203015357":{"name":"as-typed","version":"0.0.0-dev.20210203015357","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"bedff630e5d50e2c4b85d1b79b652fb195f424ab","_id":"as-typed@0.0.0-dev.20210203015357","_nodeVersion":"10.23.1","_npmVersion":"6.14.10","dist":{"integrity":"sha512-2xQLhf2CUX2WaxmZQyVC8w/fe3hCt0FOOR0ShiJdviX4mdtbkbCV0jirzMh7Rzuc5RFTnw/MBb/f5/99yFW9Fg==","shasum":"97c392c3a16043cd5be8ad795dd2a90608c46fd3","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210203015357.tgz","fileCount":13,"unpackedSize":34676,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGgI4CRA9TVsSAnZWagAAggMP/i9UkTurmyCkr+jpaaU0\nhdRm1ENOTcTvtAUOr5XkhLbYZ5d78zStjb+ptdb3/CnE9yhlYO0EQoRQj6Yl\nyHprsi5h0SBi1+GZN3EFP0irgrGlBGn/9XyCCwmtw12q+fjBf1q9i9O2BOC7\nwu/qMcqAQjzj8u+JXCIuC5ZykjUVTmFZ2DdJEWHMoJx7H+kIXLESCNMq6jQe\nT8FIBcdAoV9NFWjHBKT3/GAeddqu6AyBqdOjKSDRHqbpvcPYDHhyW4pIY0c3\nDCHBLSKM9X2becBjuk+wRpnyidu3jPOt1rgY52nbSKFiDD7k4VZA4pz+SIJt\nreUbbRgAknDUZLPrb9GFGUY4f6sqkywDH886k/9qkVj6IEw0C06m49slxDc1\nmlExqlCyQLFsyFhPmSn1wHRu/+CbU5NwpYgBwDDH11RVtGWRHa3vG9tnMrUb\neC9EeeZlgefTwuBy8zyKw70P71cxL8OWv6dFT5cPKivyr7afVwNAbWNf3kiv\nzLMgoV845Sp+FYh5dtpWg1XeX5i0erO+wrlxYGojt5BO2h8KBTu9w7jqgmzK\nIgaZjcafjKpJeCcBUUY1ahh3tiLiDGwoGQkFm+AUMN6LcfFBTci4+COuvebl\ntZQ4ZXzAHCyo27D5Rs1lUc2DeEtXTh8mhmnmflknBirp4WBS3IMod5xBUsD1\n7oMx\r\n=M3Jm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHXT4/BUS24nvAVLRTUd3b/Ucfp0l8AaV/HBoszSRirnAiBxwkdVPo2yRAxXAsBGJfmdJfeWS2G3y/8PL1SblddfOQ=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210203015357_1612317239572_0.582478950874399"},"_hasShrinkwrap":false},"0.0.0-dev.20210203020142":{"name":"as-typed","version":"0.0.0-dev.20210203020142","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"ed501f6c8dd7f36ecd04856a80bf178099d94228","_id":"as-typed@0.0.0-dev.20210203020142","_nodeVersion":"10.23.1","_npmVersion":"6.14.10","dist":{"integrity":"sha512-YAXou2UhrsuXjb3s7Y6AS8PM3cowgeK+jyTHlU5yM0+LtYl41mNBbhpNG4sbnmB2pO8zP2O9D/EOTlvMBPg0Og==","shasum":"aa4f01dd6c4793d8cb9335699ce039ee2eaa24e6","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210203020142.tgz","fileCount":13,"unpackedSize":34930,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGgQICRA9TVsSAnZWagAA9D8P/R9BXeLAuSW4wtqCLllG\nvJoWQpLGSmRVL7bnsSO+5wnVOjBTqoUiDKqfFKdQRUvlvP0FNV6HhLYmm338\nt8r5csiOO760212hwyIKY8X4AmdBDz8fn/BooB77iGOz5RdYzM1lY1DJBwty\nou2sxermqrA/zzg7dk7zDJGxbOWy+GBW0GX/OoKpvrFaM4Wmwl8xBcpCQd/X\n+DbRyLZz+i43WJB/VLGedtCTxYajElXhWZLyDTlmBpaw4QxNlyz9kwmwI7Nr\ntRbNN1AyQi8ViUQFAW4IaWueDc7vBYtxlFpVN+jcQ8Ar1oi797KCJobkldyH\nZ4z3S22iynu+7CqD/g3URjwAX7K0wjLs5oySXm7qR8NyYOmkiYk/PhrqNVt9\nm5QtnAm2YB0oJu8e15QR1kIYoUtCw7MX1bskkZISoF+1nYdMs3GBG/aGwdfG\nsn2aHDvTHmr3nqHMbwK1lKufaASABs84Scmk9C1bjwF0ctDbRILZCv7nytxq\nt7iwbluytOfOiTRqykwQJgkfiXfcSS85M7Wbzhv0YHvqb/viQqP07AZpOuNg\nSSqbJDVTUXG77NBU6ArnqeYQRrYlOEx1Wl4IjdVVQBZU18lsls4ERDovCv1S\n1jncRIX1VD0SIyXX8ezozKeK+uL2gOS9gig8C4JcE9zWN4v3Q3di7R69aOAY\nTUyv\r\n=XfFh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID1zfaSzIG2j/fV67OOZmU8S/dj04tXmLpbsLDwvX5ttAiEAxeMxf0qKyfTaVn41KcfFDjXbxTa9gvImjhU+a2FlozY="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210203020142_1612317704366_0.9307727366236067"},"_hasShrinkwrap":false},"0.0.0-dev.20210203020211":{"name":"as-typed","version":"0.0.0-dev.20210203020211","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"050ea4c4197fc955041cd4ed728c43c70c1d4f2f","_id":"as-typed@0.0.0-dev.20210203020211","_nodeVersion":"10.23.1","_npmVersion":"6.14.10","dist":{"integrity":"sha512-QeuKlVmPuI/FzkYZI12hmol3sF41DOxCGdqOk6b7cOPDDqLxM5qXiXSbfeJVxM9HGjwKrqs3+fXqt6p2CdyN5Q==","shasum":"e0290e3f606804c225858ed2ffa9a7ffdec379cd","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210203020211.tgz","fileCount":13,"unpackedSize":34931,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGgQlCRA9TVsSAnZWagAAacsP/0t0oZUp9NpfJPR/Ppz7\nJb63b5e8mbsd3lflJMkpWE9RNwS8Z+qHCHUDTTqYfHbu+nRPqpicbTjdXSO6\nVxihcLkoFsZrHix5j8ACDX9QbWZCdp9/drcMO3SdQcOUxh2q38TvCNQ/sDXv\nofuhgVgE3JglY8pcOCKMNuCbm2S8rfMj6OcprLk/23KddV+UBOX4PnbS2FJV\nCN7dFAATrg0uOBygEJLsa4nQ4MVNW3xlP7aLsH2iedlpQadmvSQzJ0dPNndE\n9heb/bCuUM3Z/etRbQQA0wbPdgGjNVg6bjw4pkWOonhfJd2OwRlzXBriRtfI\nqfTmEUanUfzAkGfhQAYcc938fyLQwB6cot6SUuB04kaIjtCRNPc2T7nrg4hd\nTrLhXMwTDgFqI4qOVdlk+dcxfPRrzGlO3YsmOExYk88AYf2WdNgXL1IJYO0R\n56QpwZj50UPFfjlmh8I9mEnUYPknKF8A46oUCZCbB4TO/OJZ7eOiPbkDu9y+\nBoEVORR7ae7xNDPLGiY8sbMBKCYZHNxzRjCPaexZhxJC0gI8V+tbHdPPoS11\nBblXj7jOHoYGO4M3d46H9khgtnpVsuYW9kMClXUTJaduxOP4REF1EgAFLpzF\nXQBWA3R2KU5tRCwFxpbX7qCMSbS1ayoJAbq7d24lSlquYvrO9mEEaH/atxlZ\nLYCj\r\n=zAVq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEpLhx0JjAgZ7TtLs2V9z1pqGfUmNm0wlX79n7GJ6PDlAiEApJ17CRaJjsRdFTNdkMifodGekxa9m/yIUIOLBME+fhI="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210203020211_1612317732803_0.15493302978814527"},"_hasShrinkwrap":false},"0.0.0-dev.20210203020833":{"name":"as-typed","version":"0.0.0-dev.20210203020833","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"e428ab2f2cef48d4d6cee30aff72eedf2d9b8def","_id":"as-typed@0.0.0-dev.20210203020833","_nodeVersion":"10.23.1","_npmVersion":"6.14.10","dist":{"integrity":"sha512-cbEupnrYk6RCEzqsMM0MIuVeJfXM9rNX3g5/pLLBGRhpGfvX1Kp+ljVd90s2q6UR1fcbZNk8gcFMO9ntwjSelQ==","shasum":"ddfa5d0acb9feff53675ae22bb0231059162129f","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210203020833.tgz","fileCount":13,"unpackedSize":34742,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGgWjCRA9TVsSAnZWagAADVIP/0xJPDO/3ArCSgOV0OfP\nhgPMOfLmXhHnAuj3pZwAmQ5IGcvjV0PfvBvHoyDIbq83PJt7XXBFuJkmYzJS\nMtH4GXywMetfIA2QeGQy+xpCObvP+TFEZbR2Kg1hlu95BOGXjRarL9ZqImsE\n2OqIalC9cW/g2S+IHO2UvMdEUoFiHCoR0AK1RvquE6SwWakYtfDPNqCJzzTz\nslpwsVfqGf3+ues5ERjqSe0jY1VKrghNvCiCN5GQ1CaLdw/T5/bfyzlW/j+5\nSnB+FRO9wlKv9KWNQ1pyyvfkXFsOW+XXM12fpVBc90/Mv7oQCs6gR3exCTut\nCDBcBwFXjXEmftKAZebQoYUJ6u9SQvQ9AZ79Ki91MwZcjZ3Z9kQLGzLLmmWk\nmDfG1xyEgRibywKazhrbiAubRuJnvVAvnWIORlxzrOM6ThnHru/UHz7X3bGz\nlmv8Dlu23O3snI/hyAcdKDq54Xoyq8zPlH0w6Xcb+JE3eVOliDk0SxVFo0VC\ninJzwSmmbOd5bsWxJCn4AKoyEAFo8ZSsGWr1q6m2exge7NPSOT7T14JTr8Y7\nebdNH8E8g5jl2bJguTMSYr/arDS5trjyBDoX/33qzLtWXhZ8Xdmm+vzTE+Og\nF+KfSbFhvQTq1GJZwCPswNPiXwnoXs00La+6MlUPAVZEhK2dbi2qnJxFqJE5\nQXdl\r\n=X4sd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjlVWRs1g0vynjWC803zyvuznQuF8QEqVaQSLk2EcioAIgGl9+cgIWNOZrSCgJh0ly+WypX1YttF1QbMn1DS30sOo="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210203020833_1612318115431_0.8113166900070354"},"_hasShrinkwrap":false},"1.2.0":{"name":"as-typed","version":"1.2.0","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"gitHead":"e428ab2f2cef48d4d6cee30aff72eedf2d9b8def","_id":"as-typed@1.2.0","_nodeVersion":"10.23.1","_npmVersion":"6.14.10","dist":{"integrity":"sha512-f/TVWV/DcpAjOtMAjoqbZXLluaB5l/ZozcbRH6yqDfrkLyeeKb7nKyV4ObsCQv+R+pFaUo2PU5OV/KV3X1QaSA==","shasum":"2485b74458ea718d5f1352f2a25893d6ca928f83","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-1.2.0.tgz","fileCount":13,"unpackedSize":34723,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGgaECRA9TVsSAnZWagAA4gMQAJ3BmklBV47kbQnFFjcQ\nrWCHAoyWaIGk3+QhozUgyWtXsC4SqnB9qB9lDS5DS7dOh9hqLbe3Cp3m6Y0X\nEU8d2RraGegPRjZR7bcg6KNzRiVGgBSvs97zF1vy5Xpl/U4vo52RgMByKOwb\nRaZM5U5SLzsNjad5sWqZCb3iaz38/yhifpyN9AI5+fucs90JK8KGxw2SI3k7\ngrIQQ6O159lz+HR9P5AeVkBFH5B8uBQqazRZPIiQXB4euGHC2Zdqd28Amx1R\nN3BLSdXIghBV2HikaOwoSlE5prLtRzUaDgFmy9M+pvMF7A8hrgdlOLyXkMvl\n6fwa38LsL3VhRU6BqhPGM+6Vk6jYHkQlBS8sNno7tJiK0/E5uoTWQ1ELtk0N\nBtWqeyNmseTpxuZoF7unE+ExK1tAgoCpJ1NXeYNwXVAam8k6AYu+2qwwYTj6\n9gDLrrwOwseZApHmFaTnxofOMTwe1mQVif+QBOdmvs4NXRsqUda0TUw7+8E/\nh24ykQhRbl8eugb/IXxyOEvJaOOWW5CuVktElgMBk9CL4gU7D18RQlpRVys4\nkA2vLRdwFw13wPZs4itKuxRDDyxbp2WWJ0clafaJi0tYslI+0NCgcIFOT+07\n3GgNqu5cVxc0RJ+BqPYvS79fiIBv9rLhVFcXrn1EHhggh9rz1CyVJM9J8VZT\nGiD9\r\n=6pn5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRrJUtoIlbHIeW0JjOrqLy5g5hhuRmbxBpnJz2MXceHQIgf+stpksAQoyaij45n0HuhYG7rM+qY+D97zB6hsXiXJw="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_1.2.0_1612318340190_0.16607289459474361"},"_hasShrinkwrap":false},"0.0.0-dev.20210212015318":{"name":"as-typed","version":"0.0.0-dev.20210212015318","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","dependencies":{},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.11.0","@typescript-eslint/parser":"^4.11.0","@typescript-eslint/typescript-estree":"^4.11.0","eslint":"^7.16.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.20.2","eslint-plugin-prettier":"^3.3.0","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"23ba7af09d08e14158e7105203de2f71b1ff2f74","_id":"as-typed@0.0.0-dev.20210212015318","_nodeVersion":"10.23.2","_npmVersion":"6.14.10","dist":{"integrity":"sha512-NOHi+h4Xg5JuW5hdjMX05VazcB26xjYREWVE+qKozbYf6K6u1qLcnT/tZgW5Xo+slALw9v57u7eWvD3WpEljhQ==","shasum":"6d800cbc75aad7c8e5c549503c91c465fb53157a","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210212015318.tgz","fileCount":13,"unpackedSize":30893,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJd+QCRA9TVsSAnZWagAAXlcP/il8KccGwy30MFXMYfbO\niivmBoY1hEdhP3RNHS1KYYwUBTyQfqd3M0z81hQGc1wjAw8vKspFWQTxxb3+\nQuOx+1mGAV/z3KxRUNH5I6xwsdYayUQGXV8u4XgtVwWrxbBvxfjAHEFOJYhH\n0AS9a4P7WQ7x54GlavOmghh1gmUSyJ21M+JMIlpgvsyzVgF04/Sz1+G8M2MU\nNA6iNsOqzI6pzBHeK61JknM3MX+BLyjFU87FccPnciMBOCrgq4OLCHuXtL1f\ne9Z8Ark8yPdzBV0jQoymMSd/hxyJl/GnSO+7Jn8e6HuF76YwT8Y+JCAPw003\nFuOqLH45Cl/vBz/3KyENqTEDWKhZ4Rsb0e8BIg6zoD0KoF3/0ZvWp9M5rEaw\nn7uuDQmN+Mfsrgh+Lm3wsWAxI+y3NrWgoHXtqKG/sU29b6DNVPcVzjE+HHRB\noM/KL0QvLNv3vpF5Tuhl5FIlKTwbXbMmppAUWOlv8uRodtH1pCcSSuFuJ9Ze\n4WP7DYQbz7b0nZNy83egxMqgSo5V3AA1WCfaJuvIOnK45r2ie3aV6xRrrZWz\n1GaBOOPSQ+Jo2NVf5Acv3SNsW3TPDYGhpF3FTAbJJwOu6cuf6S24YZzo8WDT\nSDbig6fpctppbdBYjMq3aLZuv2wAR22aQRii1qvv+NiSeXTN6g/6Ro9C6tku\nl4J5\r\n=gBHq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDWTaG/kjTmKebZ5COCKYgzp2P9OSrlMpLguTGbFk1MZAiAuMj5teTUUNIIG/ePxNBMvNw4RT+4YNPuidPzQb5nDKg=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210212015318_1613094800116_0.9429716710243274"},"_hasShrinkwrap":false},"0.0.0-dev.20210212015557":{"name":"as-typed","version":"0.0.0-dev.20210212015557","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","ts-node":"^9.1.1","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"78ab721e3af42589c30c224b79b76636c6a81d0d","_id":"as-typed@0.0.0-dev.20210212015557","_nodeVersion":"10.23.2","_npmVersion":"6.14.10","dist":{"integrity":"sha512-VqLqH58hphW12dQIEANZ2WXfJUUreSgzhQWduzRb+EY44TvTEy1qlq9n2Yv+jGJ2Wem33Y49YzHMBzCJZYxAMQ==","shasum":"2f70f58c8bc0c5646741ff43ee6828eadf544b9c","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210212015557.tgz","fileCount":13,"unpackedSize":30871,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJeAuCRA9TVsSAnZWagAAdysP/0xAdD0KiiVuavpIkDg7\ntSuwCW2a+UnL14G0Ayik8efluzOK57RD9wfUs0/APxZIk33LcVDmIoqbwi5w\nbVZYnoJeSmmSbSTrEgwZLopGyKNqe797wsnFaH+ZZ7nv4rgqsCw6xtqbDCW8\nYZbwhyzZD3vJFEIoNt0krLHxfbrzxYBfeLjQgzOZz7cLqp42+381DOCXYXVM\nKjzVkhypC2kUUI89h+GGRjA6DtzRakx2BqPiWs+psjfqEFXv53i/cMi7olBv\ndGmcAV9CimnJjPGLI9/mWZcxwE20dOk0ZzVqAEoWU8z67aFPnz2D7GJnlAEi\nRbOnQH7jUrUjBTqc9lRu8/4Y791E9CYMpNre9YZP/LC2jHccjJxvsARUiClE\n4yNeeHxrT9xDNA6x2khWrGxyfrqHOZRz9G9e4BE1nBvfcuk6DmNPPB6z8+Kg\nlqhlWiuVj2/6XThuxqgQyY/I7c7yzDUMYCrCW5umKbWHdqUmqKPm9JHyPsd2\ngUgXVIHGzjAabrBW1t2P1qEkOjL0/398ang3EnTPtLPgBk3p+Q39002CzRbO\n2dq4nE6PpiQXJEgwNHCHItz7Ju1G65O7WN2WdPV7Hv8Y9O1fIrKMC1EYN7zL\n+C3eKUSrvwSCLeKT9TF+pobwDSzQbmlzE37n1amG/PZgZRqz2gv9ocmxKnDi\nYjTp\r\n=Tnpk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEtIlAdExbOZTVF3LN8NFde8ZzFwpY6Lc04vkD//p2KlAiAovYQQaG6bsyZwXLRuqn4savxeYoyOCg4kVz05DJldWg=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210212015557_1613094958231_0.32910649229705813"},"_hasShrinkwrap":false},"0.0.0-dev.20210212020232":{"name":"as-typed","version":"0.0.0-dev.20210212020232","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"0910dafffe2f7b35f8b1622281ec184e290fb545","_id":"as-typed@0.0.0-dev.20210212020232","_nodeVersion":"10.23.2","_npmVersion":"6.14.10","dist":{"integrity":"sha512-wOYoSzD+g2n52lJ979rFWUen9TJQdyrfTZQm6B+K36rHNn6SgPI9z5BKmJyN11v5zZAdepDjelrfaRVbMxPdtw==","shasum":"a83a14d93c5b39c5d8b71251ea1c3bd6f59cf15b","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210212020232.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJeG5CRA9TVsSAnZWagAA07MP/iPH2r1qoMvFg9a6wNV6\nbBLPHYVG7tLVtXiT3tpmsazIB8xuNYCH4uz+WvXNuZA2YaatDP5tsoO/vrht\nyjElnNl79P0R8zWAEwVaEwBhfQqnJU+3Jm1m8Aa5xYr657hlikyPBfaTH/S9\ns1QCYM9r1xR3l64IFGnTJZsKCDYVkdimuZh7Hx/qKuSekyuHSCB4o4rf1PhN\n1CH18IShAmrZ1LANjLsPjzZfNTyqyJKoe5wQxBQju0irT3l2T2XdOfrNmbMH\nF81YZPc13KTqm0N9ZInbpxWQrZNbJOgVHA4ryFdNW5DjTp8156lmkQ9OuhWw\n1cDxyGVgwpoiIR+yoRQ2KY3jZ6TDPajg7b8AmF6oCmmiV1vcIKarRtFWOTg+\nBCXg/FBNpSt7f+ptiF7T2ZkyHRkZn5x7/JHLO+XZ8hcmBWfvjjS5nDBYGnme\nM3xCwOqXkwrxuxsL1u/4OuaEwCFbhDdgHH+HcrjU9G4ipfRJuq840OHoXQBu\nI5/lKWLXGInDQoEzx9ti7p7gUWymVHmA2WZuOUgUxi+armCYMIDkpC+Z/Zk9\n3g4sLnDGTx/MLZ3QNmk+Q8UaMvdv9dHtqm36D4c585r688dFyGXZXf8n2ZK8\nzl7n/0sP1cK8I/G/B1jEJvbkLKntcO0JJfU/YKAUOQRTL6627bjSqLsAcObg\nYudi\r\n=OAm9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCiAxjxBJylZTA7oJPBYLYITcpE3gOrkzT2Zme4SdzQOAIgStBa92P5KEVNPQ+DpOLwxqaMTsO/lq81TOORjH/s9f8="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210212020232_1613095353408_0.6493819176048761"},"_hasShrinkwrap":false},"1.3.0":{"name":"as-typed","version":"1.3.0","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"gitHead":"0910dafffe2f7b35f8b1622281ec184e290fb545","_id":"as-typed@1.3.0","_nodeVersion":"10.23.2","_npmVersion":"6.14.10","dist":{"integrity":"sha512-cEEHgSky2Slztm8HAVPN75EFT9mcpmmEWFQ8JZdcCjkNsRg64XLaVDeFi43lkfTfX9h9ABq15XmmGBIZtfFcqQ==","shasum":"5b55383f6465d1c35a91cfc919e3d3004bc6790c","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-1.3.0.tgz","fileCount":13,"unpackedSize":30827,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJeHkCRA9TVsSAnZWagAAXUwP+QHozJKN7eJ3k90MaLxp\nKg7IKCcsINl4GxUCSmA+ic6sWW1laeJsvX5zvHBBt8J3B0a/AHqyDwKhT0WY\nM9Ri2jHxo7YYq4dJGVQgO0TKyQlzwFTkb1Ep3Qhc1X1AprQknd0F1Ef0ROVh\nAJhTf4j8Led8epXPVkVVHSQMpPHRqdnu77fkyHxjoDev3TW39roZJ/7jrvwx\n8c0D2ne5wieJz537x1c3svMswv8K+V+vUBIIKW2Ohsszu2rrkMx+cnGfaKqB\nP9byhBizZtyjiiK6Mvkfaf69f35nd8+feEKGGzL8OSpxrZyGZdIwLSU2cen3\nj0ZpAdFPGDEjGHupkKvzLspEojxfZLYppABAqGKEIEhi2Mpi7gQjrg2sfmnp\npLC0O1ipxdo1gJvWxo1HS1HMvpBR6VlGJnJM0VzjPD2H4siIccj/3DTiqbw7\notzqH8c0Y+g1xfozvWnRV4s6RkY1LYlZnIwNgEhI6e0DFAGdkFlSovRwxk/p\na9ucLGJM6xZKQTKLQEC0NWJn7qOY+QtId+tm9NCB0vfRCym1FimOleqSVrz5\nZyzwR0eO6gzYnmVgCLFxXzZVAekRV8b5clCL6+csII+N64xf5qorwEHTYarZ\nf2QXRzQXF/xlNNI226BNE9TnOlNGGquW48n8Mwjsqo+n2wmQdxJQYnkMBNe3\nH6+/\r\n=AFa/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCCzSjOJzLzx55jAyms8BogeOvqym3KPRpoNp3GndUIXAIhALf3ayWNvU3SUOjKhyXtn3W2vfXkrsgdi5k78k6apaRT"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_1.3.0_1613095395707_0.537278083301171"},"_hasShrinkwrap":false},"0.0.0-dev.20210215202415":{"name":"as-typed","version":"0.0.0-dev.20210215202415","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"6b99cb3e2b3159dab29235fce2ef09c87e4e9f95","_id":"as-typed@0.0.0-dev.20210215202415","_nodeVersion":"10.23.2","_npmVersion":"6.14.10","dist":{"integrity":"sha512-1GoHGJByRKeNt3O7+Yqnqpt2u5SMzYC3PcaZIrtUpGP1Xui84nu/Tth8hoVkzz9I7DeB1bPXhzOVjM32zTv3Ew==","shasum":"3903c5b8a1a3167bc5b470e67ac8abeb11e0a1f6","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210215202415.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgKthxCRA9TVsSAnZWagAAfE8QAJvsREp3/ALd2WvO0iFu\nfp5In9z4+a0bq9yfho25UBNZH39f3sicnbnNwu5BcbOOInxIhplvbBclTIfr\nDpwXlNKEw3DpEfH9csJw4hZWhu8uKEa/dWH+aYe96rd+mDU0ZH+8Lb6+eCh8\neafV+TU6Sg7c9+LANkZAmPmhVnVRFVPt/IbF8zSFGPDB6+X/a9TsY8sJRcDk\nnRhBJn7g9Cufidyl52E8WUsgRW1KybY7KZYpsR/FNgk2AFvTQroJM7SIrkJ9\nVsvbG6bd6AmgaZFHXu7NbSzxEDHnGNpCW++BnkAVzJ98Zp8V7BA6+sZEApfw\nGUmCI3PqmzkPw1d8Gc9yCGkPbUtFeu41oVkLTPhBRlfbeBvuVD+nnNzmbbXv\nziP9gc5LoobQ208gfZ4i5y02ADZgdy/cKpLk30Ej2uJgNgqnNDoy8+J7DClU\nuiWXFOtm7y/5oMWryksDYijPZTib2Jdl0HNz6jAGkR3FnEIHXfQ9DO+n5Hvv\nkfvgCBF7LFXtAyAhUTBycYfweh6w3M2cJK8rnK1iXnaiyvgApsE+ZcO05K+L\ncFLn/krQ0OwtHDQGQHoFUng0Pas3DMYOeHUr21g9d45T9BJHfnvbB3xHVT6e\nMytKFWLKKLyq4hI+mkZ0iLFEsJ8cmmi040tWK11UCbaqTcjJHGxsM/UYA+Gk\nA8Px\r\n=b706\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCm0xEAVH4kdJgFLnRLPDbWop276Q8iaIQ/5oxsbkaUUAIgDfqH9cIL0F7j0VoxBax7k5RULaveWkdEgTp1ORwPEZY="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210215202415_1613420657191_0.41205163124830113"},"_hasShrinkwrap":false},"0.0.0-dev.20210216141650":{"name":"as-typed","version":"0.0.0-dev.20210216141650","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"e10d574337245a2cd707122b2437020a742e2de4","_id":"as-typed@0.0.0-dev.20210216141650","_nodeVersion":"10.23.2","_npmVersion":"6.14.10","dist":{"integrity":"sha512-KhTmXrVcPbVVtOzBSXxwU9Ncwjsf8EWVLkZLXPO2rSJugeYJ62BfqJqGX+5L+Z4vqJ7tNTnr1U5+aLSWJp6kjA==","shasum":"ecf84562431f690f2bee9aa09db1c345a2925bb2","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210216141650.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgK9PUCRA9TVsSAnZWagAAf9IP/2JzK72CGBDIQIXAWERA\njm2CiDQKM72j9fYTlhD3nD9c/lBfUrlrYcyrrbYL7XAWONsSSzaheENKYGSc\nMi9yZWoqFqNYVEchIhIq2LNkKkG6ItrbwLJJhAK1BlOEmAQ4ArkdFKNKETC1\nr8A3n6YYmpf/unZAf5Q4wZ9mDTnOP0zLi0+e0X2OPnU4Wq7PaQUENUbqB+jq\n5oSCsYuPJh6JUXjkae18idox+FCgU0+lBsGeIN8WdkTsrHUoT9QiC1cnoAkl\nFB8ELDzsQ1znZjZTsiTLB/7OEWCw1gWKdQW2zoArNj8YoehyaGib1eAzQ9qW\naN/m7Xg+6cB0LCP4/X+FYGYKzrXAq4JVXBN4yAB7SVNvdu40LJND7+OG3BON\neZ7xXs3cSR9mOXUfLgSWIJBWrE421v29NC7LM/7tQ+6dY5I1cTORw1lCb3if\nwbcWyrJPVVoMK+tYjc5dKLRs6IEYwE4vxcz/AyjbmAhkNCMh2n0N1ooQNjmi\nDJ7Q6wmE0RlIcq0QYqABcHY6RAQ7z0+q8l0LfseakTt0sBdjKjll6Ly66mgi\nVBjawz/VG4efqMflK91HDpHpG4DyMFZ72OEIDjfJ+UgJRdrYRmLMCxBcnCOt\nM6iS7WgqR9/x8F86QyYtMWlvaFPvzq6G/tgi5EflLfaa0HvU3elO+/J09Nz+\n7Ta3\r\n=RaaW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCdcAs1bSgSfygUZTEUkj+lwmK7MtPYcBXDvJDEXScVQIgaqCOss3w8YJuiH8qHPtgtnghU7rB0FW6rlpMp01Fw/s="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210216141650_1613485012326_0.3585140765397745"},"_hasShrinkwrap":false},"0.0.0-dev.20210216141654":{"name":"as-typed","version":"0.0.0-dev.20210216141654","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"2b6ad291a01806543b51288fd8977d2cd73ba297","_id":"as-typed@0.0.0-dev.20210216141654","_nodeVersion":"10.23.2","_npmVersion":"6.14.10","dist":{"integrity":"sha512-X+5bX/JN+am/jabhQVzHdwogRtnRtnBckETnpTpPXNN3DXJAj/Ue7IejbhkMJouhFWlQ1w3R9jc1rVRPIfg+9w==","shasum":"23324ec376022cc8be9efaa4044ac8d813d95161","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210216141654.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgK9PXCRA9TVsSAnZWagAAeoUP/RT9D+92V0BXg1EqNik4\nNPezuklW30Y7xiv/hCLLgYocDxsdMeAop825PgCfHTdwGW00PFeqhpFKrO9a\n/efzDJJA9L8y00Z9dByTntoFfmUWoldkFNeGbVmGFv8tBUtp6BBsLTQANjaA\n9gqIdIrwwkmo0nptqB4u95ftsKWh9Oj5v/E/CQDRqGBOV2NEwJ2K8vERCOAV\n+f9a4y38lUAscu8vvGeUerx0jKllaTDEnSBTd+3rjt9ssBD3Lr1GYSDuFJlh\nErRZ3vF/vrjk0LMwsuZ+0LM5z1krFiaiLaBCmA+qgQEeSRjqwznqulR2NTSe\n8fjf//RHDsLqRGvbdztjyVvFQJepuiY4g2d2h++ZG3iNZ3Q+6LNSlj6K1AEn\n/+LmLcxbRtSXVJgnw72Z8DlsQx64vV14afVBEZ2kEUe+te/Z0qrHHgGIGbLA\nsp6QyBH+jCPnmW9MrFxBYifrmvrHnFZ+GlN9hWo0hoU3305SQybSGVOKAsTX\nYxQvmUwit+uBMIL1znnMhWKMApFqgg76+1mFQvJTlhN4+e34VnWF4tl8334Q\nrNd4m+p62eZ+2s6jRneG4I9W5ccLDsQ+gYzqlnZ7nYGMIO8FquixKtDo198g\nPBVMA8t9yEJPgUGaiSnSs55kNRYwN1wag+KvxH41be5SZNiVlITmH1IhhA9L\nWmxa\r\n=CgR9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDWw/TuZDnpnVtNxpvYKBJBNh7tc6ku0A1FCxiY3fB6CwIhAL/XMtadWEQFQhXKtDZtW3Rcd+rlypgMSTdP6UmxjS3w"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210216141654_1613485015390_0.6099663180109236"},"_hasShrinkwrap":false},"0.0.0-dev.20210216141755":{"name":"as-typed","version":"0.0.0-dev.20210216141755","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"d16ee7f4e19c34ddd0533a3b56beb636a65eaa86","_id":"as-typed@0.0.0-dev.20210216141755","_nodeVersion":"10.23.2","_npmVersion":"6.14.10","dist":{"integrity":"sha512-0DcmlHF5o7IibeIlKQcHj2d3oegC/bSXz5SeDrHj62BtI+Ls5LY01Mu1JOy14z+5a99PTmC96uIXNa523QKz2g==","shasum":"5b3a91d90779726548ae20a573269eac7854c08c","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210216141755.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgK9QVCRA9TVsSAnZWagAANKsP/1th1Cln2ak+5o93AdFw\nH9vUW0Oz+CU0bxkndGyxO3RmoqS4vXZ4aq8kT4N8msil3hPGOwTXqSSvK6LM\nDgGBuL1ItN2UK01Yd2zP9QRACe4AZFQkpNibHzvIUIunyAita9s5kq7bBACs\nhUdQ/QJykSR8Co5wwfzvBW/gossqyLqFK+CW2TjMdPOujPVFyhUB+rHxarfW\n8LPieyGZiQOp4lJrwDu0FULMqWizLs2LIW4/Bnz4Hg9ecIl9sFrRoIJFF70g\nXMwfAcg/aVkkVju0sz5xpNfUvhTbwB2DoFbBeGcFo/XaRq+9J5tKxOnuFxu6\nWOZOJMFrxLGV1SZSY0kljZAkUpISc3FqsAcu+iAv6ntl+vwPXShCSsvzeQFW\nXpFzFqQDzRWF+r596Cx5tRLzmh2t6abirY8A/fZoggCRuhpFmEG7t/cc+AOm\nQ31UNCC5PDmE/8jG1/z4v+LR+WAQWlmEMTeUFWIiZo6o1uRC/1xvlf+V+VV1\neMT/NO2eFppQED28USjcGtlQTpBP966cBSapNljZ5c7AZxGMVMZnhloDjEjb\n3Q80pLnn5qcSbeRx6T8xU93TWU5u49evnNOaUUdZNgHoKpcO16npJe8pzWAE\nbyukwhgTW/sAAXjQsq7vJT8tV3UQgOwZoKxkX3ZCTmW9BzrK0V2vxaG94BTs\n6+CW\r\n=XPWf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMWyHleeoHih48oHlcBIOfhtAH46FXG5ed0Ya6yM7LpAIhAJjg5T8P3cIrxF71LaFLiY+i7AeAqXnZRC2n2QQuEdim"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210216141755_1613485076533_0.29262511891623255"},"_hasShrinkwrap":false},"0.0.0-dev.20210222120340":{"name":"as-typed","version":"0.0.0-dev.20210222120340","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^8.0.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"9b3b6fb29056fbe27eca06607ba0c9e253bdec3c","_id":"as-typed@0.0.0-dev.20210222120340","_nodeVersion":"10.23.3","_npmVersion":"6.14.11","dist":{"integrity":"sha512-L0pAZrZJCQuebgSnNCRki73O+bBGJbENeT73pPNt54siebuz6Ltz/5CwUD53oZxY13HbjcPR2QwbxKZzRgJt0A==","shasum":"779cf5f527c6c195a687de59707b91654b90f670","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210222120340.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgM52eCRA9TVsSAnZWagAAcXkP/1kpjrYZZAVFb3DgXuAL\nAVONgXXDREHERTA9pvrU9imwKP9J5hpenSPxf+bm8IWQ+txEiivJT2+oYfwm\nxDW2IiTf6Tx/oTNzQ3OMz3EEwRstktKmCYtfhdow1zzyRmig6OdnpJZ6DDv5\nkxmYK5e63h6YFko4lajDqxZuDb84tzDPkkYnWssCXQ4PjLUwdDbzCFI1sQ1Z\nyxg1NdQPwyOCRka4KCW/Jpoqs0aL8+ApDEWBxYwTWw3REfbw8a6ooNrgF65Q\nIt/Dx1MC066lCBE9Nq2lg4sMALRAkPu9s9NDo7GDvvHf7ZCxt5NSx4PQuiHJ\nyCqAQfyFH6Zn1eKDF7+w6cXD1bZkauAUMsi6uP8/Bo3EriV3gajyEDW45NjE\nNnT5POLi+uNbvvSEzxjeb7+MCTwWRWBQZjyvc1hT92ihlHR2mj9hdTu47MGt\nxfzolfZELrL9Y3Bby+CJyN1GZqdghwLV/UAsmn0OPFfuDeieKe4zYJAuAhL8\nEhyx0tD09JN65czCu7i687XMchlSm8KsnKwqlmERYbPZSbE2WfcIbBysftO6\nueHV3nftt064+E1D03fLXbsmTQ001eSWPduMLJ5IsMS/OlTbTHVnWOpRH50o\nfXkvej/NfCehb3dYlePcWSywIDOTYGMxnpGc0De+BtXP8mIvGCS7H5UlUKNR\npkWm\r\n=I2Be\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDu8Tm4TIigX6LH5i4jNTDeA8Ci4ENrVuEtJTL/EaeOowIhAKJ39Da+OJHKxqFg8xRD1RW2XsekICb54CtL1GDBtB94"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210222120340_1613995421617_0.044584300367064955"},"_hasShrinkwrap":false},"0.0.0-dev.20210224120107":{"name":"as-typed","version":"0.0.0-dev.20210224120107","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^8.0.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"ec9e5263d9417caace50c1580996dad4a99ac588","_id":"as-typed@0.0.0-dev.20210224120107","_nodeVersion":"10.23.3","_npmVersion":"6.14.11","dist":{"integrity":"sha512-ZzYFxYpfRvTpxM9d7vPflhbpezshcAuOj/53X0wSDLJF1A12DrxxOwLQ2OQdBAF1GTLqXIeSYB/avBclVCCizw==","shasum":"3ecea9108ffc70513bb94bdf09550550c9137887","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210224120107.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgNkAGCRA9TVsSAnZWagAAcE4P/iiwEPaBxnTrLjRO6cGl\nE/o+v3L+UH5V+v+RoUvT3SxuZGtiOHEnR/5Wi6iX9fw46ycAz/n2G4Yft0g7\neIXPiMsZ2S9xMDckAQlip1Smg06/sChcnq6mkWuqrXIM5LljMx0uceuy7MS0\nrcTqjKwS/T29kQB6yrvptqsa+Ah71CHGvO4Y63vou8pLBSzjAHE/5RQlCnhc\nUtVs4LhWGTHsLnVMOa6Lv1cbZlyivCs/XJrK7Y9vS/BGapjYgNO2BQ5IjIUS\nzgL0FvdKLIAWgGIpF+H47tp5Sstwx/5cTrEEDTOE84wZBc0PyyuPB6N6DG9C\nT0PCkARZJjKvib4P8bAs6ijK/5XFbAJBAX9CybFekcccsIqa7+1hOMBvS3xc\nitY1qstpRg7R7qDIPkK4qK1H3nOnQqp8WXDyGj92Z2mnB3fctKeufYNs7aMr\nedJumrWE6shcZbIqUa79nVYrY6C79SBE0D6w/XCgcHoooroCQSOIm65rI6sB\nNu4yWl97EfLKM+/fQepzvZMjOej+LfRi51pwMYTaeshhNF4Z+2jFALeE6krg\nkFXiZwFIB50MBTjgInnJ3RxaaYfi31eQZlNousA0wcdya73c8yNdHLQphQBr\nsjUN7nk7F1L3eFT75WOzXueKpPhmxQcwvQjnwFfRKNm8yEFexl9ASD09EKiX\n0mLc\r\n=IQUb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEKMQYqg6Rgy1bOq3BUakx76+c8DttFZ3RhkHz1GPkkaAiEAn9PCutG7frfxGwOH3qrbUk8U/C41+6NmUUJrgBqZROI="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210224120107_1614168070380_0.1834662222227692"},"_hasShrinkwrap":false},"0.0.0-dev.20210224120117":{"name":"as-typed","version":"0.0.0-dev.20210224120117","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^8.0.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"466ecdc091885b4c53a850089d93635b96b2b73c","_id":"as-typed@0.0.0-dev.20210224120117","_nodeVersion":"10.23.3","_npmVersion":"6.14.11","dist":{"integrity":"sha512-le96ju+4UzBO47v++215kDJwn9mRcljpV0ZBZJAu6LYIoV1Wy9fZzAN/lLdFUaY5252p7YAJZcjUMaNSaKolJA==","shasum":"553b19a7bdf4f3f3c9dafa8531632b2127fd686c","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210224120117.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgNkAPCRA9TVsSAnZWagAAxxkP/R9z9bPPIl+lrLmtcaBb\nwzUu5JYtZHfaPzX6AVG1xhY/igWtP/0T9lkdFlhrEPbBqqAjkh6wQfeqKCss\nUxwiMwYxcUhZoqr5D+ebVXYLddciWy1exnHDFTZ4VUaoh8qOlWn33c8v2ped\nDIWML1xMi/h9xkmAloEkYUprdsEjfHvE2MUqQrF224kC1nuuBRF9H6uyutex\nCJH0w9qp8Ih7+9TQCEwUJs4lwdaJx/4+WHsFB4RSn92ZcFq3XKtpxD7yT51q\nW9oD1tsIYQNoeeloFp6ZVzw3kkF6WlC6pyEsnB4j0sXkSy1z+/MbTfySwEsh\n51VonHGwLlWdgmJHRmpgoayfZToUDjV9uoW3twy/lo9ODM3pfxahhUZasUP0\nuXRrBHZQHP7F+1qlaP5x11/qhPRmIjT4eByNDIF/29g5JjhqWkVZjuIftwkG\nbe703PJcMVRRXcGloXBI1mEYg7/eDjNyUp300xkOmqdGFMbQ7VzlUuz3d4+D\nUaqQ3EJky4kal27MjEd2XoGXqsVlMNbyU+BJImAGAUF1GZFkURR+F7DtVBLF\nBuFAkh3XFfYWKHQPxhy+YlsmxQr/ZF0BnGuDW2gw/dROLvnctl2uZS48Nrha\n8r5QnMUUMq/Otl2nMzew9yxyIgsNOZVvgLorCUDr/glWdMKctQ/XX2PWmRel\nQAUE\r\n=3maj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCKGS+03wnRFLuDWjrOPNRz0odI+ONZzC45GxFH16eujgIgBowSBo3ohmlz3DpvkTh53rLdFOpPm+ybr9RuXxfD5tE="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210224120117_1614168078608_0.8857441271738706"},"_hasShrinkwrap":false},"0.0.0-dev.20210224120151":{"name":"as-typed","version":"0.0.0-dev.20210224120151","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^8.0.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"9ce6beeaad51779ef711d87d0ad3e3eeab1d367f","_id":"as-typed@0.0.0-dev.20210224120151","_nodeVersion":"10.23.3","_npmVersion":"6.14.11","dist":{"integrity":"sha512-YERkqwdtFXUdDA6OXM3MuzX35OWSWQkhLvtRnLOKqSq/WFh619G7Y7KSSTr2aJE/v+mU6hR5CKd7G8MQ01NZ2Q==","shasum":"558049ab445b4c463f492a851b1ec33e8afa59ac","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210224120151.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgNkAxCRA9TVsSAnZWagAAwUoQAIAfb7aX9VETggXgdpZZ\nBdoMpWQ9PjrDChjnUFKrWJCiwfkEmhyrJfw+q0XsraX8W4cy/RJhmWwwPSxV\n7hNU6mNGdzBssKIdCWhSV/xbNXRYoR6Ey6i05/u5JmZ0wVF3aMy/gDC2T7c1\n8p0oaLaVme9t5WNDxThxXc/6UpgHfJkUjwC+V2FvnFvahqqnv50YjnZ3jUDY\na5BcMfqNxDHCKly0C/N8qkGSO72EpFeOWYaJz9iu8Y2jIZnpQPadYryn+ie1\nRC/LWDFT+3fyjtpFI/iTaqDFrDMbPeHO2OYJDMVy0oGbk0Ca498Cm25tl7r6\nAhSHR0Ob6M7e5t3h4OESEoSlxZ/pDlDCrG8TMegCoTZhVbuCGDsysfgNKsfi\n3+GB/nXArDwbWvh6zVTyEYy1UqQWDrDAKphaLFx24N387c8ULBmsGaIkQRgF\nx4np3Vl06X4bjEPr7q5thHtD3J4Z/dImhgn63C19onCi5DUCVNi70hage3qf\nfds+V39ViwkQvqxovidIY5CvzKbTUgnLlU7nU/qX4x//NCdj1nG+8/Zu7WBi\nCygWoal2U7L/4wQ7ygvR0r8koI3XLQPDPYuREuy7CGvFZ14NwWOhYphmmYHw\nwLX7xbYIQs3yTJeGqtTOZCe4usph28xh8CmeQgtNTmS0UPs8XReydwfNRX3B\nkWYA\r\n=MJT2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICg74dtSDtFmAXRbyWw7kkOLxGshKp40ZpgrsCYi4XS2AiEAu4sGB1M9eg37Yxqfm5bkT36DtsZ2ryGVuBlI9vY8ZAA="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210224120151_1614168113219_0.8716813939746655"},"_hasShrinkwrap":false},"0.0.0-dev.20210225170210":{"name":"as-typed","version":"0.0.0-dev.20210225170210","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^8.0.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"f0df1d5df882f83753f55a758a28f91b95f66714","_id":"as-typed@0.0.0-dev.20210225170210","_nodeVersion":"10.23.3","_npmVersion":"6.14.11","dist":{"integrity":"sha512-F9hCpWTZZMI/Z40lshJpC7ZhcSILfM9ISpGYJMdB5kOWFUAYObr1ibE2w8fuLv+8DaOVXCzm9rRgnY7UB8zb7w==","shasum":"fcbedfbd729d8c21b8704c2233d0084352c55ff7","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210225170210.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgN9gUCRA9TVsSAnZWagAAZIEP/2t/wWvP8J6tQT5tHaK1\ncZiHK4YR0tWXLZtKwNyjfnR6adB8SsKvC6Q6wIkVhdOu1sljnVYA/g16d/DC\nqto16VAs3P6HVtFTNehBjN7CiW6Ao2M4PgaCPvJTPoWqKqHo82qjFBDh7w4j\nTbO1TtoAHTMtNDuCS6g/z+s1qerG89ED9zd9RrD3vzzyls9zc/Y9cxefrU7S\ndpNWSoGICMRpNugWikLDbW+lPLLyT0yM1DLc0uvZgeIwCGkULQcR6gmkkaDv\nNYK0ZR732LLw6xMG41q3/pas8+agNybUOPFbO+n9YZrI4C9Uw9cQSDccUuWL\npfyC4Td8HgDN0jXf2GD97EDf0/Ne3H6zfdI8LmMY/oUkWWV8fo+BMUg/MUle\nO+MgL7Z0XrvTQ/16KoDzuN6MOmjPQDXSHXw5wHrD1ceMUCgR8+JqDFxH4TqJ\nUB0Pu2E+kPJeMMT+FKRYHK3FZ5s7crVaEY9y3x2TYn5mACJxi8h54Wpk7i3V\nd/ptYbCnR7gZIGemrzPtiPDjym57IFpEboXdG/ysuUrdqaw25dIuHysihm4k\nnMkG8if5+W06jKlm6i+Vw8qTacVuaHFIO7JJCybobGIf+cwqunZjyEUKYcJN\n+yZX9IQAuzrE9NTgamONNZJFHg/Ko84eKyx6oK1GimmoJD2gHg/VBlJHvv2e\nsWZW\r\n=EJh5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGaFY+0/NUeoA1y9ffgxGeMLURej1tjxeuWFawQf5/+4AiAKb7M56JuSdxW89QLhN4qxa+XwV3sOQZzvMEfDQ07Wcg=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210225170210_1614272531941_0.9114326559128134"},"_hasShrinkwrap":false},"0.0.0-dev.20210302120445":{"name":"as-typed","version":"0.0.0-dev.20210302120445","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^8.0.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"0a8e607c85b7949c1a5d3c0447117d295c9320dc","_id":"as-typed@0.0.0-dev.20210302120445","_nodeVersion":"10.23.3","_npmVersion":"6.14.11","dist":{"integrity":"sha512-vgaun4flqFM9RH8zyQ9luBrmDZ1tE09sE/ESbXgOrAz1/mzkHQOwUGyuWg7tg6MccqMzja/9Cp2IC0VLeUTG3A==","shasum":"e4dcd5259b8a10ec036a449013c37c33254c68dd","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210302120445.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgPingCRA9TVsSAnZWagAAEgcP/2LYCWMHGB9fWGPOIb1J\n//3ko7toPb48CiZaM0HM6hNclCqHfoNY/bfthlJnwojPOmVHv8ryknVSlJYB\ndRzZiDAGK9N9YyvnF0MN1Nni7RcAThLV64KvDftArg+BZmnoMmsSAWiEqlzn\nOmOyu4Jn0uOpMuypIr0jJewdCtT61mWf0kpAHYc5jxP7i0Y16vFl9lNRU196\nshmR5aW6Av4HLVdjhfc1WwgDXHlctCAIj2mP0uutJxBjcBXhAOqd22cvV+k9\nIrmIyeLjw7938ua6fdT4YMrtHJJN8TU52M6oAhx5WwqENp6JN322q4uhh0yD\nOPok+QWB+20GaEVRpHBbEg0VySQGpk6SHB7r42yipukH8YDbQKtcyGaGB1L4\nozgkEKQU86EhiUqGioo9IF9jcF0ugld/u203kgWOCjdKUmntWgH6nMaqHmF6\nqI5a8oDlfJBILIwTgr3L6SrJHZ5gkEOW603LlR0RI13svzcOS94Evzbx0uKS\nzCDz+xrjzrEgx48iSNWFCBe4QoqCSfWWH0vH8VFNdM+z4UsWtxbeu4V135Vp\nfHJ68jRtLyDanpFkBleVmVsQD7io3jsbb4yJ+guQg9YqgFP7uGdSF76D2ToV\nnI4guJUT1WPL5A4oWZ9kSn4rMEAAlIHMsNwgx8Y6HamkJU1/QsPJDacOcUGg\nK6XE\r\n=f99S\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCw/CHePNfvNg29JH6a78dPKqEvvgRwVjSsYH9ZNy73ugIgUbvg8Xyzx1uzhIc/DMqIRQy/dNpiMuQl5Z50LLRTtvM="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210302120445_1614686687411_0.25787814725007485"},"_hasShrinkwrap":false},"0.0.0-dev.20210302120458":{"name":"as-typed","version":"0.0.0-dev.20210302120458","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^8.0.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"0d0ca133927f849c53322b9add50bda4a486e8f3","_id":"as-typed@0.0.0-dev.20210302120458","_nodeVersion":"10.23.3","_npmVersion":"6.14.11","dist":{"integrity":"sha512-lp2kPbN5wWx4kq2EqTc8eXmbQPrHNEV6yufgZuNHiPzPx00m/a3W7jmby0vhUqTBP1Z6OPJeX6SuNQ6S5noALw==","shasum":"4cd644769b2518ae9a016975bfb0bfaab5f81ce4","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210302120458.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgPinsCRA9TVsSAnZWagAA0/EP/3hNH5nRRDjX5aUwhqo6\nS32VAvItiKnZ8hOZthWa4jIUhV0uyR7lerA1yYyWJ2zKylvC+jjjrKGhb7z9\nj/FtXBWgSGVYPeNAJYXwju+WSfE4KZF0hZwmgQvw8n23KELhB5Nkn/vRQ3Sh\nF14fVhQ6JsRTrgAU6JZ6ht0R9q7kQ9iI7CruVHFQUo6XRGm1/bBr7y6r9/uh\n9rBWJGzBOV8EJv+oDzjfyfxagD8fwL6JiuOS/XqsdPrKv7CZ6laQV0j1WYQU\nkKn0VC+hnLDbzM6zUcyoUltRiPbUfyac0qmO3nxaTq4FSckhOaZLyRgbtDCM\n8BPoZsDSkwcG9YA9tKwUFtuSYNmrx3u2r6xS53O8HIU486gX6pyORLFeGjxz\nHTP4HKQHLkXvWeXD11PHv/tN2JsU18wF63LyncGGV/+iQGrz3+st7CDhumO3\nD4ZidBY93qvi+jYAf1jWPL6k+Du24VrNiF4P5ZOoMJilrLjbsSFwp2qm9z1V\n5ZwzdztplFffHttFODrnbgg8LEAmfX3tDFqYc84NqizbQvkwb6yf9/vkXAei\nkEP8hCk+afk/zQXVXNbDFqeQ7d/Gn5IM29E+dttDEqOdbqxleUzjkT/mXgaz\n5GrNk0chRKodh2S1TNrQybuAg7P9IEcOGZJ/dSMTD6v16RYyFRbO1pcN0w4V\nJUJr\r\n=5Ja/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIED4YLcScvi49Jaay+O9DyTZ1DVEGAq14n2IOUC+rDAhAiBA4EPOukq0chCg8wwjdghHHhRm0LvtNDqVOSk1l41ifA=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210302120458_1614686699846_0.6675202165196701"},"_hasShrinkwrap":false},"0.0.0-dev.20210302120528":{"name":"as-typed","version":"0.0.0-dev.20210302120528","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.15.0","@typescript-eslint/parser":"^4.15.0","@typescript-eslint/typescript-estree":"^4.15.0","eslint":"^7.19.0","eslint-config-prettier":"^8.0.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.1.5"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"06118b6a891c89873a2b138eefb0b65aea7a9076","_id":"as-typed@0.0.0-dev.20210302120528","_nodeVersion":"10.23.3","_npmVersion":"6.14.11","dist":{"integrity":"sha512-Z4+FIe3YUemnjLHCia4/nekHYVPwiIOLo/uZqYvNtexFzBRorZaYDVV9FnDodPNmB+tNQK6XUWXJwtlfH0w08A==","shasum":"2eeda9939c4bb0aee98df7259bbe23016dfb1d7f","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210302120528.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgPioKCRA9TVsSAnZWagAAQMAQAIZKvC/BCaKI8iO3ncwy\nyNjT7s3g9Y+OFB5L89BXvKorhGvokvnj8ySGxQ/wtfHNFw+obGIz1qlz1Hws\nMkFMtIdaWNQWMUkHIfO6izqmCsBaBBix/MLtwteymEdvD+yntkJitH9bTBEd\nmetk0/bVGsjXrKEi0KeB5FySIT8+Kw1gqQXeYENNbeSkv8O+wxR3AETMFyJE\nSBpUXs9jvJNozOlFjbcMGQntm69FCYM/yXwNrUrBHSsSeDB5dksIqwusNLJC\n8lqQptS8LTwWdZj5MyVN5/QlswlQV7BO3WUxVesyK5XkpydNWiACBscYFv+Y\n/eZq+zsthNTBsgJptUlqwjVIlmFnVMRi5RmFQ1oAshR43LxSf38G/5soeqQT\nVB8prenOH+P7MkWaP2ze8+b3gvKP/6UQxCbIBeQS82HluX2Qm7NUz6xmy/xh\nz/O2GpJQlAnFk5xMwIfplh3714Ht+0OI0UIBI2fV2F7qg2I8jIvl5zm8zMUb\n80pnvBR1GIwiU5hjJJKp0DyRKs08ewqU9tBdEo64VesziGhLJkRBYME3Ocjp\neKn9RVugik7Inw5p0qkdZUufzAhJQlTq7EbsqzhMy7QDQYQMOr+26ccZKhtf\nD2ptv3DCM47PniTRd9VASmfi/rwEkYfvhnQLTw+sXb6GztZpn6aABZ+BRKeD\n9xeh\r\n=Nekm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEIeXynBejjdyUwajRt9InpbIQkP+AV6wvbfOBmD1tCpAiAhfhLTx+yPJs+G0I2+St2g1dmn6394RBtJW1Oqc3ozGg=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210302120528_1614686729618_0.16975626097153773"},"_hasShrinkwrap":false},"0.0.0-dev.20210310234600":{"name":"as-typed","version":"0.0.0-dev.20210310234600","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.17.0","@typescript-eslint/parser":"^4.17.0","@typescript-eslint/typescript-estree":"^4.17.0","eslint":"^7.21.0","eslint-config-prettier":"^8.1.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.2.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"ae3dee392654b1e41e0bea8daabbd6550ab12adf","_id":"as-typed@0.0.0-dev.20210310234600","_nodeVersion":"10.24.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-IiGAcfhRt8lrfLHP+6vUSxIVKpZdvQse/kAoicqAmSYyUE8EIqFZyBC7ZdFcNDSOAVTcQudUQqbglLpz2ftMlQ==","shasum":"94cd1c9495de8f5ca103ac6155f71367dd61cef9","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210310234600.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgSVo6CRA9TVsSAnZWagAAmfIP/04g98Wtcw28gT6icBhC\n543hsq1TBHAcqnt3c+gObNujbYFqDIViyYZBDFn/iQgMcakslhIT8yyOxUsW\nZMrremab089FXpWZKQ0yOzwPP7ToTkU04J5AFG9rH+yvpsI0rNrdACzMcmD5\nFerZRDeBG5SM3d6GrKqf8FZ9J/LlAs48ma96Wk6aT22FUFdgxMnUboskMyld\nUZ7CGCH0Yo+AsrAoS2jNx1NalhiNgv74Ej9BiDPzdGmjV05IoTxTW+WCZ+6M\nb0WKMhI7BQD342/H4VyrgW0qNSVNSToh/ue60x42NPesPL1fkcME2yNTzwtx\n+4QrzG5Z4cL1rDlJ9eGFJ7NoJzPT3hCwsqPQDrbADVogVHu11srCQmzcdvjc\nlhugsoSsIQcUGzYliYlp8Y6kF9h8m87DON1KNEaooKyetWWrmTy7wNIzIr17\nKcJfiuVBsWAZDPnC9ryEL3UkSghCQkyrZ0EVQTsj5uhxjRjSBAbF4YHnFwjn\n97J4Jj3mYbKH+6/0iTf4Y3QM5lq5BJ/Zk7F14RAvhkN/8y9LFKF4e6/fRltf\nlFZq1g4nm5/vGVuF2D67b7aPl8YT9tpBdrtHt1XSfHVJiX1IiwTifpg5ieYX\na+vOPn56LFBGKMbgOQCJcjuy3NfHrXm1K/Vx6w4Ilv8lGpJ1JWWNPh426ibW\nGfm7\r\n=o5qq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDoOwQhVC2KKUw1dL/0JopRrbd47M8IuomwB7uGifJ/DAiBfXZfeiWGNhIZ650E0pTm0saWZp3/qETga4nh1NZRDyA=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210310234600_1615419961799_0.405984619333156"},"_hasShrinkwrap":false},"0.0.0-dev.20210414122543":{"name":"as-typed","version":"0.0.0-dev.20210414122543","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'","prettier:fix":"prettier --write '*.{t,j}s'","prettier:check":"prettier --check '*.{t,j}s'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0","@typescript-eslint/typescript-estree":"^4.22.0","eslint":"^7.24.0","eslint-config-prettier":"^8.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","prettier":"^2.2.1","spec.ts":"^1.1.3","typescript":"^4.2.4"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"15415b39655eb8305dbdb0117cd3b99b55879c69","_id":"as-typed@0.0.0-dev.20210414122543","_nodeVersion":"10.24.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-H2hxF50EFLqi+2y8855g2OjjVAmsaMUSSDiunRkJ2KhIC1Haaa1oyEWl4zpG0XOriKCBf1kv+6kCtVJCx8zZjA==","shasum":"cd4db97ffea01d4c304c1d4b52bf674c512656f6","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20210414122543.tgz","fileCount":13,"unpackedSize":30846,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgdt9JCRA9TVsSAnZWagAAazMP/2HCnwdZPItaKUiOnWgR\nDaY1bmaQYyO/IZwQnKHiCxtkvwYqLrcgiYDv+o/AbQVMpJ2eByL3tVEsBhxC\nSnn8Tdb9vCakN5EtHR6xO6tGqGuOrVQiOuRkXM/1rBg3VGyPXcz/RfA0ALyy\niulJhMqr24ZtHGDpW/jtx9nAufc+etfX8Irji6spRe8T2hf+EGqujocxg3AK\n+z5KAG3mA+KX51NnP7awZb/z4JuLErlrALgG4sPWsYoaIPS1o7ocLTaoHGQu\nSms3mzEIZP+B2oSNwX55U3Xf+AWzhgkZTakl96j6IzY75jUWzycDZ0hIMCyu\ng4v0lJoKqGRXLXPAIbj3Z6KGpFhC5OIWM0H8yR/DLZ9YemyKfNU9nJVtHaS8\naChq3dBzHu/o7SH2Ie51lNyQSwmAnxkVjf9iWcqflmcQuHeVQQ3vZHUHDHxX\nF7wsKy7Aa768ZMP80mTDbboqndXgo5Spqw4GE2MWc/+qiO06B97DWdAie0YP\nS9xNphhoTu6U/6sd8AjjCh6aGVlILGSSDNyPrLA5iDIZKCClWrH6SoVu5IIF\nn7HHc2+njQy0a1SpW5o3XmGB5gM9WYaltn6IAZohRKoC8O/6OrU+Wp5Viftl\necmiPutvlpY5nt7qMYwYpxiTtnb7x9Rw4o0OII+QKrFum7rkIP+QQh4e88iW\nDQak\r\n=upl0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC3k3xN3NlnQ9p2p6O9SDzdVaD7j4PWcTdxNfdmmtNqzwIhAPKYSSlXg3dPrkqx5rXEW4Oys3BFVklbHzqZy9NLIMsG"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20210414122543_1618403145346_0.1853967246745618"},"_hasShrinkwrap":false},"0.0.0-dev.20211001101341":{"name":"as-typed","version":"0.0.0-dev.20211001101341","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.32.0","@typescript-eslint/parser":"^4.32.0","@typescript-eslint/typescript-estree":"^4.32.0","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.24.2","eslint-plugin-prettier":"^4.0.0","prettier":"^2.4.1","spec.ts":"^1.1.3","typescript":"^4.4.3"},"readme":"# `as-typed`\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\",\n    },\n    lastName: {\n      type: \"string\",\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0,\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\",\n    },\n  },\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive types\n\n- `AsTyped<{type: \"string\"}>` === `string`\n- `AsTyped<{type: \"number\"}>` === `number`\n- `AsTyped<{type: \"integer\"}>` === `number`\n- `AsTyped<{type: \"boolean\"}>` === `boolean`\n- `AsTyped<{type: \"null\"}>` === `null`\n- `AsTyped<{type: \"undefined\"}>` === `undefined`\n\n#### Limitations\n\n- Patterns are not supported.\n  There is no regex validation in typescript\n  [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160)\n\n- Value validation (min, max etc) is not supported\n  Typescript is not meant for value checking (at least currently).\n\n### Defined objects\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}}>` === `{foo?: number}`\n\n#### with required properties\n\n- `AsTyped<{type: \"object\", properties: {foo: {type: \"number\"}, bar: {type: \"string}, required: [\"foo\"]}>` === `{foo: number, bar?: string}`\n\n#### objects with a specific value type\n\n`AsTyped<{type: \"array\", items: [{type: \"number\"}, {type: \"string\"}], additionalItems: {type: \"boolean\"}}>` === `[number, string, ...boolean[]]`\n\n### Recursive objects and arrays\n\n- `AsTyped<{type: \"array\", items: {type: \"array\", items: {type: \"string\"}}}>` === `string[][]`\n- `AsTyped<{type: \"object\", properties: {arr: {type: \"array\", items: {type: \"object\", additionalProperties: {type: \"string\"}}}}}` === `{arr?: {[name: string]: string}[]}`\n\n### Simple array\n\n- `AsTyped<{type: \"array\", items: {type: \"string\"}}>` === `string[]`\n\n### Tuple\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}]}>` === `[string, number]`\n\n### Tuple with additional items\n\n- `AsTyped<{type: \"array\", items: [{type: \"string\"}, {type: \"number\"}], additionalItems: {type: \"string\"}}}>` === `[string, number, ...string[]]`\n\n### Recursive reference by $id\n\n#### Simple references:\n\n- `AsTyped<{definitions: {foo: {$id: \"foo\", type: \"number\"}}, $ref: \"foo\"}>` === `number`\n\n#### Deep references:\n\n- `AsTyped<{definitions: {str1: {$id: \"str1\", $ref: \"str2\"}, str2: {$id: \"str2\", type: \"string\"}}, $ref: \"str1\"}>` === `string`\n\n#### Path references:\n\n- `AsTyped<{definitions: {foo: {type: \"number\"}}, $ref: \"#/definitions/foo\"}>` === `number`\n\n### not\n\n`Not` works mainly on primitive types, e.g. `AsTyped<{not: {type: \"string\"}}>` will resolve to `number | object | any[] | boolean | null | undefined`\n\n### oneOf\n\n- `AsTyped<{oneOf: [{type: \"string\"}, {type: \"number\"}]}>` === `string | number`\n\nCurrently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n\n### allOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}}]}>` === `{a?: number, b?: string}`\n\n### anyOf\n\n- `AsTyped<{allOf: [{type: \"object\", properties: {a: {type: \"number\"}}}, {type: \"object\", properties: {b: {type: \"string\"}}, required: [\"b\"]}]}>` === `{a?: number, b: string} | {a?: number} | {b: string}`\n\n### If/Then/Else\n\n`If/Then/Else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. It's strange to have this sugar in the schema which doesn't reduce the verbosity.\nCurrently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863)\n","readmeFilename":"README.md","gitHead":"758fb19b310e0f259c18a9dabbd9e34896685d00","_id":"as-typed@0.0.0-dev.20211001101341","_nodeVersion":"10.24.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-Gu3YVnjvfXmYjAdBMhCt07ZaqtIlDc1wvCyatPfJG6ipfRkJkfK3j9zR8pc8R60ohIVfVyKeWG3vzyv690qGPw==","shasum":"6bca68381f83d6b97c491bddaafbdd20d46c3c01","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20211001101341.tgz","fileCount":13,"unpackedSize":30668,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICTBysDqkr9ouL1gDxnGfVvmLalzYuTGpr76scVySyMkAiAcMnMJBMYUvsxm88xkUXmYRi8PbEev9D8GkCZJbAmLBA=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20211001101341_1633083224062_0.3415310586936535"},"_hasShrinkwrap":false},"1.3.1":{"name":"as-typed","version":"1.3.1","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^4.32.0","@typescript-eslint/parser":"^4.32.0","@typescript-eslint/typescript-estree":"^4.32.0","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.24.2","eslint-plugin-prettier":"^4.0.0","prettier":"^2.4.1","spec.ts":"^1.1.3","typescript":"^4.4.3"},"gitHead":"758fb19b310e0f259c18a9dabbd9e34896685d00","_id":"as-typed@1.3.1","_nodeVersion":"10.24.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-4s//vzrSL5tgPQrVouVVmpmWwSWPBPPqJos/XiSemOuHF3FCGP7I7Qhh9HfFVeHNv54nzhMaIEm6ViWD9DRjww==","shasum":"756ac0b2229358ca6a525217319b985aa25903a4","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-1.3.1.tgz","fileCount":13,"unpackedSize":30649,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnymlTx+zmMqoZPqTA0lGdTgZ2kO6S4CGN54AZQWwrHgIgd6n00S4BSoHRrCyHwaZZ90vJCC7WP8ZhD85Lw/OzU2M="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_1.3.1_1633083320298_0.269527005945998"},"_hasShrinkwrap":false},"0.0.0-dev.20211123121203":{"name":"as-typed","version":"0.0.0-dev.20211123121203","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.4.0","@typescript-eslint/parser":"^5.4.0","@typescript-eslint/typescript-estree":"^5.4.0","eslint":"^8.3.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prettier":"^4.0.0","prettier":"^2.4.1","spec.ts":"^1.1.3","typescript":"^4.5.2"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\ntype Undef = AsTyped<{ type: \"undefined\" }>; // undefined\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"c732c62c6859854f5a301418c9ca45030ae09432","_id":"as-typed@0.0.0-dev.20211123121203","_nodeVersion":"10.24.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-GnpCfsE/dSOQs/gB1CAaiN7qP3lK1sm7jxAt7crnRDSVF4sOPMpWnA+WVh9sM102eNVMtxX8xEk/U5yG6Di4Lw==","shasum":"e81f715e02fd41e6ab86ca23dbe0a344ad19d0fe","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20211123121203.tgz","fileCount":5,"unpackedSize":14124,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnNqVCRA9TVsSAnZWagAAdpgP+wTf23RzDFFO3RvVJqY4\nwN7U+0U4u62k8JcPN6TpZluc6uF75ex5S/DqxOP3qqbx/ZuR4rJd1Dlg2Hyo\nw6Fr4pGlWqF6XjhDZtxBy7WQNxGZ9+Zeg6/pn+5grZTsKrZPmjqlp7NmU9AY\nnOlWTuODnkb0A8IDUL755gKAHf6dZlkcbHitCe3Os7LY5doOIGJNQhYJiUPD\n1ocqZA5ukUe3GO18VqdcFYDp6r/7WStUxr1JUxZDGHLYot45kKDCxIA2LJ8v\nwqrj0P4Iq7OX4b6RKzTPsdndEqJxnrbWuKXSnftqTv6UuftaT5M0WNUbR0m9\nl6YWcfDmhx6ElpqcH2m6GWTZaU0a1s0vOIEGNhLV4/9/JdWvHxodVtcuJIwW\nwqFVfxC2OMZOW/T5cgYQh58IH9SUoSINJPJwQcyU7fubeMZ35Y7fo1msUvB+\nP7fJmIhEE+QbGQ3VDcBevgCr11G+PScNXmPZG4TbHrB/1VMRZ5Qjb8+hpCrp\n+T5BkOjAzDtVxMkkFVvmlmtHwdAVo2zMZTM/hI4sP0N4xzZhUVnea97hqjkk\nstUfaSjT5NwAJcR0oXr5FSfBuuvyLbWJl1wppWa2WxaFFD4qBS1WuqQ9dWtt\nIjPeUT6/cJuvg6/OUPU1Ze3LicV2Awxfij9GkYfKI++sozb5Jg2k0bJQ7lLk\nnrca\r\n=BLGR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD/83hWfpigUy87YKyiwJvhAR5XuJKPdvDJa+VO2UkoFAIhAPYKlr58kECO+If3dKOJrJ3wfkesnOX4KhoQ8WKY2dl1"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20211123121203_1637669525130_0.7621342879379052"},"_hasShrinkwrap":false},"0.0.0-dev.20211123121842":{"name":"as-typed","version":"0.0.0-dev.20211123121842","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.4.0","@typescript-eslint/parser":"^5.4.0","@typescript-eslint/typescript-estree":"^5.4.0","eslint":"^8.3.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prettier":"^4.0.0","prettier":"^2.4.1","spec.ts":"^1.1.3","typescript":"^4.5.2"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\ntype Undef = AsTyped<{ type: \"undefined\" }>; // undefined\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"6430086c90f117985a73c913b9842e364b1bbac9","_id":"as-typed@0.0.0-dev.20211123121842","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-+h4mzFB/JXBF0Z9VCDDkf3bVNN4mV7jgScAlP1b3maia7LwasTSnneydtA5qNd6OpQcnglSTc3VrqU8KRxE5ww==","shasum":"7d957377dea325da06509e971e1101810f4d38ee","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20211123121842.tgz","fileCount":5,"unpackedSize":14124,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnNwkCRA9TVsSAnZWagAAfnsQAKS6KUIss05u/WiSL0ZZ\nWluQF+wkkXZ7WdekJ/uhbWNspjoTz3lvWR50qPXvURQFjDvhbMzLSCZVpTDR\nclR6RB8Tf3RtyubQKcJbHS+EqDZ22dWQZZCeww2NPWvRGaSXzLH9mo6gR8xr\niWjdP+h0L8IcOo+gtrzAQHdv43Ufz7C71sujZR+csgml5o+gaVCaimrU2cPH\nx6usjlWRt5/qeIvKXzfvwCXtG2Y7S3NqvbMfW1GOsX3sDur508xiRh5R0K3H\nMsKn4b8pS6PCBHuUY5pFACM/m/uo7Rl1possB5Pt5IuB/R2ObjvGib1ziAdM\nxZrqj+kcsCUWdUwXrFOy1rNQ4MUCz5aswDghEo19Z8bGWy6VQ3Zp2WXEo25s\nYHXcQKMU1U2ub9RArcwU2taUyHC+rRdEx9yvjBeRe6J8+fQAvnlUCGhdYCyG\noZgIm8CCHIxV3qscMz3EzhvrNfcBG8H5uYlgagXAN7HSdMgEW8+k4UFvwMOH\nt3Nn47y3yByidiHO6RISolj2FbNF7d5k4SB01T44vyFsrAPcp+zG90sUv4Ei\nutlyNxDUpzE/mgOqeXrCLxSASQa3bFzz7NLuWd9vsPoElR4aH2z1/a/fciLq\nA0xyfXI8qJh7/w9rlOprROweBw+hp5V50LQe5k/apMxJvxtRpMJzfHDUW9te\nLHEe\r\n=0sFm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDax3oy2l0ZhoPJ9WsyHNsCGdZjFW6p755aqvcafgT4LwIhAIQPLUGKEpg51jKqUQnXMul+zsVDJAfkoTLKjND3oJ/Y"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20211123121842_1637669924004_0.3855451910976204"},"_hasShrinkwrap":false},"1.3.2":{"name":"as-typed","version":"1.3.2","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.4.0","@typescript-eslint/parser":"^5.4.0","@typescript-eslint/typescript-estree":"^5.4.0","eslint":"^8.3.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prettier":"^4.0.0","prettier":"^2.4.1","spec.ts":"^1.1.3","typescript":"^4.5.2"},"gitHead":"6430086c90f117985a73c913b9842e364b1bbac9","_id":"as-typed@1.3.2","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-94ezeKlKB97OJUyMaU7dQUAB+Cmjlgr4T9/cxCoKaLM4F2HAmuIHm3Q5ClGCsX5PvRwCQehCzAa/6foRFXRbqA==","shasum":"65ec38eb651ea6d62646e00dd336c2fd8076e7a6","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-1.3.2.tgz","fileCount":5,"unpackedSize":14105,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnNzHCRA9TVsSAnZWagAAXwsQAJTyMU9Ra+ZHm4eCpGp+\ng3BdsyflII3HaAmF5WO9Bs0LJlzthGVLf38cMX5Ap/LAP76HCEvh2zqiMkeF\nCA7a9J7PeT4mO+X6Iu9QBDCBeby4uyqThgKEeXeaslSSFG0YyGhVzfFXnsy+\neYwNRo0AAU7vpikODI+gVp6FkNZEYhV0C5A1hb3Tb9/w55rsw9a170GKjUD9\nnj32gD4vKQbXXm8K7DlYH7MxP+dTgcSpuzwhv3Rx/S1sBMG+joxaI3J98I9L\nk4LZg8/HxsN2E1cWXgPvyS9JRA2t6s2G4+bnRiz/w7k31QOlf/aKVzDhcyDq\nCtt/GSYfwx7DTM3AQRvOlyJbA/+hlNwWgoTIpQZgSQYrgmqMIYOjSnOF51yg\nsKX9bk0iq8BqaTvKFWOOh3exoAKGo6P5q+vQpV9ai10hRnMVtDr/WL8PHcp6\n8OTubvjXd/8S5tdZek0D1AchXWfl1XMiZ7jtnfFoTbS8BdKWfhX9fcd4l/3q\ng756O7z+RXlFSci0Fuvn/pR6nENHzxpb/d41WjONaLLQ1SG7qewtgdFIap3b\nl9v3pfHSmqVv2WAt5A613//r3sGOjLmd4QvhVIvdE1/qm1vyhdnTZtEN7xKY\n0wDJMwm9+AZ6/hV3BVTGUF5obyl4yoUdpOt7sY0HwTSGJ4Ms2D3OuTsCiDkd\nOncx\r\n=n7z4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFxIXdk3L/Qg4ai2+gcf1t4hej64Db1GzOlAn5SjBvsBAiA7pSC6qLXmmTbP6/gy/6SbsW9k92WHczr2j8ua9eZ3pg=="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_1.3.2_1637670086993_0.34767274207128707"},"_hasShrinkwrap":false},"0.0.0-dev.20211123122715":{"name":"as-typed","version":"0.0.0-dev.20211123122715","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.4.0","@typescript-eslint/parser":"^5.4.0","@typescript-eslint/typescript-estree":"^5.4.0","eslint":"^8.3.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prettier":"^4.0.0","prettier":"^2.4.1","spec.ts":"^1.1.3","typescript":"^4.5.2"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string | undefined;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\ntype Undef = AsTyped<{ type: \"undefined\" }>; // undefined\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"9466009745303f32f7a4daa3c89b9e188ad9e0fb","_id":"as-typed@0.0.0-dev.20211123122715","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-4PnxjyuMwMJIAEURAd30DiVaGgviiTsI2DBMgiosQWP7hjVPcigrpOob3qn9l/AouWQ1/e4pjZCGJlfmUtBvtw==","shasum":"b7046034bedc2158ebefb8569dd8e6a458e2b97e","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20211123122715.tgz","fileCount":6,"unpackedSize":14165,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnN4lCRA9TVsSAnZWagAA4ZYP/iNdGs7+Fxei3PTFAY5p\nEzjKlDkcrJC7OuFFrdtj2qwiotyNcp0griWzELXhdVt3woxC+Ezfg8Kz2VFg\n35HMkQtXAShThnBb8aalzd2svDOTNCwa/NC2qgUUFX5ie93LwLEIYIxJ61Gr\nl5y39pb6VZUmhR8fH6UD+adzNSZqA9Iy7wG6xUZp26AsGCoOBlo9IjQuxHb3\nYgakuqDBHb+arfq95EuL+4ZCDAUSMYKTxqYS4gKtGezSJzE0+xzBeQ3V598d\nOQHz7vWiN3Rm49sWXkFGK0B1+27iS7GXeHsTfZe2f5RIJpcIcJ6WRNC9cscb\n1x99MYDPvJsc7uv+0QV60eGfWdk9hWhcAsMyvzSVJKit8c7jwmBloLviAsQ4\nUTou6sbMLdhcTdkbkjQqvV6Tj8qfmM1n2JIYefZVMNjOHFY07zP8aFmmZ/2B\n7YAK+vMqFlkmiXgFtZG2ugdgOQHxtdDFE33iN/LIyHHq997+SdLs76aL/5hn\npern7gtx+u9HZTIAWJB0jMuAfsx9D/x4ee4QK7Tz3aP9oCcrGaN4rHXnLcfY\nb2W6hDcQQq6CBGXRBE2QykV+C5KCTymuh6rqyf5AsrZ6BgdQzYreWk5xCxc4\nKtQeQQPjxbNaksBhMTmZDpGyiGec+RFkIm52eYZJMA5LAMGQaTnOyXSiI/oa\nrndb\r\n=fsv/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDRfV60fyY88QNag+DRhC6Xm7JflHuRXN81jhfwk4qoyQIhAJ9R8mVGq+1UI1nH6FbBaY+kkqbWyPiwj4dt+gGrm0pc"}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20211123122715_1637670437039_0.12079844391386407"},"_hasShrinkwrap":false},"0.0.0-dev.20211123123024":{"name":"as-typed","version":"0.0.0-dev.20211123123024","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.4.0","@typescript-eslint/parser":"^5.4.0","@typescript-eslint/typescript-estree":"^5.4.0","eslint":"^8.3.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prettier":"^4.0.0","prettier":"^2.4.1","spec.ts":"^1.1.3","typescript":"^4.5.2"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"c0d2026dbd0dd17db85a9c0f1dd04b2f1784c03f","_id":"as-typed@0.0.0-dev.20211123123024","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-vy4V9qD6gwDSQy9t3IQ8jUFnlf2aEXn0ZTcyEPheh55cgxESLXio+xPXUHCm7EZlF0c5/H/e8fCiily4Gay6OQ==","shasum":"2f09afd5945b43530035a9fdb127186e7a718902","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20211123123024.tgz","fileCount":6,"unpackedSize":14095,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnN7iCRA9TVsSAnZWagAAhkgP/31lPtJvEvvM1wEHsbjM\n4wpcoTSJXnsMLDbNke63BR7+xdXdwsakZ5H29Nk62GuaMO+mz0vSQyWXJrKr\nZvRPgiC2sOT1dZ01MQnJ4wtt+biV8TtHFMvSlKm0N/5XwZsRsEIGBMMpYHZD\nHMBgXTzukSHVqFTzC/G+S0HnALrWednUCKBLr23HMt9rITeJfh+KOOHQYJRW\nbZbfaZbRKHUb01P50dk4gci+aeJsUD3H3Dn97lmkhrmoKmepPLTYS6yIb737\nvUxK5SSxYy+bKlNdbqCmDJrAshbTjY1e8riWzc0zx21CrR+V5ITjLHhdStR4\ncSqJwxN7cyYR3XQ3hZ1MCoWq17mtJF/mGImehvamqVtkIVGO8a4ZNwJTiAAu\nxP5i21MeVfgiYNeG53A/3ktxExWM+ibfMKd5T4vG3GNjVdU23QeQ+K3xqocu\nvj2VXjskajuN7yx+idKQsqwDMi3ws98q702oSBLBgtvNEFWAeIdFOqPu/7Ck\nXZjgWImoRCt9ZqVyPn//B1+Dk7TVJCa0Q6N/76OD2wHKwoSStxwsKJy+fLFS\na4wQG7BcD/fRxX6WJ/gTbhMnwM2mgjODoyjxds5L/pfO75vAqMV9J2yNsUvj\n/0CNjnsBdMeEnNOIoZAA7FTWQm1M3Q0rCZZiL+37fsuO46j+CxRV5yULwM3t\ndGoX\r\n=8h3B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGADpOiEP8klr25gwjw5W80mrdjtNOrJP3l7erHvj2RtAiEAzXF459BCLVeCOMr8P5eYztPhKE1xguksCSueg/bxWrA="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20211123123024_1637670625916_0.4370426114234345"},"_hasShrinkwrap":false},"0.0.0-dev.20211123123644":{"name":"as-typed","version":"0.0.0-dev.20211123123644","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.4.0","@typescript-eslint/parser":"5.4.0","@typescript-eslint/typescript-estree":"5.4.0","eslint":"8.3.0","eslint-config-prettier":"8.3.0","eslint-plugin-import":"2.25.3","eslint-plugin-prettier":"4.0.0","prettier":"2.4.1","spec.ts":"1.1.3","typescript":"4.5.2"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"776ad4c083987b3cf35a41729513a462ca9eb48f","_id":"as-typed@0.0.0-dev.20211123123644","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-rRskS/c74mbPYiO28FptmxUIkt9LjPQJjLHl+dNaIC2csB/+iwnGJTZt5dqRQJcZddBogh5jNEmRYWLiQUR5rA==","shasum":"a807def99051df3839cb830cf8b2467fadc73f53","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20211123123644.tgz","fileCount":6,"unpackedSize":14085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnOBdCRA9TVsSAnZWagAA/mAP/jWaC5nDC1vQw4s8huEx\nz8owDxblfaskx+qz6+R8fAnyqUDnxVtSKLbkskGIxsLNLgQlM1YMG5GLEIac\nhxuqJyoORRfjW2besqdKBLnIzcv9f0wt4Cw+GAIr+jvQkvnab1oGfWr/mBIR\nGkl4RZEa6SlgD7AtYFAWHb6y3OvFSb62IXNtzXn9ZaiEsn+laIRvhtB+XdJk\nHndykgrr5lIIcJPzbLI50ytDUWw3+bVJGARELVQBR9Xz80VaH/sYQFJPfJeo\nAUuXRO9vfihq3te+gW8F11wO2zlYrho2UbYHsrzQLMRkZi7OADKWHFt5hgia\nzc/3ZrifGTrJmQWVVVdOKCjXSrgPGpd+sVc0fz3AdRGUOEy7FLUq1kJnUabP\nAz0fwtznGgwwezjLfaca9tZwYyYXuYUmQN0alNAGEo9hMb6RLz+bvd5/h0rW\nwTj3naLOoyo5kMriMBpPCtlTqsq+q771P95jNewkSPVP8bQlpUOtlrAUbaQ5\n8Lqh4ZqwjZGalfaC/cOzETSaxKVDuHisLu7Yw5hvMrvkFjAimhdk0UGf7lry\nQWrgV0yamluHAcOVjaNvVHyy7dKzpZlHRFzQNemFR733GgEXMkG758Np/Nlv\n1kPbSTCIYmnunX80fbvxC8ktxcb7WERM+rdqhLoa1nXy1aZZ8ht/PEwqIxyN\nvbt0\r\n=n0CG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2eDcaby2qbC6ArLvZoKCJKTO44n3EeGQzVEgL3uvfDwIgDZYrmgpb6fjRbjWG2KXyY4xbfUc5+3PMhYjdhsvGigQ="}]},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20211123123644_1637671005359_0.7503644821003712"},"_hasShrinkwrap":false},"0.0.0-dev.20220410000512":{"name":"as-typed","version":"0.0.0-dev.20220410000512","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.4.0","@typescript-eslint/parser":"5.4.0","@typescript-eslint/typescript-estree":"5.4.0","eslint":"8.3.0","eslint-config-prettier":"8.3.0","eslint-plugin-import":"2.25.3","eslint-plugin-prettier":"4.0.0","prettier":"2.4.1","spec.ts":"1.1.3","typescript":"4.5.2"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"d6070dbba521f5cb6bf62995ebff7bf0ab9c2b54","_id":"as-typed@0.0.0-dev.20220410000512","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-8cWC5xmlkDPBT8RulYWzrBocS9P8hp18iSjrfMVoyum6ma2uTcJhFrswEMALCEUu+H1j52o6Jz8SPxlH7iEp2Q==","shasum":"44873d63acea953cbd9d058372852ad3e1e99f76","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220410000512.tgz","fileCount":6,"unpackedSize":14085,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCxbnxFt0+u91exLQTfUgpWE/nc6zcsOh1pRre9+WA+lQIhAK+QBn1ltFkMXzcJ5SLgV64HN5yM99cr0opKssn0lWvu"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUh85ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrFtRAAgA7Epi5i7g+DJOumntr3umaaqngcOwcGUmBoYOzt1jPV1mxm\r\n6U51coXMT5rKoscotTnvl5BvQMn+F+Hhfg0xlrx6mQmDC6jIWms2SFzSmMWr\r\n09Q2tcIajyYQFQa63RNoCcSonP5HDfscUfIGIgSWM2Da1Q3UxZ6f3Mly7Ft6\r\ny2q7MLFuPRyG7VWTKyq9NOnwg3gI/3Ksp1BfTxvs/RzwiSpNzwr2ngWz6Jrf\r\n44v2fbSk6Yr0SFO4Nk8ZUkjSRleQu40qXLzuHEr7At8MP736vkTnuzyFMYJ2\r\nIX3GlUhu5n1UUlKoEuR5a6uxQvShZT+wCkankgEL84OsFJoOsP+dNHTzDx6p\r\nxYKgQcvVtiowrw3jD83kGniYmJJ8zptBtA3HPD79k+20LfAEUWBkNOxrvLao\r\n/556wuOR2fZW6BZy6C4sxEd9VSmmUI3ps7KpXInfUTbzl4dXTYDuZt61B4v+\r\nYkUD7NpKmFLUN43mFs+8P/h7BIPT0L6E9xdyvLfBrffoqw1lRM69gfdUW1GG\r\nzGY0nZ0CJSGLjnTj6JDK8yw1+LPrJq7N+qU0sJduQLadwQKRC+ZPSvPDJa2U\r\n+Xo/rZDmzzz3j7OkDeuvTP3478ASMaD5o4gLUpHHCb5kHEZHAY6hsqJwI8dn\r\nO6YlyfmEKGgEUJGXFqHHt1YTZpslk9SDirc=\r\n=/LqL\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220410000512_1649549113549_0.616318868525733"},"_hasShrinkwrap":false},"0.0.0-dev.20220410000642":{"name":"as-typed","version":"0.0.0-dev.20220410000642","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.4.0","@typescript-eslint/parser":"5.4.0","@typescript-eslint/typescript-estree":"5.4.0","eslint":"8.3.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.25.3","eslint-plugin-prettier":"4.0.0","prettier":"2.4.1","spec.ts":"1.1.3","typescript":"4.5.2"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"f739a8b31bff3b44f6b9eda3ea50b259ade11282","_id":"as-typed@0.0.0-dev.20220410000642","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-CGSaSTDdiUdZ6Erp0otC5eO1v9taotZjtpFA6KsxasEPh+/w1HltpR0/S5eC1ygg8hnfFTOl3zQfKQWfw84NIw==","shasum":"36862d6a0a1b7a2b74a7c7113dc7dc313ce99b6f","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220410000642.tgz","fileCount":6,"unpackedSize":14085,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDamwL9lr68mm6ZgGGm/aLu2rQsxE44xdj1L/BBsqYjWQIgTDvFG2hZ2ZQZ1ZpzJblB+h0PcalNoN7aAKlWHWclioo="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUh+TACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmovSA/9Hg7fijHlFi9bqZRYZtpmWHHCTIgzCCEUkanrgYfMrifD0vIl\r\nRmxVtL8m7oBdggMCHbCHdmuca26RJXqdsBSS1MpZSy3Wr+eq4amk838d255/\r\nxPWdSI0ADSdWh2zF9tivtF0++epjwuqr7lbeJ5KUtyVlfwdYxVGRvHzoLAZQ\r\n6WzZXGTDU1sB0iQbPEKX3bnQVMBCY2hFpMqYtamiuE/hn5sM/eYCXhl/4tw6\r\n1/2RPfq6BP1SQY1kaxOglUNkGWWHZSrzu9DZ3wklJk3Nm4+XmIQwGVn/vDE4\r\n4NriJLM1xIwT43h0kWk84iuikLm/UPcCkjvAjlgGn8DISqvRdhfx6K8uS53h\r\nLkt1RTl2UsWXclFAd8908taN/L1qe4/9tpWiANtlLQ2OWUO0eM6UP0HQ1sVE\r\n713iGsJTGelxUIwcVlh9Pk/SFb72p95evAWkAvn8i4rdmixcyRCkxQaCO0Og\r\nNOdis1l2rRdu/LJA92vcj/HEpPEIhUHfW8LWLzb5UKK1wfG/Xl5Yi/Nm20JB\r\n2+oYL4QCjwc3QGmoQuvQlueKhCzYYXOydCu4PrlIdncQrYplWNPglvHbbOB2\r\nBgr22j0yBW9UMiFoMdOsl9w9Z3zTR6RjYeeaClQugopQtCU5zWECI10pBV3c\r\nTeNz7Om3nxVJiE9YKAze31L0C0FccLoxm38=\r\n=7P02\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220410000642_1649549203347_0.07811503254872654"},"_hasShrinkwrap":false},"0.0.0-dev.20220410000709":{"name":"as-typed","version":"0.0.0-dev.20220410000709","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.4.0","@typescript-eslint/parser":"5.4.0","@typescript-eslint/typescript-estree":"5.4.0","eslint":"8.3.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.25.3","eslint-plugin-prettier":"4.0.0","prettier":"2.4.1","spec.ts":"1.1.3","typescript":"4.5.2"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"0435ba76cb0d105478951e602fbd55d1528263b9","_id":"as-typed@0.0.0-dev.20220410000709","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-iHH0v1rJPGAE4qhV+NuSADppHF2MsuHpeQNYxqOymIYqQ2BniXmGvlfrdXglOrqEJb3hLqkUcE+vuZJs44ZADA==","shasum":"c005ce7831a9e822ad3a8a0259aa28022657a4c4","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220410000709.tgz","fileCount":6,"unpackedSize":14085,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG3Qi0AaFqoX2caq1Sw2k5cynY6xbMv7sVzGrXlYuVR+AiB3U9DesdpPFodhI/k2pD5XcAp2W/l/fwqytEXWh5adjA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUh+uACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqlDhAAhyvtYv1bSvGQo29NGh7brdFuSk6m0KJ4r25FTTghkyt5h7AH\r\ngLl2BjKbiBYoWyVjMDS4D4EWXuFt5/fzoKnS2qCW1cvTxwVypHMaXsHveoyi\r\nzCxe9Vk996Vh1xZ6Gx4cNBcHEwzyWD+3TUW5bt3En8vtSQwWXxK+8dk2de4n\r\n/mN3IUeIWiGML3vpRak/pZ5+otlinBzskeElGwI7QUiEotdewRSKWa9HOwyq\r\nrCs7K2IkR3GXeYqPNJqlqzR3lg7cZPNSfPJHA/PbQJ2t2aEh04T52BOgXk2d\r\new5Mf9m+5MWR7e2L3ksyablMAFavdqVDah+RtdDcw1naHz6sNhFbh5/eB+B/\r\nu8zUEvdKSRXL4C1Isq3eD0q5B8wU8kqTHxsr0zgBhJIaSNYztlkeYE8ZvYLL\r\nhPhiiwmgXbRsyZrliNEkyerW9IqTtpqIc7OPZdnRiiUiS1oGFHF31TR+pmuk\r\nfRMSAPTi27VxyD0mDdmS7cRdFg5hEDeI537ZGnb+/iCyoKsKTGWHsHu6+kWm\r\nkxBy4+QdOitqyQuiVPXWxUmwkSzJFgH2r9YpQ3DkB9fchDNJQHzIGUiDoxDb\r\nb8uowIqYq3v+k3fwVDlztjTlbNkCeJTMC1pysq/4Jm80TttoXR9ZzFj1EIMY\r\nlrkChW3w9WFfdg9zvMsChVLtMsXNfSpv0fA=\r\n=1fOl\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220410000709_1649549230565_0.06171153133272744"},"_hasShrinkwrap":false},"0.0.0-dev.20220410000737":{"name":"as-typed","version":"0.0.0-dev.20220410000737","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.4.0","@typescript-eslint/parser":"5.4.0","@typescript-eslint/typescript-estree":"5.4.0","eslint":"8.3.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.25.3","eslint-plugin-prettier":"4.0.0","prettier":"2.4.1","spec.ts":"1.1.3","typescript":"4.6.3"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"fbe78c57472554e80d46845dbc74dbbde4be86b8","_id":"as-typed@0.0.0-dev.20220410000737","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-Wt2sFDAE91KsPhiyq6BM9E3SI9eSiCvp8vBY3TCb5eFtHczvTb+2mwecwL67pZWQmoX1VxM/bCGYO16QQDEXVQ==","shasum":"c65958ba05335366ef1fb2df0bb2eb53775cc587","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220410000737.tgz","fileCount":6,"unpackedSize":14085,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCh6h/89nwb5te5rWbN7uosFtaipw4E9xCTW30avxnh9wIhALNHSZCi4KLgz4umGQ+V6ospEdG7seDJjOeKWt2l/SUy"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUh/LACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoJqA//bJImRnAZS8/0lWLfYTcTKbErJZzQl2t6Oc3fbFT/3es7h6lm\r\nkR+bsqzU5a1g7Wjc7I9sSwBlBpNRu/tM/ywMui0fJIy7hAU55XA3VDdSpFW6\r\nGHC8a5YNCFtFmReqjSPGCMGKNXOTItlexIPqZvSdhe43AsX2oToeas29+m3a\r\nbG7WUH4XdqiRCQ2rYlhtrF9l75mNxpPEcV+gNMCoc5X9GeqSQ40A3f6z8if0\r\nxZ9mSB0JpwIEGJbVjO+B94tcAKEienKVZPrb8fGNH+Xq/kwIkB6bgmMXlKMu\r\nrYLUvXCCzo4wkP/Q2c2Lu94pqplTU9o5H+Zn/sIAIO7jr6bYcI27ZuVuM42c\r\njtRbNvzlnTncEpfSkvRDJSVK6/Ci4GANWNw2uekkv4Ye3/8Oul9tIgErAHz1\r\nkOZKe1CabxpS0VTONzrEVyFI/a/si/oFhuouoMlnaNH8fPpcAE8xRw6C1CNt\r\nG45/KHzgCk2YMmHBrGzt30ohbIzku1rd2EokfNxqXyTdnITwgqcu4K0oZIc4\r\npslp2bPcsgq6ng8PCgEavIv2h3SKwIzqojEgKcz5aLiSIQ3L5r+eomyv8jln\r\n0OXpECLaQeHAiWfVele5RK1E3xUAUuuPd7eOd41TuWKo+EoNLgxOzd+MYT+h\r\nuhHtWs2wZK7xjMl29jZZMqpnB2OxDUHqxq0=\r\n=Cw4d\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220410000737_1649549259054_0.6546883188928176"},"_hasShrinkwrap":false},"0.0.0-dev.20220410000747":{"name":"as-typed","version":"0.0.0-dev.20220410000747","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.18.0","@typescript-eslint/parser":"5.18.0","@typescript-eslint/typescript-estree":"5.18.0","eslint":"8.3.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.25.3","eslint-plugin-prettier":"4.0.0","prettier":"2.4.1","spec.ts":"1.1.3","typescript":"4.6.3"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"9ac6831be8646c76aeb629dd63a5846009844672","_id":"as-typed@0.0.0-dev.20220410000747","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-01mcSiK6tiau8Vz28J/wNj0Q0KMKJs4QrhUjEz7BK7lpbW/7B6Tvjuo7V1wrrsaHAIr3tEkJuH0C3TILLWfNUQ==","shasum":"5e309b48946c1f07b50d425bcae4c5ebd76a17ef","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220410000747.tgz","fileCount":6,"unpackedSize":14088,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIELlU5EG8Z9vcNx6mIZhfJc8xTX7FuANCFGno42c/3UdAiBGQsoFRkrcB8MA5DmJNOPuW1+XWJomGko34PejNo0d5A=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUh/UACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqTHxAAnCHQt8ZayRomGxp788gv7074miSsWDI12j1Vp/uDdPZlFqVV\r\nT54EEYt19qnO2jEeWX1MJ/8lvAhIFGlBsjaRUgitHI1hszJhhSLyV/u2skJE\r\n6bPXinKBFijkL9j2ljHXrxerQ2UKGx2OzNbW27mXx2nB00mP+N9JEswBrRIg\r\n2p81dR5Zeij5LRsL/gCEfUpg7XYJpm/fHVr1PmIr/z4Lr3TLAa5uWn7L4AOt\r\n5VKRenQCMlf6ZDD0ErZDq9EVCUaceDtosvVqkxX79XFemUVpZ3+CwoxjImSG\r\nKzRVDu1j8i6NDQoESPDlHFugsKoNsZNAmWAhZIADra3oTT3iPSm0zqR4pqKs\r\nM1xSRo2bAk3BWBFsFdB3nLdfr/r838cP1mCKorAN990JqVhOJzmJiBCiE1En\r\np6K1eIm5SmaOvR0grbXlfwwUyPDtT5JiyUHjF81CIhEAwRplGGoaTKL2MwfU\r\nGMghOGKkQvJPfGRQ5xiGeXEGqsVFQmLbF8a1f/ZKvnsdPDGTOYvYWU8lKfFY\r\n2MNSR2xztdGW8S8jp/rIdNI2rTgKZNLgdna/MyT5cw/uYG/uNM+MIdGoPVKc\r\nti3yW4qoCwn0S6/wTJaRutYdWEWH47WwQm3Un9U3k7ofiqJxlLrkQOz8qiT5\r\np4YU6HgFKTHjSHIFd9l/pJ128OpSCj5pAZs=\r\n=r0xp\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220410000747_1649549268177_0.29132258878632356"},"_hasShrinkwrap":false},"0.0.0-dev.20220410000755":{"name":"as-typed","version":"0.0.0-dev.20220410000755","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.18.0","@typescript-eslint/parser":"5.18.0","@typescript-eslint/typescript-estree":"5.18.0","eslint":"8.3.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.25.3","eslint-plugin-prettier":"4.0.0","prettier":"2.6.2","spec.ts":"1.1.3","typescript":"4.6.3"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"7978dd8a7f8ea7d9657af76b194f4746c4f64f64","_id":"as-typed@0.0.0-dev.20220410000755","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-vc2yPxCBS4LDiOu3g+K/cUEQaBr3dEmeQ/OueAhhsRZSSFwJqxZjpv9FNJMWjfxfw4S7ankqlplXIjwUTuVlLA==","shasum":"b668677384132d60b6cbabcd1858caa03833b71a","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220410000755.tgz","fileCount":6,"unpackedSize":14088,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDGRxYKKXYW6i7ZiJFRXyBYR/VpgKgFdiAkjcQkVfbwYwIhAI5g6ZtfJ5a0xHt2YCOZZuFPmukw9ms2a9BfSnC4cd6z"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUh/cACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqDsA//TRHJP76qieC4CbmqR0lV0IEkTCveAr4b+Q+LSdGFbmuS06+N\r\nNOPT0Kc7rL3kh2AAATAqBgCDV8vXp/8GpkdcmOtpguA4L+IvywCPrX/Z2AMK\r\nVIEwPbul4OYo5r8/6+ggNWD2UYOJ4Hx0Kg7NKO4EfpEVMtYMol0m99Qd8ZlC\r\nvJs9ZJmtrOOY5aLSjCUMG9eIYe2BTtiNTMAYPyhX58MsazW465VgXUEmVBYG\r\n6M5nbsqNeWU5fNrCIGd7kNL9z26YhrxigaoBLuFek6PDujK7PGyxza+g8lyP\r\nIs7fiG36XUgjOhpthOP1ARMG89a2gPzJUh23ioX4hOROEaBw3Ux8orVDesso\r\nPm2huc7aUl+Szw7JvQaeunb2k3JQiBeqiL45He2D9M31QayyyQdz3jvqzDoj\r\n+k8U1wvcgYgGDWNwJln6xOkQ0hfnyiroc/zhgwl9/GG6JnvDfJo2TSP6tF5R\r\nuFFoNP1J78RlOKzsaDzgf0xtCvQDEsnxnPrR53Ea80kdO8iY+sDpzUuf8Sme\r\nZEsLXJqwwrQqEHYsXfbXisu+ED3lvdf8wnXkQAVgakgonLR3U7ZD+9+goDiR\r\nVZJ7CNbv+pXFRiSlodKteryRx+P9JNbeHu9DngWX/dNsRFZYku7RMbXMD9C5\r\nI5d/CCwOF+ge2WJoiem10IVhqXTeB05etwY=\r\n=ySRX\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220410000755_1649549276437_0.7602717829288457"},"_hasShrinkwrap":false},"0.0.0-dev.20220410000830":{"name":"as-typed","version":"0.0.0-dev.20220410000830","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.18.0","@typescript-eslint/parser":"5.18.0","@typescript-eslint/typescript-estree":"5.18.0","eslint":"8.3.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","eslint-plugin-prettier":"4.0.0","prettier":"2.6.2","spec.ts":"1.1.3","typescript":"4.6.3"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"b431776bcc914b1474c302054bd6f40c6569626b","_id":"as-typed@0.0.0-dev.20220410000830","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-aT0D01DkYKji9T/a/drDEndPRGPW7a8nGtu+aue3PJGFMDazXhGDOTLjWERYn4DakQZtcOmkka0J1X76IS9Bgw==","shasum":"17d944042c25298454c4df2dc3c259182c613bb2","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220410000830.tgz","fileCount":6,"unpackedSize":14088,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHTFDnvUi6U1co6JQbPRxDDQqA5eNCoyuWrP8SEjcJkQAiBrPgv1NN2E1JmKT0iGecZisPsQRSTj5wmZIw+lFOhFmQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUiAAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpLsg//b2Y15dDfkStwe76gJklnyfDUbxEpn3SrVEy9T5WTm6cp4sIq\r\nDCvVfDzrQkydfgLCtL+3SQ5itDdz+ysSgVKcLg/RcywOV/fhX3IYNv4UAlPH\r\n/pPHl20hz9vpVzaJcBI7yLQ0uz2b/6ahXayzdA0nVYqe4ht45gmAwrmdno+K\r\nPPNbkJJZdmK21/zL1HXguYpaCrsHUfGZLDk+yJeMdGJG8OdXn2M3Gx/m6KkK\r\nlzwH6p5j3zRkIcN33rN6dSwsk8Uh7do6zDO05SRgKtALSjXlAfrhzLoKhvns\r\nCuIbBmbLqGi5PkdvTUNvMj/ZqA7qRvtWDicaXX5HHmeLU3UY0BpNPvM6vCPA\r\nFSLfuP01YpPbrNHEci9cE6qRFf1Rt7IkrVOcPUQ2vGmNs/wpPRdfdQFyXluQ\r\na6qAurL0zaH9qy+GKBe9Y0do+PRzElf8ETaxgNHHVzoYkC1NVd8g/3KgUe0b\r\nIgtDeD7Rt0b1pY5Me4DCC4EMTQTlDE5+aMMZVilNgn7WtaQN/ApO6dyHVEvV\r\nrz5Dg+dhdhLb7lueGMHL3jXYorpJIS4r9F7GX8Mxu8BqAGTFZJTB6OFAfjWY\r\nhgyWeecAMu0KszaPiBJNGZpDGTU9sTPftoNkyclim7zPvMPwZA9hSGA6L2W6\r\nXbpGU+hDVtin9MBv07o0mXDY5uqtsqqqRA4=\r\n=Z20X\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220410000830_1649549312139_0.42196463616967494"},"_hasShrinkwrap":false},"0.0.0-dev.20220410000910":{"name":"as-typed","version":"0.0.0-dev.20220410000910","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.18.0","@typescript-eslint/parser":"5.18.0","@typescript-eslint/typescript-estree":"5.18.0","eslint":"8.13.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","eslint-plugin-prettier":"4.0.0","prettier":"2.6.2","spec.ts":"1.1.3","typescript":"4.6.3"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"102a7c654943f24f76f01712ee6d9fe35d9a10e7","_id":"as-typed@0.0.0-dev.20220410000910","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-zyb568XGWDVLz27pRQW0WKhgV2v6h/1HBTvRlRSjvKZ/5ZekbQWA6N21jfyZvQWBLBiImGQJ2YqrwU5q8WyQkg==","shasum":"9638d1004b179a3ad8c4a8bd6a46b463bcca4f35","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220410000910.tgz","fileCount":6,"unpackedSize":14089,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCs8HS6Ow1w/WDSmynHH9KelBUf7lhxklGhedCBYYt8MgIgYcLlRgM5B1U/iBbk9JlGmtJOaHLApSkhF2v/T9qXVkU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUiAnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrbGRAAhoc04cOEICiK76DFqakwedvO9GlpBH+xn2/iK8vvnNnB7nwh\r\nJB9OAPtfwVToIeMklT69IxKBRNzRh+Le6DMeOiR0CpbXEP7zml18EF+UGRNU\r\n3DTS2sJWcLdVITQhZXCkdfeDGVSgk5pOT1p/WbZ3B/anu1Yho3/12IhUZSMN\r\n4WQ5CB1KvD/EP2CV6QnuLNmu3jczjO3z5mHZB1qsntkAFk/dMhwWMjceGhNu\r\nQ2s2U5AA/vU1vEacJif8N6ZHILNgoUzGJieGjtoFoLNIVc6Hxbnm0bX727W9\r\nXEhY0xTWK8QZiMr7zZ++A2R2vMzVlVEYOyfhXZnq9e/yaSXTZkIgRT10vIZr\r\nXmaGKZJoYwKc3j+qDVhmG6HJHTiK4ws2OrJ8wKlbV3hpiXEi7u6jq/K5CfSI\r\nW2q96envR6ByB7cwSq05gOGge+wPPCrQcvBXzvyxLzdzuGAWSOKy3xr4UCtV\r\nDWv3/7pVv8FUZUwmQ5D6PGuo2CTJ+lDeXCHVa60iCnVSOykL5UnN+VKKonaq\r\nFK3fww2MQaT4jG/rb6K6fBpbqkwEqjfqSHtRLBHj2GJJrKtONR0okmZxctmr\r\noNQPJxnO4nqg69EnxDP/JVHCNugTbxhFhFylH4kA5p5X5GCoiRNIGK//lT+U\r\nwFPxk8W75X2km3wiwvt/YGwPO/JtKFdZ43M=\r\n=RtGU\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220410000910_1649549351390_0.35228736726795473"},"_hasShrinkwrap":false},"0.0.0-dev.20220619013536":{"name":"as-typed","version":"0.0.0-dev.20220619013536","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.18.0","@typescript-eslint/parser":"5.18.0","@typescript-eslint/typescript-estree":"5.18.0","eslint":"8.13.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","eslint-plugin-prettier":"4.0.0","prettier":"2.7.1","spec.ts":"1.1.3","typescript":"4.6.3"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"5ea4d96b4a567a0a857aaa20228f574067199965","_id":"as-typed@0.0.0-dev.20220619013536","_nodeVersion":"14.19.3","_npmVersion":"6.14.17","dist":{"integrity":"sha512-iViICdUjpHv0190wtkJHHlkptWsyNVNCLSLbcEjfw6+jXWJVvjH6u4I5xSniEWtBZOzm84QGX+rqSEtsroihxw==","shasum":"c55c75dad635453ab2cfb07197b63e2de67c6a47","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220619013536.tgz","fileCount":6,"unpackedSize":14089,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCm2Hr2ywGQQhA7ynfofSb5bB1yHeg35uoGtGjy40AgawIgYxW7ZDSTdXafIU+KBwtvClJzRC27NXbzZu8rfTmwMQU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJirn1pACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoLYw/9HQNuacsIhk52lcHNuRshnD10ejytAS6pHXs6o2AUkrYlzWVR\r\nxvA2cS4urmKlxFwS4ccot+Pluw7LwhoKhTPm3gxNmJJN9OlcekJAl4Y91xyQ\r\nzP1KduRqFv8bAgKkwR5qqE3agU6uxGBXTuMkkLfGdRMszoI5sKjPGFVeEE1n\r\nQ7nMttirGEkzid809CY/x3Fim5OCO7Ij6DPeOU63Adh8Eq18cOBfv/LNBg+N\r\nC7ngEsbeyteSiMQsh2LTsM+H4r+W8w1FIoh11AqJoej/pUQEAWxRqPs6K+LV\r\nLRRiqsYSScvhKOwpLRQxCpJKWz+b2Ns9cGtwOeXAIiMS6dmr5YKTBh0GiJR9\r\nAjdnTUicOXz2dV+v34AKEqTjKpqWCi3eTvooEy0Fw7+X7P7NX0owKAidz6gA\r\n53Le5l0VavAUEtt8xi/HEnsmUBhgMzy2z4kfHvJK1gsPTSk/1kJoLLbRegfb\r\nmPngWLbkMIgL//+r6rSbo1NqqGXMAW9bXwH9LbGNlTnuW1DafDgIYwjZA8Wy\r\nPaYWbDTkf3/loQNgHk0x/YyihuYocRITrbos+yIsUek8WGXQOgDJPiPqlroE\r\ncSCkR02CkZ4tGlYFlZKFeLzfZL4eiyK6eOKF+D30SF/It9+Bhx3NZOevL5TO\r\ntB7VVQSobM9mnqPyHiugIKh7G5MMgkTfLKM=\r\n=zpeu\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220619013536_1655602537710_0.7795499863915116"},"_hasShrinkwrap":false},"0.0.0-dev.20220619013725":{"name":"as-typed","version":"0.0.0-dev.20220619013725","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.28.0","@typescript-eslint/parser":"5.28.0","@typescript-eslint/typescript-estree":"5.28.0","eslint":"8.13.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","eslint-plugin-prettier":"4.0.0","prettier":"2.7.1","spec.ts":"1.1.3","typescript":"4.6.3"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"409daa748e67fb02c3d28cb0d8825f762ad5da24","_id":"as-typed@0.0.0-dev.20220619013725","_nodeVersion":"14.19.3","_npmVersion":"6.14.17","dist":{"integrity":"sha512-MdLB8GzF3VfRRhcb69ZM+FYiLbEKJ/Ekqmyqp+kDgPpQsjAsBWWKiJIFLDKRnLETGQf/kaJfWV1rybw6STXC3Q==","shasum":"7308bc3d780117b4ee1e24ff9c0d04632c0fcca0","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220619013725.tgz","fileCount":6,"unpackedSize":14089,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDTL8sxakTlEjV/SKfgYOBIVAhEFRZ8CiuV8zoaA3cJCQIgSEa/gfarOLo4G4KFXc64/NsFTc2076Ru3m2H7UbgM2g="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJirn3XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqgUA//Q/GFz47SLaPz0poOVXd9XMnfViPMzNhx0cJV+M7LkdWifKsV\r\nCv9ldncqj9soklov+XNsRiJazl7weHdOYfXplVFtoIyATGykO2X1OlU6ktBL\r\nXZ44UIisr+FuUQLrf5XDcgga9kAWeVpNSg+IHR/fSKVbZZCbWY1tvfEUWE1e\r\nmWstcyT0WuTPcEq+gtED3YDS4u1JUYI5L0ZOYss/YEII5MBeKmZCezun/D7b\r\nhd8ezHglSkBe15by7o8oC35CcdKD/pNCVmzPkzkOCtwBQIFKdhjXaPeocEL6\r\nF/YcjEmYuNKGADder1N3Mompknyd4xSQxDJsdu6hV2HWgDgnb59za1Y0Vc8X\r\nsVAZ2r43PNAqD+tq18ZjT+5zVQJROYtxZz8EG7hWYfozz7+FV1EIPJ09j24T\r\nFTpkn5JqqQtRyTODkb5cf7D3yEr4o4CBs9iQEsefpjobWlsP0FJ+HTKvn1Jn\r\npBS4DqNsjvzNGBj0Bm68/7wMKfT0idAxauTObuxX4ckWu9HzXSgrSR8cgxop\r\nc6jg0pUy1Vt5KeSvDXVf68ub5vnatazssfrEmvcIfAILwQVZ/sfx+TBit9Iy\r\ngKyVs87YoB40OtrdoDWnnXIin8N1QN/34W5LyazjWbWrgj5Z0/t0Tmwmq8CM\r\nsfNyxbMdN+RiMWlOtNG0NeeljhfZeig0LyI=\r\n=qPmt\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220619013725_1655602647070_0.276850742359922"},"_hasShrinkwrap":false},"0.0.0-dev.20220619013809":{"name":"as-typed","version":"0.0.0-dev.20220619013809","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.28.0","@typescript-eslint/parser":"5.28.0","@typescript-eslint/typescript-estree":"5.28.0","eslint":"8.13.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","eslint-plugin-prettier":"4.0.0","prettier":"2.7.1","spec.ts":"1.1.3","typescript":"4.7.4"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"004583530eddc3656dd671cfb8ed6d4483ca8554","_id":"as-typed@0.0.0-dev.20220619013809","_nodeVersion":"14.19.3","_npmVersion":"6.14.17","dist":{"integrity":"sha512-CRenT4lgLsOFNZSi3+pnp6JgqPYUmN3AJIuoHRdk9p8ijTNB+9igr3ReJ5BIIKulochpTpi64+VyY8QAF6FhAg==","shasum":"c1c370942f84a1c698cf581b0bdd0977ce405dd2","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220619013809.tgz","fileCount":6,"unpackedSize":14089,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC9hQMd5zCwtmZET65NrbU9IxF4YP2naNeTMUq5+JtwhwIhAN/GyUf4N7P8ReAA5ZWIUA1tM/DcW2J4jxYVDD8INxaI"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJirn4CACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrjgg/8DiIkjWlmaV0Q/haf0Mzguqk44/VDFzQ57U7LJ4TxfiEzafXD\r\n/AXRDND4gh9ryvWI1QbM1IBfFeNjTmHBi1+FyC2IYI121ET8qaETS0T0vIeS\r\nPc/8ghg1u+zfLTHp9Ghd3Z95MzSUvqdJ/EjFKFEDJYb8U4S8ut1KomsRmXIL\r\nOor1pG/WHLK17qcNhH72wkS+NJd4GYNP6DJTRoiordYHBY/tdH7bsnnuiorI\r\n5EIixaqtRDrTUAGaE/1yq5VyrObPvgdE1UjCfpjIdi/O2ob+45rmcGT7Fwia\r\n/QCSFbxz5f8eLGiYARcWCM5F7rO47dgA1IKJc9c7KWcKmNGx9WXf4DwTS+sN\r\nmDgBiJXLrsjXU4ThOqXahPy/NQRpnHZFxIFnKn7srANVBiMSwUZ4fmyoCa10\r\nvpHt8s0e4XZvIJYu2m0b2uvllxF3cCVPfnCWbo8ETEFlFLm2a9tQoul02tl8\r\nTsADwfVpOg5XblxEQ5V+Qp+M1sXYhFoGNxWUyAnBHV7Z5QOafHYKK2Pc40WB\r\nkKd0SLwmRyBjPAMTXPTxZs6/2nnnTTB00UiLmAZRq/jTsZfcnjjqImiaLsIe\r\nyMMxiStoh1NYGIFk8LEdAwNV7kb654LT2zs7LKtxHtgc+cdh+Hcfuec1Uk0a\r\nSElT+0+/59rAY7QQzsyyfxdxURT7C3N6VZo=\r\n=XncH\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220619013809_1655602690096_0.13023954770890733"},"_hasShrinkwrap":false},"0.0.0-dev.20220619013933":{"name":"as-typed","version":"0.0.0-dev.20220619013933","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.28.0","@typescript-eslint/parser":"5.28.0","@typescript-eslint/typescript-estree":"5.28.0","eslint":"8.18.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","eslint-plugin-prettier":"4.0.0","prettier":"2.7.1","spec.ts":"1.1.3","typescript":"4.7.4"},"readme":"# `as-typed`\n\n![npm badge](https://img.shields.io/npm/v/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"ea1b407a5eecad454654dd9fccda627664fe6462","_id":"as-typed@0.0.0-dev.20220619013933","_nodeVersion":"14.19.3","_npmVersion":"6.14.17","dist":{"integrity":"sha512-XeF18QH7uvVL8yIILwBbXqwgYEbHLA5Lvx4lMfSZuddhDtV34hsglfxMCywBeQ0IdkzNvYS8lb/qaGYNPutHgQ==","shasum":"0ab13e2b6300955dd40ee71e7889274b16ca3479","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220619013933.tgz","fileCount":6,"unpackedSize":14089,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2W9VRM8zlJMba4071PD7bXbT6J+HSpqZEyMI1L3NySwIgboqBteJk+l6mpPKYIrkLvVAepScYBH48YKnumztCRy4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJirn5XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpwGw//TgzNKKkpSp2bpB43L+/LLarGP+9H7faU6P4xKxSoWjPfdwYu\r\nt99nkh+jTyaQGrjdnkLZhSiD1Zk+DpzgZgxeAe03Ig2A5Dd5HR5Jkeg4zVBK\r\n9WglqoiVDebNhdSAT1yjy6ANqJIbW4HyQYai3GodfRL81qEB8/JwbCkTJKpR\r\nJ3o+LxpCq4o0Z8CoUxd12WHuczoE5AenLRWT+W3Y9QaGEFgeVdeH6IcQKJ4l\r\n3MlZZQe+4DejX6eA1Hrf/24QCukbYbmvhlSJJfrWAY7aJ72b2XMRLJVTn4DP\r\nrSaVfFnUoPIQEozVCZdK5anjg1/8lvp+Nu9oHdddAdeo8oPjPH1N65X50R7S\r\nHbj9ODD84c1ace4UFBTV0UeI0Jbl/Pm+T4oOMh/b8YEjZ3xVoHJ5UZdUlExX\r\nddt8nwxSHT65eTU5SuhZ1wRnE9OmGQq666tymqx3uoCN9xR6LxRDrSuqq5gA\r\nwXepFuUbIjDEd3q35bQ2ibIBz4bE0vwBpoAZx9YGMsye8kIFeMO10uYCthQ8\r\nJItZ5Ej0DNRzlfutGuRYUgEJW9Sp/YIfeKfkLIV/x6ce/AJSwSz1eS4dfldr\r\ncaddnLMynXEidDI8JlQaFluaPi3Buf5pCvIq+koqQrXeAvMMNQRR3ZSJx6fj\r\nFdF4B6DTkl14SeW/W3OXce58634teoanens=\r\n=QDGw\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220619013933_1655602774830_0.42913194957793577"},"_hasShrinkwrap":false},"0.0.0-dev.20220802112108":{"name":"as-typed","version":"0.0.0-dev.20220802112108","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.28.0","@typescript-eslint/parser":"5.28.0","@typescript-eslint/typescript-estree":"5.28.0","eslint":"8.18.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","eslint-plugin-prettier":"4.0.0","prettier":"2.7.1","spec.ts":"1.1.3","typescript":"4.7.4"},"readme":"# `as-typed`\n\n[![npm badge](https://img.shields.io/npm/v/as-typed)](https://www.npmjs.com/package/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"45c76cca5ef9bc03b23d3ffd5ecd401236318071","_id":"as-typed@0.0.0-dev.20220802112108","_nodeVersion":"14.20.0","_npmVersion":"6.14.17","dist":{"integrity":"sha512-sj+VhiXm/mTI23hsya1J44hQpxIHPnsPY1XtfpzJZIEO80k4PvK8p04a7IffC4rV15M/JEMdnaBZIio+BWq96A==","shasum":"e813bf6892de4b7c6ef08b9f44e7affe1a756a02","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220802112108.tgz","fileCount":6,"unpackedSize":14131,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDpT9Iv8FogZpKK+sQDuYVzobJueFj3ZQEkv99pFxgQUQIgCXmFUAcdYmq8W2iIbUJBZBlLhvtDdXqmR9h3qkPeg1o="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi6QilACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr4MhAAidy6J9yuDKQr+SDlX1L5Y/ICUb+YaEPOtd4YB/tQDN9qGMLK\r\nxfW0m1hT3Mq9sM5sU9i3i0V7dMJZh+rO8LADnPOlGXzODCD0/LvaRmUWMYUl\r\n8zMME0Oq+TA11GPNLLCiSV7rtqCzzUbRApMQxggsqoVNqdl60Xxa+HfF7VW4\r\niUIcigbYEjhvk7yorpDBjOu2J5nuDnkJxbbCWokqyP4wj9x/CLIpocj7vpw5\r\nbbxk1llszg2meyV3T0f2HNXQ2gNcA4x25EwHOhGhePlLB83KmzEUB9Eb+I8/\r\nYhUACXQECDPvjAnct0BYXr+YD8IH8ZAMm7J8cUqZ6kzcQRnQA74z7JMrEtza\r\nsrSE8XsByRHbS4MJk9V2oIOhxFxc2D/7L9i6vtUUAXfutJ8A0GGTGzXDAjhx\r\nG963TwPduiqaYzgT5btzBpGtN2E24GPLXaAXRea2uhQUE/t5lxpbCAClmGnu\r\nrM8Zd7dnwckRtNBHuRF/cC7ILj8IXSZYNm6Dd7ho1r9xNbVZJjhw2k75Q7oC\r\naslAujHGJR9/9TgDpM6R3VP3rvcNNQCctAeJHi23YrIPO7O8bCnm1a0FsSWh\r\nzUAwDSnYZP8Fy4J4HqJeWVbdC3XBboh/35QL8PPAARSwUeNZQksmh1iudHby\r\nckMfUysnqboipgVE+IskBS8TrbDH75zkuaw=\r\n=5sOV\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220802112108_1659439269492_0.8326030551516845"},"_hasShrinkwrap":false},"0.0.0-dev.20220907144324":{"name":"as-typed","version":"0.0.0-dev.20220907144324","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"5.28.0","@typescript-eslint/parser":"5.28.0","@typescript-eslint/typescript-estree":"5.28.0","eslint":"8.18.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","eslint-plugin-prettier":"4.0.0","prettier":"2.7.1","spec.ts":"1.1.3","typescript":"4.7.4"},"readme":"# `as-typed`\n\n[![npm badge](https://img.shields.io/npm/v/as-typed)](https://www.npmjs.com/package/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"0d67f1d0cfab1f404d9676c943569bb5d8294f4d","_id":"as-typed@0.0.0-dev.20220907144324","_nodeVersion":"14.20.0","_npmVersion":"6.14.17","dist":{"integrity":"sha512-wvNm9kG7aDqTJgCpo0eVCbGja6UTZK5JVIwQiS6pOfRS+vwO8IUmnYAzKAqRBmDdVMdbNn9fbziBMZ0FJrx+6A==","shasum":"6000f8dccd8c47951f56ca7701877c350951a25b","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220907144324.tgz","fileCount":6,"unpackedSize":14132,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDX8nRFz2o3X/YmLJ4uk/OfSuZfX6nKshokDVJIbjQahgIhAPBWNx2B7dkvFlSozQN5dl0CgWiF/fo9xruR7RhWl2Yu"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGK4PACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoz8w/+JQkfEfJCecx1dcZenogR9ZdiewH399CY6ImHj5pURzOllfdm\r\nKMLInN1SsAJ9ifIoRr12kdxDYGDJGY1XbLoaUEGkS6R4rluXDv0N+tsU6uyx\r\naaBnEae0glJKZgNji1tIUyo7pZKLfRgTRAZEjIt72mStbme5u/08mF3qI5Lx\r\nUhgjpDi2FXoqM7JaTMSc/1Yd8A5p6gm4eJz/soTlMMDHUhmlSmUYy7IXBJ3J\r\nRv8BNRt9K10Pdo41w7IANmqjBIPeiCQB0Fzba15PoRUXJYU1lkhVp0cihjHp\r\nIgse8NZqOFIVOZYUQq/pO1Q9XW0HrKwTruLWJmMZQUVZn3hrTme4UGaXhRyn\r\nKJsToFz0OHY32UNgHH6ELJBheHHLu6cmORR36M/9rKjtOM14rvFuHyULakEW\r\ndF7bLWQJfLHSFf1HxwlrIKemd3fCC8peKtCBbPloAdyGXACuJJX28da9GEr/\r\n9DUC32jIl6P2V5+0dFktrStueZJZCisPtrnUXZmrzX/HJXMAfgy0kn3+whnT\r\nkawotI/M3Vt7GH91ULyirHBVmBFRjutiXMb5j4qSONtOjYY6mf0vc0uOSh0C\r\nnhSw3qPgSy+DhMkKMuYxgU73+zGGbScXv7dy9x/xYRszDdrrvfuJnoXLMg8T\r\nZ/4KeeP9PeeZrMfasO7qMfkQQfVCDjKjr+Q=\r\n=nwvc\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220907144324_1662561807333_0.946601524020295"},"_hasShrinkwrap":false},"0.0.0-dev.20220908000114":{"name":"as-typed","version":"0.0.0-dev.20220908000114","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.36.2","@typescript-eslint/parser":"^5.36.2","@typescript-eslint/typescript-estree":"^5.36.2","eslint":"^8.23.0","eslint-config-prettier":"^8.5.0","eslint-plugin-import":"^2.26.0","eslint-plugin-prettier":"^4.2.1","prettier":"^2.7.1","spec.ts":"^1.1.3","typescript":"^4.8.2"},"readme":"# `as-typed`\n\n[![npm badge](https://img.shields.io/npm/v/as-typed)](https://www.npmjs.com/package/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"cb472edeed36c412c3d5d87073260a0ea0bc94bd","_id":"as-typed@0.0.0-dev.20220908000114","_nodeVersion":"14.20.0","_npmVersion":"6.14.17","dist":{"integrity":"sha512-J7Ifm42VTmu4Pg1MORuC+bFK5jwQdfY4c3N1pbfYZ8NSHnZhUmKM6n4kDMWXcCDcub3ZEbrncebGoJqyrMpGJw==","shasum":"f5cf97c44da97e7a807c197137235bfb286cf719","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220908000114.tgz","fileCount":6,"unpackedSize":14142,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAcrIJlThZvIWq127fHDQIKB9yyEyMtOuFAmRp6jmqiDAiBn/M8QBjgk+FYH+CI3m2FevHnyQMDyxddG53i6OMd+1g=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGTDMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr7uA/9FmUGEnTqI+sNaw+C+It66BsbshLABX0V+zcsn0OEa3xfJher\r\n+UMpN4SWdN2XHkH137O0tfGX63REiNJmxCLYBXeHEGJHc1sWVY5YLaK/0B33\r\nVtGxzSYOffcK/vxarX84p2QjHslKUPDpTdIefHUhvqBez1zAYCnoeyaZXlYc\r\nBnZ+3IBF86KP4+vBqAk6Cldql9swHNhw0Xj8eevC+HdN5aV7pfrGdMo0IWtB\r\nXHd2q/wY5qBgD/LlyIjKYFvH5e2ey2Tzis3dzlVVY8iwpnARJ3aO5j0+aCBa\r\n5NwZNmrVzYpzyjyEC9FhzE2HJ+nKWwHxBx+Of6/oUtRgsDTnqAq1DUkZuIoU\r\nqWkSEeeRYXCz/lRMMco6R7EqzS4JlreEkPpwbrL5l1YYeKEwWgpMcFFlINkH\r\nsZYZQv2EKlA4AyfMPW0Vka8nB6kOo5Qcw/aCCrE3hKYLZAfIiLX+4xBQlABi\r\njPvAwmHfuMQdIGsmPEDVlI+ghy4ASjPHOa+V2ZL2Qrb+1VFP0edQkBCVkeDm\r\n6WW3Q26nW8Nb2SlyomTB1lQzQiFDz1+sgMVy35zkb7Y018EWc7aa5jTVKsLS\r\n/vwAQCXwkgwg5r/vao25yt8tOGN3eWxa0sG1RVErYVWKX3gR3SrlV4MKtJw4\r\nB+EU2YswszTeYZOsmH3mkpac4xNZrvv3lf8=\r\n=9SyW\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220908000114_1662595275744_0.5560838819537284"},"_hasShrinkwrap":false},"0.0.0-dev.20220912112845":{"name":"as-typed","version":"0.0.0-dev.20220912112845","description":"Static TypeScript types from a literal JSONSchema type","types":"index.d.ts","scripts":{"test":"tsc -noEmit","eslint:fix":"eslint --fix '*.ts'","eslint:check":"eslint '*.ts'"},"keywords":["typescript","jsonschema","json","schema"],"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"publishConfig":{"access":"public"},"homepage":"https://github.com/lbguilherme/as-typed#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.36.2","@typescript-eslint/parser":"^5.36.2","@typescript-eslint/typescript-estree":"^5.36.2","eslint":"^8.23.0","eslint-config-prettier":"^8.5.0","eslint-plugin-import":"^2.26.0","eslint-plugin-prettier":"^4.2.1","prettier":"^2.7.1","spec.ts":"^1.1.3","typescript":"^4.8.2"},"readme":"# `as-typed`\n\n[![npm badge](https://img.shields.io/npm/v/as-typed)](https://www.npmjs.com/package/as-typed)\n\nType magic to convert a JSON Schema literal into the proper TypeScript type representation, all without additional build steps. This module has no runtime functionality by itself. It exposes a single `AsTyped` type which takes a valid JSON Schema and outputs the equivalent type for it. With this you can get type safety at runtime and validate your values at runtime writing types just once. Great for JSON integrations and data serialization.\n\nThis is forked from https://github.com/wix-incubator/as-typed fixing many bugs, modernizing and introducing support for more types thanks to newer TypeScript features.\n\n## Install\n\n```\nnpm install --save-dev as-typed\n```\n\n## Usage\n\n```typescript\nimport { AsTyped } from \"as-typed\";\n\nconst schema = {\n  title: \"Example Schema\",\n  type: \"object\",\n  required: [\"firstName\", \"age\", \"hairColor\"],\n  properties: {\n    firstName: {\n      type: \"string\"\n    },\n    lastName: {\n      type: \"string\"\n    },\n    age: {\n      type: \"integer\",\n      minimum: 0\n    },\n    hairColor: {\n      enum: [\"black\", \"brown\", \"blue\"],\n      type: \"string\"\n    }\n  }\n} as const; // <<< \"as const\" is important to preserve literal type\n\ntype SchemaT = AsTyped<typeof schema>;\n/*\n  type SchemaT = {\n    firstName: string;\n    age: number;\n    hairColor: \"black\" | \"brown\" | \"blue\";\n    lastName?: string;\n  };\n*/\n```\n\n### Primitive and literal types\n\n```typescript\ntype Str = AsTyped<{ type: \"string\" }>; // string\ntype Num = AsTyped<{ type: \"number\" }>; // number\ntype Int = AsTyped<{ type: \"integer\" }>; // number\ntype Bool = AsTyped<{ type: \"boolean\" }>; // boolean\ntype Null = AsTyped<{ type: \"null\" }>; // null\n\ntype ConstStr = AsTyped<{ type: \"string\"; const: \"Hello\" }>; // \"Hello\"\ntype ConstNum = AsTyped<{ type: \"integer\"; const: 4 }>; // 4\ntype Enum = AsTyped<{\n  type: \"string\";\n  enum: [\"First\", \"Second\", \"Third\"];\n}>; // \"First\" | \"Second\" | \"Third\"\n\ntype Nullable1 = AsTyped<{ type: [\"string\", \"null\"] }>; // string | null\ntype Nullable2 = AsTyped<{ type: \"string\"; nullable: true }>; // string | null\n```\n\n- Patterns are not supported. There is no regex validation in typescript, see [Typescript issue 6579](https://github.com/Microsoft/TypeScript/issues/41160).\n- Value validation (min, max etc) is not supported. Typescript is not meant for value checking (at least currently).\n\n### Objects\n\n```typescript\ntype Obj1 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n  };\n}>; // { foo?: number }\n\ntype Obj2 = AsTyped<{\n  type: \"object\";\n  properties: {\n    foo: { type: \"number\" };\n    bar: { type: \"string\" };\n  };\n  required: [\"foo\"];\n}>; // { foo: number, bar?: string }\n\ntype Obj3 = AsTyped<{\n  type: \"object\";\n  additionalProperties: { type: \"integer\" };\n}>; // Record<string, number>\n```\n\n### Arrays and Tuples\n\n```typescript\ntype List1 = AsTyped<{\n  type: \"array\";\n  items: { type: \"string\" };\n}>; // string[]\n\ntype List2 = AsTyped<{\n  type: \"array\";\n  items: {\n    type: \"array\";\n    items: { type: \"string\" };\n  };\n}>; // string[][]\n\ntype Tuple1 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"string\" }, { type: \"number\" }];\n}>; // [string, number]\n\ntype Tuple2 = AsTyped<{\n  type: \"array\";\n  items: [{ type: \"number\" }, { type: \"string\" }];\n  additionalItems: { type: \"boolean\" };\n}>; // [number, string, ...boolean[]]\n```\n\n### References by id\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      $id: \"userschemaid\";\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      $id: \"userlist\";\n      type: \"array\";\n      items: { $ref: \"userschemaid\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"userlist\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### References by path\n\n```typescript\ntype ObjFromRefs = AsTyped<{\n  definitions: {\n    User: {\n      type: \"object\";\n      properties: {\n        name: { type: \"string\" };\n        age: { type: \"integer\" };\n      };\n    };\n    UserList: {\n      type: \"array\";\n      items: { $ref: \"#/definitions/User\" };\n    };\n  };\n  type: \"object\";\n  required: [\"result\"];\n  properties: { result: { $ref: \"#/definitions/UserList\" } };\n}>; // { result: { name?: string, age?: number }[] }\n```\n\n### Advanced Types\n\n```typescript\ntype Union1 = AsTyped<{ anyOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Union2 = AsTyped<{ oneOf: [{ type: \"string\" }, { type: \"number\" }] }>; // string | number\n\ntype Intersection1 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    { type: \"object\"; properties: { b: { type: \"string\" } } }\n  ];\n}>; // { a?: number, b?: string }\n\ntype Intersection2 = AsTyped<{\n  allOf: [\n    { type: \"object\"; properties: { a: { type: \"number\" } } },\n    {\n      oneOf: [\n        { type: \"object\"; properties: { b: { type: \"string\" } } },\n        { type: \"object\"; properties: { b: { type: \"boolean\" } } }\n      ];\n    }\n  ];\n}>; // { a?: number; b?: string } | { a?: number; b?: boolean }\n\ntype Not = AsTyped<{ not: { type: \"string\" } }>; // number | object | any[] | boolean | null | undefined\n```\n\n- `oneOf` Currently doesn\"t work as expected, and resolves the same as anyOf. See [Typescript issue 20863](https://github.com/Microsoft/TypeScript/issues/20863).\n- `if` / `then` / `else` acts exactly like `{oneOf: [{allOf: [If, Then]}, Else]}`. Currently doesn't work as expected, for the same reasons as oneOf. Resolves to `(If & Then) | Else`, which is not an accurate translation.\n","readmeFilename":"README.md","gitHead":"2a00bcd39a7c4dc9b30c32e51cbdf0506168ddd4","_id":"as-typed@0.0.0-dev.20220912112845","_nodeVersion":"14.20.0","_npmVersion":"6.14.17","dist":{"integrity":"sha512-gL0ZwWd2b8koVhB/uDZYwbvEZn26p4zDgLyfGmXGLRAD65z29li9nlqAtmJ+tfmC+e4XU1rbic+tTBR6/oEa5Q==","shasum":"6895b84e3a5452592da9009bcb245f6f18caac3d","tarball":"https://registry.npmjs.org/as-typed/-/as-typed-0.0.0-dev.20220912112845.tgz","fileCount":6,"unpackedSize":14171,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCJf5jP1UpLL1oBKCXFU+4opdMMuYv4iTf/7t1gEWZ/QgIhANUfDTbXyFZ9sVRCaT48W5quD6NFx6ED0WdSqs6IXEu5"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjHxfvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrV2Q//Wbo7TG3tXMcwECORFdrGa4tmr/GI4pUYhJ7T8KvAsKQGOd+L\r\nYHfxpbQsVRKkv+ayoBbmE8nPEH+x2D8iHIqNY9qEURbtSQLx/pFa5d0DwUM/\r\nLdTROOmSEzPhkcFXjw0R2HUf0sZH96Z3J7Em2w1Ne6QGWXSXhLXyn1aab8d5\r\nPLD6vW9iB4busVsyp0ZyWA2Tg15vQmy6+FG0L46UPrbAsmhPXMlDBVOFJO5O\r\nnvJG5usiYu0K78iczD37XXeVeb/bHSPfJH+ufxEDX5A0Oku7k02LgXjsMHMx\r\njV0deKlRiUXJd5yuMWuRkSonRDnLRDTZp/8bS0M3yYcA42j//85x19krAEsc\r\nFMZoajJsHqfmzS7fKpfKmgXJXu4ZNDklprUXWCqjdcz6R2bnQg1rHjc0tEvJ\r\nNbVSMgARjX2X0zp8Ibjh47TUeEr95s1c4RrcwYjzYhg5xAAhbhAq+qXQd3ZX\r\n7aRyq6O8qmxa7W0qdleIRev4ndQS482t23b9y5z7rx6zL6v5aYxxudQx7Fuy\r\naZVDYIpvfD8h8wn2K6M3qlPgJcUCFZxxKDvDM/bDoabtXzC7VfXPZJr7Xl+9\r\nK0KeWCaCuZA/qqgadh/sUhXG7WuU/pZiAV/GrTX7o/H70zK6Sd2l9uWocG3S\r\na5sMdspaWvZim/kTP/ttAzpLkXmX+NMF+4w=\r\n=AbVC\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lbguilherme","email":"guilherme@cubos.io"},"directories":{},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-typed_0.0.0-dev.20220912112845_1662982126945_0.9807880999160272"},"_hasShrinkwrap":false}},"time":{"created":"2020-11-26T00:13:48.029Z","0.0.0-dev.20201126001345":"2020-11-26T00:13:48.192Z","modified":"2022-09-12T11:28:47.230Z","0.0.0-dev.20201126010257":"2020-11-26T01:02:59.160Z","0.0.0-dev.20201126011200":"2020-11-26T01:12:01.683Z","0.0.0-dev.20201127230609":"2020-11-27T23:06:10.790Z","0.0.0-dev.20201127233233":"2020-11-27T23:32:34.929Z","0.0.0-dev.20201127233601":"2020-11-27T23:36:03.061Z","1.0.0":"2020-11-27T23:36:16.959Z","0.0.0-dev.20201127235259":"2020-11-27T23:53:00.678Z","1.1.0":"2020-12-21T19:29:33.787Z","0.0.0-dev.20201221193144":"2020-12-21T19:31:46.587Z","1.1.1":"2020-12-21T19:32:20.426Z","0.0.0-dev.20201223225551":"2020-12-23T22:55:53.247Z","0.0.0-dev.20201224114510":"2020-12-24T11:45:11.871Z","0.0.0-dev.20201226200227":"2020-12-26T20:02:29.123Z","0.0.0-dev.20201228213229":"2020-12-28T21:32:30.788Z","1.1.2":"2020-12-28T21:35:52.394Z","0.0.0-dev.20201229022322":"2020-12-29T02:23:24.268Z","0.0.0-dev.20201229023359":"2020-12-29T02:34:01.198Z","1.1.3":"2020-12-29T02:35:15.175Z","0.0.0-dev.20210203015357":"2021-02-03T01:53:59.735Z","0.0.0-dev.20210203020142":"2021-02-03T02:01:44.525Z","0.0.0-dev.20210203020211":"2021-02-03T02:02:12.933Z","0.0.0-dev.20210203020833":"2021-02-03T02:08:35.627Z","1.2.0":"2021-02-03T02:12:20.378Z","0.0.0-dev.20210212015318":"2021-02-12T01:53:20.240Z","0.0.0-dev.20210212015557":"2021-02-12T01:55:58.404Z","0.0.0-dev.20210212020232":"2021-02-12T02:02:33.531Z","1.3.0":"2021-02-12T02:03:15.863Z","0.0.0-dev.20210215202415":"2021-02-15T20:24:17.347Z","0.0.0-dev.20210216141650":"2021-02-16T14:16:52.455Z","0.0.0-dev.20210216141654":"2021-02-16T14:16:55.595Z","0.0.0-dev.20210216141755":"2021-02-16T14:17:56.698Z","0.0.0-dev.20210222120340":"2021-02-22T12:03:41.870Z","0.0.0-dev.20210224120107":"2021-02-24T12:01:10.542Z","0.0.0-dev.20210224120117":"2021-02-24T12:01:18.750Z","0.0.0-dev.20210224120151":"2021-02-24T12:01:53.464Z","0.0.0-dev.20210225170210":"2021-02-25T17:02:12.172Z","0.0.0-dev.20210302120445":"2021-03-02T12:04:47.612Z","0.0.0-dev.20210302120458":"2021-03-02T12:05:00.047Z","0.0.0-dev.20210302120528":"2021-03-02T12:05:29.762Z","0.0.0-dev.20210310234600":"2021-03-10T23:46:01.953Z","0.0.0-dev.20210414122543":"2021-04-14T12:25:45.591Z","0.0.0-dev.20211001101341":"2021-10-01T10:13:44.192Z","1.3.1":"2021-10-01T10:15:20.420Z","0.0.0-dev.20211123121203":"2021-11-23T12:12:05.253Z","0.0.0-dev.20211123121842":"2021-11-23T12:18:44.141Z","1.3.2":"2021-11-23T12:21:27.150Z","0.0.0-dev.20211123122715":"2021-11-23T12:27:17.161Z","0.0.0-dev.20211123123024":"2021-11-23T12:30:26.056Z","0.0.0-dev.20211123123644":"2021-11-23T12:36:45.470Z","0.0.0-dev.20220410000512":"2022-04-10T00:05:13.691Z","0.0.0-dev.20220410000642":"2022-04-10T00:06:43.561Z","0.0.0-dev.20220410000709":"2022-04-10T00:07:10.720Z","0.0.0-dev.20220410000737":"2022-04-10T00:07:39.200Z","0.0.0-dev.20220410000747":"2022-04-10T00:07:48.491Z","0.0.0-dev.20220410000755":"2022-04-10T00:07:56.591Z","0.0.0-dev.20220410000830":"2022-04-10T00:08:32.302Z","0.0.0-dev.20220410000910":"2022-04-10T00:09:11.548Z","0.0.0-dev.20220619013536":"2022-06-19T01:35:37.878Z","0.0.0-dev.20220619013725":"2022-06-19T01:37:27.268Z","0.0.0-dev.20220619013809":"2022-06-19T01:38:10.246Z","0.0.0-dev.20220619013933":"2022-06-19T01:39:35.045Z","0.0.0-dev.20220802112108":"2022-08-02T11:21:09.651Z","0.0.0-dev.20220907144324":"2022-09-07T14:43:27.506Z","0.0.0-dev.20220908000114":"2022-09-08T00:01:15.964Z","0.0.0-dev.20220912112845":"2022-09-12T11:28:47.152Z"},"maintainers":[{"name":"lbguilherme","email":"guilherme@cubos.io"}],"description":"Static TypeScript types from a literal JSONSchema type","homepage":"https://github.com/lbguilherme/as-typed#readme","keywords":["typescript","jsonschema","json","schema"],"repository":{"type":"git","url":"git+https://github.com/lbguilherme/as-typed.git"},"author":{"name":"Guilherme Bernal","email":"guilherme@cubos.io"},"bugs":{"url":"https://github.com/lbguilherme/as-typed/issues"},"license":"MIT","readme":"","readmeFilename":""}