Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.45k stars 319 forks source link

npm run test: error importing marked on v2.16.1 #392

Closed Zignature closed 2 years ago

Zignature commented 2 years ago

Describe the bug Getting an error eecuting npm run test. marked cannot be imported.

To Reproduce Steps to reproduce the behavior:

  1. Execute npm run test in the main/root directory

Expected behavior No errors

Screenshots import-marked-v2 16 1

Version information

Ionaru commented 2 years ago

Make sure the dependencies are up-to-date by running npm ci.

I've got multiple automated test runs proving it works 😉

Zignature commented 2 years ago

Ofcourse... 😏 (slaps himself in the face)

thgreasi commented 2 years ago

This is also the error that we are getting in our library https://github.com/balena-io-modules/rendition after an rm -r node_modules && npm i && npx tsc using TS 3.9.

$ npx tsc
node_modules/easymde/types/easymde.d.ts:24:10 - error TS2616: 'marked' can only be imported by using 'import marked = require("../../@types/marked")' or a default import.

24 import { marked } from 'marked';
            ~~~~~~

Found 1 error.

PS: We don't have lockfiles, so it should bring in the latest of all packages.

rendition@25.4.10
└─┬ react-simplemde-editor@4.1.5
  ├── @types/marked@0.7.4 
  └─┬ easymde@2.16.1
    └── @types/marked@4.0.1 
Ionaru commented 2 years ago

I think @types/marked@0.7.4 is causing the issue here. Marked changed its exports in version 4.0.0 and the types need to match it. (https://github.com/markedjs/marked/releases/tag/v4.0.0)

If upgrading is not possible, you could add "skipLibCheck": true to your tsconfig.json, that'll silence the error.