grapesjs-plugin-ckeditor icon indicating copy to clipboard operation
grapesjs-plugin-ckeditor copied to clipboard

typescript errors

Open hirisov opened this issue 1 year ago • 1 comments

Hello,

I get the following typescript errors with 1.0.1 in my vue3 / vite project:

node_modules/grapesjs-plugin-ckeditor/src/index.ts:109:16 - error TS7006: Parameter 'el' implicitly has an 'any' type.

109     getContent(el, rte: CKE.editor) {
                   ~~

node_modules/grapesjs-plugin-ckeditor/src/index.ts:113:12 - error TS7006: Parameter 'el' implicitly has an 'any' type.

113     enable(el, rte?: CKE.editor) {
               ~~

node_modules/grapesjs-plugin-ckeditor/src/index.ts:128:15 - error TS2352: Conversion of type 'HTMLCollection' to type 'Iterable<HTMLElement>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.

128       forEach(rteToolbar.children as Iterable<HTMLElement>, (child) => {
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/grapesjs-plugin-ckeditor/src/index.ts:128:15 - error TS2352: Conversion of type 'HTMLCollection' to type 'Iterable<HTMLElement>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Property '[Symbol.iterator]' is missing in type 'HTMLCollection' but required in type 'Iterable<HTMLElement>'.

128       forEach(rteToolbar.children as Iterable<HTMLElement>, (child) => {
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.es2015.iterable.d.ts:51:5
    51     [Symbol.iterator](): Iterator<T>;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    '[Symbol.iterator]' is declared here.

node_modules/grapesjs-plugin-ckeditor/src/index.ts:176:17 - error TS2345: Argument of type 'NodeListOf<HTMLElement>' is not assignable to parameter of type 'Iterable<HTMLElement>'.
  Property '[Symbol.iterator]' is missing in type 'NodeListOf<HTMLElement>' but required in type 'Iterable<HTMLElement>'.

176         forEach(els, (child) => {
                    ~~~

  node_modules/typescript/lib/lib.es2015.iterable.d.ts:51:5
    51     [Symbol.iterator](): Iterator<T>;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    '[Symbol.iterator]' is declared here.

node_modules/grapesjs-plugin-ckeditor/src/index.ts:192:13 - error TS7006: Parameter 'el' implicitly has an 'any' type.

192     disable(el, rte?: CKE.editor) {
                ~~


Found 6 errors in the same file, starting at: node_modules/grapesjs-plugin-ckeditor/src/index.ts:109

I use es2017 in my project, is there any way to get it working with TS project?

thanks, Gabor

hirisov avatar Nov 23 '23 13:11 hirisov

Most likely, 'el' refers to either HTMLElement or just Element. You can declare it explicitly. Or else simply use any

Afrin127329 avatar Feb 12 '24 15:02 Afrin127329