Skip to content

Commit

Permalink
fix 2 more issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammad0-0ahmad committed Jul 4, 2022
1 parent 3feb8af commit a2ff573
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions test/types/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ function gh12030() {
createdAt: { type: Date, default: Date.now }
});

// expectType<{ createdAt: Date }>({} as InferSchemaType<typeof Schema2>);
expectType<{ createdAt: Date }>({} as InferSchemaType<typeof Schema2>);

const Schema3 = new Schema({
users: [
Expand All @@ -668,13 +668,13 @@ function gh12030() {
data: { type: { role: String }, default: {} }
});

// expectType<{ data: { role?: string } }>({} as InferSchemaType<typeof Schema4>);
expectType<{ data: { role?: string } }>({} as InferSchemaType<typeof Schema4>);

const Schema5 = new Schema({
data: { type: { role: Object }, default: {} }
});

// expectType<{ data: { role?: string } }>({} as InferSchemaType<typeof Schema5>);
expectType<{ data: { role?: string } }>({} as InferSchemaType<typeof Schema5>);

const Schema6 = new Schema({
track: {
Expand Down
6 changes: 3 additions & 3 deletions types/inferschematype.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ type IsPathRequired<P, TypeKey extends TypeKeyBaseType> =
? P extends { default: undefined }
? false
: true
: P extends (Record<TypeKey, NumberSchemaDefinition | StringSchemaDefinition | BooleanSchemaDefinition | DateSchemaDefinition>)
? P extends { default: ResolvePathType<P[TypeKey]> }
? true
: P extends (Record<TypeKey, any>)
? P extends { default: any }
? IfEquals<P['default'], undefined, false, true>
: false
: false;

Expand Down

0 comments on commit a2ff573

Please sign in to comment.