5 ms·
There's some Typescript type stuff that can probably get close. https://stackoverflow.com/a/47914631/1924257 https://stackoverflow.com/a/47914631/1924257 http
by desert_boi 7y ago
There's some Typescript type stuff that can probably get close.
https://stackoverflow.com/a/47914631/1924257 https://stackoverflow.com/a/47914631/1924257
https://stackoverflow.com/a/53229857/1924257 https://stackoverflow.com/a/53229857/1924257
- morelisp 7y agoI don't agree - the TypeScript code you link is "complicated" because it's modeling complicated types, or implementing higher-order types which need to handle complicated types. And honestly it's not that complicated - an explanation of what RecursivePartial must do maps closely to the type expression ("each key of the partial type is optional, and each value's keys are also recursively so"). This isn't at all close to CRTP or SFINAE, not just because TS/JS lacks the dispatch features necessary, but because in both cases you link it's still just about type declaration. CRTP and SFINAE are both ways to hack the type system to _run_ differently.