mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-20 06:51:46 +01:00
feat(module): improve app config types autocomplete (#1870)
Co-authored-by: Dave Stewart <dev@davestewart.co.uk> Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
16
src/runtime/types/utils.d.ts
vendored
16
src/runtime/types/utils.d.ts
vendored
@@ -1,15 +1,23 @@
|
||||
export type Strategy = 'merge' | 'override'
|
||||
|
||||
export interface TightMap<O = any> {
|
||||
[key: string]: TightMap | O
|
||||
}
|
||||
|
||||
export type DeepPartial<T, O = any> = {
|
||||
[P in keyof T]?: T[P] extends object
|
||||
? DeepPartial<T[P], O>
|
||||
: T[P];
|
||||
} & {
|
||||
[key: string]: O | TightMap<O>
|
||||
}
|
||||
|
||||
export type NestedKeyOf<ObjectType extends Record<string, any>> = {
|
||||
[Key in keyof ObjectType]: ObjectType[Key] extends Record<string, any>
|
||||
? NestedKeyOf<ObjectType[Key]>
|
||||
: Key
|
||||
}[keyof ObjectType]
|
||||
|
||||
export type DeepPartial<T> = Partial<{
|
||||
[P in keyof T]: DeepPartial<T[P]> | { [key: string]: string | object }
|
||||
}>
|
||||
|
||||
type DeepKey<T, Keys extends string[]> =
|
||||
Keys extends [infer First, ...infer Rest]
|
||||
? First extends keyof T
|
||||
|
||||
Reference in New Issue
Block a user