Closed as not planned
Closed as not planned
Description
Bug Report
🔎 Search Terms
cjs typescript nodenext default export
🕗 Version & Regression Information
4.7.0-dev
While using nodenext with pure cjs modules, such as https://github.com/fastify/fastify-cookie or https://github.com/fastify/fastify-static , types are lost when using default export and cjs named export is prohibited
⏯ Playground Link
Playground link with relevant code
💻 Code
import fastifyCookie from 'fastify-cookie';
import fastifyStatic from 'fastify-static';
app.register(fastifyCookie);
app.register(fastifyStatic);
🙁 Actual behavior
import fastifyCookie
Argument of type 'typeof import("/.../node_modules/fastify-cookie/plugin")' is not assignable to parameter of type 'FastifyPluginCallback<any, Server> | FastifyPluginAsync<any, Server> | Promise<{ default: FastifyPluginCallback<any, Server>; }> | Promise<...>'.ts(2345)
🙂 Expected behavior
Type should not be lost while import
Can be workaround by
import { default as fastifyCookie } from 'fastify-cookie';
import { default as fastifyStatic } from 'fastify-static';
But i'm not sure if that's expected or not