From 73aafa63c16d6a9ad7a9fc419ee23b8ae9033b34 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 11 Apr 2018 23:02:43 +0200 Subject: [PATCH] feat(typescript): Export type for typescript --- index.d.ts | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ yarn.lock | 10 +++++++++ 3 files changed, 72 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..310e140 --- /dev/null +++ b/index.d.ts @@ -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( + WrappedComponent: React.ComponentType +): React.ComponentClass; + +export function withError( + WrappedComponent: React.ComponentType +): React.ComponentClass; + +export function withInputTypeProps( + WrappedComponent: React.ComponentType +): React.ComponentClass; + +export function withFormik( + WrappedComponent: React.ComponentType +): React.ComponentClass; + +export function withNextInputAutoFocusInput( + WrappedComponent: React.ComponentType +): React.ComponentClass; + +export function withNextInputAutoFocusForm( + WrappedComponent: React.ComponentType +): React.ComponentClass; + +export function withPickerValues( + WrappedComponent: React.ComponentType +): React.ComponentClass; + +export function withTouched( + WrappedComponent: React.ComponentType +): React.ComponentClass; + +export function makeInputGreatAgain( + WrappedComponent: React.ComponentType +): React.ComponentClass; + +export default makeInputGreatAgain; diff --git a/package.json b/package.json index 0a06d75..58f0aa9 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/yarn.lock b/yarn.lock index f98de8b..8559a6d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -1888,6 +1894,10 @@ cssom@0.3.x, "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"