-
-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Is your feature request related to a problem? Please describe.
I have a TypeScript project with exactOptionalPropertyTypes: true. When I use graphql-yoga, I get a tsc error because Yoga’s type has url?: string | undefined while NodeRequest (this package) has url?: string.
Describe the solution you'd like
I would like this package to update its optional typing to include | undefined.
Describe alternatives you've considered
- Turn off
exactOptionalPropertyTypes - Use
@ts-ignore - Open the opposite request with graphql yoga (remove the
| undefined)
Additional context
I really like the idea of exactOptionalPropertyTypes, but I have found it hard to adopt given cases such as this one. When I write “library” code with options objects, I usually do foo?: Foo | undefined for compatibility, and reserve the specific ? or | undefined for non-options function inputs (for example: path?: string vs. path: string | undefined) or for my own application code to refactor.
Open to general thoughts on exactOptionalPropertyTypes, including if the existing types without | undefined are better.
If accepted, it seems like an easy PR to do myself.