Skip to content

AI-native design editor. Open-source Figma alternative.

fix(kiwi): type the NodeChange fields fig.kiwi already declares

Danila Poyarkov45c28f2afc44
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b1dfdccc0..3d0bf8af2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@
- Show download progress with a percentage and transferred size while installing a desktop update, instead of an indeterminate message that lasted until the restart.
### Fixed
+- Type `parameterConsumptionMap`, `propRefValue`, and `expressionValue` in the Kiwi `NodeChange` codec, which `fig.kiwi` declares but the TypeScript definitions omitted, so reading them no longer needs a cast.
- Judge text contrast in the AI and MCP `describe` tool by its WCAG 2 ratio (4.5:1, or 3:1 for large text), the same ratio the `color-contrast` lint rule computes. It no longer reports passing dark text on mid-tone backgrounds as "dark on dark", now reports low-contrast light text, measures translucent and faded text as it is drawn, skips text whose color is bound to a variable, and says the ratio and the threshold it missed (#735).
- Warn about options the paint and effect helpers ignore when rendering JSX instead of dropping them silently, and point `blur` in effect helpers at `radius`, the name Figma uses (#736).
diff --git a/packages/kiwi/src/fig/codec.ts b/packages/kiwi/src/fig/codec.ts
index 10bbeeff5..12b8e69b2 100644
--- a/packages/kiwi/src/fig/codec.ts
+++ b/packages/kiwi/src/fig/codec.ts
@@ -258,6 +258,12 @@ export interface VariableAnyValue {
colorValue?: Color
alias?: { guid?: GUID; assetRef?: { key: string; version?: string } }
symbolIdValue?: { guid?: GUID }
+ // fig.kiwi PropRefValue: the component property a parameter entry points at.
+ propRefValue?: { defId?: GUID }
+ expressionValue?: {
+ expressionFunction?: string
+ expressionArguments?: VariableDataEntry[]
+ }
}
export interface VariableDataEntry {
@@ -456,6 +462,8 @@ export interface NodeChange {
// Variables
variableData?: VariableDataEntry
variableConsumptionMap?: { entries?: VariableConsumptionEntry[] }
+ // fig.kiwi declares this as the same VariableDataMap as variableConsumptionMap.
+ parameterConsumptionMap?: { entries?: VariableConsumptionEntry[] }
variableSetModes?: Array<{ id: GUID; name: string; sortPosition?: string }>
variableSetID?: { guid?: GUID; assetRef?: { key: string; version?: string } }
variableResolvedType?: string
diff --git a/tests/engine/io/fig/import/schema-coverage.test.ts b/tests/engine/io/fig/import/schema-coverage.test.ts
index 9ffe8f5ac..38c2d54ba 100644
--- a/tests/engine/io/fig/import/schema-coverage.test.ts
+++ b/tests/engine/io/fig/import/schema-coverage.test.ts
@@ -373,10 +373,10 @@ describe('Figma Kiwi schema coverage', () => {
expect(
Object.fromEntries([...buckets].map(([bucket, items]) => [bucket, items.length]))
).toEqual({
- modeled: 116,
+ modeled: 117,
schemaTag: 60,
internalBookkeeping: 17,
- rawPreserved: 49,
+ rawPreserved: 48,
styleLibraryMetadata: 39,
componentInstanceMetadata: 33,
textMetadata: 23,