simplytyped
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -6,4 +6,5 @@ import { If } from './conditionals'; | ||
export declare type Predicate<A = any> = If<IsAny<A>, (...args: any[]) => boolean, (arg: A) => boolean>; | ||
export declare type AnyFunc<R = any> = (...args: any[]) => R; | ||
export declare function Readonly<T extends object>(obj: T): DeepReadonly<T>; | ||
export declare function isKeyOf<T extends object>(obj: T, k: string): k is keyof T; | ||
export declare function objectKeys<T extends object>(obj: T): (keyof T)[]; |
{ | ||
"name": "simplytyped", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "yet another Typescript type library for advanced types", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index", |
@@ -46,3 +46,3 @@ # SimplyTyped | ||
[Predicate](#predicate) - [ConstructorFunction](#constructorfunction) - [Readonly](#readonly) - [isKeyOf](#isKeyOf) - [objectKeys](#objectkeys) | ||
[Predicate](#predicate) - [ConstructorFunction](#constructorfunction) - [AnyFunc](#anyfunc) - [Readonly](#readonly) - [isKeyOf](#isKeyOf) - [objectKeys](#objectkeys) | ||
@@ -454,2 +454,10 @@ **[Utils](#utils)** | ||
### AnyFunc | ||
Concisely and cleanly define an arbitrary function. | ||
Useful when designing many api's that don't care what function they take in, they just need to know what it returns. | ||
```ts | ||
type got = AnyFunc; // => (...args: any[]) => any; | ||
type got2 = AnyFunc<number>; // => (...args: any[]) => number; | ||
``` | ||
### Readonly | ||
@@ -456,0 +464,0 @@ This takes a runtime object and makes its properties readonly. |
30017
237
521