From 10be65f59b170a205c03ad817977f67c0bfabd3b Mon Sep 17 00:00:00 2001 From: Kotaro Sugawara Date: Thu, 9 Sep 2021 00:38:51 +0900 Subject: [PATCH 1/2] fix: add File and FileList interface for ReactNative --- package.json | 8 ++++---- src/types/global.d.ts | 11 ----------- src/types/utils.ts | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 15 deletions(-) delete mode 100644 src/types/global.d.ts diff --git a/package.json b/package.json index 07f7705e149..9602c899ad3 100644 --- a/package.json +++ b/package.json @@ -23,12 +23,12 @@ } }, "scripts": { - "clean": "rm -rf dist", + "clean": "rimraf dist", "prebuild": "yarn clean", - "build": "yarn build:modern && yarn cp:dts", + "build": "yarn build:modern", + "postbuild": "rimraf dist/__tests__", "build:modern": "rollup -c ./scripts/rollup/rollup.config.js", "build:esm": "rollup -c ./scripts/rollup/rollup.esm.config.js", - "cp:dts": "copyfiles -f ./src/**/*.d.ts dist && rm -rf dist/__tests__", "prettier:fix": "prettier --config .prettierrc --write \"**/*.{ts,tsx}\"", "lint": "eslint '**/*.{js,ts,tsx}'", "lint:fix": "yarn lint -- --fix", @@ -80,7 +80,6 @@ "@vitejs/plugin-react-refresh": "^1.3.6", "babel-jest": "^27.0.6", "bundlesize": "^0.18.0", - "copyfiles": "^2.4.1", "cypress": "8.3.0", "cypress-parallel": "^0.3.0", "eslint": "^7.32.0", @@ -98,6 +97,7 @@ "react-dom": "^17.0.1", "react-native": "^0.65.1", "react-test-renderer": "^17.0.1", + "rimraf": "^3.0.2", "rollup": "^2.56.3", "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-sourcemaps": "^0.6.2", diff --git a/src/types/global.d.ts b/src/types/global.d.ts deleted file mode 100644 index cd6267bb610..00000000000 --- a/src/types/global.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* -Projects that React Hook Form installed don't include the DOM library need these interfaces to compile. -React Native applications is no DOM available. The JavaScript runtime is ES6/ES2015 only. -These definitions allow such projects to compile with only --lib ES6. - -Warning: all of these interfaces are empty. -If you want type definitions for various properties, you need to add `--lib DOM` (via command line or tsconfig.json). -*/ - -interface HTMLOptionsCollection {} -interface FileList {} diff --git a/src/types/utils.ts b/src/types/utils.ts index b65f33cd0f5..892b37e1fdd 100644 --- a/src/types/utils.ts +++ b/src/types/utils.ts @@ -1,6 +1,26 @@ import { FieldValues } from './fields'; import { NestedValue } from './form'; +/* +Projects that React Hook Form installed don't include the DOM library need these interfaces to compile. +React Native applications is no DOM available. The JavaScript runtime is ES6/ES2015 only. +These definitions allow such projects to compile with only --lib ES6. + +Warning: all of these interfaces are empty. +If you want type definitions for various properties, you need to add `--lib DOM` (via command line or tsconfig.json). +*/ + +interface File extends Blob { + readonly lastModified: number; + readonly name: string; +} + +interface FileList { + readonly length: number; + item(index: number): File | null; + [index: number]: File; +} + export type Primitive = | null | undefined From b21171d35ae31cfa53bb78ae985cd92bcc4e3910 Mon Sep 17 00:00:00 2001 From: Beier Luo Date: Thu, 9 Sep 2021 09:09:27 +1000 Subject: [PATCH 2/2] 7.15.2-beta.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9602c899ad3..a49eef58011 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-hook-form", "description": "Performant, flexible and extensible forms library for React Hooks", - "version": "7.15.1", + "version": "7.15.2-beta.0", "main": "dist/index.cjs.js", "module": "dist/index.esm.js", "umd:main": "dist/index.umd.js",