Skip to content

Commit

Permalink
Merge pull request #641 from warreee/master
Browse files Browse the repository at this point in the history
fix(typings): Make createForClass return unkown instead of any
  • Loading branch information
kamilmysliwiec committed Nov 17, 2020
2 parents 9f726c4 + 8e8afb8 commit 17bbd79
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/factories/schema.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { TypeMetadataStorage } from '../storages/type-metadata.storage';
import { DefinitionsFactory } from './definitions.factory';

export class SchemaFactory {
static createForClass(target: Type<unknown>) {
static createForClass<T = any>(target: Type<unknown>) {
const schemaDefinition = DefinitionsFactory.createForClass(target);
const schemaMetadata = TypeMetadataStorage.getSchemaMetadataByTarget(
target,
);
return new mongoose.Schema(
return new mongoose.Schema<T>(
schemaDefinition,
schemaMetadata && schemaMetadata.options,
);
Expand Down

0 comments on commit 17bbd79

Please sign in to comment.