Request: Typescript declaration for exported variables
¿Does a type declaration file for the exported variables already exists or is it planned?
i'm doing a Node.js/typescript script to process the exported variables and transform them into styles and having an existing type description of the result would be very handy to organize the logic and create type safe functions
Ill have a look and see if I can export my typescript classes that are used in the plugin before its converted to JSON. Would that help?
@d01000100 are you automating the JSON download and file creation?
If you're only copy-and-pasting the exported JSON from Figma into a file, then tagging an as const onto the value might work even better.
const tokens = {
version: '1.0.4',
metadata: {},
collections: [
{
name: 'Collection 1',
modes: [
{
name: 'Mode 1',
variables: [
{
name: 'Foo/bar',
type: 'color',
isAlias: false,
value: '#F0A184',
},
],
},
],
},
],
} as const;
I'm not automating the JSON download ¿is there a way to do that? That would definitely make a more seamless pipeline to transform variables to stylesheets
Copying and pasting the output to a ts file does allow ts to type it, and I can inspect and destructure the object. However, I really would like to declare functions' paramaters and return types with the different structures of the result JSON.
I understand it wouldn't be a priority for a Figma plugin to have. I just asked to see if you already had it published somewhere.
For example, those are the types I've been extracting for my pipeline: types.d.txt. I was also asking to see if there were more properties I wasn't seeing in my examples.
Thank you for the response!