Skip to content

Commit

Permalink
fix(types): fix TS 4.9 excessive depth error on InferAttributes (v6) (
Browse files Browse the repository at this point in the history
  • Loading branch information
ephys committed Oct 15, 2022
1 parent 9dd93b8 commit 851daaf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/model.d.ts
Expand Up @@ -3444,15 +3444,15 @@ export type InferCreationAttributes<
* - Excluded manually using {@link InferAttributesOptions#omit}
*/
type InternalInferAttributeKeysFromFields<M extends Model, Key extends keyof M, Options extends InferAttributesOptions<keyof M | never | ''>> =
// functions are always excluded
M[Key] extends AnyFunction ? never
// fields inherited from Model are all excluded
: Key extends keyof Model ? never
Key extends keyof Model ? never
// functions are always excluded
: M[Key] extends AnyFunction ? never
// fields branded with NonAttribute are excluded
: IsBranded<M[Key], typeof NonAttributeBrand> extends true ? never
// check 'omit' option is provided & exclude those listed in it
: Options['omit'] extends string ? (Key extends Options['omit'] ? never : Key)
: Key
: Key;

// in v7, we should be able to drop InferCreationAttributes and InferAttributes,
// resolving this confusion.
Expand Down

0 comments on commit 851daaf

Please sign in to comment.