Skip to content

consistent-callback-args throws an error when given a value with a tuple type #19978

@czearing

Description

@czearing

Summary

When using isConformant:

  isConformant({
    Component: MyComponent,
    displayName: 'MyComponent',
  });

An error is thrown by the consistent-callback-args test when it receives a value containing a tuple type:

Example

This works:

  onChange?: (
    ev: React.PointerEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>,
    data: { value: number[] },
  ) => void;

image

However this throws an error:

  onChange?: (
    ev: React.PointerEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>,
    data: { value: [number, number] },
  ) => void;

image

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