Open alixander opened 3 months ago
Is there one data structure, or two? I thought there are CompileOptions
and RenderOptions
.
Overall, I'm very interested in this too.
I wonder if https://github.com/gzuidhof/tygo can be used for this?
I was experimenting with integrating d2js
into https://github.com/terrastruct/d2-obsidian and wrote these definitions here.
I only have a working prototype for now, but the type definitions seem mostly accurate for the current code.
I have noticed that the CompileResult
doesn't seem to be documented quite accurately at the moment.
Using version 0.1.23
, the simple import: import { D2, type CompileOptions } from '@terrastruct/d2'
Doesn't really work. I'm getting ts(7016)
:
Could not find a declaration file for module '@terrastruct/d2'. '/Users/anthony/github/awhitford/astro-d2/node_modules/.pnpm/@terrastruct+d2@0.1.23/node_modules/@terrastruct/d2/dist/node-esm/index.js' implicitly has an 'any' type. There are types at '/Users/anthony/github/awhitford/astro-d2/packages/astro-d2/node_modules/@terrastruct/d2/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@terrastruct/d2' library may need to update its package.json or typings.
This suggests to me that there is a bug in the package.json
file.
This what I used in one of my projects