@@ -327,37 +327,37 @@ export interface IMorphismRegistry {
327
327
* @param {Object } data Input data to transform
328
328
*
329
329
*/
330
- map < TTarget > ( type : TTarget ) : Mapper < TTarget > ;
331
- map < TTarget , TSource > ( type : Constructable < TTarget > , data : TSource [ ] ) : TTarget [ ] ;
332
- map < TTarget , TSource > ( type : Constructable < TTarget > , data : TSource ) : TTarget ;
330
+ map < Target > ( type : Target ) : Mapper < Target > ;
331
+ map < Target , Source > ( type : Constructable < Target > , data : Source [ ] ) : Target [ ] ;
332
+ map < Target , Source > ( type : Constructable < Target > , data : Source ) : Target ;
333
333
/**
334
334
* Get a specific mapping function for the provided Class
335
335
*
336
336
* @param {Type } type Class Type of the ouput Data
337
337
*
338
338
*/
339
- getMapper : ( type : any ) => any ;
339
+ getMapper < Target > ( type : Constructable < Target > ) : Mapper < Target > ;
340
340
/**
341
341
* Set a schema for a specific Class Type
342
342
*
343
343
* @param {Type } type Class Type of the ouput Data
344
344
* @param {Schema } schema Class Type of the ouput Data
345
345
*
346
346
*/
347
- setMapper : ( type : any , schema : Schema ) => any ;
347
+ setMapper < Target , TSchema extends Schema > ( type : Constructable < Target > , schema : TSchema ) : Mapper < Target > ;
348
348
/**
349
349
* Delete a registered schema associated to a Class
350
350
*
351
351
* @param type ES6 Class Type of the ouput Data
352
352
*
353
353
*/
354
- deleteMapper : ( type : any ) => any ;
354
+ deleteMapper < Target > ( type : Constructable < Target > ) : any ;
355
355
/**
356
356
* Check if a schema has already been registered for this type
357
357
*
358
358
* @param {* } type
359
359
*/
360
- exists : ( type : any ) => boolean ;
360
+ exists < Target > ( type : Target ) : boolean ;
361
361
/**
362
362
* Get the list of the mapping functions registered
363
363
*
@@ -419,7 +419,7 @@ export class MorphismRegistry implements IMorphismRegistry {
419
419
* @param {Type } type Class Type of the ouput Data
420
420
*
421
421
*/
422
- getMapper ( type : any ) {
422
+ getMapper < Target > ( type : Constructable < Target > ) {
423
423
return this . _registry . cache . get ( type ) ;
424
424
}
425
425
/**
@@ -429,7 +429,7 @@ export class MorphismRegistry implements IMorphismRegistry {
429
429
* @param {Schema } schema Class Type of the ouput Data
430
430
*
431
431
*/
432
- setMapper ( type : any , schema : Schema ) {
432
+ setMapper < Target > ( type : Constructable < Target > , schema : Schema ) {
433
433
if ( ! schema ) {
434
434
throw new Error ( `The schema must be an Object. Found ${ schema } ` ) ;
435
435
} else if ( ! this . exists ( type ) ) {
0 commit comments