Comments (1)
I don't think this is possible with remeda without needing to write a new function just for this. I'm not even sure you can do this with typescript, you'd need some elaborate mapping.
type NestedKeys<T> = { [P in keyof T]: (keyof T[P])[] }
But even this type can't "enforce" that you'd have exactly one value for each key, for your example the following object is also valid:
const x: NestedKeys<typeof variants> = { size: [], mode: [], tone: [] };
which isn't very useful.
Try see if you can build a better type via utils in type-fest
from remeda.
Related Issues (20)
- Idea: Map and filter at once HOT 4
- groupBy: Generic key types HOT 2
- Submit to devdocs? HOT 6
- how to stop R.pipe( HOT 2
- keys: Wrong return value in example
- Implement intersectWith HOT 2
- Missing function: isEmpty HOT 4
- Option to filter docs by types HOT 2
- TS errors in curried `pick` HOT 2
- Question: Example removing undefined from array? HOT 2
- The sample function doesn't seem to infer types correctly HOT 1
- Helper to check if all object values are Truthy? HOT 2
- Pipe item not receiving guarded value? HOT 4
- I cannot understand doc for sortBy HOT 3
- Feature Request: swap element in Array HOT 1
- it would be cool if it works HOT 4
- Generate testing suites using a ChatGPT-4 CLI wrapper HOT 1
- lint for correctness HOT 1
- `filterValues` for filtering objects HOT 2
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 remeda.