-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed as not planned
Closed as not planned
Copy link
Labels
ExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.
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
Metadata
Metadata
Assignees
Labels
ExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.