Open unshame opened 1 year ago
Ref: INT-3162
I cannot replicate it, can you provide us a repo with an example and the step by step instructions to replicate it?
Here you go https://github.com/unshame/tinymce-node-next-bug
yarn
yarn run build
will give the following error:
src/App.vue:6:6 - error TS2345: Argument of type '{}' is not assignable to parameter of type 'typeof import(".../node_modules/@tinymce/tinymce-vue/lib/cjs/main/ts/index")'.
Property 'Editor' is missing in type '{}' but required in type 'typeof import(".../node_modules/@tinymce/tinymce-vue/lib/cjs/main/ts/index")'.
6 <Editor />
~~~~~~
node_modules/@tinymce/tinymce-vue/lib/cjs/main/ts/index.d.ts:9:1
9 export default Editor;
~~~~~~~~~~~~~~~~~~~~~~
'Editor' is declared here.
Found 1 error in src/App.vue:6
Thanks for the example, we will investigate on that
With
"moduleResolution": "NodeNext"
intsconfig.json
, typescript incorrectly assumes the type of exports of@tinymce/tinymce-vue
.This works at runtime but doesn't compile:
This compiles but breaks at runtime:
This works, but requires a dynamic import:
The way I managed to fix it is to patch
@tinymce/tinymce-vue
'spackage.json
with"type": "module"
, so typescript knows to treat it as an es module. But I'm not sure if that's a proper solution, since I'm still trying to wrap my head around this whole typescript node esm disaster.