Skip to content

Commit

Permalink
adding typescript support (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: Antonio <[email protected]>
  • Loading branch information
iusehooks and Antonio authored Jan 15, 2021
1 parent 4dd39e2 commit fc5179c
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/build/**
**/dev/**
**/node_modules/**
**/node_modules/**
/**/*.d.ts
220 changes: 194 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "usetheform",
"version": "3.3.0",
"version": "3.3.1",
"description": "React library for composing declarative forms in React and managing their state.",
"main": "./build/index.js",
"module": "./build/es/index.js",
"types": "./build/index.d.ts",
"repository": "github:iusehooks/usetheform",
"homepage": "https://iusehooks.github.io/usetheform",
"scripts": {
Expand All @@ -24,6 +25,7 @@
"author": "Antonio Pangallo (https://github.com/antoniopangallo)",
"files": [
"build/index.js",
"build/index.d.ts",
"build/index.es.js",
"build/es",
"build/umd"
Expand Down Expand Up @@ -80,6 +82,7 @@
"rimraf": "^3.0.2",
"rollup": "^2.35.1",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-terser": "^7.0.2"
},
"jest": {
Expand Down
4 changes: 4 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import replace from "@rollup/plugin-replace";
import commonjs from "@rollup/plugin-commonjs";
import nodeResolve from "@rollup/plugin-node-resolve";
import bundleSize from "rollup-plugin-bundle-size";
import copy from "rollup-plugin-copy";

const config = {
input: "./src/index.js",
Expand All @@ -25,6 +26,9 @@ const config = {
}),
replace({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
}),
copy({
targets: [{ src: "src/index.d.ts", dest: "build" }]
})
]
};
Expand Down
20 changes: 20 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
declare module "usetheform" {
export const Index: any;
export const Form: any;
export const Input: any;
export const Select: any;
export const TextArea: any;
export const Collection: any;
export const FormContext: any;
export const getValueByPath: any;
export const STATUS: any;
export const useForm: any;
export const useValidation: any;
export const useSelector: any;
export const useAsyncValidation: any;
export const useChildren: any;
export const useField: any;
export const useCollection: any;
export const useMultipleForm: any;
export const withIndex: any;
}

0 comments on commit fc5179c

Please sign in to comment.