ts-belt
ts-belt copied to clipboard
Better S.startsWith
Currently, S.startsWith returns just a boolean. Which is not bad, but in typescript, we could give more information on the type by simply changing type signature with
export declare function startsWith<const SubStr extends string>(substr: SubStr): (str: string) => str is `${SubStr}${string}`
// for non-curried version
export declare function startsWith<const SubStr extends string>(str: string, substr: SubStr): str is `${SubStr}${string}`