import { Length } from '../../array/Length'; import { Push } from '../../array/Push'; import { Equal } from '../../commonness/Equal'; import { Tuple } from '../../primitive'; /** * * Type that takes a string and a value and returns the index of the value in the string * * 문자열과 값을 받아 문자열에서 값의 인덱스를 반환하는 타입 * * @params S - String to search in / 검색할 문자열 * * @params U - Value to search for / 검색할 값 * * @returns Index of the value in the string / 문자열에서 값의 인덱스 * * @example * type cases = [ * Expect, 1>>, * Expect, 4>>, * Expect, -1>>, * Expect, 1>>, * Expect, 2>>, * Expect, -1>>, * ]; * * @link https://www.utilscript.site/docs/usage-string/index-of * */ export type IndexOf = S extends `${infer Current}${infer Rest}` ? U extends `${infer UC}${string}` ? Equal extends true ? Length : IndexOf> : -1 : -1;