Skip to content

Array of function predicates with match() #41

@apademide

Description

@apademide

I don't have that in mind right now, but match() might very well not properly type arrays of function predicates.

If I do that, the parameter is typed:

match([
  [(x) => something(x), "value"]
], "input") // ← "input" should become the inferred value of `x`

However, in that case it might not be supported on the type level and become Parameter 'x' implicitely is any:

match([
  [[(x) => something(x), (x) => somethingElse(x)], "value"]
], "input")

If that's not there, the type level should be changed from [FunctionPredicate, unknown] to [FunctionPredicate | FunctionPredicate[], unknown] which should be the fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚀 — ImprovementEnhancement, feature request or suggestion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions