slint-ui/slint · warning

Duplicated property name

Error message

Duplicated property name ${propName}

What it means

When a compiled Slint component instance is wrapped into a JS Component object, every declared property is re-exposed as an own accessor property via Object.defineProperty. If the translated (kebab-to-camelCase) property name already exists on the object — e.g. it collides with another property, a callback, a built-in member, or another property that translates to the same JS name — the library skips defining it and prints this warning instead of throwing. The colliding property will not be accessible under the expected name.

Solutions

  1. Rename one of the colliding properties in the .slint file so each translates to a unique camelCase name
  2. Check the warning text to identify which propName collides and grep the .slint source for that name in both kebab-case and camelCase
  3. Access the property through instance.getProperty('original-name') / setProperty() directly if renaming is impossible

Example fix

// before (file.slint)
property <int> my-prop;
property <string> myProp;
// after (file.slint)
property <int> my-prop;
property <string> myLabel;
Defensive patterns

Strategy: validation

Validate before calling

function hasUniquePropertyNames(translationMap) {
  const seen = new Set();
  for (const p of translationMap.properties) {
    const js = toCamelCase(p.name);
    if (seen.has(js)) return false;
    seen.add(js);
  }
  return true;
}

Type guard

function isDefinedOn(obj, key) {
  return Object.prototype.hasOwnProperty.call(obj, key) || obj[key] !== undefined;
}

Prevention

When it happens

Trigger: Calling loadFile() or loadSource() on a .slint component whose root declares two properties that map to the same JS identifier (e.g. 'my-prop' and 'myProp'), or a property named like an existing Component member such as 'run'.

Common situations: Hand-written .slint files with casing-only differences between property names; generated or converted code (e.g. Figma import) producing clashing names; properties named after JS Object.prototype members.

Related errors


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/701a736b230d58df. Report an issue: GitHub.

Appendix: source

Thrown at api/node/typescript/index.ts:432

                for (var key in properties) {
                    const value = properties[key];
                    // Unknown names are passed through, to be reported by the
                    // setter below.
                    const name = declaredName.get(key) ?? key;

                    if (value instanceof Function) {
                        instance.setCallback(name, value);
                    } else {
                        instance.setProperty(name, properties[key]);
                    }
                }

                const componentHandle = new Component(instance!);
                instance!.definition().properties.forEach((prop) => {
                    const propName = translateName(prop.name);

                    if (componentHandle[propName] !== undefined) {
                        console.warn("Duplicated property name " + propName);
                    } else {
                        Object.defineProperty(componentHandle, propName, {
                            get() {
                                return instance!.getProperty(prop.name);
                            },
                            set(value) {
                                instance!.setProperty(prop.name, value);
                            },
                            enumerable: true,
                        });
                    }
                });

                instance!.definition().callbacks.forEach((cb) => {
                    const callbackName = translateName(cb);

                    if (componentHandle[callbackName] !== undefined) {
                        console.warn(

View on GitHub (pinned to bb937076de)