Skip to content

Question: Should Streams have the prototype for Symbol.toStringTag and toString declared? #952

@ThisIsMissEm

Description

@ThisIsMissEm

In certain implementations of whatwg streams, I've come across them not implementing toString or Symbol.toStringTag on the prototype meaning that if you're trying to find out if you've been given a stream (or another data type) then you have to rely on duck typing.

In the following, I'd expect to see "[object ReadableStream]" returned:

let r = new ReadableStream()
// ReadableStream {}
r.toString()
// "[object Object]"
> Object.prototype.toString.call(r)
// "[object Object]"

In Safari these all return as I'd expect, in Chrome and Firefox they return "[object Object]". The spec doesn't actually specify the toString behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions