Comments (2)
hey @gossi I am not a super expert in TypeScript, so I am not 100% sure I am grasping what you're suggesting and its implications (not only potential breaking changes, but also in ease of maintainability of the library itself).
Would you have time to open a small PR/demo to show what you mean? Doesn't need to be a full-fledged PR, just an MVP to better understand the changes you're proposing.
Thanks
from figma-api.
Yes, sure.
Given these things:
- I'm an author of a figma plugin, that uses the official types from
@figma/plugin-typings
. - I'm also a direct user of AST Types (instead of the
Figma.Api
). That is I'm fetching the figma file myself and then use the types from this project for my code.
Now, I'm using two different (type) libraries to express the same code - as the figma plugin API and the response from the figma rest API are pretty much equal (the same for my use-case). BUT the types are different. Let's make an example for a text node:
- Official types:
TextNode
- This library:
TEXT
orNode<'TEXT'>
This confuses me 😵 - so I was wondering, if the types from this library can/should be renamed to match the name from the official plugin api, so from TEXT
-> TextNode
.
Schematic code:
// figma-api/types.ts
export type TextNode = VectorNode & {
// ...
}
been used as:
import { TextNode } from 'figma-api';
interface MyOwnLibrary {
/** a text field */
textField: TextNode;
}
My second idea (to use the official types under the hood) is kinda not possible as these types are not importable.
The idea is a combination of an aesthetic request (in my eyes 🙈) and DX improvements for folks working in a figma plugin and with the rest api. A possible migration is to allow both APIs, mark the existing one deprecated and remove it with the next major release. The effort of course is heavily questionnable.
I hope it is clearer?
from figma-api.
Related Issues (20)
- How to test the library? Can we collect some ideas? HOT 3
- Missing `spread` in `EffectShadow_` type HOT 2
- Axios vulnerability HOT 1
- How to get a file list? HOT 2
- Api.getFileNodes: Issue with special characters HOT 1
- how to require it in nodejs HOT 1
- Update the FrameInfo properties' names
- Add the "containingStateGroup" property to the FrameInfo type
- Found a missing property HOT 1
- return type of getFileNodes is more dynamic
- Add Missing Properties for Text Node
- Fix incorrect type field name being used
- Fix minor Typing Issue with lineIndentation
- Update "file.components" type HOT 2
- GetFileNodesResult document is incorrect HOT 3
- styles map missing from FRAME nodes
- supprimer (commentez-le) le button connexion
- ComponentSets HOT 1
- Variables Endpoint HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from figma-api.