Skip to content

Convert project from JavaScript to TypeScript Stage#184

Merged
jpaladin merged 27 commits into
masterfrom
stage
May 28, 2026
Merged

Convert project from JavaScript to TypeScript Stage#184
jpaladin merged 27 commits into
masterfrom
stage

Conversation

@jpaladin

Copy link
Copy Markdown
Contributor

No description provided.

dependabot Bot and others added 19 commits February 9, 2026 05:41
Bumps [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) from 3 to 5.
- [Release notes](https://github.com/peter-evans/create-or-update-comment/releases)
- [Commits](peter-evans/create-or-update-comment@v3...v5)

---
updated-dependencies:
- dependency-name: peter-evans/create-or-update-comment
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4 to 6.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](actions/setup-node@v4...v6)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 19.2.10 to 19.2.14.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

---
updated-dependencies:
- dependency-name: "@types/react"
  dependency-version: 19.2.14
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [cypress](https://github.com/cypress-io/cypress) from 15.9.0 to 15.13.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/CHANGELOG.md)
- [Commits](cypress-io/cypress@v15.9.0...v15.13.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-version: 15.13.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
…e/actions/setup-node-6

Bump actions/setup-node from 4 to 6
- Convert src/validationFunctions.js → src/validationFunctions.ts
- Convert src/formUtils.js → src/formUtils.ts
- Convert src/useValidation.js → src/useValidation.ts
- Convert src/index.js → src/index.ts with type re-exports
- Remove manual types/index.d.ts (now auto-generated via vite-plugin-dts)
- Add tsconfig.json with strict mode
- Update vite.config.js to use .ts entry and dts plugin
- Update package.json types field to point to dist/index.d.ts
- Add typescript and vite-plugin-dts as dev dependencies
- Update cypress test imports to remove .js extensions

Agent-Logs-Url: https://github.com/Enterwell/react-form-validation/sessions/024b1f72-0daf-4fca-813d-93f6e09775eb

Co-authored-by: AleksandarDev <[email protected]>
…cypress-15.13.0

Bump cypress from 15.9.0 to 15.13.0
…e/peter-evans/create-or-update-comment-5

Bump peter-evans/create-or-update-comment from 3 to 5
…types/react-19.2.14

Bump @types/react from 19.2.10 to 19.2.14
…ect-to-typescript

# Conflicts:
#	pnpm-lock.yaml
…escript

Convert project from JavaScript to TypeScript
@github-actions

Copy link
Copy Markdown

@jpaladin Version should be bumped!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 migrates the library codebase from JavaScript to TypeScript and updates the build/package outputs to publish both ESM and CJS bundles along with generated type declarations.

Changes:

  • Added TypeScript sources (*.ts) and tsconfig.json, removing the hand-written types/index.d.ts.
  • Updated Vite library build to emit both index.mjs and index.cjs, and added vite-plugin-dts to generate dist/index.d.ts.
  • Updated package metadata (main/module/types/exports) and refreshed related dev dependencies and GitHub Actions versions.

Reviewed changes

Copilot reviewed 11 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vite.config.js Adds vite-plugin-dts and switches library entry to src/index.ts; outputs both ESM and CJS.
types/index.d.ts Removes manually maintained declarations in favor of generated typings.
tsconfig.json Introduces TypeScript compiler configuration for the project.
src/validationFunctions.ts TypeScript port of validation helpers with JSDoc.
src/validationFunctions.js Removes the JavaScript implementation after TS migration.
src/useValidation.ts Adds exported public types (FieldConfig, Field, Fields) and generic hook typing.
src/index.ts Re-exports runtime APIs and newly exported public types.
src/formUtils.ts Adds stronger typings (including ExtractedValues) and TS ports of form utilities.
package.json Updates output entry points and introduces conditional exports; adds TS + dts plugin dev deps.
pnpm-lock.yaml Locks new/updated dependencies (TypeScript, vite-plugin-dts, etc.).
cypress/components/localRemoteValidation.cy.jsx Updates imports to align with TS source paths.
.github/workflows/version-check.yml Updates action version used for PR commenting.
.github/workflows/npm-publish.yml Updates actions/setup-node major version.
.github/workflows/build.yml Updates actions/setup-node major version.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

src/formUtils.ts:127

  • submitForm currently doesn't declare a return type, so TypeScript will infer it as unknown | Promise<unknown> (losing the ability to reflect the actual onSubmit return type and the undefined case when the form is invalid). Consider adding a generic for the submit return type (e.g., <TReturn, ...>(..., onSubmit: (...) => TReturn) => TReturn | Promise<TReturn> | undefined) and typing the new Promise accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/validationFunctions.ts Outdated
Comment thread package.json Outdated
jpaladin and others added 6 commits May 27, 2026 14:16
jpaladin and others added 2 commits May 27, 2026 15:01
@jpaladin jpaladin requested review from DorijanH and radovix May 27, 2026 13:16
@jpaladin jpaladin marked this pull request as draft May 27, 2026 13:30
@jpaladin jpaladin marked this pull request as ready for review May 27, 2026 13:33
@jpaladin jpaladin merged commit 927170c into master May 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants