nteract / semiotic

A data visualization framework combining React & D3
https://semioticv1.nteract.io/
Other
2.44k stars 133 forks source link

clean up the types and export them #497

Closed micahstubbs closed 4 years ago

micahstubbs commented 5 years ago

clean up the types and export them

https://github.com/nteract/semiotic/issues/316

micahstubbs commented 5 years ago

Semiotic is super-awesome. It would be really nice to be able to use the native types for Semiotic in my TypeScript project 😄

charmsRace commented 4 years ago

I'm trying to get a handle on this (not necessarily for a semiotic production PR, but at least to yarn link into my own TypeScript project), but I'm finding it confusing to start taking apart the build pipeline. It seems that rollup-plugin-typescript does not support emitting TS declaration files, so you need to do something like add a "dist:types": "tsc -p ./tsconfig.json --emitDeclarationOnly" script in package.json, in addition to adding "declaration" and "declarationDir" to tsconfig.json::compilerOptions.

After fixing some basic typing errors (unexported interfaces within OrdinalFrame.tsx, etc.), this seems to sort-of work, but it's not quite that simple. The declarations are emitted, but they're A) not consolidated to a single index.d.ts or anything, which would probably be ideal, and B) not actually visible after yarn link-ing. I'm missing something here, but I'm not sure if it's to do with rollup settings (never used it), package.json settings, or the semiotic-specific build pipeline.

I'd appreciate any input here @emeeks. I feel like delta here can't be too large, since semiotic's already in TypeScript (may be optimistic here), but I don't have a comprehensive enough understanding of semiotic to puzzle it out (haven't even learned the API yet). I may decide to work on this in the future after this use case, but in the meantime I need to use a library that already has typings.

micahstubbs commented 4 years ago

💯 for helping @Calamitizer figure out the types

emeeks commented 4 years ago

I think the latest version should have types exported, if it doesn't feel free to open a new issue.