Skip to content

Commit 9313e70

Browse files
Merge pull request #16 from bamlab/typescript
feat(typescript): Export type for typescript
2 parents a22c534 + 73aafa6 commit 9313e70

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

index.d.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import * as React from 'react';
2+
3+
export interface makeReactNativeFieldProps {
4+
name: string;
5+
}
6+
7+
export interface withInputTypePropsProps {
8+
type: string;
9+
}
10+
11+
export interface withErrorProps {
12+
name: string;
13+
}
14+
15+
export interface withTouchedProps {
16+
name: string;
17+
}
18+
19+
export type makeInputGreatAgainProps = makeReactNativeFieldProps &
20+
withInputTypePropsProps &
21+
withErrorProps &
22+
withTouchedProps;
23+
24+
export function makeReactNativeField<Props>(
25+
WrappedComponent: React.ComponentType<Props>
26+
): React.ComponentClass<Props & makeReactNativeFieldProps>;
27+
28+
export function withError<Props>(
29+
WrappedComponent: React.ComponentType<Props>
30+
): React.ComponentClass<Props & withErrorProps>;
31+
32+
export function withInputTypeProps<Props>(
33+
WrappedComponent: React.ComponentType<Props>
34+
): React.ComponentClass<Props & withInputTypePropsProps>;
35+
36+
export function withFormik<Props>(
37+
WrappedComponent: React.ComponentType<Props>
38+
): React.ComponentClass<Props>;
39+
40+
export function withNextInputAutoFocusInput<Props>(
41+
WrappedComponent: React.ComponentType<Props>
42+
): React.ComponentClass<Props>;
43+
44+
export function withNextInputAutoFocusForm<Props>(
45+
WrappedComponent: React.ComponentType<Props>
46+
): React.ComponentClass<Props>;
47+
48+
export function withPickerValues<Props>(
49+
WrappedComponent: React.ComponentType<Props>
50+
): React.ComponentClass<Props>;
51+
52+
export function withTouched<Props>(
53+
WrappedComponent: React.ComponentType<Props>
54+
): React.ComponentClass<Props & withTouchedProps>;
55+
56+
export function makeInputGreatAgain<Props>(
57+
WrappedComponent: React.ComponentType<Props>
58+
): React.ComponentClass<Props & makeInputGreatAgainProps>;
59+
60+
export default makeInputGreatAgain;

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.0-development",
44
"description": "Make the most of your React Native forms with Formik",
55
"main": "index.js",
6+
"type": "index.d.ts",
67
"scripts": {
78
"test": "jest --coverage",
89
"commitmsg": "validate-commit-msg",
@@ -33,6 +34,7 @@
3334
},
3435
"homepage": "https://github.com/bamlab/react-native-formik#readme",
3536
"devDependencies": {
37+
"@types/react": "^16.3.8",
3638
"babel-core": "6.26.0",
3739
"babel-jest": "^22.4.1",
3840
"babel-preset-react-native": "4.0.0",

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@
118118
version "9.4.7"
119119
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.4.7.tgz#57d81cd98719df2c9de118f2d5f3b1120dcd7275"
120120

121+
"@types/react@^16.3.8":
122+
version "16.3.8"
123+
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.3.8.tgz#40c7e4eca3f48783e4c4ccee26fc7f5a5a476d84"
124+
dependencies:
125+
csstype "^2.0.0"
126+
121127
JSONStream@^1.0.4:
122128
version "1.3.2"
123129
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.2.tgz#c102371b6ec3a7cf3b847ca00c20bb0fce4c6dea"
@@ -1888,6 +1894,10 @@ cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0":
18881894
dependencies:
18891895
cssom "0.3.x"
18901896

1897+
csstype@^2.0.0:
1898+
version "2.2.0"
1899+
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.2.0.tgz#1656ef97553ac53b77090844a2531c6660ebd902"
1900+
18911901
csurf@~1.8.3:
18921902
version "1.8.3"
18931903
resolved "https://registry.yarnpkg.com/csurf/-/csurf-1.8.3.tgz#23f2a13bf1d8fce1d0c996588394442cba86a56a"

0 commit comments

Comments
 (0)