Skip to content

ReadonlySet and ReadonlyMap are lacking Symbol.toStringTagΒ #60042

Open
@lionel-rowe

Description

@lionel-rowe

πŸ”Ž Search Terms

ReadonlySet, ReadonlyMap, Symbol.toStringTag

πŸ•— Version & Regression Information

This is the behavior in every version I tried, and I reviewed the FAQ for entries about ReadonlySet, ReadonlyMap, Symbol.toStringTag

⏯ Playground Link

https://www.typescriptlang.org/play/?target=99#code/C4TwDgpgBAsgrsAhsAlgOwOY0WGFgAWA9gCYByiAttALxQCiAHgMYA2cJEAPANYQhEAZrBxc4aHmiIB3NABoo4yTLQA+BXwHCAShEQkiaViGxgxEqbIVLLa1QChQkWAmToMAZXx5CpCtSg6JjYObk0hKC9gc2VZdShwnT0DIxAomNtVB3sAehyoAAFgAGcAWghGSGZgcoAnWqJa+1Z8KEQALhckVExTH2JyKlpIkEoAIyJWADpgIg9gWvcAFUQMXPyisoqqmoh6xubWsc74bvco-r8hwJHxyZm5heXV+yA

πŸ’» Code

type MutatingMapMethodName = Exclude<keyof Map<unknown, unknown>, keyof ReadonlyMap<unknown, unknown>>
type MutatingSetMethodName = Exclude<keyof Set<unknown>, keyof ReadonlySet<unknown>>

// @ts-expect-error
let a: MutatingMapMethodName = Symbol.toStringTag
// @ts-expect-error
let b: MutatingSetMethodName = Symbol.toStringTag

πŸ™ Actual behavior

Both @ts-expect-errors give Unused '@ts-expect-error' directive.(2578)

πŸ™‚ Expected behavior

Both @ts-expect-errors are used

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions