-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add generic Deep type #12
Comments
Was thinking about it a little bit and I think this aint possible - although Im quite new to TS so I might miss something. The challenge here is that each of those types does something different to property modifiers, and also we don't know how to map a property modifier to array modifier. So at the very least we would require 3 type parameters |
You want to have high order function in TypeScript (which is discussed here – microsoft/TypeScript#1213) You still can define declare const __placeholder__: unique symbol;
type Placeholder = { readonly [__placeholder__]: unknown };
type Replace<T, X, Y> = {
[K in keyof T]: T[K] extends X ? Y : T[K];
}; But let me check that it can be implemented somehow Also it has limitations with restrictions but we don't have them so might be possible |
Also, you might need several implementation of |
Several days ago I've seen work on hotscript - https://github.com/gvergnaud/hotscript Maybe it will be possible to organise it so it would be possible to reuse the same types, although I didn't have a chance to play with it |
I've closed the PR because it is not a priority right now, I may come back to it at some point |
Is it possible to create generic Deep type that would minimize repetition between
DeepPartial
,DeepReadonly
etc ?The text was updated successfully, but these errors were encountered: