File tree Expand file tree Collapse file tree 7 files changed +26
-37
lines changed
Expand file tree Collapse file tree 7 files changed +26
-37
lines changed Original file line number Diff line number Diff line change @@ -21,5 +21,7 @@ module.exports = {
2121 '@typescript-eslint/explicit-function-return-type' : 'off' ,
2222 '@typescript-eslint/no-explicit-any' : 'off' ,
2323 '@typescript-eslint/no-use-before-define' : 'off' ,
24+ '@typescript-eslint/ban-types' : 'off' ,
25+ '@typescript-eslint/explicit-module-boundary-types' : 'off'
2426 } ,
2527} ;
Original file line number Diff line number Diff line change @@ -4,13 +4,11 @@ import { RAW_OBJECT_DEFINITION } from '../mongoose.constants';
44import { TypeMetadataStorage } from '../storages/type-metadata.storage' ;
55
66const TYPE_METADATA_KEY = 'design:type' ;
7-
87/**
98 * Interface defining property options that can be passed to `@Prop()` decorator.
109 */
1110export type PropOptions =
12- | mongoose . SchemaTypeOpts < any >
13- | mongoose . Schema
11+ | mongoose . SchemaDefinition [ 'string' ]
1412 | mongoose . SchemaType ;
1513
1614/**
@@ -19,7 +17,7 @@ export type PropOptions =
1917 */
2018export function Prop ( options ?: PropOptions ) : PropertyDecorator {
2119 return ( target : object , propertyKey : string | symbol ) => {
22- options = ( options || { } ) as mongoose . SchemaTypeOpts < unknown > ;
20+ options = ( options || { } ) as mongoose . SchemaTypeOptions < unknown > ;
2321
2422 const isRawDefinition = options [ RAW_OBJECT_DEFINITION ] ;
2523 if ( ! options . type && ! Array . isArray ( options ) && ! isRawDefinition ) {
@@ -40,7 +38,7 @@ export function Prop(options?: PropOptions): PropertyDecorator {
4038 TypeMetadataStorage . addPropertyMetadata ( {
4139 target : target . constructor ,
4240 propertyKey : propertyKey as string ,
43- options,
41+ options : options as PropOptions ,
4442 } ) ;
4543 } ;
4644}
Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ export class DefinitionsFactory {
4141 }
4242
4343 private static inspectTypeDefinition (
44- optionsOrType : mongoose . SchemaTypeOpts < unknown > | Function ,
45- ) : PropOptions {
44+ optionsOrType : mongoose . SchemaTypeOptions < unknown > | Function ,
45+ ) : PropOptions | [ PropOptions ] | Function {
4646 if ( typeof optionsOrType === 'function' ) {
4747 if ( this . isPrimitive ( optionsOrType ) ) {
4848 return optionsOrType ;
@@ -72,7 +72,7 @@ export class DefinitionsFactory {
7272 } else if ( Array . isArray ( optionsOrType ) ) {
7373 return optionsOrType . length > 0
7474 ? [ this . inspectTypeDefinition ( optionsOrType [ 0 ] ) ]
75- : optionsOrType ;
75+ : ( optionsOrType as any ) ;
7676 }
7777 return optionsOrType ;
7878 }
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export class SchemaFactory {
99 const schemaMetadata = TypeMetadataStorage . getSchemaMetadataByTarget (
1010 target ,
1111 ) ;
12- return new mongoose . Schema < T > (
12+ return new mongoose . Schema (
1313 schemaDefinition ,
1414 schemaMetadata && schemaMetadata . options ,
1515 ) ;
Original file line number Diff line number Diff line change 11import { Type } from '@nestjs/common' ;
22import { ModuleMetadata } from '@nestjs/common/interfaces' ;
3- import { ConnectionOptions } from 'mongoose' ;
3+ import { ConnectOptions } from 'mongoose' ;
44
55export interface MongooseModuleOptions
6- extends ConnectionOptions ,
6+ extends ConnectOptions ,
77 Record < string , any > {
88 uri ?: string ;
99 retryAttempts ?: number ;
Original file line number Diff line number Diff line change 2222 "devDependencies" : {
2323 "@commitlint/cli" : " 11.0.0" ,
2424 "@commitlint/config-angular" : " 11.0.0" ,
25+ "@nestjs/common" : " 7.5.5" ,
26+ "@nestjs/core" : " 7.5.5" ,
2527 "@nestjs/platform-express" : " 7.5.5" ,
2628 "@nestjs/testing" : " 7.5.5" ,
2729 "@types/jest" : " 26.0.16" ,
28- "@nestjs/common" : " 7.5.5" ,
29- "@nestjs/core" : " 7.5.5" ,
30- "@types/mongoose" : " 5.10.1" ,
3130 "@types/node" : " 11.15.0" ,
3231 "@typescript-eslint/eslint-plugin" : " 4.9.0" ,
3332 "@typescript-eslint/parser" : " 4.9.0" ,
3736 "husky" : " 4.3.0" ,
3837 "jest" : " 26.6.3" ,
3938 "lint-staged" : " 10.5.2" ,
40- "mongoose" : " 5.10.19 " ,
39+ "mongoose" : " ^5.11.5 " ,
4140 "prettier" : " 2.2.1" ,
4241 "reflect-metadata" : " 0.1.13" ,
4342 "release-it" : " 14.2.2" ,
5150 "peerDependencies" : {
5251 "@nestjs/common" : " ^6.0.0 || ^7.0.0" ,
5352 "@nestjs/core" : " ^6.0.0 || ^7.0.0" ,
54- "@types/mongoose" : " ^5.0.0" ,
55- "mongoose" : " ^5.4.19" ,
53+ "mongoose" : " ^5.11.3" ,
5654 "reflect-metadata" : " ^0.1.12" ,
5755 "rxjs" : " ^6.0.0"
5856 },
You can’t perform that action at this time.
0 commit comments