nhn / tui.editor

🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
http://ui.toast.com/tui-editor
MIT License
17.2k stars 1.76k forks source link

Vue editor - Typescript Type error on site compilation #1796

Closed j-melville closed 3 years ago

j-melville commented 3 years ago

Describe the bug

Hi. We are in the process of migrating from Toast UI vue editor v2 to v3, apologies but this might be the first of many posts :)

Our site is Vue v2.6.11 and TypeScript 3.9.6

After installing v3.1.0 and running an NPM serve we see the following output in the console:

 INFO  Starting development server...
Starting type checking service...
Using 1 worker with 2048MB memory limit
98% after emitting CopyPlugin

 DONE  Compiled successfully in 26212ms                                                                  10:32:09
Type checking in progress...

  App running at:
  - Local:   http://localhost:4200/
  - Network: http://10.11.8.69:4200/

  Note that the development build is not optimized.
  To create a production build, run npm run build. 

ERROR in C:/AzureDevOps/BottKitt/src/BottKitt.Vue/node_modules/@toast-ui/editor/types/editor.d.ts(268,41):
268:41 Cannot find name 'from'.
    266 | }
    267 | 
  > 268 | export type SelectionPos = Sourcepos | [from: number, to: number];
        |                                         ^
    269 | export type EditorPos = MdPos | number;
    270 | export interface NodeRangeInfo {
    271 |   range: SelectionPos;
ERROR in C:/AzureDevOps/BottKitt/src/BottKitt.Vue/node_modules/@toast-ui/editor/types/editor.d.ts(268,55):
268:55 Cannot find name 'to'.
    266 | }
    267 | 
  > 268 | export type SelectionPos = Sourcepos | [from: number, to: number];
        |                                                       ^
    269 | export type EditorPos = MdPos | number;
    270 | export interface NodeRangeInfo {
    271 |   range: SelectionPos;
Version: typescript 3.9.6
Time: 33574ms

Excuse any potential ignorance, but is it meant to be {from: number, to: number} or [{from: number, to: number}]?

Please advice, we won't be able to move forward with the migration until this is resolved, as the site will not compile!

Thanks

js87zz commented 3 years ago

@j-melville Our type definition is defined with typescript v4.2.3. If your typescript version is v3.9.6, the ts compiler cannot check the labeled tuple because the labeled tuple is included above the v4.0.0.

If it is difficult to update the typescript version, it would be good to consider to remove library checks using skipLibCheck option.

j-melville commented 3 years ago

Ok, thanks!