DEP0195:在没有 new 的情况下实例化 node:http 类


\DEP0195: Instantiating node:http classes without new

版本历史
版本变更
v24.2.0

仅文档弃用。

类型:仅文档

\Type: Documentation-only

不推荐使用 node:http 模块导出的没有 new 限定符的类实例化。建议改用 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.

可自动迁移 (source):

\An automated migration is available (source):

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

AltStyle によって変換されたページ (->オリジナル) /