simple-markdown icon indicating copy to clipboard operation
simple-markdown copied to clipboard

Typescript, dependency issues and missing definitions

Open nurdism opened this issue 6 years ago • 1 comments

Using the version 7.1, type definitions for markdown.htmlFor & markdown.ruleOutput are missing, and I'm running into an issue with the dependencies labeled in the package:

"@types/node": ">=10.0.0",
"@types/react": ">=16.0.0"

I'm using @types/node@^12.0.0 witch is causing a ton of compile errors, the @types packages should be labeled peerDependencies.

nurdism avatar Nov 26 '19 19:11 nurdism

Hi! Thanks for trying the typescript support! Sorry for the late response!

Regarding markdown.htmlFor & markdown.ruleOutput, there's a new markdown.outputFor that should handle both of those cases more simply, which has type support:

// instead of:
let output = markdown.htmlFor(markdown.ruleOutput(rules, "html"));
// you can now write:
let output = markdown.outputFor(rules, "html");

This does require that you have the markdown.defaultRules.Array rule in your rules, so if you're making custom rules not extended from markdown.defaultRules, you may have to add an explicit Array: markdown.defaultRules.Array into your rules object.

If you try that and it gives you trouble, please let me know!

I'm using @types/node@^12.0.0 witch is causing a ton of compile errors, the @types packages should be labeled peerDependencies.

I'm not very familiar with the typescript ecosystem yet, but my impression is that npm should use your @types/node@^12.0.0 in that case, since "@types/node": ">=10.0.0" is compatible with @types/node@^12.0.0. If you run npm dedupeit might update both to use@types/node@^12.0.0`.

For @types/node this was only for the umd require wrapper, so I think it might be safe to remove this dependency now that it's being packaged with rollup. I just published [email protected] with no dependency on @types/node, so upgrading to that wil hopefully fix this!

Sorry again for the late response and thanks for your patience! December has been pretty busy for me (job searching and starting a new job). Hope you are having happy holidays!

ariabuckles avatar Dec 30 '19 22:12 ariabuckles