generic-type-guard
Advanced tools
Comparing version 3.1.0 to 3.2.0
import { MappedTypeGuard, PartialTypeGuard, TypeGuard } from "../guards"; | ||
/** | ||
* Fluent Builder pattern for creating guards for interface types. | ||
*/ | ||
export interface InterfaceBuilder<T extends {}> { | ||
/** | ||
* Finalise and return the type guard which has been built. | ||
*/ | ||
get(): TypeGuard<T>; | ||
/** | ||
* Add a free-form type guard to this interface as a union. | ||
*/ | ||
with<V>(ptv: PartialTypeGuard<{}, V>): InterfaceBuilder<T & V>; | ||
/** | ||
* Add a single property to the interface. | ||
* | ||
* @param key The string key of the property. | ||
* @param ptv The type guard for this property. | ||
*/ | ||
withProperty<K extends string, V>(key: K, ptv: TypeGuard<V>): InterfaceBuilder<T & { | ||
[prop in K]: V; | ||
}>; | ||
/** | ||
* Add a string index signature to the interface. | ||
* | ||
* @param value The type guard for values accessed by the index signature. | ||
* @param enforce | ||
* Whether to enforce that there is at least one property already set. Be careful setting this to false, you will | ||
* get some unexpected outputs, for instance arrays will have a string index signature. | ||
*/ | ||
withStringIndexSignature<V>(value: TypeGuard<V>, enforce?: boolean): InterfaceBuilder<T & { | ||
[prop: string]: V; | ||
}>; | ||
/** | ||
* Add a numeric index signature to the interface. | ||
* | ||
* @param value The type guard for values accessed by the index signature. | ||
* @param enforce | ||
* Whether to enforce that there is at least one property already set. Be careful setting this to false, you will | ||
* get some unexpected outputs, for instance arrays will have a string index signature. | ||
*/ | ||
withNumericIndexSignature<V>(value: TypeGuard<V>, enforce?: boolean): InterfaceBuilder<T & { | ||
[i: number]: V; | ||
}>; | ||
/** | ||
* Add many properties to the interface at once. | ||
* | ||
* @param props A map of properties to guards to apply to the interface. | ||
*/ | ||
withProperties<V>(props: MappedTypeGuard<V>): InterfaceBuilder<T & V>; | ||
} | ||
/** | ||
* A small class to help with constructing interface checkers. | ||
* A small class to help with constructing interface guards. | ||
*/ | ||
@@ -19,0 +55,0 @@ export declare class IsInterface implements InterfaceBuilder<{}> { |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
exports.__esModule = true; | ||
var o = require("../objects"); | ||
var o = __importStar(require("../objects")); | ||
var functions_1 = require("./functions"); | ||
var primitives_1 = require("../primitives"); | ||
var functions_1 = require("./functions"); | ||
/** | ||
@@ -37,3 +44,3 @@ * Internal class used to represent each step in the building process. | ||
/** | ||
* A small class to help with constructing interface checkers. | ||
* A small class to help with constructing interface guards. | ||
*/ | ||
@@ -66,2 +73,2 @@ var IsInterface = /** @class */ (function () { | ||
exports.IsInterface = IsInterface; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbWJpbmF0b3JzL2ludGVyZmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLDhCQUFnQztBQUNoQyw0Q0FBNkM7QUFDN0MseUNBQTZDO0FBYTdDOztHQUVHO0FBQ0g7SUFHRSx1QkFBbUIsR0FBNEI7UUFDN0MsSUFBSSxDQUFDLEdBQUcsR0FBRyxHQUFHLENBQUM7SUFDakIsQ0FBQztJQUVNLDJCQUFHLEdBQVY7UUFBQSxpQkFFQztRQURDLE9BQU8sVUFBQyxHQUFHLElBQWUsT0FBQSx5QkFBWSxDQUFDLEdBQUcsQ0FBQyxJQUFJLEtBQUksQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLEVBQWxDLENBQWtDLENBQUM7SUFDL0QsQ0FBQztJQUVNLHdCQUFBLE1BQUksQ0FBQSxHQUFYLFVBQWUsR0FBNEI7UUFDekMsT0FBTyxJQUFJLGFBQWEsQ0FBUSwwQkFBYyxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQU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BFLE9BQU8sSUFBSSxhQUFhLENBQUMsQ0FBQyxDQUFDLHVCQUF1QixDQUFDLEtBQUssRUFBRSxPQUFPLENBQUMsQ0FBQyxDQUFDO0lBQ3RFLENBQUM7SUFFTSwrQ0FBeUIsR0FBaEMsVUFBb0MsS0FBbUIsRUFBRSxPQUFjO1FBQWQsd0JBQUEsRUFBQSxjQUFjO1FBQ3JFLE9BQU8sSUFBSSxhQUFhLENBQUMsQ0FBQyxDQUFDLHdCQUF3QixDQUFDLEtBQUssRUFBRSxPQUFPLENBQUMsQ0FBQyxDQUFDO0lBQ3ZFLENBQUM7SUFFTSxvQ0FBYyxHQUFyQixVQUF5QixLQUF5QjtRQUNoRCxPQUFPLElBQUksYUFBYSxDQUFDLENBQUMsQ0FBQyxhQUFhLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQztJQUNuRCxDQUFDO0lBQ0gsa0JBQUM7QUFBRCxDQUFDLEFBeEJELElBd0JDO0FBeEJZLGtDQUFXIn0= |
@@ -8,4 +8,10 @@ import { PartialTypeGuard } from "../guards"; | ||
constructor(ptt: PartialTypeGuard<B, T>); | ||
/** | ||
* Finalise and return the partial type guard for this builder. | ||
*/ | ||
get(): PartialTypeGuard<B, T>; | ||
/** | ||
* Add a new option for this intersection. | ||
*/ | ||
with<U extends B>(ptu: PartialTypeGuard<B, U>): IntersectionOf<B, T & U>; | ||
} |
@@ -11,5 +11,11 @@ "use strict"; | ||
} | ||
/** | ||
* Finalise and return the partial type guard for this builder. | ||
*/ | ||
IntersectionOf.prototype.get = function () { | ||
return this.ptt; | ||
}; | ||
/** | ||
* Add a new option for this intersection. | ||
*/ | ||
IntersectionOf.prototype["with"] = function (ptu) { | ||
@@ -21,2 +27,2 @@ return new IntersectionOf(functions_1.isIntersection(this.ptt, ptu)); | ||
exports.IntersectionOf = IntersectionOf; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJzZWN0aW9ub2YuanMiLCJ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JLGNBQWMsQ0FBQywwQkFBYyxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUUsR0FBRyxDQUFDLENBQUMsQ0FBQztJQUMzRCxDQUFDO0lBQ0gscUJBQUM7QUFBRCxDQUFDLEFBcEJELElBb0JDO0FBcEJZLHdDQUFjIn0= |
@@ -8,4 +8,10 @@ import { PartialTypeGuard } from "../guards"; | ||
constructor(ptt: PartialTypeGuard<B, T>); | ||
/** | ||
* Finalise and return the partial type guard for this builder. | ||
*/ | ||
get(): PartialTypeGuard<B, T>; | ||
with<V extends B>(ptv: PartialTypeGuard<B, V>): UnionOf<B, T | V>; | ||
/** | ||
* Add a new option for this union. | ||
*/ | ||
with<U extends B>(ptv: PartialTypeGuard<B, U>): UnionOf<B, T | U>; | ||
} |
@@ -11,5 +11,11 @@ "use strict"; | ||
} | ||
/** | ||
* Finalise and return the partial type guard for this builder. | ||
*/ | ||
UnionOf.prototype.get = function () { | ||
return this.ptt; | ||
}; | ||
/** | ||
* Add a new option for this union. | ||
*/ | ||
UnionOf.prototype["with"] = function (ptv) { | ||
@@ -21,2 +27,2 @@ return new UnionOf(functions_1.isUnion(this.ptt, ptv)); | ||
exports.UnionOf = UnionOf; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5pb25vZi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21iaW5hdG9ycy91bmlvbm9mLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EseUNBQXNDO0FBRXRDOztHQUVHO0FBQ0g7SUFHRSxpQkFBWSxHQUEyQjtRQUNyQyxJQUFJLENBQUMsR0FBRyxHQUFHLEdBQUcsQ0FBQztJQUNqQixDQUFDO0lBRU0scUJBQUcsR0FBVjtRQUNFLE9BQU8sSUFBSSxDQUFDLEdBQUcsQ0FBQztJQUNsQixDQUFDO0lBRU0sa0JBQUEsTUFBSSxDQUFBLEdBQVgsVUFBeUIsR0FBMkI7UUFDbEQsT0FBTyxJQUFJLE9BQU8sQ0FBQyxtQkFBTyxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUUsR0FBRyxDQUFDLENBQUMsQ0FBQztJQUM3QyxDQUFDO0lBQ0gsY0FBQztBQUFELENBQUMsQUFkRCxJQWNDO0FBZFksMEJBQU8ifQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5pb25vZi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21iaW5hdG9ycy91bmlvbm9mLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseUNBQXNDO0FBR3RDOztHQUVHO0FBQ0g7SUFHRSxpQkFBWSxHQUEyQjtRQUNyQyxJQUFJLENBQUMsR0FBRyxHQUFHLEdBQUcsQ0FBQztJQUNqQixDQUFDO0lBRUQ7O09BRUc7SUFDSSxxQkFBRyxHQUFWO1FBQ0UsT0FBTyxJQUFJLENBQUMsR0FBRyxDQUFDO0lBQ2xCLENBQUM7SUFFRDs7T0FFRztJQUNJLGtCQUFBLE1BQUksQ0FBQSxHQUFYLFVBQXlCLEdBQTJCO1FBQ2xELE9BQU8sSUFBSSxPQUFPLENBQUMsbUJBQU8sQ0FBQyxJQUFJLENBQUMsR0FBRyxFQUFFLEdBQUcsQ0FBQyxDQUFDLENBQUM7SUFDN0MsQ0FBQztJQUNILGNBQUM7QUFBRCxDQUFDLEFBcEJELElBb0JDO0FBcEJZLDBCQUFPIn0= |
@@ -6,7 +6,2 @@ import * as tg from "./index"; | ||
} | ||
export interface ComplexInterface extends TestInterface { | ||
b: boolean; | ||
maybeString?: string; | ||
nullableString: string | null; | ||
} | ||
/** | ||
@@ -20,3 +15,3 @@ * Simple way to test an interface. | ||
* You can then combine this PartialTypeGuard with isObject to get a full typeguard | ||
* from `any`. If you add properties to TestInterface or change types then this form will | ||
* from `undefined`. If you add properties to TestInterface or change types then this form will | ||
* trigger a type error as the interfaces won't match up structurally. | ||
@@ -29,4 +24,8 @@ */ | ||
* This is exposed for both intersection and union combinators. | ||
* | ||
* If you have a complex interface like this, then the best way to deal with the type is to | ||
* generate it from the guard if feasible. | ||
*/ | ||
export declare const isTypeSafeComplexInterface: tg.PartialTypeGuard<{}, ComplexInterface>; | ||
export declare const isTypeSafeComplexInterface: tg.PartialTypeGuard<{}, Record<"str", string> & Record<"num", number> & Record<"b", boolean> & Record<"maybeString", string | undefined> & Record<"nullableString", string | null>>; | ||
export declare type ComplexInterface = tg.GuardedType<typeof isTypeSafeComplexInterface>; | ||
/** | ||
@@ -33,0 +32,0 @@ * This is the alternative syntax for defining interfaces in a bit cleaner way. |
@@ -1,8 +0,18 @@ | ||
declare type Diff<T, U> = T extends U ? never : T; | ||
export declare type NotEmpty = Diff<unknown, null | undefined>; | ||
/** | ||
* A partial type guard that can take a value of one type and determine if it is also a valid value of a subtype. | ||
*/ | ||
export declare type PartialTypeGuard<T, U extends T> = (value: T) => value is U; | ||
/** | ||
* A full type guard that can guard any value and determine if it is valid. | ||
*/ | ||
export declare type TypeGuard<T> = PartialTypeGuard<unknown, T>; | ||
/** | ||
* Extracts the type that is being guarded for from a type guard. | ||
*/ | ||
export declare type GuardedType<T extends PartialTypeGuard<any, unknown>> = T extends PartialTypeGuard<any, infer U> ? U : never; | ||
/** | ||
* An object of type guards based on the input type. | ||
*/ | ||
export declare type MappedTypeGuard<T> = { | ||
[P in keyof T]: TypeGuard<T[P]>; | ||
}; | ||
export {}; |
"use strict"; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
exports.__esModule = true; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VhcmRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2d1YXJkcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VhcmRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2d1YXJkcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsdURBQXVEIn0= |
@@ -15,3 +15,3 @@ import { MappedTypeGuard, PartialTypeGuard } from "./guards"; | ||
* | ||
* @param {boolean} enforce | ||
* @param enforce | ||
* Whether to enforce that there is at least one property already set. Be careful setting this to false, you will | ||
@@ -26,3 +26,3 @@ * get some unexpected outputs, for instance arrays will have a string index signature. | ||
* | ||
* @param {boolean} enforce | ||
* @param enforce | ||
* Whether to enforce that there is at least one property already set. Be careful setting this to false, you will | ||
@@ -37,3 +37,3 @@ * get some unexpected outputs, for instance objects will have a numeric index signature. | ||
*/ | ||
export declare const isInstance: <T extends {}>(klass: new (...args: any[]) => T) => PartialTypeGuard<unknown, T>; | ||
export declare const isInstance: <T extends {}>(klass: new (...args: unknown[]) => T) => PartialTypeGuard<unknown, T>; | ||
/** | ||
@@ -40,0 +40,0 @@ * Validate that a given object has all the given properties |
@@ -24,3 +24,3 @@ "use strict"; | ||
* | ||
* @param {boolean} enforce | ||
* @param enforce | ||
* Whether to enforce that there is at least one property already set. Be careful setting this to false, you will | ||
@@ -36,3 +36,3 @@ * get some unexpected outputs, for instance arrays will have a string index signature. | ||
if (value(o[prop])) { | ||
n += 1; | ||
n++; | ||
} | ||
@@ -44,2 +44,3 @@ else { | ||
} | ||
/* eslint-disable-next-line no-magic-numbers */ | ||
return !enforce || n > 0; | ||
@@ -51,3 +52,3 @@ }; | ||
* | ||
* @param {boolean} enforce | ||
* @param enforce | ||
* Whether to enforce that there is at least one property already set. Be careful setting this to false, you will | ||
@@ -64,3 +65,3 @@ * get some unexpected outputs, for instance objects will have a numeric index signature. | ||
if (value(o[prop])) { | ||
n += 1; | ||
n++; | ||
} | ||
@@ -72,2 +73,3 @@ else { |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L0MsT0FBTyxDQUFDLE9BQU8sSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBQzNCLENBQUM7QUFoQkQsQ0FnQkMsQ0FBQztBQUVOOztHQUVHO0FBQ1UsUUFBQSxVQUFVLEdBQUcsVUFBZSxLQUFvQztJQUMzRSxPQUFBLFVBQUMsQ0FBQyxJQUFhLE9BQUEsQ0FBQyxZQUFZLEtBQUssRUFBbEIsQ0FBa0I7QUFBakMsQ0FBaUMsQ0FBQztBQUVwQzs7OztHQUlHO0FBQ1UsUUFBQSxhQUFhLEdBQ3hCLFVBQUksS0FBeUI7SUFDM0IsT0FBQSxVQUFDLENBQUM7UUFDQSxLQUFLLElBQU0sSUFBSSxJQUFJLEtBQUssRUFBRTtZQUN4QixJQUFJLENBQUMsbUJBQVcsQ0FBQyxJQUFJLEVBQUUsS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLEVBQUU7Z0JBQ3RDLE9BQU8sS0FBSyxDQUFDO2FBQ2Q7U0FDRjtRQUVELE9BQU8sSUFBSSxDQUFDO0lBQ2QsQ0FBQztBQVJELENBUUMsQ0FBQyJ9 |
@@ -1,2 +0,3 @@ | ||
import { NotEmpty, PartialTypeGuard, TypeGuard } from "./guards"; | ||
import { PartialTypeGuard, TypeGuard } from "./guards"; | ||
declare type Diff<T, U> = T extends U ? never : T; | ||
/** | ||
@@ -32,2 +33,9 @@ * Validate if a value is a javascript number. | ||
/** | ||
* Validates that a value is one of a set of values. | ||
*/ | ||
export declare const isElementOf: { | ||
(): PartialTypeGuard<unknown, never>; | ||
<T>(...ss: T[]): PartialTypeGuard<unknown, T>; | ||
}; | ||
/** | ||
* Validate if a value is a specific javascript number. | ||
@@ -39,3 +47,6 @@ */ | ||
*/ | ||
export declare const isSingletonNumberUnion: <T extends number>(...ns: T[]) => PartialTypeGuard<unknown, T>; | ||
export declare const isSingletonNumberUnion: { | ||
(): PartialTypeGuard<unknown, never>; | ||
<T extends number>(...ss: T[]): PartialTypeGuard<unknown, T>; | ||
}; | ||
/** | ||
@@ -52,3 +63,6 @@ * Validate if a value is a string. | ||
*/ | ||
export declare const isSingletonStringUnion: <T extends string>(...ss: T[]) => PartialTypeGuard<unknown, T>; | ||
export declare const isSingletonStringUnion: { | ||
(): PartialTypeGuard<unknown, never>; | ||
<T extends string>(...ss: T[]): PartialTypeGuard<unknown, T>; | ||
}; | ||
/** | ||
@@ -100,3 +114,3 @@ * Validate if a value is a boolean. | ||
*/ | ||
export declare const isSet: TypeGuard<NotEmpty>; | ||
export declare const isSet: <T = unknown>(obj: T) => obj is Diff<T, null | undefined>; | ||
/** | ||
@@ -123,1 +137,2 @@ * Helper for asserting nothing at all. | ||
export declare const isNever: (n: never) => never; | ||
export {}; |
"use strict"; | ||
exports.__esModule = true; | ||
var MINIMUM_ARRAY_INDEX = 0; | ||
/** | ||
@@ -43,2 +44,12 @@ * Validate if a value is a javascript number. | ||
/** | ||
* Validates that a value is one of a set of values. | ||
*/ | ||
exports.isElementOf = (function () { | ||
var ss = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
ss[_i] = arguments[_i]; | ||
} | ||
return function (s) { return ss.indexOf(s) >= MINIMUM_ARRAY_INDEX; }; | ||
}); | ||
/** | ||
* Validate if a value is a specific javascript number. | ||
@@ -52,9 +63,9 @@ */ | ||
*/ | ||
exports.isSingletonNumberUnion = function () { | ||
var ns = []; | ||
exports.isSingletonNumberUnion = (function () { | ||
var ss = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
ns[_i] = arguments[_i]; | ||
ss[_i] = arguments[_i]; | ||
} | ||
return function (n) { return ns.indexOf(n) >= 0; }; | ||
}; | ||
return function (s) { return ss.indexOf(s) >= MINIMUM_ARRAY_INDEX; }; | ||
}); | ||
/** | ||
@@ -75,3 +86,3 @@ * Validate if a value is a string. | ||
*/ | ||
exports.isSingletonStringUnion = function () { | ||
exports.isSingletonStringUnion = (function () { | ||
var ss = []; | ||
@@ -81,4 +92,4 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
} | ||
return function (s) { return ss.indexOf(s) >= 0; }; | ||
}; | ||
return function (s) { return ss.indexOf(s) >= MINIMUM_ARRAY_INDEX; }; | ||
}); | ||
/** | ||
@@ -161,3 +172,3 @@ * Validate if a value is a boolean. | ||
*/ | ||
exports.isAny = function (_a) { return true; }; | ||
exports.isAny = function (_a) { return true; }; /* eslint-disable-line @typescript-eslint/no-unused-vars */ | ||
/** | ||
@@ -175,2 +186,2 @@ * Alias for isAny. | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpbWl0aXZlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9wcmltaXRpdmVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUE7O0dBRUc7QUFDVSxRQUFBLFFBQVEsR0FBc0IsVUFBQyxDQUFDO0lBQzNDLE9BQUEsT0FBTyxDQUFDLEtBQUssUUFBUSxJQUFJLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUM7QUFBekMsQ0FBeUMsQ0FBQztBQUU1Qzs7R0FFRztBQUNVLFFBQUEsY0FBYyxHQUFzQixVQUFDLENBQUM7SUFDakQsT0FBQSxPQUFPLENBQUMsS0FBSyxRQUFRLElBQUksQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxJQUFJLE1BQU0sQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDO0FBQS9ELENBQStELENBQUM7QUFFbEU7Ozs7O0dBS0c7QUFDVSxRQUFBLE9BQU8sR0FBc0IsVUFBQyxDQUFDO0lBQzFDLE9BQUEsT0FBTyxDQUFDLEtBQUssUUFBUTtBQUFyQixDQUFxQixDQUFDO0FBRXhCOzs7O0dBSUc7QUFDVSxRQUFBLFFBQVEsR0FBRyxlQUFPLENBQUM7QUFFaEM7O0d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DO0FBQzdELENBQUMsQ0FBQyJ9 |
{ | ||
"name": "generic-type-guard", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Generic type guards for TypeScript", | ||
@@ -8,12 +8,12 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "rm -fr dist && tsc --target es3", | ||
"prepack": "rm -fr dist && tsc --target es3", | ||
"build": "rimraf dist && tsc --target es3", | ||
"prepack": "rimraf dist && tsc --target es3", | ||
"test": "yarn lint && yarn mocha", | ||
"test-watch": "nodemon -e ts,json --exec yarn test", | ||
"lint": "tslint -p . -c ../../tslint.json", | ||
"lint-watch": "nodemon -e ts,json --exec tslint -p . -c ../../tslint.json", | ||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", | ||
"lint-watch": "nodemon -e ts,json --exec eslint . --ext .js,.jsx,.ts,.tsx", | ||
"mocha": "nyc mocha --opts mocha.opts", | ||
"mocha-watch": "nodemon -e ts,json --exec yarn mocha --opts ../../mocha.opts", | ||
"stryker": "stryker run ./stryker.conf.js", | ||
"stryker-watch": "nodemon -e ts,json --exec stryker run ./stryker.conf.js", | ||
"stryker": "stryker run", | ||
"stryker-watch": "nodemon -e ts,json --exec stryker run", | ||
"codecov-local": "nyc report", | ||
@@ -66,22 +66,24 @@ "codecov-report": "nyc report --reporter=json && codecov -p ../.. -f coverage/*.json -F generic_type_guard" | ||
"devDependencies": { | ||
"@stryker-mutator/core": "~1.1.0", | ||
"@stryker-mutator/html-reporter": "~1.1.0", | ||
"@stryker-mutator/mocha-framework": "~1.1.0", | ||
"@stryker-mutator/mocha-runner": "~1.1.0", | ||
"@stryker-mutator/typescript": "~1.1.0", | ||
"@types/chai": "*", | ||
"@types/mocha": "*", | ||
"@types/node": "*", | ||
"chai": "^4.1.2", | ||
"codecov": "^3.0.0", | ||
"mocha": "^6.0.2", | ||
"nodemon": "^1.18.7", | ||
"nyc": "^13.1.0", | ||
"source-map-support": "~0.5.3", | ||
"ts-node": "^8.0.2", | ||
"tslint": "^5.9.1", | ||
"tslint-eslint-rules": "^5.0.0", | ||
"typescript": "~3.3.3" | ||
"@mscharley/eslint-config": "1.2.2", | ||
"@stryker-mutator/core": "3.1.0", | ||
"@stryker-mutator/mocha-framework": "3.1.0", | ||
"@stryker-mutator/mocha-runner": "3.1.0", | ||
"@stryker-mutator/typescript": "3.1.0", | ||
"@types/chai": "4.2.11", | ||
"@types/mocha": "7.0.2", | ||
"@types/node": "12.12.36", | ||
"@typescript-eslint/eslint-plugin": "2.29.0", | ||
"@typescript-eslint/parser": "2.29.0", | ||
"chai": "4.2.0", | ||
"codecov": "3.6.5", | ||
"eslint": "6.8.0", | ||
"mocha": "7.1.1", | ||
"nodemon": "2.0.3", | ||
"nyc": "15.0.1", | ||
"rimraf": "3.0.2", | ||
"source-map-support": "0.5.17", | ||
"ts-node": "8.8.2", | ||
"typescript": "3.8.3" | ||
}, | ||
"gitHead": "a2002df59aa73f4a305f297b143f9ad7af1d1db9" | ||
"gitHead": "bde99cf5ed138de8ecff928caf271065246835bf" | ||
} |
@@ -6,9 +6,8 @@ # generic-type-guard | ||
[![Codecov](https://img.shields.io/codecov/c/github/mscharley/generic-type-guard.svg)](https://codecov.io/gh/mscharley/generic-type-guard) | ||
[![Join the chat at https://gitter.im/generic-type-guard/Lobby](https://badges.gitter.im/generic-type-guard/Lobby.svg)](https://gitter.im/generic-type-guard/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
**Source:** [https://github.com/mscharley/generic-type-guard](https://github.com/mscharley/generic-type-guard/packages/generic-type-guard) | ||
**Source:** [https://github.com/mscharley/generic-type-guard](https://github.com/mscharley/generic-type-guard/tree/master/packages/generic-type-guard) | ||
**Author:** Matthew Scharley | ||
**Contributors:** [See contributors on GitHub][gh-contrib] | ||
**Bugs/Support:** [Github Issues][gh-issues] | ||
**Copyright:** 2017 | ||
**Copyright:** 2020 | ||
**License:** [MIT license][license] | ||
@@ -76,41 +75,14 @@ **Status:** Active | ||
```typescript | ||
```typescript | ||
import * as tg from "generic-type-guard"; | ||
export interface TestInterface { | ||
str: string; | ||
num: number; | ||
} | ||
const isTypeSafeTestInterface: tg.PartialTypeGuard<{}, TestInterface> = | ||
tg.isIntersection(tg.hasProperty("str", tg.isString), tg.hasProperty("num", tg.isNumber)); | ||
export const isTestInterface: TypeGuard<TestInterface> = (o: any): o is TestInterface => | ||
isObject(o) && isTypeSafeTestInterface(o); | ||
// or perhaps you have a larger interface... | ||
export interface ComplexInterface extends TestInterface { | ||
b: boolean; | ||
maybeString?: string; | ||
nullableString: string | null; | ||
} | ||
export const isTypeSafeComplexInterface: tg.TypeGuard<ComplexInterface> = | ||
new tg.IsInterface() | ||
.withProperty("str", tg.isString) | ||
.withProperty("num", tg.isNumber) | ||
.withProperty("b", tg.isBoolean) | ||
.withProperty("maybeString", tg.isOptional(tg.isString)) | ||
.withProperty("nullableString", tg.isNullable(tg.isString)) | ||
.get(); | ||
// Alternatively: | ||
export const isTypeSafeComplexInterface2: tg.PartialTypeGuard<{}, ComplexInterface> = | ||
new tg.IntersectionOf(tg.hasProperty("str", tg.isString)) | ||
.with(tg.hasProperty("num", tg.isNumber)) | ||
.with(tg.hasProperty("b", tg.isBoolean)) | ||
.with(tg.hasProperty("maybeString", tg.isUnion(tg.isUndefined, tg.isString))) | ||
.with(tg.hasProperty("nullableString", tg.isNullable(tg.isString))).get(); | ||
export const isComplexInterface = | ||
new tg.IsInterface().withProperties({ | ||
str: tg.isString, | ||
num: tg.isNumber, | ||
b: tg.isBoolean, | ||
maybeString: tg.isOptional(tg.isString), | ||
nullableString: tg.isNullable(tg.isString), | ||
}).get(); | ||
export type ComplexInterface = tg.GuardedType<typeof isComplexInterface>; | ||
``` | ||
@@ -154,2 +126,11 @@ | ||
##### Fix for structural typing issues | ||
If possible, you should reframe the question. Instead of creating a type to guard against, create a guard and export the type: | ||
```typescript | ||
const isFoo = tg.isRecord("foo", tg.isOptional(tg.isString)); | ||
type Foo = tg.GuardedType<typeof isFoo>; | ||
``` | ||
[gh-contrib]: https://github.com/mscharley/generic-type-guard/graphs/contributors | ||
@@ -156,0 +137,0 @@ [gh-issues]: https://github.com/mscharley/generic-type-guard/issues |
33
834
48653
20
137