-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Autocomplete all include parameters and make
lookup
generic
Replace all overloads of the `lookup` method with one generic interface. Now that we have `EntityTypeMap` and `EntityIncludeMap` this approach no longer causes "excessively deep type" errors. The trick to make this work is to pass the generic parameter to the map before accessing its properties, since accesssed properties of the map can not be generic on their own. Lots of imports and an unused helper type can now be dropped as well.
- Loading branch information
Showing
4 changed files
with
33 additions
and
123 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 |
---|---|---|
@@ -1,8 +1,3 @@ | ||
/** Transforms a string type from kebab case to snake case. */ | ||
export type SnakeCase<KebabCase extends string> = KebabCase extends | ||
`${infer A}-${infer B}` ? `${A}_${SnakeCase<B>}` : KebabCase; | ||
|
||
/** Restricts the given type to be a union type. */ | ||
export type UnionTypeOrNever<T, U extends T = T> = T extends unknown | ||
? [U] extends [T] ? never : T | ||
: never; |