Search code examples
angulartypescripttypesckeditorgetter

Angular build fails with ckeditor - Getter and setter accessors do not agree in visibility


I tried to install ckeditor5-angular and ckeditor5-build-classic according to https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/frameworks/angular.html . When Building, I got the error message:

Error: node_modules/@types/ckeditor__ckeditor5-ui/src/editableui/editableuiview.d.ts:7:9 - error TS2379: Getter and setter accessors do not agree in visibility.

7     get _hasExternalElement(): boolean;
          ~~~~~~~~~~~~~~~~~~~

Error: node_modules/@types/ckeditor__ckeditor5-ui/src/editableui/editableuiview.d.ts:8:19 - error TS2379: Getter and setter accessors do not agree in visibility.

8     protected set _hasExternalElement(newValue: boolean);
                    ~~~~~~~~~~~~~~~~~~~

editableuiview.d.ts:

import { Locale } from "@ckeditor/ckeditor5-utils";
import View from "../view";

export default class EditableUIView extends View {
    isFocused: boolean;
    name: string;
    get _hasExternalElement(): boolean;
    protected set _hasExternalElement(newValue: boolean);

    constructor(locale: Locale, editingView: View, editableElement?: HTMLElement);
}

Now what I could do is remove the portected from the setter but this change will not be permanent since it is a generated file in node_modules.

I have already created a typings.d.ts file which is recommended here: error: Could not find a declaration file for module '@ckeditor/ckeditor5-build-classic' angular 9

How could I fix this error permanently?

Thank you in advance!


Solution

  • I found a solution: I have uninstalled the types package for ckeditor and it was working without it after that.