elysiajs / elysia-apollo

Plugin for Elysia for using GraphQL Apollo
MIT License
3 stars 6 forks source link

Error when using Apollo plugins. #3

Open PS1TD opened 1 year ago

PS1TD commented 1 year ago

Trying to disable the disbale the Apollo playground.

Setting enablePlayground: false weirdly disables the playground but enables the Apollo Sandbox.

Looking into how to disable sandbox i found that Apollo just accepts plugins to disable or change the behavior of the Sandbox.

When I try

new Elysia()
    .use(
        apollo({
            path: "/test",
            enablePlayground: false,
            typeDefs,
            resolvers,
            plugins: [
                // Install a landing page plugin based on NODE_ENV
                process.env.NODE_ENV === "production"
                    ? ApolloServerPluginLandingPageProductionDefault({
                            graphRef: "my-graph-id@my-graph-variant",
                            footer: false,
                      })
                    : ApolloServerPluginLandingPageLocalDefault({ footer: false }),
            ],
        })
    )
    .listen(3000)

I get error

Type 'import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").ApolloServerPlugin<import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/context").BaseContext>' is not assignable to type 'import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").ApolloServerPlugin<import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/context").BaseContext>'.
  Types of property 'serverWillStart' are incompatible.
    Type '((service: import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerContext) => Promise<void | import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerListener>) | undefined' is not assignable to type '((service: import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerContext) => Promise<...>) | undefined'.
      Type '(service: import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerContext) => Promise<void | import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerListener>' is not assignable to type '(service: import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerContext) => Promise<...>'.
        Type 'Promise<void | import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerListener>' is not assignable to type 'Promise<void | import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerListener>'.
          Type 'void | import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerListener' is not assignable to type 'void | import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerListener'.
            Type 'GraphQLServerListener' is not assignable to type 'void | GraphQLServerListener'.
              Type 'import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerListener' is not assignable to type 'import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").GraphQLServerListener'.
                Types of property 'renderLandingPage' are incompatible.
                  Type '(() => Promise<import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").LandingPage>) | undefined' is not assignable to type '(() => Promise<import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").LandingPage>) | undefined'.
                    Type '() => Promise<import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").LandingPage>' is not assignable to type '() => Promise<import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").LandingPage>'.
                      Type 'Promise<import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").LandingPage>' is not assignable to type 'Promise<import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").LandingPage>'.
                        Type 'import("/home/user/Desktop/BunElysiaApollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").LandingPage' is not assignable to type 'import("/home/user/Desktop/BunElysiaApollo/node_modules/@elysiajs/apollo/node_modules/@apollo/server/dist/esm/externalTypes/plugins").LandingPage'.
                          Types of property 'html' are incompatible.
                            Type 'string | (() => Promise<string>)' is not assignable to type 'string'.
                              Type '() => Promise<string>' is not assignable to type 'string'.
asharnadeem commented 5 months ago

+1, any resolution here?