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

2059 - Drop String #19262

Open
CaoXueLiang opened this issue Nov 16, 2022 · 0 comments
Open

2059 - Drop String #19262

CaoXueLiang opened this issue Nov 16, 2022 · 0 comments
Labels
2059 answer Share answers/solutions to a question en in English

Comments

@CaoXueLiang
Copy link

type StringToUnion<S, Total extends unknown[] = []> = S extends `${infer F}${infer R}` ? StringToUnion<R, [...Total, F]> : Total[number];

type DropString<S extends string, D extends string, Result extends string = ''> = S extends `${infer F}${infer R}`
  ? F extends StringToUnion<D>
    ? DropString<R, D, Result>
    : DropString<R, D, `${Result}${F}`>
  : Result;
@CaoXueLiang CaoXueLiang added answer Share answers/solutions to a question en in English labels Nov 16, 2022
@github-actions github-actions bot added the 2059 label Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2059 answer Share answers/solutions to a question en in English
Projects
None yet
Development

No branches or pull requests

1 participant