-
-
Notifications
You must be signed in to change notification settings - Fork 22
String: Type-level helpers for more accurate string types #498
String: Type-level helpers for more accurate string types #498
Conversation
🦋 Changeset detectedLatest commit: 0a89dfe The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
feat: add capitalize and uncapitalize to use TS builtin types
f070fd3
to
a990a54
Compare
Looks nice :) Would be a good idea to add some dtslint tests for this, to make sure there are no regressions over time. Also, if you could run |
@tim-smart Cool, I can definitely start adding some test cases for these tomorrow sometime. |
@tim-smart I've added some unit tests for the captialize and uncapitalize functions, and I've added some type-level tests for all the other helpers. |
Thanks, looking good! Once CI is passing and docs are updated ( Also we can drop this to a patch release as it seems backwards compatible. |
19675d1
to
2646545
Compare
@tim-smart Got the docs updated, and fixed one of the examples that had a copy/paste error that failed the type-checks |
Thanks. I think you might not have the latest dev deps (we changed eslint plugins a few weeks back). |
I was looking through the docgen code, and noticed some usage of the
stripMargin
function which I had a need for recently and didn't know existed, which got me looking at the rest of the String module.Initially I noticed toUpperCase and toLowerCase could easily be improved with the built-ins from TS, I figure those are fairly safe to continue to add here. There's also
Capitalize
andUncapitalize
built-ins, so I went ahead and added corresponding functions for them.I also started adding some type-level helpers for some of the easier things to replicate in string functionality. I'm less sure we'll wanna include these types of things in this lib, but I figured I'd open a PR for discussion about it.