slint-ui/slint · warning
Duplicated property name ${cb} on global ${global}
Error message
Duplicated property name ${cb} on global ${global} What it means
Callbacks of a global are also attached to the global's JS object under their translated names. When a callback's camelCase key already exists on that object (a property or another callback with the colliding spelling), the bindings warn 'Duplicated property name <cb> on global <global>' and skip the callback - so invoking or setting it from JavaScript fails with an undefined member.
Source
Thrown at api/node/typescript/index.ts:558
globalName,
prop.name,
value,
);
},
enumerable: true,
},
);
}
});
instance!
.definition()
.globalCallbacks(globalName)
?.forEach((cb) => {
const callbackName = translateName(cb);
if (globalObject[callbackName] !== undefined) {
console.warn(
"Duplicated property name " +
cb +
" on global " +
global,
);
} else {
Object.defineProperty(
globalObject,
translateName(cb),
{
get() {
return function () {
return instance!.invokeGlobal(
globalName,
cb,
Array.from(arguments),
);
};View on GitHub (pinned to 3fd8f2ec03)
Solutions
- Rename the colliding callback or the property so the translated keys differ.
- Smoke-run the app and grep the console for 'Duplicated property name'.
- Pick one naming style per global and enforce it in review/CI.
- Check the generated .d.ts: the missing callback signature indicates the shadowed one.
Example fix
// before (.slint): callback collides with the property after translation
export global Player {
out property <int> trackChanged; // -> trackChanged
callback track-changed(int); // -> trackChanged (collides)
}
// after: unique camelCase keys
export global Player {
out property <int> current-track;
callback track-changed(int); // trackChanged is now unique
} Defensive patterns
Strategy: validation
Validate before calling
const globalObj = (instance as any)[jsGlobalName];
for (const cb of instance.definition().globalCallbacks(jsGlobalName) ?? []) {
const key = cb.replace(/-(\w)/g, (_, c: string) => c.toUpperCase());
if (typeof globalObj[key] !== 'function') {
throw new Error(`callback "${cb}" on global "${jsGlobalName}" is shadowed`);
}
} Prevention
- Before adding a callback, check its camelCase form is not already a property/callback on that global
- Apply renames globally so kebab and camel spellings never coexist
- Watch the console warning during dev runs; treat it as a test failure
When it happens
Trigger: On one global: callback track-changed together with property <int> trackChanged (or callback do-thing next to callback doThing); a callback renamed in .slint while a property with the equivalent camelCase name already exists.
Common situations: Adding a callback whose name mirrors an existing property; partial kebab/camel refactors inside globals; gluing generated and hand-written .slint fragments together.
Related errors
- Duplicated property name ${globalName} (In JS: ${jsName})
- Duplicated property name ${propName} on global ${global}
- Duplicated function name ${cb} on global ${global}
- [slint-ui] Ignoring slint-ui-dev ${devVersion}: it does not
AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19).
Data as JSON: /api/errors/c5d318b2c0d769a0.
Report an issue: GitHub.