Skip to content

5153 - IndexOf #32099

Closed
Closed

Description

@PassionZale
type IndexOf<T, U, Count extends any[] = []> = T extends [infer L, ...infer R]
  ? Equal<L, U> extends true
    ? Count["length"] extends 0
      ? "-1"
      : Count["length"]
    : IndexOf<R, U, [...Count, 0]>
  : -1;

Activity

  1. added
    answer
    zh-CN
    on Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    5153answerzh-CN

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions