Skip to content

Missing methods from SetIterator<T> #1600

@musjj

Description

@musjj
const a = ["foo", "bar"];
a.every((v) => typeof v === "string");

const b = new Set(["foo", "bar"]);
const values = b.values().toArray();
values.every((v) => typeof v === "string");

const c = new Set(["foo", "bar"]);
c.values().every((v) => typeof v === "string");

The code compiles to:

local ____lualib = require("lualib_bundle")
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
local Set = ____lualib.Set
local __TS__New = ____lualib.__TS__New
local ____exports = {}
local a = {"foo", "bar"}
__TS__ArrayEvery(
    a,
    function(____, v) return type(v) == "string" end
)
local b = __TS__New(Set, {"foo", "bar"})
local values = b:values():toArray()
__TS__ArrayEvery(
    values,
    function(____, v) return type(v) == "string" end
)
local c = __TS__New(Set, {"foo", "bar"})
c:values():every(function(____, v) return type(v) == "string" end)
return ____exports

Here, :toArray() and :every() is missing from the set iterator returned by :values(), causing a runtime error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy