[FEATURE]: Converts the package to typescript. - #127
Open
pravton wants to merge 14 commits into
Open
Conversation
pravton
requested review from
NicholasLancey,
andrewrubin,
consolecmnd,
liamegan,
marlonmarcello,
meteoratlas and
saugatmalla
August 25, 2026 00:22
There was a problem hiding this comment.
Pull request overview
Converts the @wethegit/react-gallery package source and build pipeline to TypeScript, adding type exports and updating docs/examples to support TS consumers while keeping runtime behavior largely the same.
Changes:
- Migrates library entry points, components, hooks, and utilities from JS/JSX to TS/TSX and adds shared type definitions.
- Updates Vite build to use a TS entry and generate
.d.tsoutput; adds a stricttsconfig.json. - Updates package metadata and README to publish/describe the new TypeScript typings and usage examples.
Reviewed changes
Copilot reviewed 21 out of 24 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Adds vite-plugin-dts and switches lib entry to src/lib/index.ts. |
| tsconfig.json | Introduces strict TS compiler settings for the repo. |
| src/main.tsx | Updates example app to TS and adjusts React root initialization. |
| src/lib/utils/classnames.ts | Replaces JS utility with typed TS implementation. |
| src/lib/utils/classnames.js | Removes old JS classnames implementation. |
| src/lib/types/types.ts | Adds shared exported type definitions for components/hooks. |
| src/lib/types/css-modules.d.ts | Adds TS module declarations for CSS modules. |
| src/lib/index.ts | Adds typed public exports (components + types). |
| src/lib/index.js | Removes old JS index exports. |
| src/lib/hooks/use-gallery.tsx | Adds generic return typing for the useGallery hook. |
| src/lib/components/gallery-pagination.tsx | Migrates pagination component to TS with typed render props. |
| src/lib/components/gallery-pagination.jsx | Removes old JSX pagination component. |
| src/lib/components/gallery-pagination-item.tsx | Migrates pagination item to TS and adds click arg typing. |
| src/lib/components/gallery-pagination-item.jsx | Removes old JSX pagination item. |
| src/lib/components/gallery-nav.tsx | Migrates nav component to TS with typed render prop and props. |
| src/lib/components/gallery-main.tsx | Migrates main component to TS with generics and typed pointer events/styles. |
| src/lib/components/gallery-item.tsx | Migrates item component to TS with typed props and style casting. |
| src/lib/components/gallery-context.tsx | Migrates context/provider to TS with typed context value + props. |
| README.md | Adds JS + TS usage examples and updates type references in docs. |
| package.json | Adds types export and introduces TS-related dev tooling/scripts. |
| package-lock.json | Updates lockfile for new TS/dts/eslint dependencies and versioning. |
| .eslintrc | Adds TypeScript ESLint configuration. |
| .changeset/six-nails-tease.md | Adds changeset for the TypeScript conversion + docs updates. |
| .changeset/pre.json | Enables Changesets pre-release mode for a beta tag. |
Suppressed comments (6)
src/main.tsx:2
Rootis only used as a type; import it as type-only to avoid relying on tooling to erase it (and to prevent potential runtime named-import issues).
src/main.tsx:105- Typo in comment: "re-intializing" → "re-initializing".
src/lib/components/gallery-context.tsx:98 goToIndexcurrently treats falsy items (e.g.,0,"",false) as if the index is invalid because it checks!items[index]. Sinceitemsis generic (T[]), this should validate index bounds instead of item truthiness.
This issue also appears on line 114 of the same file.
src/lib/components/gallery-context.tsx:116
- This effect has the same falsy-item issue as
goToIndex(!items[activeIndex]). IfTcan be falsy, this may incorrectly reset the gallery. Prefer an index bounds check.
README.md:67 - Spelling/capitalization: "Javascript" should be "JavaScript".
#### Usage: Javascript
README.md:125
- Spelling/capitalization: "Typescript" should be "TypeScript".
#### Usage: Typescript
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
8
to
12
| "plugin:react-hooks/recommended", | ||
| "prettier" | ||
| "prettier", | ||
| ], | ||
| "parser": "@typescript-eslint/parser", | ||
| "parserOptions": { "ecmaVersion": "latest", "sourceType": "module" }, |
Comment on lines
+70
to
74
| "@typescript-eslint/eslint-plugin": "^8.67.0", | ||
| "@typescript-eslint/parser": "^8.67.0", | ||
| "@vitejs/plugin-react-swc": "^4.3.3", | ||
| "eslint": "^8.5.7", | ||
| "eslint-config-prettier": "~9.1.0", |
| > | ||
| <Tag | ||
| className={buttonClassName} | ||
| aria-current={active ? "true" : null} |
| "@wethegit/react-gallery": minor | ||
| --- | ||
|
|
||
| - Converts the package to typscript. |
| - Accessibility. Built with careful attention to focus management and assistive technology. | ||
| - Fully-customizable layouts, using CSS Custom Properties. | ||
| - Provides a custom React hook for accessing gallery data, state, updater functions, and more. Build anything on top of the existing gallery components! | ||
| - Written in typescript |
Comment on lines
+4
to
+7
| "initialVersions": { | ||
| "@wethegit/react-gallery": "5.0.0" | ||
| }, | ||
| "changesets": [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task: https://wethecollective.teamwork.com/app/tasks/25795363
Description.
Converts the package to TypeScript.
Additional notes
pre.jsonis included with the changeset.