-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweaks to DataTable generics (#1968)
Adjust DataTable types. - Make key in `cell` slot prop less strict to prevent type errors in markup. - Resolve property path names up to one level deep for header keys.
- Loading branch information
Showing
7 changed files
with
73 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
type PathDepth = [never, 0, 1, 2, ...0[]]; | ||
|
||
type Join<K, P> = K extends string | number | ||
? P extends string | number | ||
? `${K}${"" extends P ? "" : "."}${P}` | ||
: never | ||
: never; | ||
|
||
export type PropertyPath<T, D extends number = 10> = [D] extends [never] | ||
? never | ||
: T extends object | ||
? { | ||
[K in keyof T]-?: K extends string | number | ||
? `${K}` | Join<K, PropertyPath<T[K], PathDepth[D]>> | ||
: never; | ||
}[keyof T] | ||
: ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
type PathDepth = [never, 0, 1, 2, ...0[]]; | ||
|
||
type Join<K, P> = K extends string | number | ||
? P extends string | number | ||
? `${K}${"" extends P ? "" : "."}${P}` | ||
: never | ||
: never; | ||
|
||
export type PropertyPath<T, D extends number = 10> = [D] extends [never] | ||
? never | ||
: T extends object | ||
? { | ||
[K in keyof T]-?: K extends string | number | ||
? `${K}` | Join<K, PropertyPath<T[K], PathDepth[D]>> | ||
: never; | ||
}[keyof T] | ||
: ""; |