Skip to content

table.find on string union table errors #2156

@cheesycod

Description

@cheesycod

Minimum Reproducible Example

local a = {
    "A",
    "B"
} :: {"A" | "B"}
table.find(a, "A")

To me, this feels like it should work but I instead get the following error:

TypeError: No valid instantiation could be inferred for generic type parameter V. It was expected to be at least:
	"A" | "B" | string
and at most:
	"A" | "B"
but these types are not compatible with one another.Luau[1057](https://luau-lang.org/typecheck)```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnew solverThis issue is specific to the new solver.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions