Skip to content

Commit ade04e0

Browse files
committed
fix(types): fix infered schema.embed
1 parent 75ac795 commit ade04e0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/createSchema.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { isPlainObject, ObjectKeys } from './utils';
22
import { createErrors } from './createErrors';
33
import { DATAERR, $record, SCHEMAERR } from './constants';
44
import invariant from 'tiny-invariant';
5-
import { RecordValidator, Schema } from './validatorTypes';
5+
import { RecordValidator, Schema, R, O, RecordOptions } from './validatorTypes';
66
import { DataFrom } from './type-utils';
77
import { traverse as _traverse, Visitor } from './traverse';
88

@@ -20,6 +20,9 @@ export function createSchema<T extends Schema>(_schema: T) {
2020
return !validate(data, true) && isPlainObject(data);
2121
}
2222

23+
function embed(): R<RecordOptions<T>>;
24+
function embed(config: { optional: false }): R<RecordOptions<T>>;
25+
function embed(config: { optional: true }): O<RecordOptions<T>>;
2326
function embed(config = { optional: false }): RecordValidator<T> {
2427
return { type: $record, shape: schema, ...config };
2528
}

0 commit comments

Comments
 (0)