AI-native design editor. Open-source Figma alternative.
fix(fig): guard component property definitions
Danila Poyarkove5f440d8beba
diff --git a/tests/engine/io/fig/roundtrip/helpers.ts b/tests/engine/io/fig/roundtrip/helpers.tsindex b6ac7ec27..79e592efb 100644--- a/tests/engine/io/fig/roundtrip/helpers.ts+++ b/tests/engine/io/fig/roundtrip/helpers.ts@@ -87,17 +87,20 @@ function sameNodeReference(ctx: VerifierContext, a: string, b: string): booleanfunction isComponentPropertyDefinitions(value: unknown): value is ComponentPropertyDefinition[] {if (!Array.isArray(value)) return false- return value.every(- (entry) =>- typeof entry === 'object' &&- entry !== null &&- typeof entry.id === 'string' &&- typeof entry.name === 'string' &&- (entry.type === 'VARIANT' ||- entry.type === 'TEXT' ||- entry.type === 'BOOLEAN' ||- entry.type === 'INSTANCE_SWAP') &&- typeof entry.defaultValue === 'string'+ return value.every(isComponentPropertyDefinition)+}++function isComponentPropertyDefinition(value: unknown): value is ComponentPropertyDefinition {+ if (!value || typeof value !== 'object') return false+ const candidate = value as Partial<ComponentPropertyDefinition>+ return (+ typeof candidate.id === 'string' &&+ typeof candidate.name === 'string' &&+ (candidate.type === 'VARIANT' ||+ candidate.type === 'TEXT' ||+ candidate.type === 'BOOLEAN' ||+ candidate.type === 'INSTANCE_SWAP') &&+ typeof candidate.defaultValue === 'string')}