Skip to content
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

[BUG] Altair Fastify plugin not compatible with nodenext #2666

Closed
1 task done
kingston opened this issue Oct 1, 2024 · 1 comment · May be fixed by #2667
Closed
1 task done

[BUG] Altair Fastify plugin not compatible with nodenext #2666

kingston opened this issue Oct 1, 2024 · 1 comment · May be fixed by #2667

Comments

@kingston
Copy link

kingston commented Oct 1, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Using the Fastify plugin in an ESM Fastify app results in a Typescript build error.

src/plugins/graphql/index.ts:147:28 - error TS2769: No overload matches this call.
  Overload 1 of 3, '(plugin: FastifyPluginCallback<{ path: string; baseURL: string; endpointURL: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
    Argument of type 'typeof import("/.../node_modules/.pnpm/[email protected][email protected]/node_modules/altair-fastify-plugin/dist/index")' is not assignable to parameter of type 'FastifyPluginCallback<{ path: string; baseURL: string; endpointURL: string; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.

Expected Behavior

The plugin should be able to be used with ESM enabled.

Steps To Reproduce

Set "type": "module" in your package.json and add typescript support.

import AltairFastify from 'altair-fastify-plugin';
import Fastify from 'fastify';

const app = Fastify();

app.register(AltairFastify);

Environment

- OS: Mac
- Browser: N/A
- Platform: Node.JS
- Version: 20

Additional context

Fastify has fixed their plugins using the "infamous triplet" with module.exports (fastify/fastify#4349). Ideally it can be applied to this plugin so it supports both CJS/ESM seamlessly.

@imolorhe
Copy link
Collaborator

We can mark this as closed now?

@imolorhe imolorhe closed this as completed Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants