-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(console): deprecate Deno.customInspect #10035
Conversation
op_crates/console/02_console.js
Outdated
return String(value[customInspect]()); | ||
} | ||
// This non-unique symbol is used to support op_crates, ie. | ||
// in op_crates/web we don't want to depend on unique "Deno.customInspect" | ||
// symbol defined in the public API. Internal only, shouldn't be used | ||
// by users. | ||
const nonUniqueCustomInspect = Symbol.for("Deno.customInspect"); | ||
if ( | ||
nonUniqueCustomInspect in value && | ||
typeof value[nonUniqueCustomInspect] === "function" | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this logic means that Deno.customInspect
will stop working. I think we should still support it until 2.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The non-unique custom inspect which we use for op crates implementations should be renamed to something else since the public custom inspect symbol has stolen its name. We handle the internal one with its own logic (i.e. pass it the inspect()
function as an arg) so the difference should be preserved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should always pass the inspect
function as an arg - even for the public one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I'll rename internal one to something else and keep the different handlings of public one and internal one.
@kt3k could you please update |
@bartlomieju Sure. I'll try. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint rule has already landed in denoland/deno_lint#748 so this is ready to land. Looks good to me
This PR deprecates
Deno.customInspect
as suggested in #9294 and suggests usingSymbol.for("Deno.customInspect")
instead.ref #9294