-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Readme undersells difficulty of using with TypeScript #260
Comments
I agree. It's been a trial and error at times to figure out how to type things so that TypeScript is happy. |
I also found the type check errors from examples to be jarring and instead of learning a Markdoc concept I started learning some TS instead. Might be good to note the |
when working with typescript adding the following to your config saves some guess work: import Markdoc, { Config } from "@markdoc/markdoc";
const config: Config = {
...
} i'm reluctant to add this in a PR for the docs because it written for |
FWIW for JS purists, you can add this annotation to get intellisense and IDE errors (vs transpilation errors)
So, in this case it'd look something like /** @type {import('@markdoc/markdoc').Config} */
const config = {
...
} Which would give you give you IDE warning/errors and intellisense You can cmd+click into it to see the types too |
ah, thats a good suggestion @fieldju - have put up a PR for the team to consider |
What happened?
The readme suggests that using with TypeScript is as simple as installing a few files and setting up a
tsconfig.json
file. But there are some pretty steep roadblocks later on. The particular one I've hit is that for theconfig
object you pass toMarkdoc.transform
, the compiler expects a very complicated type — persource/types.ts
, it'swhich is not something I know how to construct. The example
config
object given in the docs,fails to typecheck. The docs give no guidance, and as a result, I can't use any of Markdoc's interesting features. I'd appreciate either an example in the docs of a config object that will typecheck or (if all else fails) a heads-up in the readme that TS wizardry is required.
To reproduce
I encountered this following the instructions here: https://markdoc.dev/docs/tags
Version
0.1.13
Additional context
This may not count as a full-fledged bug, and probably merits the "docs" label. Sorry for the confusion, this was my only option. :)
The text was updated successfully, but these errors were encountered: