Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add File and FileList interface for ReactNative #6495

Merged
merged 2 commits into from Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions 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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
11 changes: 0 additions & 11 deletions src/types/global.d.ts

This file was deleted.

20 changes: 20 additions & 0 deletions 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
Expand Down