react-redux-typescript
Advanced tools
Comparing version 3.0.0-rc.1 to 3.0.0-rc.2
@@ -1,9 +0,9 @@ | ||
export declare type DiffKeys<T extends string, U extends string> = ({ | ||
[K in T]: K; | ||
export declare type DiffKeys<K extends string, L extends string> = ({ | ||
[P in K]: P; | ||
} & { | ||
[K in U]: never; | ||
[P in L]: never; | ||
} & { | ||
[k: string]: never; | ||
})[T]; | ||
export declare type OmitKeys<T extends string, U extends T> = (DiffKeys<T, U>); | ||
})[K]; | ||
export declare type OmitKeys<K extends string, K2 extends K> = (DiffKeys<K, K2>); | ||
export declare type Diff<T extends object, U extends object> = Pick<T, DiffKeys<keyof T, keyof U>>; | ||
@@ -10,0 +10,0 @@ export declare type Omit<T extends object, K extends keyof T> = Pick<T, DiffKeys<keyof T, K>>; |
@@ -1,9 +0,9 @@ | ||
export declare type DiffKeys<T extends string, U extends string> = ({ | ||
[K in T]: K; | ||
export declare type DiffKeys<K extends string, L extends string> = ({ | ||
[P in K]: P; | ||
} & { | ||
[K in U]: never; | ||
[P in L]: never; | ||
} & { | ||
[k: string]: never; | ||
})[T]; | ||
export declare type OmitKeys<T extends string, U extends T> = (DiffKeys<T, U>); | ||
})[K]; | ||
export declare type OmitKeys<K extends string, K2 extends K> = (DiffKeys<K, K2>); | ||
export declare type Diff<T extends object, U extends object> = Pick<T, DiffKeys<keyof T, keyof U>>; | ||
@@ -10,0 +10,0 @@ export declare type Omit<T extends object, K extends keyof T> = Pick<T, DiffKeys<keyof T, K>>; |
@@ -1,9 +0,9 @@ | ||
export declare type DiffKeys<T extends string, U extends string> = ({ | ||
[K in T]: K; | ||
export declare type DiffKeys<K extends string, L extends string> = ({ | ||
[P in K]: P; | ||
} & { | ||
[K in U]: never; | ||
[P in L]: never; | ||
} & { | ||
[k: string]: never; | ||
})[T]; | ||
export declare type OmitKeys<T extends string, U extends T> = (DiffKeys<T, U>); | ||
})[K]; | ||
export declare type OmitKeys<K extends string, K2 extends K> = (DiffKeys<K, K2>); | ||
export declare type Diff<T extends object, U extends object> = Pick<T, DiffKeys<keyof T, keyof U>>; | ||
@@ -10,0 +10,0 @@ export declare type Omit<T extends object, K extends keyof T> = Pick<T, DiffKeys<keyof T, K>>; |
{ | ||
"name": "react-redux-typescript", | ||
"version": "3.0.0-rc.1", | ||
"version": "3.0.0-rc.2", | ||
"description": "React / Redux / TypeScript Utils", | ||
@@ -33,3 +33,3 @@ "author": "Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io)", | ||
"dependencies": { | ||
"ts-redux-actions": "1.0.0-beta5" | ||
"ts-redux-actions": "1.0.0-rc.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "devDependencies": { |
@@ -13,4 +13,6 @@ # React / Redux / TypeScript Utils | ||
## Redux Actions Utils | ||
> For advanced docs check here: https://github.com/piotrwitek/ts-redux-actions | ||
- [createAction](#createaction) | ||
> Reimporting from submodule [`ts-redux-actions`](https://github.com/piotrwitek/ts-redux-actions) | ||
API Docs: https://github.com/piotrwitek/ts-redux-actions#api | ||
- [getType](https://github.com/piotrwitek/ts-redux-actions#gettype) | ||
- [createAction](https://github.com/piotrwitek/ts-redux-actions#createaction) | ||
@@ -35,28 +37,12 @@ ## Mapped Types | ||
## Redux Actions Utils | ||
### createAction | ||
> https://github.com/piotrwitek/ts-redux-actions#createaction | ||
```ts | ||
createAction(typeString, creatorFunction?) | ||
typeString: TS extends string, | ||
creatorFunction: (...args: any[]) => { type: TS, payload?: P, meta?: M, error?: boolean } | ||
return: ( | ||
(...args: any[]) => { type: TS, payload?: P, meta?: M, error?: boolean } | ||
) & { readonly type: TS } | ||
``` | ||
--- | ||
## Mapped Types | ||
### DiffKeys | ||
> Return a difference of non-related string literal unions | ||
```ts | ||
type DiffKeys<T extends string, U extends string> | ||
``` | ||
> `DiffKeys<K extends string, L extends string>` | ||
> Compare set of keys `K` and `L` and return a subset with a difference | ||
Usage: | ||
```ts | ||
import { OmitKeys } from 'react-redux-typescript'; | ||
interface BaseProps { a: string, b?: number, c: boolean } | ||
@@ -70,9 +56,9 @@ interface Props { a: number, d: number } | ||
### OmitKeys | ||
> Omit part of string literal union with constraint to existing literals | ||
```ts | ||
type OmitKeys<T extends string, U extends T> | ||
``` | ||
> `OmitKeys<K extends string, K2 extends K>` | ||
> From set of keys `K` subtract it's subset `K2` | ||
Usage: | ||
```ts | ||
import { OmitKeys } from 'react-redux-typescript'; | ||
interface BaseProps { a: string, b?: number, c: boolean } | ||
@@ -85,9 +71,9 @@ | ||
### Diff | ||
> Return an object containing non-intersecting properties of non-related objects | ||
```ts | ||
type Diff<T extends object, U extends object> | ||
``` | ||
> `Diff<T extends object, U extends object>` | ||
> From `T` remove intersecting properties with `U` | ||
Usage: | ||
```ts | ||
import { OmitKeys } from 'react-redux-typescript'; | ||
interface BaseProps { a: string, b?: number, c: boolean } | ||
@@ -101,9 +87,9 @@ interface Props { a: number, d: number } | ||
### Omit | ||
> Omit object property with constraint to existing keys | ||
```ts | ||
type Omit<T extends object, K extends keyof T> | ||
``` | ||
> `Omit<T extends object, K extends keyof T>` | ||
> From `T` remove a set of properties `K` | ||
Usage: | ||
```ts | ||
import { OmitKeys } from 'react-redux-typescript'; | ||
interface BaseProps { a: string, b?: number, c: boolean } | ||
@@ -116,9 +102,9 @@ | ||
### Overwrite | ||
> Overwrite intersecting properties from <U> to <T> | ||
```ts | ||
type Overwrite<T extends object, U extends object> | ||
``` | ||
> `Overwrite<T extends object, U extends object>` | ||
> Replace intersecting properties from `U` to `T` | ||
Usage: | ||
```ts | ||
import { OmitKeys } from 'react-redux-typescript'; | ||
interface BaseProps { a: string, b?: number, c: boolean } | ||
@@ -132,9 +118,9 @@ interface Props { a: number, d: number } | ||
### Assign | ||
> Assign properties from <U> to <T> (overwrite intersecting) | ||
```ts | ||
type Assign<T extends object, U extends object> | ||
``` | ||
> `Assign<T extends object, U extends object>` | ||
> Copy and replace all properties from `U` to `T` | ||
Usage: | ||
```ts | ||
import { Assign } from 'react-redux-typescript'; | ||
interface BaseProps { a: string, b?: number, c: boolean } | ||
@@ -141,0 +127,0 @@ interface Props { a: number, d: number } |
46802
155
+ Addedts-redux-actions@1.0.0-rc.0(transitive)
- Removedts-redux-actions@1.0.0-beta5(transitive)
Updatedts-redux-actions@1.0.0-rc.0