https://github.com/denoland/deno/pull/826#discussion_r473451844
this null treated as default to 2 is different with node:
in Node this null is treated as unlimited depth
> var o = { a: { b: { c: { d: new Date } } } };
undefined
> console.log(o)
{ a: { b: { c: [Object] } } }
> console.dir(o, { depth: null });
{
a: { b: { c: { d: 2020-08-19T23:55:58.009Z } } }
}
I don't mean it should be exactly same as Node implementation, but better to be
I think console.dir(o, { depth: Infinity }); is more expressive than null
CC @nayeemrmn what's your take on this one?
Let's see... an explicit { depth: null } violates the type definition of Deno.InspectOptions. When something violates our types, we let it be undefined behaviour at runtime (except for web APIs). That applies here, Deno.inspect(value, { depth: null }) (and by extension console.dir(value, { depth: null })) is not supported.
I think
console.dir(o, { depth: Infinity });is more expressive thannull
I agree. Rather than adding null to the types to match Node, let's wontfix this.
I agree with @nayeemrmn, closing as won't fix.
Most helpful comment
Let's see... an explicit
{ depth: null }violates the type definition ofDeno.InspectOptions. When something violates our types, we let it be undefined behaviour at runtime (except for web APIs). That applies here,Deno.inspect(value, { depth: null })(and by extensionconsole.dir(value, { depth: null })) is not supported.I agree. Rather than adding
nullto the types to match Node, let's wontfix this.