#using Console#table when writing to stderr in NodeJS

5 messages · Page 1 of 1 (latest)

drifting ore
#

I used to be able to use the table function on stderr by constructing a new console object (new Console(process.stderr)) and then using .table() on that.

However, after updating my types, this fails, because the constructor expects NodeJS.WritableStream and process.stderr is of type NodeJS.WriteStream & { fd: 2; }. these are apparently incompatible because the latter is missing 8 properties. I'm not sure if the types are broken, or if something changed. I can't find anything about this online.

(I'd also be happy with an alternative method that doesn't involve creating a new console object, but that wouldn't really be related to TypeScript anymore.)

worn summit
twilit socket
#

Should probably state your @node/types versions

drifting ore
#

I'm using @node/types 22.5.0, and typescript 5.5.4. I downgraded typescript to 5.4.5 to fix other issues I had with a library, which magically also made this error disappear.

it's really weird that it works in the TS playground though. does it also use the latest version of @types/node?

#

technically this is "fixed" now on my end, I don't need the latest version of TS. so I guess I can close this for now - but it's still weird