-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(types): Remove global ReadableStream override #3281
base: main
Are you sure you want to change the base?
Conversation
|
* | ||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator | ||
*/ | ||
export interface YogaReadableStreamOverride<R = any> extends ReadableStream<R> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit torn on this name. I was thinking of using ReadableStreamWithAsyncIterator
.
Would love some more perspectives on this name
A change like this could have some bad behaviors downstream. Users of the library may not realise that they rely on the override that Curious to know what level of changeset we want for this change. |
@@ -7,5 +7,6 @@ | |||
"lib": ["esnext", "DOM", "DOM.Iterable"], | |||
"allowSyntheticDefaultImports": true, | |||
"skipLibCheck": true | |||
} | |||
}, | |||
"include": ["src/*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to add this in as tsc was complaining about errors in graphql-yoga/src/server.ts
Many errors like this
> example-fastify@0.13.6 check /home/arishi/forks/graphql-yoga/examples/fastify
> tsc --pretty --noEmit
../../packages/graphql-yoga/src/server.ts:351:15 - error TS2578: Unused '@ts-expect-error' directive.
351 // @ts-expect-error Add plugins has context but this hook doesn't care
n1ru4l/envelop#2104 (comment) |
This PR attempts to solve the problem raised in n1ru4l/envelop#2104
Currently graphql-yoga overrides the
ReadableStream
interface in theglobal
namespace. This causes issues in environments like cloudflare workers where@cloudflare/worker-types
already overrides the global namespace with its own definitions ofReadableStream
among other types.