Skip to content

Commit 47469d6

Browse files
Cover decimal128
1 parent 0131b7e commit 47469d6

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

test/types/schema.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ export function autoTypedSchema() {
376376
array3?: any[];
377377
array4?: any[];
378378
array5?: any[];
379+
decimal1?: Schema.Types.Decimal128;
380+
decimal2?: Schema.Types.Decimal128;
381+
decimal3?: Schema.Types.Decimal128;
379382
};
380383

381384
const TestSchema = new Schema({
@@ -412,7 +415,10 @@ export function autoTypedSchema() {
412415
array2: Array,
413416
array3: [Schema.Types.Mixed],
414417
array4: [{}],
415-
array5: []
418+
array5: [],
419+
decimal1: Schema.Types.Decimal128,
420+
decimal2: 'Decimal128',
421+
decimal3: 'decimal128'
416422
});
417423

418424
type InferredTestSchemaType = InferSchemaType<typeof TestSchema>;

types/inferschematype.d.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ type ResolvePathType<PathValueType, Options extends SchemaTypeOptions<PathValueT
145145
PathValueType extends BufferConstructor | 'buffer' | 'Buffer' | typeof Schema.Types.Buffer ? Buffer :
146146
PathValueType extends BooleanConstructor | 'boolean' | 'Boolean' | typeof Schema.Types.Boolean ? boolean :
147147
PathValueType extends 'objectId' | 'ObjectId' | typeof Schema.Types.ObjectId ? Schema.Types.ObjectId :
148-
PathValueType extends MapConstructor ? Map<string, ResolvePathType<Options['of']>> :
149-
PathValueType extends ArrayConstructor ? any[] :
150-
PathValueType extends typeof Schema.Types.Mixed ? any:
151-
IfEquals<PathValueType, ObjectConstructor> extends true ? any:
152-
IfEquals<PathValueType, {}> extends true ? any:
153-
PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
154-
unknown;
148+
PathValueType extends 'decimal128' | 'Decimal128' | typeof Schema.Types.Decimal128 ? Schema.Types.Decimal128 :
149+
PathValueType extends MapConstructor ? Map<string, ResolvePathType<Options['of']>> :
150+
PathValueType extends ArrayConstructor ? any[] :
151+
PathValueType extends typeof Schema.Types.Mixed ? any:
152+
IfEquals<PathValueType, ObjectConstructor> extends true ? any:
153+
IfEquals<PathValueType, {}> extends true ? any:
154+
PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
155+
unknown;

0 commit comments

Comments
 (0)