From 0a9ea3cbe070633ae1d5c685a756cd15c92fd68f Mon Sep 17 00:00:00 2001 From: Ben Grynhaus Date: Thu, 16 Aug 2018 20:19:49 +0300 Subject: [PATCH] fix build issue due to TS bug --- lib/repository/readonly-repository.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/repository/readonly-repository.ts b/lib/repository/readonly-repository.ts index 62878fb..b982c1b 100644 --- a/lib/repository/readonly-repository.ts +++ b/lib/repository/readonly-repository.ts @@ -452,7 +452,8 @@ export class ReadonlyRepository imple model$ = of(model); } - return entity.readonly ? model$.pipe(map(model => Object.freeze(model))) : model$; + // typecasting is used here until bug in TS is fixed (https://github.com/Microsoft/TypeScript/issues/26495) + return (entity.readonly ? model$.pipe(map(model => Object.freeze(model))) : model$) as TEntity extends TConcreteEntity ? Observable : Observable; } private static getSubModel(entityField:Field, value:any, paris:Paris, config:ParisConfig, options: DataOptions = defaultDataOptions):Observable{