From 27cbba9005c03368e5d53f11465e96c560f6cdc9 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 21:52:38 +0300 Subject: [PATCH 1/9] Templating type definition --- object-assign/object-assign.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/object-assign/object-assign.d.ts b/object-assign/object-assign.d.ts index 52ef486c72..ad797b25ef 100644 --- a/object-assign/object-assign.d.ts +++ b/object-assign/object-assign.d.ts @@ -4,6 +4,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "object-assign" { + function objectAssign(target: T, source: U): T & U; + function objectAssign(target: T, source1: U, source2: V): T & U & V; + function objectAssign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q; + function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q, source5: T): T & U & V & W & Q & R; function objectAssign(target: any, ...sources: any[]): any; export = objectAssign; } From d3d99d650b27beaf7f8c436f3e49f96977a5aec9 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 22:35:52 +0300 Subject: [PATCH 2/9] Update react-redux-tests.tsx --- react-redux/react-redux-tests.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react-redux/react-redux-tests.tsx b/react-redux/react-redux-tests.tsx index 7dba7f2fa2..3ebf6ae539 100644 --- a/react-redux/react-redux-tests.tsx +++ b/react-redux/react-redux-tests.tsx @@ -268,8 +268,8 @@ connect(mapStateToProps3)(TodoApp); // return { todos: state.todos }; //} -function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState { - return objectAssign({}, ownProps, { +function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState & TodoProps { + return objectAssign({}, ownProps, dispatchProps, { todos: stateProps.todos[ownProps.userId], addTodo: (text: string) => dispatchProps.addTodo(ownProps.userId, text) }); From a0e4d1fc3740d86e28e8856e981f95fffd5d813d Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 22:41:01 +0300 Subject: [PATCH 3/9] Update react-redux-2.1.2-tests.tsx --- react-redux/react-redux-2.1.2-tests.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react-redux/react-redux-2.1.2-tests.tsx b/react-redux/react-redux-2.1.2-tests.tsx index 7ead497767..a2aade3ff4 100644 --- a/react-redux/react-redux-2.1.2-tests.tsx +++ b/react-redux/react-redux-2.1.2-tests.tsx @@ -233,8 +233,8 @@ connect(mapStateToProps3)(TodoApp); // return { todos: state.todos }; //} -function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState { - return objectAssign({}, ownProps, { +function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState & TodoProps { + return objectAssign({}, ownProps, dispatchProps, { todos: stateProps.todos[ownProps.userId], addTodo: (text: string) => dispatchProps.addTodo(ownProps.userId, text) }); From 6e9b95facc04e268b48be30c605653055c6be046 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Fri, 19 Aug 2016 22:37:37 +0300 Subject: [PATCH 4/9] Update object-assign.d.ts --- object-assign/object-assign.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object-assign/object-assign.d.ts b/object-assign/object-assign.d.ts index ad797b25ef..c3f92b7592 100644 --- a/object-assign/object-assign.d.ts +++ b/object-assign/object-assign.d.ts @@ -8,7 +8,7 @@ declare module "object-assign" { function objectAssign(target: T, source1: U, source2: V): T & U & V; function objectAssign(target: T, source1: U, source2: V, source3: W): T & U & V & W; function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q; - function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q, source5: T): T & U & V & W & Q & R; + function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R; function objectAssign(target: any, ...sources: any[]): any; export = objectAssign; } From 912e35ffabf81a20987c185b90eeee616ac6ec1d Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Fri, 19 Aug 2016 23:00:49 +0300 Subject: [PATCH 5/9] Update object-assign-tests.ts --- object-assign/object-assign-tests.ts | 80 ++++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 9 deletions(-) diff --git a/object-assign/object-assign-tests.ts b/object-assign/object-assign-tests.ts index 53dfd5e707..d1304422d3 100644 --- a/object-assign/object-assign-tests.ts +++ b/object-assign/object-assign-tests.ts @@ -1,17 +1,79 @@ /// import objectAssign = require("object-assign"); -function assign1() { - var result = objectAssign({hello: "world"}); - return result; +interface Target { + hellow: string; } -function assign2() { - var result = objectAssign({hello: "world"}, {hello: "worlds", second: "extra"}); - return result; +interface Source1 { + source1: string; } -function assign3() { - var result = objectAssign({hello: "world"}, {hello: "worlds", second: "extra"}, {hello: "stop", the: "spinning"}); - return result; +interface Result extends Target, Source1 { + } + +interface Source2 { + source2: string; +} + +interface Result2 extends Result, Source2 { + +} + +interface Source3 { + source3: string; +} + +interface Result3 extends Result2, Source3 { + +} + +interface Source4 { + source4: string; +} + +interface Result4 extends Result4, Source3 { + +} + +interface Source5 { + source2: string; +} + +interface Result5 extends Result4, Source5 { + +} + +function assign1(): Result { + return objectAssign({hellow: "world"}, {source1: "U"}); +} + +function assign2(): Result2 { + return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}); +} + +function assign3(): Result3 { + return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}); +} + +function assign4(): Result4 { + return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}); +} + +function assign5(): Result5 { + return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"}); +} + +function assign() { + return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"}, { + hellow: "hellow", + source1: "source1", + source2: "source2", + source3: "source3", + source4: "source4", + source5: "source5", + generic: "any" + }); +} + From 3af3e291f296fb37426660fdd042e4a4d00a4b75 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Fri, 19 Aug 2016 23:01:15 +0300 Subject: [PATCH 6/9] Update object-assign-tests.ts --- object-assign/object-assign-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object-assign/object-assign-tests.ts b/object-assign/object-assign-tests.ts index d1304422d3..d285219b24 100644 --- a/object-assign/object-assign-tests.ts +++ b/object-assign/object-assign-tests.ts @@ -38,7 +38,7 @@ interface Result4 extends Result4, Source3 { } interface Source5 { - source2: string; + source5: string; } interface Result5 extends Result4, Source5 { From 3e194fcd32705d0934ed4a545bb2bb96754b48d9 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Fri, 19 Aug 2016 23:03:34 +0300 Subject: [PATCH 7/9] Update object-assign-tests.ts --- object-assign/object-assign-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object-assign/object-assign-tests.ts b/object-assign/object-assign-tests.ts index d285219b24..6b9a898ed4 100644 --- a/object-assign/object-assign-tests.ts +++ b/object-assign/object-assign-tests.ts @@ -33,7 +33,7 @@ interface Source4 { source4: string; } -interface Result4 extends Result4, Source3 { +interface Result4 extends Result3, Source4 { } From f1760b924d1f7b13f6f9c936811fd1a0ac5bb6c7 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Fri, 19 Aug 2016 23:06:33 +0300 Subject: [PATCH 8/9] Update react-redux-tests.tsx --- react-redux/react-redux-tests.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react-redux/react-redux-tests.tsx b/react-redux/react-redux-tests.tsx index 3ebf6ae539..7dba7f2fa2 100644 --- a/react-redux/react-redux-tests.tsx +++ b/react-redux/react-redux-tests.tsx @@ -268,8 +268,8 @@ connect(mapStateToProps3)(TodoApp); // return { todos: state.todos }; //} -function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState & TodoProps { - return objectAssign({}, ownProps, dispatchProps, { +function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState { + return objectAssign({}, ownProps, { todos: stateProps.todos[ownProps.userId], addTodo: (text: string) => dispatchProps.addTodo(ownProps.userId, text) }); From 5bd8afe661c476ffbb32a195d7dc2422babd6b2b Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Fri, 19 Aug 2016 23:07:41 +0300 Subject: [PATCH 9/9] Update react-redux-2.1.2-tests.tsx --- react-redux/react-redux-2.1.2-tests.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react-redux/react-redux-2.1.2-tests.tsx b/react-redux/react-redux-2.1.2-tests.tsx index a2aade3ff4..7ead497767 100644 --- a/react-redux/react-redux-2.1.2-tests.tsx +++ b/react-redux/react-redux-2.1.2-tests.tsx @@ -233,8 +233,8 @@ connect(mapStateToProps3)(TodoApp); // return { todos: state.todos }; //} -function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState & TodoProps { - return objectAssign({}, ownProps, dispatchProps, { +function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState { + return objectAssign({}, ownProps, { todos: stateProps.todos[ownProps.userId], addTodo: (text: string) => dispatchProps.addTodo(ownProps.userId, text) });