Browse Source

fix(core): Fix entity relation paths typings in TS 4.5

Closes #1409
Michael Bromley 3 years ago
parent
commit
c5e6c04442

+ 3 - 1
packages/core/src/common/types/entity-relation-paths.ts

@@ -49,7 +49,9 @@ export type PathsToStringProps2<T extends VendureEntity> = T extends string
     : {
           [K in EntityRelationKeys<T>]: T[K] extends VendureEntity[]
               ? [K, PathsToStringProps1<T[K][number]>]
-              : [K, PathsToStringProps1<T[K]>];
+              : T[K] extends VendureEntity
+              ? [K, PathsToStringProps1<T[K]>]
+              : never;
       }[Extract<EntityRelationKeys<T>, string>];
 
 export type TripleDotPath = `${string}.${string}.${string}`;

+ 0 - 1
packages/core/src/service/helpers/entity-hydrator/entity-hydrator.service.ts

@@ -5,7 +5,6 @@ import { unique } from '@vendure/common/lib/unique';
 
 import { RequestContext } from '../../../api/common/request-context';
 import { InternalServerError } from '../../../common/error/errors';
-import { Translatable } from '../../../common/types/locale-types';
 import { TransactionalConnection } from '../../../connection/transactional-connection';
 import { VendureEntity } from '../../../entity/base/base.entity';
 import { ProductVariant } from '../../../entity/product-variant/product-variant.entity';