Closed justinbkay closed 2 months ago
can you please try v26.0.6?
Hi, this is on 26.0.6
✘ [ERROR] NG2: Type '{ table: boolean; toolbar: { container: (string[] | { font: never[]; }[] | { size: (string | boolean)[]; }[] | { customStyles: number[]; }[] | { script: string; }[] | ({ color: never[]; background?: undefined; } | { background: never[]; color?: undefined; })[] | { ...; }[] | { ...; }[] | { ...; }[] | { ...; }[])[]; ...' is not assignable to type 'QuillModules'.
Types of property 'toolbar' are incompatible.
Type '{ container: (string[] | { font: never[]; }[] | { size: (string | boolean)[]; }[] | { customStyles: number[]; }[] | { script: string; }[] | ({ color: never[]; background?: undefined; } | { background: never[]; color?: undefined; })[] | { ...; }[] | { ...; }[] | { ...; }[] | { ...; }[])[]; handlers: { ...; }; }' is not assignable to type 'string | boolean | QuillToolbarConfig | { container?: string | string[] | QuillToolbarConfig | Record<string, string | string[]>[] | undefined; handlers?: { ...; } | undefined; } | undefined'.
Type '{ container: (string[] | { font: never[]; }[] | { size: (string | boolean)[]; }[] | { customStyles: number[]; }[] | { script: string; }[] | ({ color: never[]; background?: undefined; } | { background: never[]; color?: undefined; })[] | { ...; }[] | { ...; }[] | { ...; }[] | { ...; }[])[]; handlers: { ...; }; }' is not assignable to type '{ container?: string | string[] | QuillToolbarConfig | Record<string, string | string[]>[] | undefined; handlers?: { [key: string]: any; } | undefined; }'.
Types of property 'container' are incompatible.
Type '(string[] | { font: never[]; }[] | { size: (string | boolean)[]; }[] | { customStyles: number[]; }[] | { script: string; }[] | ({ color: never[]; background?: undefined; } | { background: never[]; color?: undefined; })[] | { ...; }[] | { ...; }[] | { ...; }[] | { ...; }[])[]' is not assignable to type 'string | string[] | QuillToolbarConfig | Record<string, string | string[]>[] | undefined'.
Type '(string[] | { font: never[]; }[] | { size: (string | boolean)[]; }[] | { customStyles: number[]; }[] | { script: string; }[] | ({ color: never[]; background?: undefined; } | { background: never[]; color?: undefined; })[] | { ...; }[] | { ...; }[] | { ...; }[] | { ...; }[])[]' is not assignable to type 'string[]'.
Type 'string[] | { font: never[]; }[] | { size: (string | boolean)[]; }[] | { customStyles: number[]; }[] | { script: string; }[] | ({ color: never[]; background?: undefined; } | { background: never[]; color?: undefined; })[] | { ...; }[] | { ...; }[] | { ...; }[] | { ...; }[]' is not assignable to type 'string'.
Type 'string[]' is not assignable to type 'string'. [plugin angular-compiler]
for now i would just type your custom toolbar dropdown as any. i have to check, what typings are really allowed
should be fixed in 26.0.7
feel free to reopen if it is not
Getting the following errors with ngx-quill 26.0.7
& Angular 18.2.0
:
✘ [ERROR] TS2411: Property 'indent' of type 'string | undefined' is not assignable to 'string' index type 'string | number | boolean | (string | number | boolean)[]'. [plugin angular-compiler]
node_modules/ngx-quill/config/quill-editor.interfaces.d.ts:13:4:
13 │ indent?: string;
╵ ~~~~~~
✘ [ERROR] TS2411: Property 'list' of type 'string | undefined' is not assignable to 'string' index type 'string | number | boolean | (string | number | boolean)[]'. [plugin angular-compiler]
node_modules/ngx-quill/config/quill-editor.interfaces.d.ts:14:4:
14 │ list?: string;
╵ ~~~~
✘ [ERROR] TS2411: Property 'direction' of type 'string | undefined' is not assignable to 'string' index type 'string | number | boolean | (string | number | boolean)[]'. [plugin angular-compiler]
node_modules/ngx-quill/config/quill-editor.interfaces.d.ts:15:4:
15 │ direction?: string;
╵ ~~~~~~~~~
✘ [ERROR] TS2411: Property 'header' of type 'number | (number | boolean)[] | undefined' is not assignable to 'string' index type 'string | number | boolean | (string | number | boolean)[]'. [plugin angular-compiler]
node_modules/ngx-quill/config/quill-editor.interfaces.d.ts:16:4:
16 │ header?: number | Array<boolean | number>;
╵ ~~~~~~
✘ [ERROR] TS2411: Property 'color' of type 'string | string[] | undefined' is not assignable to 'string' index type 'string | number | boolean | (string | number | boolean)[]'. [plugin angular-compiler]
node_modules/ngx-quill/config/quill-editor.interfaces.d.ts:17:4:
17 │ color?: string[] | string;
╵ ~~~~~
✘ [ERROR] TS2411: Property 'background' of type 'string | string[] | undefined' is not assignable to 'string' index type 'string | number | boolean | (string | number | boolean)[]'. [plugin angular-compiler]
node_modules/ngx-quill/config/quill-editor.interfaces.d.ts:18:4:
18 │ background?: string[] | string;
╵ ~~~~~~~~~~
✘ [ERROR] TS2411: Property 'align' of type 'string | string[] | undefined' is not assignable to 'string' index type 'string | number | boolean | (string | number | boolean)[]'. [plugin angular-compiler]
node_modules/ngx-quill/config/quill-editor.interfaces.d.ts:19:4:
19 │ align?: string[] | string;
╵ ~~~~~
✘ [ERROR] TS2411: Property 'script' of type 'string | undefined' is not assignable to 'string' index type 'string | number | boolean | (string | number | boolean)[]'. [plugin angular-compiler]
node_modules/ngx-quill/config/quill-editor.interfaces.d.ts:20:4:
20 │ script?: string;
╵ ~~~~~~
✘ [ERROR] TS2411: Property 'font' of type 'string | string[] | undefined' is not assignable to 'string' index type 'string | number | boolean | (string | number | boolean)[]'. [plugin angular-compiler]
node_modules/ngx-quill/config/quill-editor.interfaces.d.ts:21:4:
21 │ font?: string[] | string;
╵ ~~~~
✘ [ERROR] TS2411: Property 'size' of type '(string | boolean)[] | undefined' is not assignable to 'string' index type 'string | number | boolean | (string | number | boolean)[]'. [plugin angular-compiler]
node_modules/ngx-quill/config/quill-editor.interfaces.d.ts:22:4:
22 │ size?: Array<boolean | string>;
╵ ~~~~
do you get this with the demo repo as well?
can you try 26.0.8 please?
26.0.7 is working for me and 26.0.8. 1 issue though. When I implement the handler, it is giving a typescript error.
TS2339: Property 'quill' does not exist on type '{ 'custom-dropdown': (value: string) => void; }'.
I'm working around this with //@ts-expect-error
'custom-dropdown': function (value: string) {
if (value) {
//@ts-expect-error
const cursorPosition = this.quill.getSelection().index;
//@ts-expect-error
this.quill.insertText(cursorPosition, value);
//@ts-expect-error
this.quill.setSelection(cursorPosition + value.length); // Place cursor after inserted text
}
},
can you please share the whole config or component?
btw. i guess i can not help you there, but it should work when you use this[quill]
.
quill exists in the context of the handler methods on this
but the compiler does not know anything about it.
{
toolbar: {
container: [...],
handlers: {
'custom-dropdown': function (value: string) {
const quill = this['quill']
if (value && quill) {
const cursorPosition = quill.getSelection().index;
quill.insertText(cursorPosition, value);
quill.setSelection(cursorPosition + value.length); // Place cursor after inserted text
}
}
}
}
}
That does work, but I still have to use //@ts-expect-error
for the const quill = this['quill'];
line.
Stange, maybe it is a tsconfig setting. In my Demo repo it is not needed
Am 22. August 2024 17:16:19 MESZ schrieb Justin @.***>:
That does work, but I still have to use @.***
for the
const quill = this['quill'];` line.-- Reply to this email directly or view it on GitHub: https://github.com/KillerCodeMonkey/ngx-quill/issues/1918#issuecomment-2304958436 You are receiving this because you modified the open/close state.
Message ID: @.***>
can you try 26.0.8 please?
The errors I mentioned in node_modules/ngx-quill/config/quill-editor.interfaces.d.ts
are gone in version 26.0.8
. Thank you!
Hello,
I have tried this code out in a CDN version of quill 2.0 and it works fine. I'm attempting to add a custom drop down to the toolbar.
When I try the same in my Angular version with ngx-quill, it seems fine in the editor, no typescript issues, but when it gets compiled, I get this error:
This is Angular 18.1.0 and ngx-quill 26.0.5.
Best regards, Justin