admin管理员组文章数量:1434015
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.
本文标签: Quill 2Use typescript imports or Quillimport()Stack Overflow
版权声明:本文标题:Quill 2 - Use typescript imports or Quill.import()? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745561885a2663521.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论