@gravity-ui/uikit
Version:
Gravity UI base styling and components
19 lines (18 loc) • 741 B
TypeScript
export type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
/**
* The final type is string but IDE will suggest values from T
* Use (string & {}) for better autocomplete https://github.com/Microsoft/TypeScript/issues/29729#issuecomment-505826972
*
* @example
* ```
* type Lang = StringWithSuggest<'en' | 'rs'>;
*
* const lang: Lang = '';
* // Start typing in your TypeScript-enabled IDE.
* // You **will** get auto-completion for `en` and `rs` literals.
* ```
*/
export type StringWithSuggest<T extends string> = `${T}` | (string & {});
export type DeepPartial<T, N extends number = 9> = N extends 0 ? T : Partial<{
[P in keyof T]: DeepPartial<T[P], [never, 0, 1, 2, 3, 4, 5, 6, 7, 8][N]>;
}>;