Skip to content

Commit

Permalink
Merge pull request #16 from bamlab/typescript
Browse files Browse the repository at this point in the history
feat(typescript): Export type for typescript
  • Loading branch information
VincentLanglet authored Apr 13, 2018
2 parents a22c534 + 73aafa6 commit 9313e70
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
60 changes: 60 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import * as React from 'react';

export interface makeReactNativeFieldProps {
name: string;
}

export interface withInputTypePropsProps {
type: string;
}

export interface withErrorProps {
name: string;
}

export interface withTouchedProps {
name: string;
}

export type makeInputGreatAgainProps = makeReactNativeFieldProps &
withInputTypePropsProps &
withErrorProps &
withTouchedProps;

export function makeReactNativeField<Props>(
WrappedComponent: React.ComponentType<Props>
): React.ComponentClass<Props & makeReactNativeFieldProps>;

export function withError<Props>(
WrappedComponent: React.ComponentType<Props>
): React.ComponentClass<Props & withErrorProps>;

export function withInputTypeProps<Props>(
WrappedComponent: React.ComponentType<Props>
): React.ComponentClass<Props & withInputTypePropsProps>;

export function withFormik<Props>(
WrappedComponent: React.ComponentType<Props>
): React.ComponentClass<Props>;

export function withNextInputAutoFocusInput<Props>(
WrappedComponent: React.ComponentType<Props>
): React.ComponentClass<Props>;

export function withNextInputAutoFocusForm<Props>(
WrappedComponent: React.ComponentType<Props>
): React.ComponentClass<Props>;

export function withPickerValues<Props>(
WrappedComponent: React.ComponentType<Props>
): React.ComponentClass<Props>;

export function withTouched<Props>(
WrappedComponent: React.ComponentType<Props>
): React.ComponentClass<Props & withTouchedProps>;

export function makeInputGreatAgain<Props>(
WrappedComponent: React.ComponentType<Props>
): React.ComponentClass<Props & makeInputGreatAgainProps>;

export default makeInputGreatAgain;
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.0-development",
"description": "Make the most of your React Native forms with Formik",
"main": "index.js",
"type": "index.d.ts",
"scripts": {
"test": "jest --coverage",
"commitmsg": "validate-commit-msg",
Expand Down Expand Up @@ -33,6 +34,7 @@
},
"homepage": "https://github.com/bamlab/react-native-formik#readme",
"devDependencies": {
"@types/react": "^16.3.8",
"babel-core": "6.26.0",
"babel-jest": "^22.4.1",
"babel-preset-react-native": "4.0.0",
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
version "9.4.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.4.7.tgz#57d81cd98719df2c9de118f2d5f3b1120dcd7275"

"@types/react@^16.3.8":
version "16.3.8"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.3.8.tgz#40c7e4eca3f48783e4c4ccee26fc7f5a5a476d84"
dependencies:
csstype "^2.0.0"

JSONStream@^1.0.4:
version "1.3.2"
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.2.tgz#c102371b6ec3a7cf3b847ca00c20bb0fce4c6dea"
Expand Down Expand Up @@ -1888,6 +1894,10 @@ [email protected], "cssom@>= 0.3.2 < 0.4.0":
dependencies:
cssom "0.3.x"

csstype@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.2.0.tgz#1656ef97553ac53b77090844a2531c6660ebd902"

csurf@~1.8.3:
version "1.8.3"
resolved "https://registry.yarnpkg.com/csurf/-/csurf-1.8.3.tgz#23f2a13bf1d8fce1d0c996588394442cba86a56a"
Expand Down

0 comments on commit 9313e70

Please sign in to comment.