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

TypeScript Error: Movement is not part of state #501

Closed
do-kevin opened this issue Jun 2, 2022 · 8 comments
Closed

TypeScript Error: Movement is not part of state #501

do-kevin opened this issue Jun 2, 2022 · 8 comments
Assignees

Comments

@do-kevin
Copy link

do-kevin commented Jun 2, 2022

Information:

  • Use Gesture version: ^10.2.4
  • TypeScript

Bug
I am getting an error complaining about state's movement. I've tried removing my node_modules and upgrading the package, but it still shows up. movement is still part of state on my console.log.

On hover, it says

Property 'movement' does not exist on type 'Omit<SharedGestureState & CommonGestureState & { axis: "x" | "y" | undefined; xy: Vector2; } & { _pointerId?: number | undefined; ... 7 more ...; swipe: Vector2; } & { ...; }, "event"> & { ...; }'.

Screenshots
gesture linting bug
console

@dbismut
Copy link
Collaborator

dbismut commented Jun 3, 2022

@dbismut dbismut closed this as completed Jun 3, 2022
@linonetwo
Copy link

linonetwo commented Jul 6, 2022

截屏2022-07-06 23 25 44
截屏2022-07-06 23 26 18

Simillar issue here.

And when passed to animated.mesh:

ClipboardEventHandler<EventTarget> | undefined; ... 156 more ...; position: Vector3; }' is not assignable to type 'AnimatedProps<Omit<ExtendedColors<Overwrite<Partial<Mesh<BufferGeometry, Material | Material[]>>, NodeProps<Mesh<BufferGeometry, Material | Material[]>, typeof Mesh>>>, NonFunctionKeys<...>> & { ...; } & EventHandlers>'.
  Types of property 'onClick' are incompatible.
    Type 'MouseEventHandler<EventTarget> | undefined' is not assignable to type '((event: ThreeEvent<MouseEvent>) => void) | undefined'.
      Type 'MouseEventHandler<EventTarget>' is not assignable to type '(event: ThreeEvent<MouseEvent>) => void'.
        Types of parameters 'event' and 'event' are incompatible.
          Type 'IntersectionEvent<MouseEvent>' is missing the following properties from type 'MouseEvent<EventTarget, MouseEvent>': altKey, button, buttons, clientX, and 27 more.ts(2322)

@dbismut
Copy link
Collaborator

dbismut commented Jul 6, 2022

I won't reopen without a sandbox.

@cuppachino
Copy link

I was able to recreate the issue by selecting "Use VS Code's Version 4.8.0-dev.20220714" over the workspace version, which in my case was 4.7.4

in the status bar, left of your selected language mode, click the curly braces.
image

image

The fix is to your workspace version.

@dbismut
Copy link
Collaborator

dbismut commented Aug 28, 2022

@cuppachino seems like TS 4.8 does introduce this bug. I'm not sure why tbh.

image

@dbismut
Copy link
Collaborator

dbismut commented Aug 28, 2022

Here's a minimal repro on TS Playground.

It seems to be linked to the NonNullable type / making drag and pinch optional in state.
Deactivating strictNullChecks fixes it for TS 4.8.

@dbismut
Copy link
Collaborator

dbismut commented Aug 28, 2022

Ok after some investigation, this is because of the simplification of the NonNullable mapped type.

// Native NonNullable Utility Type

// definition on 4.7 and lower
type NonNullable<T> = T extends null | undefined ? never : T

// definition from 4.8 
type NonNullable<T> = T & {}

Fix is incoming (at least I hope).

@dbismut
Copy link
Collaborator

dbismut commented Aug 30, 2022

Should be now fixed in 10.2.19.

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

No branches or pull requests

4 participants