DEV Community

Discussion on: Check for extraneous props in React (and save hours of debugging)

Collapse
devinrhode2 profile image
Devin Rhode

I need this but for typescript. Even TS 4.1.2 takes in extra unknown props without issues :(

Collapse
vvo profile image
Vincent Voyer Author

Hm actually I jumped into the TypeScript wagon today and had good surprises: it does check for extraneous props as long as you type props of your own components.

Example:

Collapse
devinrhode2 profile image
Devin Rhode

Wow it actually does work... codesandbox.io/s/warn-against-extr...
Our tooling in our project needs to get updated... It's using some older CRA but I want to just use Next.js. Of coruse, we'd have to tell Next.js "Our whole App component should not be server-side rendered" via the component wrapper, but it'd be much easier to stay on the bleeding edge that way