get-convex / get-convex/uploadstuff
Type Error in `@xixixao/uploadstuff` - `useEvent.ts:38:21`
- Dominant language
- TypeScript
- Stars
- 26
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
**Description:**
A type error occurs in the `@xixixao/uploadstuff` package, specifically in the `useEvent.ts` file, when attempting to build or run the application. The error message indicates that a `useRef` call is missing a required argument.
**Error Details:**
```
./node_modules/.pnpm/@xixixao+uploadstuff@0.0.5_react-dropzone@14.3.5_react@19.0.0__react@19.0.0_typescript@5.7.2/node_modules/@xixixao/uploadstuff/lib/useEvent.ts:38:21
Type error: Expected 1 arguments, but got 0.
36 | // Create a stable callback that always calls the latest callback:
37 | // using useRef instead of useCallback avoids creating and empty array on every render
> 38 | const stableRef = useRef();
| ^
39 | if (!stableRef.current) {
40 | stableRef.current = function (this: unknown) {
41 | // eslint-disable-next-line @typescript-eslint/no-unsafe-return, prefer-rest-params, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
```
**Steps to Reproduce:**
1. Install the `@xixixao/uploadstuff` package, version `0.0.5`, with dependencies including:
- `react-dropzone@14.3.5`
- `react@19.0.0`
- `typescript@5.7.2`
2. Attempt to build or run the project.
3. Observe the type error in the `useEvent.ts` file at line 38.
**Expected Behavior:**
The code should compile and run without type errors.
**Environment:**
- Node.js version: 22
- npm version: 10
- `pnpm` version: 9.15
- Operating System: macOS Sequoia 15.1.1
**Additional Information:**
The issue seems related to the usage of `useRef` without an initial argument, which is required for proper typing in TypeScript. Providing a default value or ensuring compatibility with the expected type might resolve the issue.
**Simple Fix:**
```
const stableRef = useRef(null);
```
Would be nice to fix this without needing to patch the module.
Contributor guide
No contributing guide indexed for this repository
Research direction
Inspect lib/useEvent.ts at line 38, starting with the useRef call and its TypeScript error under the listed React and TypeScript versions. Verify the change by building or running the package with the reported dependencies; done means the type error no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100