Skip to content

Conversation

SamMousa
Copy link
Contributor

The type for currentSingleElement suggests it is always set, but it is not.

public get currentSingleElement(): IElement|undefined {
return !this.isShowingPreview ? this.currentSingleElementValue : undefined;
}
public set currentSingleElement(val: IElement) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angular give the compiling error:
error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type
Type 'undefined' is not assignable to type 'IElement'.

set currentSingleElement(val: IElement|undefined)

Copy link
Contributor Author

@SamMousa SamMousa Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-1.html#unrelated-types-for-getters-and-setters

Seems like a very old typescript version?

Edit: it's an ancient version of angular: https://angular.dev/reference/versions
I'd propose dropping all unsupported versions of Angular and updating to TS >= 5.2.

Holding back your whole code base to support frameworks that no longer receive support makes no sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants