AI-native design editor. Open-source Figma alternative.
test(figma-api): assert component property types
Danila Poyarkov71423fb0f20a
diff --git a/packages/core/src/figma-api/compatibility.ts b/packages/core/src/figma-api/compatibility.tsindex ccc83c468..2a7ce3429 100644--- a/packages/core/src/figma-api/compatibility.ts+++ b/packages/core/src/figma-api/compatibility.ts@@ -1,6 +1,8 @@/// <reference types="@figma/plugin-typings" />import type { FigmaAPI } from './index'+import type { FigmaComponentNode, FigmaComponentSetNode } from './node-types'+import type { FigmaNodeProxy } from './proxy'type Expect<T extends true> = T@@ -35,3 +37,43 @@ export type SupportedPluginAPI = Pick<export type FigmaAPIIncompatibleKeys = IncompatibleKeys<FigmaAPI, SupportedPluginAPI>export type FigmaAPICompatibility = Expect<FigmaAPIIncompatibleKeys extends never ? true : false>++type ComponentPropertyDefinitionsMatch = Expect<+ FigmaComponentNode['componentPropertyDefinitions'] extends ComponentPropertyDefinitions+ ? ComponentPropertyDefinitions extends FigmaComponentNode['componentPropertyDefinitions']+ ? true+ : false+ : false+>++type ComponentPropertyMethodsMatch = Expect<+ FigmaComponentNode['addComponentProperty'] extends ComponentNode['addComponentProperty']+ ? FigmaComponentSetNode['editComponentProperty'] extends ComponentSetNode['editComponentProperty']+ ? true+ : false+ : false+>++type InstancePropertySurfaceMatch = Expect<+ Pick<+ FigmaNodeProxy & InstanceNode,+ | 'componentProperties'+ | 'componentPropertyReferences'+ | 'setProperties'+ | 'isExposedInstance'+ | 'exposedInstances'+ > extends Pick<+ InstanceNode,+ | 'componentProperties'+ | 'componentPropertyReferences'+ | 'setProperties'+ | 'isExposedInstance'+ | 'exposedInstances'+ >+ ? true+ : false+>++export type ComponentPropertyAPICompatibility = ComponentPropertyDefinitionsMatch &+ ComponentPropertyMethodsMatch &+ InstancePropertySurfaceMatch