figma-api icon indicating copy to clipboard operation
figma-api copied to clipboard

return type of getFileNodes is more dynamic

Open bboydflo opened this issue 2 years ago • 0 comments

Hi, and thanks for this library. I however realized that we can pass some id's to getFileNodes method such that we can get results of type GetFileNodesResult which has a property called nodes with this interface:

{
    [nodeId: string]: {
        document: Node<'DOCUMENT'>,
        components: { [nodeId: string]: Component },
        schemaVersion: number,
        styles: { [styleName: string]: Style },
    }|null
}

Unfortunately, this is not always correct. It is possible to pass id's of other nodes and get results with a document property with a different type (not always DOCUMENT).

I hope it makes sense. I am working on a PR that should not break the current types. Please let me know what you think.

bboydflo avatar Mar 29 '22 16:03 bboydflo