diff --git a/source/core/index.ts b/source/core/index.ts index 12c98d213..d5a7aa754 100644 --- a/source/core/index.ts +++ b/source/core/index.ts @@ -490,7 +490,7 @@ export default class Request extends Duplex implements RequestEvents { this._request.end((error?: Error | null) => { // eslint-disable-line @typescript-eslint/ban-types // The request has been destroyed before `_final` finished. // See https://github.com/nodejs/node/issues/39356 - if ((this._request as any)._writableState?.errored) { + if ((this._request as any)?._writableState?.errored) { return; }