8000 Merge pull request #126 from dteske25/master · dasveloper/react-sortablejs@b40b7b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit b40b7b6

Browse files
authored
Merge pull request SortableJS#126 from dteske25/master
Adds explicit Omit<T,K> type, as older versions of TS do no include it.
2 parents b48d612 + 0a47569 commit b40b7b6

File tree

7 files changed

+16
-3
lines changed

7 files changed

+16
-3
lines changed

dist/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CSSProperties, ForwardRefExoticComponent, ReactHTML, RefAttributes } from "react";
22
import Sortable, { MoveEvent, Options, SortableEvent } from "sortablejs";
33
import { ReactSortable } from "./react-sortable";
4+
import { Omit } from './util';
45
export interface ItemInterface {
56
/** The unique id associated with your item. It's recommended this is the same as the key prop for your list item. */
67
id: string | number;

dist/types.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/util.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,9 @@ export interface Normalized<T> extends Input {
4040
* @param props `ReactSortable.Props`
4141
*/
4242
export declare function destructurePropsForOptions<T>(props: PropsWithChildren<ReactSortableProps<T>>): Exclude<Options, AllMethodNames>;
43+
/**
44+
* Construct a type with the properties of T except for those in type K.
45+
* Including this allows for backwards compatibility with earlier versions of TS.
46+
*/
47+
export declare type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
4348
//# sourceMappingURL=util.d.ts.map

dist/util.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"email": "waynevanson@gmail.com"
66
},
77
"license": "MIT",
8-
"version": "2.0.10",
8+
"version": "2.0.11",
99
"private": false,
1010
"main": "dist/index.js",
1111
"module": "dist/index.es.js",

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from "react";
77
import Sortable, { MoveEvent, Options, SortableEvent } from "sortablejs";
88
import { ReactSortable } from "./react-sortable";
9+
import { Omit } from './util';
910

1011
// @todo: remove dynamic types and create declarative types instead for readability of user.
1112
// add these in docs as well

src/util.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,9 @@ export function destructurePropsForOptions<T>(
187187
} = props;
188188
return options;
189189
}
190+
191+
/**
192+
* Construct a type with the properties of T except for those in type K.
193+
* Including this allows for backwards compatibility with earlier versions of TS.
194+
*/
195+
export type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;

0 commit comments

Comments
 (0)
0