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

Add StringRepeat type #938

Merged
merged 1 commit into from
Aug 14, 2024
Merged

Conversation

Max10240
Copy link
Contributor

@Max10240 Max10240 commented Aug 12, 2024

Closes #827

I saw that the issue has a help wanted tag, and I have some free time, so I finished it.
Note that I renamed it to StringRepeat instead of RepeatString to make it compatible with StringSlice...

@sindresorhus
Copy link
Owner

This would also be a good candidate for https://github.com/sindresorhus/ts-extras

@Max10240
Copy link
Contributor Author

Max10240 commented Aug 13, 2024

This would also be a good candidate for https://github.com/sindresorhus/ts-extras

A new function like stringRepeat ? Being a JS function doesn't seem to make much sense IMO(Although that's the example I wrote in the annotation document of type RepeatString😅, I think it's probably not actually very common in the JS world), I guess few people care about the exact type of value returned by the function stringRepeat. Please let me know if I misunderstand anything.

@sindresorhus
Copy link
Owner

sindresorhus commented Aug 13, 2024

Yeah, thinking more about it, I cannot come up with a situation where I would actually need the literal string as a type when doing actual TS.

@sindresorhus sindresorhus merged commit a83e87e into sindresorhus:main Aug 14, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

RepeatString type
2 participants