Closed tarantoj-intrepid closed 2 years ago
In the following snippet, res._data has a type of any, meaning it can be null | undefined, which do not have toString() methods, causing a runtime error. https://github.com/unjs/unenv/blob/fadb926e8827799aa0e5a33e5a5f0250f3003eac/src/runtime/fetch/call.ts#L35
any
null | undefined
toString()
Definition of the _data property is here https://github.com/unjs/unenv/blob/fadb926e8827799aa0e5a33e5a5f0250f3003eac/src/runtime/node/stream/writable.ts#L19
_data
_data should probably be typed better as either _data: unknown or _data: string | number | object | array | undefined | null to be able to catch this error at build
_data: unknown
_data: string | number | object | array | undefined | null
In the following snippet, res._data has a type of
any
, meaning it can benull | undefined
, which do not havetoString()
methods, causing a runtime error. https://github.com/unjs/unenv/blob/fadb926e8827799aa0e5a33e5a5f0250f3003eac/src/runtime/fetch/call.ts#L35Definition of the
_data
property is here https://github.com/unjs/unenv/blob/fadb926e8827799aa0e5a33e5a5f0250f3003eac/src/runtime/node/stream/writable.ts#L19_data
should probably be typed better as either_data: unknown
or_data: string | number | object | array | undefined | null
to be able to catch this error at build