errors in node_modules after install

Open
#96 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

Start in node_modules/ecctrl/src/EcctrlJoystick.tsx at the reported lines and reproduce the install/build errors. Check the nullability of querySelector results and window.visualViewport; done means the reported TypeScript errors no longer appear after installation.

Written by the indexing model from the issue text.

Description

Compiled with problems:
×
ERROR in node_modules/ecctrl/src/EcctrlJoystick.tsx:22:11
TS2322: Type 'HTMLDivElement | null' is not assignable to type 'HTMLDivElement'.
Type 'null' is not assignable to type 'HTMLDivElement'.
20 |
21 | const [windowSize, setWindowSize] = useState({ innerHeight, innerWidth })

22 | const joystickDiv: HTMLDivElement = document.querySelector("#ecctrl-joystick")
| ^^^^^^^^^^^
23 |
24 | /**
25 | * Animation preset
ERROR in node_modules/ecctrl/src/EcctrlJoystick.tsx:119:9
TS18047: 'window.visualViewport' is possibly 'null'.
117 | joystickDiv.addEventListener("touchend", onTouchEnd)
118 |
119 | window.visualViewport.addEventListener("resize", onWindowResize)
| ^^^^^^^^^^^^^^^^^^^^^
120 |
121 | return () => {
122 | joystickDiv.removeEventListener("touchmove", onTouchMove)
ERROR in node_modules/ecctrl/src/EcctrlJoystick.tsx:124:13
TS18047: 'window.visualViewport' is possibly 'null'.
122 | joystickDiv.removeEventListener("touchmove", onTouchMove)
123 | joystickDiv.removeEventListener("touchend", onTouchEnd)
124 | window.visualViewport.removeEventListener("resize", onWindowResize)
| ^^^^^^^^^^^^^^^^^^^^^
125 | }
126 | })
127 |
ERROR in node_modules/ecctrl/src/EcctrlJoystick.tsx:163:11
TS2322: Type 'HTMLDivElement | null' is not assignable to type 'HTMLDivElement'.
Type 'null' is not assignable to type 'HTMLDivElement'.
161 | const buttonTop5Material = useMemo(() => new THREE.MeshNormalMaterial({ transparent: true, opacity: 0.5 }), [])
162 |
163 | const buttonDiv: HTMLDivElement = document.querySelector("#ecctrl-button")
| ^^^^^^^^^
164 |
165 | /**
166 | * Animation preset

Dominant language
TypeScript
Stars
823
Forks
102
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from pmndrs/ecctrl

All issues in pmndrs/ecctrl

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.