Skip to content

Better S.startsWith #116

@JUSTIVE

Description

@JUSTIVE

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}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions