Skip to content

Unable to assign Symbol.toStringTag to a class inheriting from Uint8ArrayΒ #50923

Closed
@matthewp

Description

@matthewp

Bug Report

πŸ”Ž Search Terms

symbol.toStringTag, uint8array

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about extending builtins

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

class Bytes extends Uint8Array {
  get [Symbol.toStringTag]() {
    return 'Bytes';
  }
}

πŸ™ Actual behavior

Property '[Symbol.toStringTag]' in type 'Bytes' is not assignable to the same property in base type 'Uint8Array'.
  Type 'string' is not assignable to type '"Uint8Array"'

As far as I'm aware you can add Symbol.toStringTag to any object.

πŸ™‚ Expected behavior

No error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions