Skip to content

Typings do not catch mistyped fetcher arguments #4166

@pke

Description

@pke

Bug report

// Should complain about wrong fetcher argument type being an array but expecting a string
useSWR("test", ([id]:[string]) => {})

// Should complain about fetcher argument must be an array
useSWR(["test"], (id) => {})

Expected Behavior

Is this a limitation of TS or of the SWR typings?

SWR 2.3.4

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