Add typings for enzyme-redux (#24948)

This commit is contained in:
Dennis Axelsson 2018-04-12 19:02:44 +02:00 committed by Mohamed Hegazy
parent 22bea9740b
commit 8cf4294b84
4 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,9 @@
import { mountWithState, mountWithStore, shallowWithState, shallowWithStore } from 'enzyme-redux';
import * as React from 'react';
const Component = () => <div>component</div>;
const shallowWithStateWrapper = shallowWithState(<Component />, {});
const shallowWithStoreWrapper = shallowWithStore(<Component />, {});
const mountWithStateWrapper = mountWithState(<Component />, {});
const mountWithStoreWrapper = mountWithStore(<Component />, {});

25
types/enzyme-redux/index.d.ts vendored Normal file
View File

@ -0,0 +1,25 @@
// Type definitions for enzyme-redux 0.2
// Project: https://github.com/Knegusen/enzyme-redux#readme
// Definitions by: Dennis Axelsson <https://github.com/knegusen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import { ReactWrapper, ShallowWrapper } from 'enzyme';
import { ReactElement } from 'react';
export function shallowWithStore<P>(
Component: ReactElement<P>,
store: any
): ShallowWrapper<P>;
export function mountWithStore<P>(
Component: ReactElement<P>,
store: any
): ReactWrapper<P>;
export function shallowWithState<P>(
Component: ReactElement<P>,
state: any
): ShallowWrapper<P>;
export function mountWithState<P>(
Component: ReactElement<P>,
state: any
): ReactWrapper<P>;

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"jsx": "react",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"enzyme-redux-tests.tsx"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }