import { DiContainer , Type } from "../di-container.ts" ; /**
 * Decorator use to mark an injected type as optional. If the type is not able to be resolved, the argument will be undefined
 */ export function Optional ( ) { return function ( target , propName ? , paramIndex ? ) { if ( propName ) { DiContainer . root ( ) . registerProperty ( target . constructor as Type , propName . toString ( ) , { isOptional : true } ) ; } if ( paramIndex || paramIndex === 0 ) { DiContainer . root ( ) . registerCtorParam ( target as Type , paramIndex , { isOptional : true } ) ; } } ; }