tinymce / generator-tinymce

Yeoman generator for TinyMCE plugins
Other
6 stars 5 forks source link

The newly created project cannot build(Type 'K' cannot be used to index type 'HTMLElementTagNameMap') #17

Closed sws797 closed 3 years ago

sws797 commented 3 years ago

Follow the documentation https://www.tiny.cloud/docs/advanced/yeoman-generator/

npm install --global yo generator-tinymce
yo tinymce
npm start

-- build error --

yarn build
yarn run v1.19.1
$ grunt
Running "clean:dirs" (clean) task
>> 0 paths cleaned.

Running "eslint:plugin" (eslint) task

C:\files\tinymce-plugins\example\src\main\ts\Plugin.ts
  5:32  warning  'url' is defined but never used  @typescript-eslint/no-unused-vars

✖ 1 problem (0 errors, 1 warning)

Running "shell:command" (shell) task
node_modules/@ephox/sugar/lib/main/ts/ephox/sugar/api/dom/Replication.d.ts(7,1213): error TS2536: Type 'K' cannot be used to index type 'HTMLElementTagNameMap'.
node_modules/@ephox/sugar/lib/main/ts/ephox/sugar/api/dom/Replication.d.ts(9,1208): error TS2536: Type 'K' cannot be used to index type 'HTMLElementTagNameMap'.
node_modules/@ephox/sugar/lib/main/ts/ephox/sugar/api/dom/Replication.d.ts(11,1210): error TS2536: Type 'K' cannot be used to index type 'HTMLElementTagNameMap'.
node_modules/@ephox/sugar/lib/main/ts/ephox/sugar/api/node/SugarElement.d.ts(8,1198): error TS2536: Type 'K' cannot be used to index type 'HTMLElementTagNameMap'.
node_modules/@ephox/sugar/lib/main/ts/ephox/sugar/api/node/SugarNode.d.ts(11,1195): error TS2677: A type predicate's type must be assignable to its parameter's type.
  Type 'SugarElement<HTMLElementTagNameMap[K]>' is not assignable to type 'SugarElement<Node>'.
    Type 'HTMLElementTagNameMap[K]' is not assignable to type 'Node'.
node_modules/@ephox/sugar/lib/main/ts/ephox/sugar/api/node/SugarNode.d.ts(11,1208): error TS2536: Type 'K' cannot be used to index type 'HTMLElementTagNameMap'.
Warning: Command failed: tsc
 Use --force to continue.

Aborted due to warnings.
error Command failed with exit code 6.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
sws797 commented 3 years ago

It was resolved by adding additional lines of code to tsconfig.json file:

{
  "compilerOptions": {
    "skipLibCheck": true
  }
}