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

Allow changeset value to be typed

Oliver Günthercf6984e6db18
diff --git a/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment-field-handler.ts b/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment-field-handler.ts
index 6ccde23811e..d8c142023e1 100644
--- a/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment-field-handler.ts
+++ b/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment-field-handler.ts
@@ -63,7 +63,7 @@ export abstract class WorkPackageCommentFieldHandler extends EditFieldHandler im
}
public get commentValue() {
- return this.change.value('comment');
+ return this.change.value<{ raw: string }>('comment');
}
public handleUserCancel() {
diff --git a/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts b/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts
index 7942f5d6bff..d1979efaec6 100644
--- a/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts
+++ b/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts
@@ -239,15 +239,15 @@ export class ResourceChangeset<T extends HalResource = HalResource> {
* @param {string} key The attribute to read
* @return {any} Either the value from the overridden change, or the default value
*/
- public value(key:string) {
+ public value<T>(key:string):T {
// Overridden value by user?
if (this.changeset.contains(key)) {
- return this.changeset.getValue(key);
+ return this.changeset.getValue(key) as T;
}
// Return whatever is on the base.
// TODO this needs to be typed
- return this.pristineResource[key];
+ return this.pristineResource[key] as T;
}
/**