-
-
Notifications
You must be signed in to change notification settings - Fork 72
Convert to TypeScript #183
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR converts the codebase from Flow/JavaScript to TypeScript and updates tests, build tooling, and dependencies accordingly.
- Introduces TypeScript definitions (
src/types.ts
) and removes Flow files. - Migrates utility and component files to
.ts
/.tsx
, adding type casts and adjusting tests. - Updates Rollup, Babel, ESLint configs, and bumps dependencies for TypeScript support.
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/types.ts | Adds TS interfaces and type exports |
src/testUtils.tsx | New TSX test utilities (formatting bug in JSX tag) |
src/renderComponent.ts | Casts to any to satisfy TS, could tighten types |
src/defaultIsEqual.ts | Function signature limits to arrays (tests use undefined) |
rollup.config.js | Adds TS plugin and updates input/output extensions |
Comments suppressed due to low confidence (2)
src/defaultIsEqual.ts:1
- The signature only accepts
any[]
, but tests passundefined
. Update it to(aArray?: any[], bArray?: any[])
for consistency with intended behavior.
const defaultIsEqual = (aArray: any[], bArray: any[]) =>
src/testUtils.tsx:18
- There's an extra space before the
button
tag and around the attribute. It should be<button onClick={() => setOn(!on)}>
to form valid JSX.
< button onClick = {() => setOn(!on)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request converts the project from Flow to TypeScript, updates build and configuration tooling, and removes now-unnecessary Flow type definitions.
- Converted source files and tests from JavaScript/Flow to TypeScript.
- Updated rollup, babel, and package configurations to support TypeScript, including new ESLint and workflow definitions.
- Removed legacy Flow files and adjusted test assertions to account for React 18+ behavior.
Reviewed Changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/testUtils.tsx | Converted utility functions to TypeScript. |
src/testUtils.js | Removed legacy Flow-based test utilities. |
src/renderComponent.ts | Updated render logic with type assertions for TypeScript. |
src/renderComponent.test.tsx | Adjusted tests with updated type checks and assertions. |
src/index.ts | Updated export API to include the new types. |
src/defaultIsEqual.ts | Modified function signature for improved type safety. |
src/FieldArray.ts | Converted FieldArray component to TypeScript. |
src/FieldArray.test.tsx | Updated tests for FieldArray with TypeScript and React 18+ adjustments. |
rollup.config.js | Integrated TypeScript plugin and updated build configuration. |
package.json & package-scripts.js | Updated dependencies and scripts to support TypeScript. |
.babelrc.js, eslint.config.js | Switch from Flow to TypeScript presets and parser. |
GitHub workflows | Added CI and lock configuration to support new build steps. |
Comments suppressed due to low confidence (1)
src/testUtils.tsx:4
- [nitpick] Using the generic 'Function' type reduces type safety; consider specifying more precise function types for the 'mock' and 'fn' parameters.
export const wrapWith = (mock: Function, fn: Function) =>
Co-authored-by: Copilot <[email protected]>
No description provided.