Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/survey-core/src/base-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export interface ISurvey extends ITextProcessor, ISurveyErrorOwner {
isDisplayMode: boolean;
isDesignMode: boolean;
areInvisibleElementsShowing: boolean;
currentSingleElement: IElement;
currentSingleElement: IElement|undefined;
areEmptyElementsHidden: boolean;
isLoadingFromJson: boolean;
isUpdateValueTextOnTyping: boolean;
Expand Down
4 changes: 2 additions & 2 deletions packages/survey-core/src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4713,7 +4713,7 @@ export class SurveyModel extends SurveyElementCore
});
this.updateButtonsVisibility();
}
private currentSingleElementValue: IElement;
private currentSingleElementValue: IElement|undefined;
private getSingleQuestions(): Array<IElement> {
const res = new Array<IElement>();
const pages = this.pages;
Expand All @@ -4728,7 +4728,7 @@ export class SurveyModel extends SurveyElementCore
}
return res;
}
public get currentSingleElement(): IElement {
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.

Expand Down