Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix HalResource, BCF API type errors

Alexander Brandon Coles9eb04568a548
diff --git a/frontend/src/app/features/bim/bcf/api/bcf-api.service.ts b/frontend/src/app/features/bim/bcf/api/bcf-api.service.ts
index 50d75e9c1ec..e2a4240ec59 100644
--- a/frontend/src/app/features/bim/bcf/api/bcf-api.service.ts
+++ b/frontend/src/app/features/bim/bcf/api/bcf-api.service.ts
@@ -49,7 +49,7 @@ export class BcfApiService {
*
* @param href
*/
- parse<T>(href:string):T {
+ parse<T>(href:string):T|undefined {
if (!href.startsWith(this.bcfApiBase)) {
throw new Error(`Cannot parse ${href} into BCF resource.`);
}
diff --git a/frontend/src/app/features/bim/bcf/helper/viewpoints.service.ts b/frontend/src/app/features/bim/bcf/helper/viewpoints.service.ts
index 5d525ee3380..cb4067b3e3f 100644
--- a/frontend/src/app/features/bim/bcf/helper/viewpoints.service.ts
+++ b/frontend/src/app/features/bim/bcf/helper/viewpoints.service.ts
@@ -55,7 +55,7 @@ export class ViewpointsService {
public getViewPointResource(workPackage:WorkPackageResource, index:number):BcfViewpointPaths {
const viewpointHref = (workPackage.bcfViewpoints as HalResource[])[index].href as string;
- return this.bcfApi.parse<BcfViewpointPaths>(viewpointHref);
+ return this.bcfApi.parse<BcfViewpointPaths>(viewpointHref)!;
}
public getViewPoint$(workPackage:WorkPackageResource, index:number):Observable<BcfViewpointData> {
@@ -124,7 +124,7 @@ export class ViewpointsService {
}
const topicHref = (workPackage.bcfTopic as HalResource)?.href;
const topicUUID$ = topicHref
- ? of(this.bcfApi.parse<BcfViewpointPaths>(topicHref).id)
+ ? of(this.bcfApi.parse<BcfViewpointPaths>(topicHref)!.id)
: this.createBcfTopic$(workPackage);
return topicUUID$.pipe(
diff --git a/frontend/src/app/features/hal/services/hal-resource.service.ts b/frontend/src/app/features/hal/services/hal-resource.service.ts
index 59d6c055e0d..4574f766c4e 100644
--- a/frontend/src/app/features/hal/services/hal-resource.service.ts
+++ b/frontend/src/app/features/hal/services/hal-resource.service.ts
@@ -291,7 +291,7 @@ export class HalResourceService {
*/
protected getResourceClassOfType<T extends HalResource>(type:string):HalResourceClass<T> {
const config = this.config[type];
- return (config && config.cls) ? config.cls : this.defaultClass;
+ return (config && config.cls) ? config.cls : this.defaultClass as HalResourceClass<T>;
}
/**