-
Notifications
You must be signed in to change notification settings - Fork 583
Closed
Labels
Description
Describe the bug
I'm following the instruction to create a minimum GraphQL server locally https://the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-bun
import { createSchema, createYoga } from "graphql-yoga";
const yoga = createYoga({
schema: createSchema<{}>({
typeDefs: /* GraphQL */ `
type Query {
greetings: String
}
`,
resolvers: {
Query: {
greetings: () => "Hello from Yoga in a Bun app!",
},
},
}),
});
const server = Bun.serve(yoga);
console.info(
`Server is running on ${new URL(
yoga.graphqlEndpoint,
`http://${server.hostname}:${server.port}`
)}`
);It runs successfully and I can see graphiql UI at http://localhost:3000/graphql
However, I'm encountering this type error when performing typescript type checking:
index.ts:18:26 - error TS2345: Argument of type 'YogaServerInstance<{}, {}>' is not assignable to parameter of type 'Serve<unknown>'.
Type 'YogaServerInstance<{}, {}>' is not assignable to type 'UnixTLSWebSocketServeOptions<unknown>'.
18 const server = Bun.serve(yoga);
~~~~
Found 1 error in index.ts:18Your Example Website or App
https://the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-bun
Steps to Reproduce the Bug or Issue
- Install Bun by following https://bun.sh/docs/installation
- Create a new directory and
bun init bun add graphql-yoga graphql typescript- Copy the example code from https://the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-bun to
index.ts bun run index.tsshould work just finetscwill show the error.
Expected behavior
I expect there is no TS errors.
Screenshots or Videos
No response
Platform
- macOS
- Bun 1.0.2
- graphql-yoga 4.0.4, typescript 5.2.2
Additional context
Thanks!