Skip to content

Working with ES6 Sets in Typescript #3069

Closed
@robianmcd

Description

@robianmcd

The constructor for an ES6 Set takes an optional iterable parameter (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) but the declaration in lib.d.ts doesn't include it

declare var Set: {
    new <T>(): Set<T>;
}

So I'm getting a Typescript error if I try to do something like new Set([1,2,3]).

On a somewhat related note I'm using the 1.5 Beta version of typescript which supports a lot of ES6 features but it still relies on the browser to support Sets. Are there plans polyfill Sets in Typescript?

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions