DEP0195:未使用 new 实例化 node:http 类


【DEP0195: Instantiating node:http classes without new

类型:仅文档

【Type: Documentation-only】

不使用 new 关键字实例化由 node:http 模块导出的类已被弃用。建议改为使用 new 关键字。这适用于所有 HTTP 类,如 OutgoingMessageIncomingMessageServerResponseClientRequest

【Instantiating classes without the new qualifier exported by the node:http module is deprecated. It is recommended to use the new qualifier instead. This applies to all http classes, such as OutgoingMessage, IncomingMessage, ServerResponse and ClientRequest.】

提供了自动迁移(来源):

【An automated migration is available (source):】

npx codemod@latest @nodejs/http-classes-with-new