Comments (7)
// @g-plane
from camelcase-keys.
This may be able to be fixed, but the "optional" mark will be lost as the given example. For example:
type Source = { a?: string }
will become:
type Result = { a: string | undefined }
These are different in TypeScript.
from camelcase-keys.
There are actually two issues with the given example:
- "City" and "Country" properties in the type are not properly converted to camelcase
- "?" is not equivalent to "| undefined"
from camelcase-keys.
"?" is not equivalent to "| undefined"
I know, but we can't operate: TypeScript playground.
from camelcase-keys.
I wanted to bump this. It seems like even if { someKey?: string}
is different than { someKey: string | undefined }
, that's probably a level less important than having the type be { some_key?: string }
but having the actual value be { someKey: string | undefined }
.
If that's a cool assumption to make, I'd be open to submitting a patch for this issue.
from camelcase-keys.
Ironically I think this fix for this is to use the type CamelCasedPropertiesDeep
from type-fest
.
from camelcase-keys.
I wanted to bump this. It seems like even if
{ someKey?: string}
is different than{ someKey: string | undefined }
, that's probably a level less important than having the type be{ some_key?: string }
but having the actual value be{ someKey: string | undefined }
.If that's a cool assumption to make, I'd be open to submitting a patch for this issue.
Output type should be { someKey?: string | undefined }
or { someKey?: string }
.
In some cases you don't want to pass keys with undefined values explicitely.
from camelcase-keys.
Related Issues (20)
- Trying to use this lib with Nest.js, and getting import error HOT 1
- Unexpected token name ยซ_000ยป, expected punc ยซ,ยป in file node_modules/camelcase-keys/index.js at 25:16 HOT 1
- Error: Failed to load function definition from source HOT 1
- iOS archive failed - phasescriptexecution failed with a nonzero exit code HOT 1
- This module's config insufficiently robust for use in Typescript HOT 3
- Failed import camelcase-keys HOT 2
- [TypeScript] If the `deep: true` option is set, even the object's properties will be converted.
- Can `exclude` option support function parameter? HOT 4
- Pitfall using Turkish locale HOT 1
- Wrong result with log4j word to camel case? HOT 1
- camelcaseKeys return key types on camelcase without exclude prop. HOT 2
- camelcaseKey ObjectId `5eaabe10cd5bca719652179d` transform to `5Eaabe10Cd5Bca719652179D` HOT 2
- Exporting `CamelCaseKeys` transformer type ๐๐ป HOT 2
- When using an opaque type the result type is wrong HOT 1
- Expose the `preserveConsecutiveUppercase` option HOT 1
- `Error [ERR_REQUIRE_ESM]`: Must use import to load ES Module: `ROOT\node_modules\camelcase-keys\index.js` HOT 7
- An issue of Cannot use import statement outside a module HOT 1
- FYI linter errors importing module HOT 1
- fix: typing errors with typescript 4.8 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camelcase-keys.