{"name":"simplytyped","version":"0.2.7","description":"yet another Typescript type library for advanced types","main":"dist/src/index","types":"dist/src/index.d.ts","scripts":{"bumpVersion":"ts-node scripts/versionBump.ts","lint":"tslint --config tslint.json --project . --format stylish","test":"npm run -s tsc && NODE_PATH=src/ ava","test:ts2.7.1":"npm install typescript@2.7.1 && npm test","test:ts2.7.2":"npm install typescript@2.7.2 && npm test","test:tsnext":"npm install typescript@next && npm test","test:all":"npm run test:ts2.7.1 && npm run test:ts2.7.2 && npm run test:tsnext","tsc":"tsc","prepublishOnly":"npm -s run test:all && rm -rf dist && npm -s run tsc"},"repository":{"type":"git","url":"git+https://github.com/andnp/SimplyTyped.git"},"keywords":["typescript","types"],"author":{"name":"Andy Patterson"},"license":"MIT","bugs":{"url":"https://github.com/andnp/SimplyTyped/issues"},"files":["dist/src"],"homepage":"https://github.com/andnp/SimplyTyped#readme","devDependencies":{"@types/node":"^8.0.57","ava":"^0.24.0","pre-push":"^0.1.1","ts-node":"^3.3.0","tslint":"^5.8.0","typescript":"^2.9.0-dev.20180323"},"pre-push":["lint","test"],"ava":{"files":["dist/test/**/*.js"]},"gitHead":"f7ebb1c91d7ddf14500bd8ae4dba60b55c9044cf","_id":"simplytyped@0.2.7","_npmVersion":"5.7.1","_nodeVersion":"8.2.1","_npmUser":{"name":"andnp","email":"andnpatterson@gmail.com"},"dist":{"integrity":"sha512-8yrfUp7K4E6WObR4903d9Cm3kEr/E3lwHmGOK78MjuaK8WTykYcf1vjaLoutlSWr8paGTmg0UCSNOY4vRhCRqw==","shasum":"16944104ad145a48729b2390f124dd9300528b16","tarball":"http://registry-npm.ywwl.com/simplytyped/download/simplytyped-0.2.7.tgz","fileCount":25,"unpackedSize":31332,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzvJgQrdQYE6LBMwUZtVZ+EHX04QkpJD9BKhaeF9HYRgIgMtHa6wpqwKWbNnJzLAFie57nLuwpfZGfX2cU6TfuvYU="}],"size":10271,"noattachment":false,"key":"/simplytyped/-/simplytyped-0.2.7.tgz"},"maintainers":[{"name":"andnp","email":"andnpatterson@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/simplytyped_0.2.7_1521817332682_0.06593987321226202"},"_hasShrinkwrap":false,"readme":"# SimplyTyped\n\n\n[![Build Status](https://travis-ci.org/andnp/SimplyTyped.svg?branch=NumberPerformance)](https://travis-ci.org/andnp/SimplyTyped)\n\nYet another typing library.\nThis differs by aiming to be less experimental than others, driven by industry use cases.\n\nMany of the exposed types are a very thin layer above built in functionality.\nThe goal is to provide all of the building blocks necessary to make concise, yet complex types.\n\n```\nnpm install --save-dev simplytyped\n```\n\n## Table of Contents\n\n**[Objects](#objects)**\n\n[AllKeys](#allkeys) - [AllRequired](#allrequired) - [CombineObjects](#combineobjects) - [DeepPartial](#deeppartial) - [DeepReadonly](#deepreadonly) - [DiffKeys](#diffkeys) - [ElementwiseIntersect](#elementwiseintersect) - [GetKey](#getkey) - [HasKey](#haskey) - [Intersect](#intersect) - [KeysByType](#keysbytype) - [Merge](#merge) - [ObjectKeys](#objectkeys) - [ObjectType](#objecttype) - [Omit](#omit) - [Optional](#optional) - [Overwrite](#overwrite) - [PlainObject](#plainobject) - [PureKeys](#purekeys) - [Required](#required) - [SharedKeys](#sharedkeys) - [StrictUnion](#strictunion) - [StringKeys](#stringkeys) - [TaggedObject](#taggedobject) - [TryKey](#trykey) - [UnionizeProperties](#unionizeproperties) - [UnionKeys](#unionkeys)\n\n**[Utils](#utils)**\n\n[NoDistribute](#nodistribute) - [NoInfer](#noinfer) - [Nominal](#nominal) - [Nullable](#nullable) - [PromiseOr](#promiseor) - [UnionToIntersection](#uniontointersection)\n\n**[Functions](#functions)**\n\n[AnyFunc](#anyfunc) - [ArgsAsTuple](#argsastuple) - [ConstructorFunction](#constructorfunction) - [OverwriteReturn](#overwritereturn) - [Predicate](#predicate)\n\n**[Strings](#strings)**\n\n[DropString](#dropstring) - [StringEqual](#stringequal) - [UnionContains](#unioncontains)\n\n**[Tuples](#tuples)**\n\n[IntersectTuple](#intersecttuple) - [Length](#length) - [UnionizeTuple](#unionizetuple)\n\n**[Numbers](#numbers)**\n\n[Add](#add) - [IsOne](#isone) - [IsZero](#iszero) - [Next](#next) - [NumberEqual](#numberequal) - [Numbers](#numbers) - [NumberToString](#numbertostring) - [Prev](#prev) - [Sub](#sub)\n\n**[Conditionals](#conditionals)**\n\n[And](#and) - [If](#if) - [Nand](#nand) - [Not](#not) - [Or](#or) - [Xor](#xor)\n\n**[Predicates](#predicates)**\n\n[IsAny](#isany) - [IsArray](#isarray) - [IsBoolean](#isboolean) - [IsFunction](#isfunction) - [IsNever](#isnever) - [IsNil](#isnil) - [IsNull](#isnull) - [IsNumber](#isnumber) - [IsObject](#isobject) - [IsString](#isstring) - [IsStringFunction](#isstringfunction) - [IsType](#istype) - [IsUndefined](#isundefined)\n\n**[Runtime](#runtime)**\n\n[isKeyOf](#iskeyof) - [objectKeys](#objectkeys) - [Readonly](#readonly) - [taggedObject](#taggedobject)\n\n## Objects\n\n### AllKeys\nGets all keys between two objects.\n```ts\ntest('Can get all keys between objects', t => {\n    type a = { w: number, x: string };\n    type b = { x: number, z: boolean };\n\n    type got = AllKeys<a, b>;\n    type expected = 'w' | 'x' | 'z';\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### AllRequired\nMarks all keys as required.\n```ts\ntest('Can make all fields of options object required (not optional and not nullable)', t => {\n    type x = { a?: string, b: number | undefined };\n    type got = AllRequired<x>;\n    type expected = { a: string, b: number };\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### CombineObjects\nTakes two objects and returns their intersection.\nThis combines all keys and uses `ObjectType` to \"clean up\" the resultant object.\nUseful for making extremely complex types look nice in VSCode.\n```ts\ntest('Can combine two objects (without pesky & in vscode)', t => {\n    type a = { x: number, y: 'hi' };\n    type b = { z: number };\n\n    type got = CombineObjects<a, b>;\n    type expected = {\n        x: number,\n        y: 'hi',\n        z: number\n    };\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### DeepPartial\nUses `Partial` to make every parameter of an object optional (`| undefined`).\nIterates through arrays of objects and nested objects.\n```ts\ntest('Can get a deep partial object', t => {\n    type a = {\n        b: {\n            c: number\n        },\n        d: string\n    };\n\n    type got = DeepPartial<a>;\n    type expected = {\n        b?: {\n            c?: number\n        },\n        d?: string\n    };\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n\ntest('Can get a deep partial object with arrays', t => {\n    type a = {\n        b: Array<{\n            c: number,\n        }>,\n    };\n\n    type got = DeepPartial<a>;\n    type expected = {\n        b?: Array<{\n            c?: number,\n        }>,\n    };\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n\ntest('Can get a deep partial object with functions', t => {\n    type x = {\n        a: () => 22,\n        b: string,\n        c: {\n            d: number,\n        },\n    };\n\n    type expected = {\n        a?: () => 22,\n        b?: string,\n        c?: {\n            d?: number,\n        },\n    };\n\n    type got = DeepPartial<x>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### DeepReadonly\nUses `Readonly` to make every parameter of an object - and its sub-objects recursively - readonly.\n```ts\ntest('Can make nested object readonly', t => {\n    type x = { x: { a: 1, b: 'hi' }, y: 'hey' };\n\n    type expected = { readonly x: Readonly<{ a: 1, b: 'hi' }>, readonly y: 'hey' };\n    type got = DeepReadonly<x>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n\ntest('Can make nested object with arrays readonly', t => {\n    type x = { x: [{ a: 1, b: 'hi' }], y: 'hey' };\n\n    type expected = { readonly x: ReadonlyArray<Readonly<{ a: 1, b: 'hi' }>>, readonly y: 'hey' };\n    type got = DeepReadonly<x>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n\ntest('Can make an object with functions readonly', t => {\n    type x = {\n        a: () => 22,\n        b: string,\n        c: {\n            d: boolean,\n        },\n    };\n\n    type expected = {\n        readonly a: () => 22,\n        readonly b: string,\n        readonly c: {\n            readonly d: boolean,\n        },\n    };\n    type got = DeepReadonly<x>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### DiffKeys\nGets all of the keys that are different between two objects.\nThis is a set difference between `keyof T` and `keyof U`.\nNote that calling this with arguments reversed will have different results.\n```ts\ntest('Can get all keys that are different between objects', t => {\n    type a = { x: number, y: string };\n    type b = { y: string, z: number };\n\n    type gotA = DiffKeys<a, b>;\n    type gotB = DiffKeys<b, a>;\n\n    assert<gotA, 'x'>(t);\n    assert<gotB, 'z'>(t);\n});\n```\n\n### ElementwiseIntersect\nTakes two objects and returns their element-wise intersection.\n*Note*: this removes any key-level information, such as optional or readonly keys.\n```ts\ntest('Can combine two objects elementwise', t => {\n    type a = { x: number, y: 'hi' };\n    type b = { z: number, y: 'there' };\n\n    type got = ElementwiseIntersect<a, b>;\n    type expected = {\n        x: number,\n        y: 'hi' & 'there',\n        z: number,\n    };\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n\ntest('Can combine two objects with private members elementwise', t => {\n    class A {\n        a: number = 1;\n        private x: number = 2;\n        y: 'hi' = 'hi';\n        private z: 'hey' = 'hey';\n    }\n\n    class B {\n        a: 22 = 22;\n        private x: number = 2;\n        y: 'there' = 'there';\n        private z: 'friend' = 'friend';\n    }\n\n    type got = ElementwiseIntersect<A, B>;\n    type expected = {\n        a: 22,\n        y: 'hi' & 'there',\n    };\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### GetKey\nGets the value of specified property on any object without compile time error (`Property 'b' does not exist on type '{ a: string; }'.`) and the like.\nReturns `never` if the key is not on the object.\nIt helps to use `If<HasKey...` to handle validity of the object first.\n```ts\ntest('Can safely get the value at a certain key if it exists', t => {\n    type obj = { x: number, y: string };\n    type expected = number;\n    type got = GetKey<obj, 'x'>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n\ntest('Will get `never` if key does not exist', t => {\n    type obj = { x: number, y: string };\n    type expected = never;\n    type got = GetKey<obj, 'z'>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### HasKey\nReturns `True` if a key, `K`, is present in a type, `T`, else `False`.\n\n\n### Intersect\nReturns only the shared properties between two objects.\nAll shared properties must be the same type.\n```ts\ntest('Can get an object with only shared properties', t => {\n    type a = { x: number, y: string };\n    type b = { y: string, z: string };\n\n    type expected = { y: string };\n    type got = Intersect<a, b>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### KeysByType\nGets all keys that point to a given type.\n```ts\ntest('Can filter object keys by right side type', t => {\n    type obj = {\n        a: 1,\n        b: 2,\n        c: 3,\n    };\n\n    type expected = 'a' | 'b';\n    type got = KeysByType<obj, 1 | 2>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### Merge\nMuch like `_.merge` in javascript, this returns an object with all keys present between both objects, but conflicts resolved by rightmost object.\n```ts\ntest('Can merge two objects, resolving matching keys by rightmost object', t => {\n    type a = { x: number, y: string };\n    type b = { y: number, z: string };\n\n    type got = Merge<a, b>;\n    type expected = { x: number, y: number, z: string };\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n\ntest('Can merge an object containing all strings as keys', t => {\n    type a = {\n        y: string;\n        [s: string]: string;\n    };\n    type b = { x: number, y: number };\n\n    type got = Merge<a, b>;\n    type expected = { x: number, y: number } & Record<string, string>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### ObjectKeys\nObjects can be indexed by multiple types: `string`, `number`, `symbol`.\nFor safe compatibility with typescript version, this type will always\nhave the correct set of object key types for the current version of TS.\n\nThis is useful for functions that must take a key, instead of `K extends string`,\nuse `K extends ObjectKeys`.\n\n\n### ObjectType\nTakes any type and makes it an object type.\nUseful when combined with `&` intersection types.\n```ts\ntest('Can turn an object into another object', t => {\n    type obj = { x: number, y: string };\n    type expected = obj;\n    type got = ObjectType<obj>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### Omit\nGives back an object with listed keys removed.\nThis is the opposite of `Pick`.\n```ts\ntest('Can omit keys from an object', t => {\n    type a = { x: number, y: string, z: boolean };\n\n    type got = Omit<a, 'x' | 'y'>;\n    type expected = { z: boolean };\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### Optional\nMark specific keys, `K`, of `T` as optional (think `Partial`).\n```ts\ntest('Can make properties optional', t => {\n    type x = { x: number, y: string, z: 'hello there' };\n\n    type expected = { x?: number, y?: string, z: 'hello there' };\n    type got = Optional<x, 'x' | 'y'>;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### Overwrite\nCan change the types of properties on an object.\nThis is similar to `Merge`, except that it will not add previously non-existent properties to the object.\n```ts\ntest('Can overwrite properties on an object', t => {\n    type a = { x: number, y: string, z: 'hello there' };\n\n    type expected = { x: number, y: string, z: 'hello' | 'there' };\n    type got1 = Overwrite<a, { z: 'hello' | 'there' }>;\n    type got2 = Overwrite<a, { z: 'hello' | 'there', w: number }>;\n\n    assert<got1, expected>(t);\n    assert<expected, got1>(t);\n    assert<got2, expected>(t);\n    assert<expected, got2>(t);\n});\n```\n\n### PlainObject\nAn object with string keys and values of type `any`.\n\n\n### PureKeys\nWhen an object has optional or readonly keys, that information is contained within the key.\nWhen using optional/readonly keys in another object, they will retain optional/readonly status.\n`PureKeys` will remove the optional/readonly status modifiers from keys.\n\n\n### Required\nMark specific keys, `K`, of `T` as required.\n```ts\ntest('Can make certain fields of options object required', t => {\n    type x = { a?: string, b: number | undefined };\n    type got1 = Required<x, 'a'>;\n    type got2 = Required<x, 'b'>;\n    type got3 = Required<x, 'a' | 'b'>;\n\n    type expected1 = { a: string, b: number | undefined };\n    type expected2 = { a?: string, b: number };\n    type expected3 = { a: string, b: number };\n\n    assert<got1, expected1>(t);\n    assert<got2, expected2>(t);\n    assert<got3, expected3>(t);\n});\n```\n\n### SharedKeys\nGets all of the keys that are shared between two objects.\n```ts\ntest('Can get keys that are same between objects', t => {\n    type a = { x: number, y: string };\n    type b = { x: string, y: string, z: boolean };\n\n    type got = SharedKeys<a, b>;\n    type expected = 'x' | 'y';\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### StrictUnion\nMakes a union 'strict', such that members are disallowed from including the keys of other members\nFor example, `{x: 1, y: 1}` is a valid member of `{x: number} | {y: number}`,\n     but it's not a valid member of StrictUnion<{x: number} | {y: number}>.\n```ts\ntest('disallow union members with mixed properties', t => {\n    type a = { a: number };\n    type b = { b: string };\n\n    type good1 = {a: 1};\n    type good2 = {b: \"b\"};\n    type bad = {a: 1, b: \"foo\"};\n\n    type isStrict<T> = T extends Array<StrictUnion<a | b>> ? 'Yes' : 'No';\n\n    type strictUnion = [good1, good2];\n    type nonStrictUnion = [good1, good2, bad];\n\n    assert<isStrict<strictUnion>, 'Yes'>(t);\n    assert<isStrict<nonStrictUnion>, 'No'>(t);\n\n});\n```\n\n### StringKeys\nTypescript 2.9 introduced `number | symbol` as possible results from `keyof any`.\nFor backwards compatibility with objects containing only `string` keys, this will\nexclude any `number | symbol` keys from `keyof`.\n\n\n### TaggedObject\nFor discriminated unions of objects, it is important to have a single \"tag\" property.\nCreates an object with each entry being tagged by the key defining that entry.\n\n\n### TryKey\nLike `GetKey`, but returns `unknown` if the key is not present on the object.\n\n\n### UnionizeProperties\nGet a union of the properties of an object.\n```ts\ntest('Can get a union of all values in an object', t => {\n    type a = { x: 'hi', y: 'there', z: 'friend' };\n\n    type got = UnionizeProperties<a>;\n    type expected = 'hi' | 'there' | 'friend';\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### UnionKeys\n\n```ts\ntest('Can get all keys between objects in a union', t => {\n    type a = { w: number, x: string };\n    type b = { x: number, z: boolean };\n    type c = { y: boolean, z: string };\n\n    type got = UnionKeys<a | b | c>;\n    type expected = 'w' | 'x' | 'y' | 'z';\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n## Utils\n\n### NoDistribute\nPrevent `T` from being distributed in a conditional type.\nA conditional is only distributed when the checked type is naked type param and T & {} is not a\nnaked type param, but has the same contract as T.\n```ts\ntest(\"can create a conditional type that won't distribute over unions\", t => {\n    type IsString<T> = T extends string ? \"Yes\" : \"No\";\n    type IsStringNoDistribute<T> = NoDistribute<T> extends string ? \"Yes\" : \"No\";\n\n    /**\n     * Evaluates as:\n     * (\"foo\" extends string ? \"Yes\" : \"No\")\n     *  | (42 extends string ? \"Yes\" : \"No\")\n     */\n    type T1 = IsString<\"foo\" | 42>;\n    assert<T1, \"Yes\" | \"No\">(t);\n    assert<\"Yes\" | \"No\", T1>(t);\n\n    /**\n     * Evaluates as:\n     * (\"foo\" | 42) extends string ? \"Yes\" : \"No\"\n     */\n    type T2 = IsStringNoDistribute<\"foo\" | 5>;\n    assert<T2, \"No\">(t);\n    assert<\"No\", T2>(t);\n});\n\ntest(\"cannot be used to prevent a distributive conditional from distributing\", t => {\n    type IsString<T> = T extends string ? \"Yes\" : \"No\";\n    // It's the defintion of the conditional type that matters,\n    //  not the type that's passed in, so this still distributes\n    type Test = IsString<NoDistribute<\"foo\" | 42>>;\n    assert<Test, \"Yes\" | \"No\">(t);\n    assert<\"Yes\" | \"No\", Test>(t);\n});\n```\n\n### NoInfer\nPrevent `T` from being inferred in generic function\n```ts\ntest('Will not infer based on second argument', t => {\n    function doStuff<T>(x: T, y: NoInfer<T | 'there'>): T { return x; }\n\n    const hi = 'hi' as 'hi' | number;\n    const there = 'there';\n    const x = doStuff(hi, there);\n\n    assert<typeof x, 'hi'>(t);\n    assert<typeof x, number>(t);\n});\n```\n\n### Nominal\nConstructs a nominal type of type `T`.\nUseful to prevent any value of type `T` from being used or modified in places it shouldn't (think `id`s).\n```ts\ntest('Can make a new nominal type', t => {\n    type Id = Nominal<string, 'id'>;\n\n    // TODO: improve once negative testing is in place\n    assert<Id, Nominal<string, 'id'>>(t);\n});\n```\n\n### Nullable\nMark a type as nullable (`null | undefined`).\n```ts\ntest('Will make a type nullable (null | undefined)', t => {\n    type got = Nullable<string>;\n    type expected = string | null | undefined;\n\n    assert<got, expected>(t);\n});\n\ntest('Will make a type not nullable', t => {\n    type got = NonNullable<Nullable<string>>;\n\n    assert<got, string>(t);\n});\n```\n\n### PromiseOr\nReturns the given type or a Promise containing that type.\n```ts\ntest('Will give back a promise containing given type union the type itself', t => {\n    type got = PromiseOr<string>;\n    type expected = Promise<string> | string;\n\n    assert<got, expected>(t);\n});\n```\n\n### UnionToIntersection\nDefines an intersection type of all union items.\n```ts\ntest('Union of Strings', t => {\n    type got = UnionToIntersection<'hi' | 'there'>;\n    type expected = 'hi' & 'there';\n\n    assert<got, expected>(t);\n});\n\ntest('Union of Objects', t => {\n    type got = UnionToIntersection<{ a: 0 } | { b: 1 } | { c: 2 }>;\n\n    type expected = {\n        a: 0,\n        b: 1,\n        c: 2,\n    };\n\n    assert<got, expected>(t);\n});\n```\n\n## Functions\n\n### AnyFunc\nConcisely and cleanly define an arbitrary function.\nUseful when designing many api's that don't care what function they take in, they just need to know what it returns.\n```ts\ntest('Can define the type of a function that takes any arguments', t => {\n    type got = AnyFunc;\n    type got2 = AnyFunc<number>; // takes anything, returns a number\n\n    type expected = (...args: any[]) => any;\n    type expected2 = (...args: any[]) => number;\n\n    assert<got, expected>(t);\n    assert<got2, expected2>(t);\n});\n```\n\n### ArgsAsTuple\nReturns a tuple type of a functions arguments up to 7.\n```ts\ntest(\"Can get a tuple of function's argument types\", t => {\n    type F0 = () => any;\n    type F1 = (x: number) => any;\n    type F2 = (x: number, y: string) => any;\n    type F3 = (x: number, y: string, z: boolean) => any;\n\n    type E0 = [];\n    type E1 = [number];\n    type E2 = [number, string];\n    type E3 = [number, string, boolean];\n\n    assert<ArgsAsTuple<F0>, E0>(t);\n    assert<ArgsAsTuple<F1>, E1>(t);\n    assert<ArgsAsTuple<F2>, E2>(t);\n    assert<ArgsAsTuple<F3>, E3>(t);\n});\n```\n\n### ConstructorFunction\nThis represents the constructor for a particular object.\n```ts\ntest('Can build a constructor type for a type', t => {\n    type Constructor = ConstructorFunction<{ x: string, y: number }>;\n    class Thing { x: string = ''; y: number = 22; }\n\n    assert<Constructor, typeof Thing>(t);\n});\n```\n\n### OverwriteReturn\nModifies the return value of a function of up to 7 parameters.\n```ts\ntest('Can change return type of a function', t => {\n    type f = (x: 'hi', y: 'there', z: 22) => number;\n\n    type got = OverwriteReturn<f, string>;\n    type expected = (x: 'hi', y: 'there', z: 22) => string;\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### Predicate\nThis is a function that takes some args and returns a boolean\n```ts\ntest('Can build a predicate function with single known argument type', t => {\n    type PredFunc = Predicate<string>;\n    type expected = (arg: string) => boolean;\n\n    assert<PredFunc, expected>(t);\n});\n```\n\n## Strings\n\n### DropString\n\n```ts\ntest('Can remove a string from a union of strings', t => {\n    type a = 'hi' | 'there';\n    type b = 'hey' | 'there' | never;\n\n    assert<DropString<a, 'hi'>, 'there'>(t);\n    assert<DropString<b, 'hey' | 'there'>, never>(t);\n    assert<DropString<a, 'hi' | 'there'>, never>(t);\n});\n```\n\n### StringEqual\n\n```ts\ntest('Can check that two unions of strings are equal', t => {\n    type a = 'hi' | 'there';\n    type b = 'there' | 'hi';\n    type c = 'hi' | 'there' | 'friend';\n\n    assert<StringEqual<a, b>, True>(t);\n    assert<StringEqual<b, a>, True>(t);\n    assert<StringEqual<b, c>, False>(t);\n});\n```\n\n### UnionContains\n\n\n\n## Tuples\n\n### IntersectTuple\nGives an intersection of all values contained in a tuple.\n```ts\ntest('Can get the intersection of tuple values', t => {\n    type t = [{a: 'hi'}, {b: 'there'}, {c: 'friend'}];\n\n    type got = IntersectTuple<t>;\n    type expected = {a: 'hi'} & {b: 'there'} & {c: 'friend'};\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n### Length\n\n```ts\ntest('Can get the length of a tuple', t => {\n    type t = [1, 2, 3, 4];\n    type x = ['hello', 'world'];\n\n    type gotT = Length<t>;\n    type gotX = Length<x>;\n\n    assert<gotX, 2>(t);\n    assert<gotT, 4>(t);\n});\n```\n\n### UnionizeTuple\nGives a union of all values contained in a tuple.\n```ts\ntest('Can get a union of all values in tuple', t => {\n    type t = ['hi', 'there', 'friend'];\n\n    type got = UnionizeTuple<t>;\n    type expected = 'hi' | 'there' | 'friend';\n\n    assert<got, expected>(t);\n    assert<expected, got>(t);\n});\n```\n\n## Numbers\n\n### Add\nAdds two numbers together.\n```ts\ntest('Can add two numbers', t => {\n    type fifty = Add<12, 38>;\n    assert<fifty, 50>(t);\n});\n```\n\n### IsOne\nReturns true if the number is equal to one.\n```ts\ntest('Can check if a number is one', t => {\n    type notOne = IsOne<0>;\n    type one = IsOne<1>;\n    assert<notOne, False>(t);\n    assert<one, True>(t);\n});\n```\n\n### IsZero\nReturns true if the number is equal to zero.\n```ts\ntest('Can check if a number is zero', t => {\n    type notZero = IsZero<1>;\n    type zero = IsZero<0>;\n    assert<notZero, False>(t);\n    assert<zero, True>(t);\n});\n```\n\n### Next\nReturns the number + 1.\n\n\n### NumberEqual\nReturns `True` if the numbers are equivalent\n```ts\ntest('Can check if two numbers are equal', t => {\n    type notEqual = NumberEqual<22, 23>;\n    type equal = NumberEqual<12, 12>;\n    assert<notEqual, False>(t);\n    assert<equal, True>(t);\n});\n```\n\n### Numbers\n\n\n\n### NumberToString\nReturns the string type for a given number\n```ts\ntest('Can get a number as a string', t => {\n    type str = NumberToString<22>;\n    assert<str, '22'>(t);\n});\n```\n\n### Prev\nReturns the number - 1.\n\n\n### Sub\nSubtracts the second from the first.\n```ts\ntest('Can subtract two numbers', t => {\n    type ten = Sub<22, 12>;\n    assert<ten, 10>(t);\n});\n```\n\n## Conditionals\n\n### And\n\n```ts\ntest('Conditions can be based on AND', t => {\n    type conditional<C extends Bool, D extends Bool> = If<And<C, D>, number, string>;\n    type gotFF = conditional<False, False>;\n    type gotFT = conditional<False, True>;\n    type gotTF = conditional<True, False>;\n    type gotTT = conditional<True, True>;\n\n    assert<gotFF, string>(t);\n    assert<gotFT, string>(t);\n    assert<gotTF, string>(t);\n    assert<gotTT, number>(t);\n});\n```\n\n### If\n\n```ts\ntest('Can assign type conditionally', t => {\n    type conditional<C extends Bool> = If<C, number, string>;\n    type gotF = conditional<False>;\n    type gotT = conditional<True>;\n\n    assert<gotF, string>(t);\n    assert<gotT, number>(t);\n});\n```\n\n### Nand\n\n```ts\ntest('Conditions can be based on NAND', t => {\n    assert<Nand<True, True>,   False>(t);\n    assert<Nand<False, True>,  True>(t);\n    assert<Nand<True, False>,  True>(t);\n    assert<Nand<False, False>, True>(t);\n});\n```\n\n### Not\n\n```ts\ntest('Conditional logic can be inversed with NOT', t => {\n    type conditional<C extends Bool> = If<Not<C>, number, string>;\n    type gotF = conditional<False>;\n    type gotT = conditional<True>;\n\n    assert<gotF, number>(t);\n    assert<gotT, string>(t);\n});\n```\n\n### Or\n\n```ts\ntest('Conditions can be based on OR', t => {\n    type conditional<C extends Bool, D extends Bool> = If<Or<C, D>, number, string>;\n    type gotFF = conditional<False, False>;\n    type gotFT = conditional<False, True>;\n    type gotTF = conditional<True, False>;\n    type gotTT = conditional<True, True>;\n\n    assert<gotFF, string>(t);\n    assert<gotFT, number>(t);\n    assert<gotTF, number>(t);\n    assert<gotTT, number>(t);\n});\n```\n\n### Xor\n\n```ts\ntest('Conditions can be based on XOR', t => {\n    assert<Xor<True, True>,   False>(t);\n    assert<Xor<False, True>,  True>(t);\n    assert<Xor<True, False>,  True>(t);\n    assert<Xor<False, False>, False>(t);\n});\n```\n\n## Predicates\n\n### IsAny\n\n\n\n### IsArray\n\n\n\n### IsBoolean\n\n\n\n### IsFunction\n\n\n\n### IsNever\n\n\n\n### IsNil\n\n\n\n### IsNull\n\n\n\n### IsNumber\n\n\n\n### IsObject\n\n\n\n### IsString\n\n\n\n### IsStringFunction\n\n\n\n### IsType\n\n\n\n### IsUndefined\n\n\n\n## Runtime\n\n### isKeyOf\nType guard for any key, `k`.\nMarks `k` as a key of `T` if `k` is in `obj`.\n```ts\ntest('Can check if an object contains a key', t => {\n    const o = { a: 'hi', b: 22 };\n    const key1: string = 'a';\n\n    if (isKeyOf(o, key1)) {\n        assert<typeof key1, 'a' | 'b'>(t);\n        t.pass();\n    } else {\n        assert<typeof key1, string>(t);\n        t.fail();\n    }\n});\n```\n\n### objectKeys\nSame as `Object.keys` except that the returned type is an array of keys of the object.\nNote that for the same reason that `Object.keys` does not do this natively, this method _is not safe_ for objects on the perimeter of your code (user input, read in files, network requests etc.).\n```ts\ntest('Can get keys of an object', t => {\n    const o = { a: 'hi', b: 22 };\n    const keys = objectKeys(o);\n\n    type K = typeof keys;\n    type expected = Array<'a' | 'b'>;\n    assert<K, expected>(t);\n    assert<expected, K>(t);\n\n    t.deepEqual(keys, ['a', 'b']);\n});\n```\n\n### Readonly\nUseful for marking object literals as readonly while still keeping type inference:\n`const obj = Readonly({ a: 22, b: 'yellow' });`\n\n\n### taggedObject\nUseful for tagged unions of objects (imagine redux reducers) this tags every sub-object with the key pointing to that sub-object.\n```ts\ntest('Can generate a tagged object', t => {\n    const obj = {\n        a: { merp: 'hi' },\n        b: { merp: 'there' },\n        c: { merp: 'friend' },\n    };\n\n    const expected = {\n        a: { name: 'a' as 'a', merp: 'hi' },\n        b: { name: 'b' as 'b', merp: 'there' },\n        c: { name: 'c' as 'c', merp: 'friend' },\n    };\n\n    const got = taggedObject(obj, 'name');\n\n    t.deepEqual(got, expected);\n    assert<typeof got, typeof expected>(t);\n    assert<typeof expected, typeof got>(t);\n\n});\n```\n\n","publish_time":1521817332799,"_cnpm_publish_time":1521817332799,"dist-tags":{"beta":"1.0.3","latest":"3.3.0"}}