tui.editor: build failure due to upstream change in prosemirror-state on class Plugin

Describe the bug

With prosemirror-state moving from javascript to typescript in version 1.4.0 the number of generic arguments for the class Plugin changed to one (optional). After running npm update (which updates prosemirror-state to 1.4.0) this results in the following build errors for my project:

Error: node_modules/@toast-ui/editor/types/spec.d.ts:40:41 - error TS2707: Generic type 'Plugin<PluginState>' requires between 0 and 1 type arguments.

40   keymaps(useCommandShortcut: boolean): Plugin<any, any>[];
                                           ~~~~~~~~~~~~~~~~
Error: node_modules/@toast-ui/editor/types/editor.d.ts:315:47 - error TS2707: Generic type 'Plugin<PluginState>' requires between 0 and 1 type arguments.

315   createKeymaps(useCommandShortcut: boolean): Plugin<any, any>[];
                                                  ~~~~~~~~~~~~~~~~

Fix

I fixed this by changing the according two lines as follows: Plugin<any, any>[]; => Plugin<any>[];

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18

Commits related to this issue

Most upvoted comments

I’m also facing this issue.

Error: node_modules/@toast-ui/editor/types/convertor.d.ts:1:38 - error TS2305: Module '"prosemirror-model"' has no exported member 'ProsemirrorNode'.

1 import { NodeType, MarkType, Schema, ProsemirrorNode, Mark } from 'prosemirror-model';
                                       ~~~~~~~~~~~~~~~


Error: node_modules/@toast-ui/editor/types/editor.d.ts:6:24 - error TS2307: Cannot find module '@t/index' or its corresponding type declarations.

6 import { Editor } from '@t/index';
                         ~~~~~~~~~~


Error: node_modules/@toast-ui/editor/types/editor.d.ts:336:47 - error TS2707: Generic type 'Plugin<PluginState>' requires between 0 and 1 type arguments.

336   createKeymaps(useCommandShortcut: boolean): Plugin<any, any>[];
                                                  ~~~~~~~~~~~~~~~~


Error: node_modules/@toast-ui/editor/types/spec.d.ts:4:10 - error TS2459: Module '"prosemirror-commands"' declares 'Command' locally, but it is not exported.

4 import { Command } from 'prosemirror-commands';
           ~~~~~~~

  node_modules/prosemirror-commands/dist/index.d.ts:2:10
    2 import { Command } from 'prosemirror-state';
               ~~~~~~~
    'Command' is declared here.


Error: node_modules/@toast-ui/editor/types/spec.d.ts:40:41 - error TS2707: Generic type 'Plugin<PluginState>' requires between 0 and 1 type arguments.

40   keymaps(useCommandShortcut: boolean): Plugin<any, any>[];
                                           ~~~~~~~~~~~~~~~

✖ Failed to compile.

using

@wetternest agree. we need an official way to solve this. not work around.

This issue still happening !!

This is still happening

@AndrewBasiuk @wetternest Using this in an Angular project (with typescript v4.7.4) has long required me to include Prosemirror types in the project’s dev-dependencies for:

This worked until I just upgraded to the latest editor version (3.2.0), which now breaks with a number of errors (a couple more than @webmatth found 😬)

Error: node_modules/@toast-ui/editor/types/convertor.d.ts:1:38 - error TS2305: Module '"prosemirror-model"' has no exported member 'ProsemirrorNode'.

1 import { NodeType, MarkType, Schema, ProsemirrorNode, Mark } from 'prosemirror-model';
                                       ~~~~~~~~~~~~~~~


Error: node_modules/@toast-ui/editor/types/editor.d.ts:6:24 - error TS2307: Cannot find module '@t/index' or its corresponding type declarations.

6 import { Editor } from '@t/index';
                         ~~~~~~~~~~


Error: node_modules/@toast-ui/editor/types/editor.d.ts:336:47 - error TS2707: Generic type 'Plugin<PluginState>' requires between 0 and 1 type arguments.

336   createKeymaps(useCommandShortcut: boolean): Plugin<any, any>[];
                                                  ~~~~~~~~~~~~~~~~


Error: node_modules/@toast-ui/editor/types/spec.d.ts:4:10 - error TS2459: Module '"prosemirror-commands"' declares 'Command' locally, but it is not exported.

4 import { Command } from 'prosemirror-commands';
           ~~~~~~~

  node_modules/prosemirror-commands/dist/index.d.ts:2:10
    2 import { Command } from 'prosemirror-state';
               ~~~~~~~
    'Command' is declared here.


Error: node_modules/@toast-ui/editor/types/spec.d.ts:40:41 - error TS2707: Generic type 'Plugin<PluginState>' requires between 0 and 1 type arguments.

40   keymaps(useCommandShortcut: boolean): Plugin<any, any>[];

Fortunately, for now, downgrading to v3.1.10 fixes the errors.