Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
quick fixes
  • Loading branch information
vkarpov15 committed Sep 25, 2023
commit 18ee0eb411464a98ee3bc941a2d9bb167a2f3f77
28 changes: 20 additions & 8 deletions test/types/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,8 @@ function gh12869() {

const dbExample = new Schema(
{
active: { type: String, enum: ['foo', 'bar'] as ['foo', 'bar'], required: true }
}
active: { type: String, enum: ['foo', 'bar'], required: true }
} as const
);

type Example = InferSchemaType<typeof dbExample>;
Expand Down Expand Up @@ -1247,10 +1247,22 @@ async function gh13797() {
interface IUser {
name: string;
}
new Schema<IUser>({ name: { type: String, required: function() {
expectType<IUser>(this); return true;
} } });
new Schema<IUser>({ name: { type: String, default: function() {
expectType<IUser>(this); return '';
} } });
new Schema<IUser>({
name: {
type: String,
required: function() {
expectType<IUser>(this);
return true;
}
}
});
new Schema<IUser>({
name: {
type: String,
default: function() {
expectType<IUser>(this);
return '';
}
}
});
}