Skip to content
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

Generic type YEvent<T> requires 1 type argument(s) #3

Merged
merged 1 commit into from Apr 26, 2022

Conversation

kculmback-eig
Copy link
Contributor

We have just imported immer-yjs into our project (and has been great so far!), but it is causing our build to fail. (Even with skipModuleCheck: true set in tsconfig, which is odd and we need to figure out)

The issue stems from the YEvent type needing a type argument.

../../node_modules/.pnpm/immer-yjs@0.1.4_immer@9.0.12+yjs@13.5.34/node_modules/immer-yjs/src/immer-yjs.ts:11:59 - error TS2314: Generic type 'YEvent<T>' requires 1 type argument(s).

11 function applyYEvent<T extends JSONValue>(base: T, event: Y.YEvent) {
                                                             ~~~~~~~~

../../node_modules/.pnpm/immer-yjs@0.1.4_immer@9.0.12+yjs@13.5.34/node_modules/immer-yjs/src/immer-yjs.ts:49:64 - error TS2314: Generic type 'YEvent<T>' requires 1 type argument(s).

49 function applyYEvents<S extends Snapshot>(snapshot: S, events: Y.YEvent[]) {
                                                                  ~~~~~~~~

../../node_modules/.pnpm/immer-yjs@0.1.4_immer@9.0.12+yjs@13.5.34/node_modules/immer-yjs/src/immer-yjs.ts:52:45 - error TS7006: Parameter 'obj' implicitly has an 'any' type.

52             const base = event.path.reduce((obj, step) => {
                                               ~~~

../../node_modules/.pnpm/immer-yjs@0.1.4_immer@9.0.12+yjs@13.5.34/node_modules/immer-yjs/src/immer-yjs.ts:52:50 - error TS7006: Parameter 'step' implicitly has an 'any' type.

52             const base = event.path.reduce((obj, step) => {
                                                    ~~~~

../../node_modules/.pnpm/immer-yjs@0.1.4_immer@9.0.12+yjs@13.5.34/node_modules/immer-yjs/src/immer-yjs.ts:195:31 - error TS2314: Generic type 'YEvent<T>' requires 1 type argument(s).

195     const observer = (events: Y.YEvent[]) => {
                                  ~~~~~~~~

Found 5 errors in the same file, starting at: ../../node_modules/.pnpm/immer-yjs@0.1.4_immer@9.0.12+yjs@13.5.34/node_modules/immer-yjs/src/immer-yjs.ts:11

Adding a generic type argument of any fixes the the type issue. If there is a better type argument, I would be happy to update the PR with it!

@sep2
Copy link
Owner

sep2 commented Apr 26, 2022

Thanks for reporting this! It looks good to me. I will release a new version tomorrow.

@sep2 sep2 merged commit 0563f4e into sep2:main Apr 26, 2022
@sep2
Copy link
Owner

sep2 commented Apr 26, 2022

Btw, did you try "skipLibCheck": true?

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.

None yet

2 participants