I am in the process of upgrading my project from Quill v1 to v2.
Quill now has typescript type definitions and I don't know if I should keep using the static Quill.import()
method or if I should import the types instead, which also provides strong typing.
The documentation examples still use Quill.import()
in some cases, for example parchment blot extensions but I don't know if this has just not been updated.
Also, the documentation for the import methods has got the following footnote, which is what initially made me unsure about the type imports as it mentions side effects:
Note
Don't confuse this with the import keyword for ECMAScript modules.
Quill.import() doesn't load scripts over the network,
it just returns the corresponding module from the Quill library without
causing any side-effects.
Quill docs
I currently have:
const Tooltip = Quill.import('ui/tooltip');
const quillTooltip = new Tooltip(this.quill) as any;
but now I could do:
import Tooltip from 'quill/ui/tooltip';
...
const quillTooltip = new Tooltip(this.quill);
Is there an officially preferred way out of the two? Are there any pitfalls using the import keyword?
Thank you.