Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better S.startsWith #116

Open
JUSTIVE opened this issue Jun 22, 2024 · 0 comments
Open

Better S.startsWith #116

JUSTIVE opened this issue Jun 22, 2024 · 0 comments

Comments

@JUSTIVE
Copy link

JUSTIVE commented Jun 22, 2024

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}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant