[1.2.0] type for render prop in figma.boolean is incorrectly inferred as `{}`
Given a figma connect configuration where figma.boolean is returning a function in one branch, e.g.:
import figma from '@figma/code-connect';
import { MyComponent } from './MyComponent.js';
figma.connect(MyComponent, 'https://www.figma.com/', {
props: {
render: figma.boolean('has a render prop', {
true: (props: any) => <span {...props}>a render prop</span>,
false: undefined,
}),
},
example: (props) => <MyComponent render={props.render} />,
});
The type of props.render is {} which results in a type error:
Type '{}' is not assignable to type '(props: unknown) => ReactNode'.
Type '{}' provides no match for the signature '(props: unknown): ReactNode'.
In 1.1.4 the type was correctly inferred so this seems to be a regression.
Hey @andrew-pledge-io, thanks for the report. Sounds like a bug. We'll look into this and update you!
I see a note in the release notes for 1.2.4:
(from 1.2.3) Fix issue with nesting figma.boolean and getProps
Unfortunately it doesn't seem to fix this issue
Hi @andrew-pledge-io, that fix was for an unrelated issue, however in the upcoming release (1.2.5) this type issue should be fixed. 1.2.5 will be released sometime after the holidays.