We are trying to use strict null safety and are noticing that undefined is sometimes being passed in for the node arg on onExit, addEndListener, and other related exit/enter callbacks, but the type definition says that node will never be nullable:
I'm wondering if either undefined shouldn't be passed in for node, or if the typing can be updated to represent the behavior maybe something like this (not sure if that's the right way to solve it):
What is the current behavior?
Hello! 👋
I'm not sure if I should make this issue here or in https://github.com/DefinitelyTyped/DefinitelyTyped, but I'm starting here.
We are trying to use strict null safety and are noticing that
undefined
is sometimes being passed in for thenode
arg ononExit
,addEndListener
, and other related exit/enter callbacks, but the type definition says thatnode
will never be nullable:Source: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/6ae2e4769cf67e9e4527fa881116c3d58b43324d/types/react-transition-group/Transition.d.ts#L12-L24
What is the expected behavior?
I'm wondering if either
undefined
shouldn't be passed in for node, or if the typing can be updated to represent the behavior maybe something like this (not sure if that's the right way to solve it):Could you provide a CodeSandbox demo reproducing the bug?
https://codesandbox.io/p/sandbox/transition-undefined-node-arg-g24fgt?file=%2Fsrc%2FDemo.tsx
Thank you!