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

Type Challenges 2688-StartsWith #64

Open
kscory opened this issue Mar 15, 2024 · 3 comments
Open

Type Challenges 2688-StartsWith #64

kscory opened this issue Mar 15, 2024 · 3 comments
Labels
Challenges Problems of Typescript-Challenges

Comments

@kscory
Copy link
Member

kscory commented Mar 15, 2024

답안을 작성해주세요.

@kscory kscory added the Challenges Problems of Typescript-Challenges label Mar 15, 2024
@wogha95
Copy link
Member

wogha95 commented Apr 8, 2024

type StartsWith<T extends string, U extends string> = T extends `${U}${string}` ? true : false;

@kscory
Copy link
Member Author

kscory commented Apr 9, 2024

type StartsWith<T extends string, U extends string> = T extends `${U}${string}` ? true : false

@bananana0118
Copy link
Collaborator

type StartsWith<T extends string, U extends string> = U extends '' ? true :T extends `${infer First}${U}${infer Rest}`?
  `${First}` extends "" ? 
    true: 
    false :
  false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Challenges Problems of Typescript-Challenges
Projects
None yet
Development

No branches or pull requests

3 participants