Closed ianobermiller closed 1 year ago
Hi @ianobermiller, I really didn't expect such behavior, thanks for the PR :)
As for the undefined, I tried to keep aligned with the typescript version of react-relay DefinitelyTyped/DefinitelyTyped/react-relay/relay-hooks/useFragment
Do you think there's a problem there too?
I'm not entirely sure what you mean. Adding undefined
to the types in this repo brings it in line with the DefinitelyTyped types as well, so that seems good.
Hi @ianobermiller, this PR was released with version 8.0.2 https://github.com/relay-tools/relay-hooks/releases/tag/v8.0.2
Yay, thank you!
When you have an overloaded function the declaration doesn't emit type on the function body, so you have to duplicate it.
Practically speaking, usePagination does not allow
null
in TypeScript with the current release because that definition is not emitted.While I was modifying these, I made them also accept
undefined
which you often get from Relay generated types. It is handled the same as null.Test Plan
npm run compile
lib/usePagination.d.ts
has ausePagination
definition that accepts null/undefined for the fragmentRef