jemgold / figma-js

Little wrapper (+ types) for the Figma API
https://jongold.github.io/figma-js/
MIT License
490 stars 47 forks source link

Fix duplicate Component type, add missing attributes, and make some optional as per real API responses. #18

Closed jamiemill closed 5 years ago

jamiemill commented 5 years ago

Fix bugs.

1) Fix duplicate Component type

There were two Component declarations, which typescript merged, but one should only contain component metadata and the other contains a full component.

2) Add missing attributes

When I tried to annotate a real API response with this type, typescript complained because there were some unexpected attributes.

3) Make some optional as per real API responses

It also complained because there were some missing attributes.

The above are fixed.

To be honest, I'm not sure if other attributes can be optional because this isn't documented in the Figma API docs. This was just enough to fix type errors on my sample API response.