mattpocock / mattpocock/ts-reset

Incompatible with immer-yjs

Open
#181 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
8.6k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

Love this project. Unfortunately, I tried installing this on a project at work and it collided with immer-yjs:

https://github.com/sep2/immer-yjs/blob/main/packages/immer-yjs/src/immer-yjs.ts#L39C78-L39C78

../node_modules/immer-yjs/src/immer-yjs.ts:39:64 - error TS2345: Argument of type '(v: JSONValue | YMap<any> | YArray<any>) => JSONValue' is not assignable to parameter of type '(value: unknown, index: number, array: unknown[]) => JSONValue'.
  Types of parameters 'v' and 'value' are incompatible.
    Type 'unknown' is not assignable to type 'JSONValue | YMap<any> | YArray<any>'.

39                     arr.splice(retain, 0, ...change.insert.map(toPlainValue))
                                                                  ~~~~~~~~~~~~


Found 1 error in ../node_modules/immer-yjs/src/immer-yjs.ts:39

I have "skipLibCheck": true, in my tsConfig and "exclude": [ ..., "node_modules", "../node_modules" ...]

Is there something I'm missing here. For now I can't use it as is, which is a pity since it's super great!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the TypeScript error from the linked immer-yjs source at packages/immer-yjs/src/immer-yjs.ts:39 with ts-reset installed. Inspect the relevant array and JSON/Yjs typings and verify how skipLibCheck affects the dependency; done means the reported project compiles without the TS2345 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.