[enzyme] state() with no props as an "S" (state type) return type (#12211)

* clarify and fix 'options' object types; Hammer.Manager requires an EventTarget, not HTMLElement

* fix RecognizerTuple type

* `state()` with no props has an `S` (state type) return value
This commit is contained in:
Mike Deverell
2016-10-26 00:35:40 +09:00
committed by Masahiro Wakame
parent b6f6ba5f89
commit 4cc7cbabf6
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -204,7 +204,7 @@ namespace ShallowWrapperTest {
}
function test_state() {
shallowWrapper.state();
const state: MyComponentState = shallowWrapper.state();
shallowWrapper.state('key');
const tmp: String = shallowWrapper.state<String>('key');
}
+3 -2
View File
@@ -204,8 +204,9 @@ declare module "enzyme" {
* Returns the state hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value.
* @param [key]
*/
state(key?: string): any;
state<T>(key?: string): T;
state(): S;
state(key: string): any;
state<T>(key: string): T;
/**
* Returns the context hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value.