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

Fix bug with split words #538

Merged
merged 2 commits into from Jan 13, 2023

Conversation

bconnorwhite
Copy link
Contributor

SplitWords seems to have a bug when casing changes from uppercase to lowercase after a separator.

For example, these tests both fail - the type resolves to never:

expectType<SplitWords<'hello WORLD lowercase'>>(['hello', 'WORLD', 'lowercase']);
expectType<SplitWords<'hello WORLD-lowercase'>>(['hello', 'WORLD', 'lowercase']);

Removing the carry over of LastCharacter after a delimiter should fix this

@sindresorhus sindresorhus merged commit 98ab903 into sindresorhus:main Jan 13, 2023
@sindresorhus
Copy link
Owner

@bconnorwhite Does your changes here and in the other pull request affect any of the exposed types? I'm asking as neither of these types are exported publicly. So not sure whether it needs a new release.

@bconnorwhite
Copy link
Contributor Author

@sindresorhus

#538

  • Fixes some cases where CamelCase would incorrectly resolve to never

#539

  • Trim removes all whitespace, not just spaces

@bconnorwhite
Copy link
Contributor Author

bconnorwhite commented Jan 13, 2023

SplitWords (and as a result CamelCase) still doesn't use the full list of whitespace characters added by #539. I've opened a separate PR for it:

#542

  • Correctly handles whitespace for change case types

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.

None yet

3 participants