File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 11export const POLYMORPHIC_OPTIONS = 'POLYMORPHIC_OPTIONS' ;
2+ export const POLYMORPHIC_KEY_SEPARATOR = '::' ;
Original file line number Diff line number Diff line change 1- import { POLYMORPHIC_OPTIONS } from './constants' ;
1+ import { POLYMORPHIC_KEY_SEPARATOR , POLYMORPHIC_OPTIONS } from './constants' ;
22import {
33 PolymorphicDecoratorOptionsInterface ,
44 PolymorphicMetadataOptionsInterface ,
@@ -9,7 +9,7 @@ const polymorphicPropertyDecorator = (
99) : PropertyDecorator => ( target : Object , propertyKey : string ) => {
1010 Reflect . defineMetadata ( POLYMORPHIC_OPTIONS , true , target ) ;
1111 Reflect . defineMetadata (
12- `${ POLYMORPHIC_OPTIONS } :: ${ propertyKey } ` ,
12+ `${ POLYMORPHIC_OPTIONS } ${ POLYMORPHIC_KEY_SEPARATOR } ${ propertyKey } ` ,
1313 {
1414 propertyKey,
1515 ...options ,
Original file line number Diff line number Diff line change 99 FindOneOptions ,
1010 ObjectID ,
1111} from 'typeorm' ;
12- import { POLYMORPHIC_OPTIONS } from './constants' ;
12+ import { POLYMORPHIC_KEY_SEPARATOR , POLYMORPHIC_OPTIONS } from './constants' ;
1313import {
1414 PolymorphicChildType ,
1515 PolymorphicParentType ,
@@ -46,7 +46,7 @@ export abstract class AbstractPolymorphicRepository<E> extends Repository<E> {
4646
4747 return keys . reduce < Array < PolymorphicMetadataInterface > > (
4848 ( keys : PolymorphicMetadataInterface [ ] , key : string ) => {
49- if ( key . split ( '::' ) [ 0 ] === POLYMORPHIC_OPTIONS ) {
49+ if ( key . split ( POLYMORPHIC_KEY_SEPARATOR ) [ 0 ] === POLYMORPHIC_OPTIONS ) {
5050 const data : PolymorphicMetadataOptionsInterface & {
5151 propertyKey : string ;
5252 } = Reflect . getMetadata (
You can’t perform that action at this time.
0 commit comments