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(schema): use scule types for runtimeConfig
type hints
#23696
Conversation
Run & review this pull request in StackBlitz Codeflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you β€οΈ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you check the type fixture failures? π
The error that was being thrown was saying that the |
Oh, interesting. I wasn't seeing any errors in the console output so I didn't think the tests were failing. I'll take another look. |
@danielroe I've changed the input for the last test that was failing. It was originally |
The intent is to split the string with
This should be achievable in TS. |
Ok, i've implemented this change.
|
@danielroe Some of these test cases may not be possible with the current logic. For example, |
The logic isn't related to whether they are words. Note that scule splits these all correctly; it's based on splitting before the change of case. I think we can use scule's native types for this - but we should ideally expose them upstream. |
This is the closest I've managed to get separately, just following the logic.
Does Scule expose itself as a type, like Defu does? |
No - see unjs/scule#58. I pushed a change in |
Brilliant, this will be a much cleaner solution π |
Co-authored-by: Daniel Roe <daniel@roe.dev>
scule 1.1.0 has now been released. https://github.com/unjs/scule/releases/tag/v1.1.0 Co-authored-by: Daniel Roe <daniel@roe.dev>
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #23696 +/- ##
=======================================
Coverage ? 58.76%
=======================================
Files ? 5
Lines ? 861
Branches ? 46
=======================================
Hits ? 506
Misses ? 355
Partials ? 0 β View full report in Codecov by Sentry. |
runtimeConfig
type hints
π Linked issue
Resolves #23246
β Type of change
π Description
In the original code, if the first character was a digit, the code was adding an underscore before the character and then converting it to uppercase. This was causing the additional underscores when the input string was already in upper snake case.
TypeScript Playground link
This PR also adds a couple of tests to catch values already in upper snake case (as in the original issue).
π Checklist