Skip to content

Commit fc5179c

Browse files
iusehooksAntonio
andauthored
adding typescript support (#28)
Co-authored-by: Antonio <[email protected]>
1 parent 4dd39e2 commit fc5179c

File tree

5 files changed

+224
-28
lines changed

5 files changed

+224
-28
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
**/build/**
22
**/dev/**
3-
**/node_modules/**
3+
**/node_modules/**
4+
/**/*.d.ts

package-lock.json

Lines changed: 194 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "usetheform",
3-
"version": "3.3.0",
3+
"version": "3.3.1",
44
"description": "React library for composing declarative forms in React and managing their state.",
55
"main": "./build/index.js",
66
"module": "./build/es/index.js",
7+
"types": "./build/index.d.ts",
78
"repository": "github:iusehooks/usetheform",
89
"homepage": "https://iusehooks.github.io/usetheform",
910
"scripts": {
@@ -24,6 +25,7 @@
2425
"author": "Antonio Pangallo (https://github.com/antoniopangallo)",
2526
"files": [
2627
"build/index.js",
28+
"build/index.d.ts",
2729
"build/index.es.js",
2830
"build/es",
2931
"build/umd"
@@ -80,6 +82,7 @@
8082
"rimraf": "^3.0.2",
8183
"rollup": "^2.35.1",
8284
"rollup-plugin-bundle-size": "^1.0.3",
85+
"rollup-plugin-copy": "^3.3.0",
8386
"rollup-plugin-terser": "^7.0.2"
8487
},
8588
"jest": {

rollup.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import replace from "@rollup/plugin-replace";
44
import commonjs from "@rollup/plugin-commonjs";
55
import nodeResolve from "@rollup/plugin-node-resolve";
66
import bundleSize from "rollup-plugin-bundle-size";
7+
import copy from "rollup-plugin-copy";
78

89
const config = {
910
input: "./src/index.js",
@@ -25,6 +26,9 @@ const config = {
2526
}),
2627
replace({
2728
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
29+
}),
30+
copy({
31+
targets: [{ src: "src/index.d.ts", dest: "build" }]
2832
})
2933
]
3034
};

src/index.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
declare module "usetheform" {
2+
export const Index: any;
3+
export const Form: any;
4+
export const Input: any;
5+
export const Select: any;
6+
export const TextArea: any;
7+
export const Collection: any;
8+
export const FormContext: any;
9+
export const getValueByPath: any;
10+
export const STATUS: any;
11+
export const useForm: any;
12+
export const useValidation: any;
13+
export const useSelector: any;
14+
export const useAsyncValidation: any;
15+
export const useChildren: any;
16+
export const useField: any;
17+
export const useCollection: any;
18+
export const useMultipleForm: any;
19+
export const withIndex: any;
20+
}

0 commit comments

Comments
 (0)