figma / plugin-typings

Typings for the Figma Plugin API
MIT License
195 stars 45 forks source link

Add 'documentchange' to ArgFreeEventType #174

Closed unformatt closed 1 year ago

unformatt commented 1 year ago

documentchange is mentioned in the docs: https://www.figma.com/plugin-docs/api/properties/figma-on/#documentchange

figma.on('documentchange', onDocumentChange)

[tsc] [widget] widget-src/code.tsx(99,14): error TS2769: No overload matches this call.
[tsc] [widget]   Overload 1 of 3, '(type: "run", callback: (event: RunEvent<ParameterValues>) => void): void', gave the following error.
[tsc] [widget]     Argument of type '"documentchange"' is not assignable to parameter of type '"run"'.
[tsc] [widget]   Overload 2 of 3, '(type: "drop", callback: (event: DropEvent) => boolean): void', gave the following error.
[tsc] [widget]     Argument of type '"documentchange"' is not assignable to parameter of type '"drop"'.
[tsc] [widget]   Overload 3 of 3, '(type: ArgFreeEventType, callback: () => void): void', gave the following error.
[tsc] [widget]     Argument of type '"documentchange"' is not assignable to parameter of type 'ArgFreeEventType'.
[tsc] [widget]
james04321 commented 1 year ago

This was addressed in https://github.com/figma/plugin-typings/pull/164. documentchange doesn't belong in ArgFreeEventType because the event includes arguments.