Skip to content
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

Generate types automatically #1

Open
jemgold opened this issue Mar 27, 2018 · 3 comments
Open

Generate types automatically #1

jemgold opened this issue Mar 27, 2018 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@jemgold
Copy link
Owner

jemgold commented Mar 27, 2018

I wrote all the types out by hand which was some pretty intense type 2 fun.

Would be excellent if someone (at Figma?) could figure out how to generate them automatically.

@dvdsgl
Copy link
Contributor

dvdsgl commented Mar 28, 2018

I wrote quicktype to do this and mentioned it to @dfield. I'll look into it for this use case.

@neelts
Copy link

neelts commented Mar 30, 2018

Also you can have a look on my Figma API extract (written in Haxe), not completed yet, but it could be helpful :)
https://github.com/neelts/figma-api-hx/blob/master/src/figma/FigmaAPIExtract.hx

It generates this JSON: https://gist.github.com/neelts/c9a4284b3f1d545070b21d713c2965bc from this JS file: https://www.figma.com/figbuild/symlinks/developers.1c90a7f2b28cad9058ead2a9750af639.min.js

@dvdsgl
Copy link
Contributor

dvdsgl commented Mar 31, 2018

FYI, I used your TypeScript types to generate a JSON schema, from which I'm generating types and JSON marshaling in C#, Go, Rust, C++, Objective-C, Java, JavaScript, Flow, Swift, Elm, and Ruby:

https://github.com/quicktype/figma-types

For Flow, TypeScript, and JavaScript, I also generate runtime typechecks that compare the Figma JSON to the TypeScript types:

https://github.com/quicktype/figma-types/blob/master/typescript/figma.ts#L2150-L2152

I haven't tried any of it yet, though 😝

chrisdrackett pushed a commit that referenced this issue Jun 21, 2021
@chrisdrackett chrisdrackett added the help wanted Extra attention is needed label Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants