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

Make types for capitalize infer format for constant strings #414

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rafawendel
Copy link

@rafawendel rafawendel commented Jun 21, 2024

This PR improves the types of capitalize on string.ts

Description

Instead of hardcoded string types, I've leveraged generic functions and TS' Capitalize to infer the type for constant strings.

Checklist

  • Changes are covered by tests if behavior has been changed or added
  • Tests have 100% coverage
  • If code changes were made, the version in package.json has been bumped (matching semver)
  • If code changes were made, the yarn build command has been run and to update the cdn directory
  • If code changes were made, the documentation (in the /docs directory) has been updated

Resolves

If the PR resolves an open issue tag it here. For example, Resolves #34

Copy link

vercel bot commented Jun 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
radash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2024 6:36pm

@aleclarson
Copy link

The built-in Capitalize type does not match the behavior of Radash capitalize.

type Foo = Capitalize<'foo Bar'>
//   ^? 'Foo Bar'

let foo = _.capitalize('foo Bar')
// => 'Foo bar'

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.

2 participants