Giter VIP home page Giter VIP logo

Comments (2)

didoo avatar didoo commented on August 16, 2024

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.

gossi avatar gossi commented on August 16, 2024

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:

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.