slint-ui/slint · warning

Duplicated property name

Error message

Duplicated property name ${globalName} (In JS: ${jsName})

What it means

After exposing instance properties, loadFile/loadSource also expose each exported global singleton as a sub-object on the Component. If the translated global name already exists on the Component object (collision with a property, callback, function, or another global), the global is skipped and this warning is printed. The global will not be reachable under the expected JS name.

Solutions

  1. Rename the global in the .slint file to a unique identifier
  2. Check the warning (it names both the original and JS name) and de-duplicate against existing root members
  3. Access the global via instance.global('original-name') if renaming is not possible

Example fix

// before (file.slint)
export global App-State {}
property <int> app-state; // collides: appState
// after (file.slint)
export global App-State {} // accessed as component.appState
property <int> counter;
Defensive patterns

Strategy: validation

Validate before calling

const memberNames = [...definition.properties, ...definition.callbacks, ...definition.functions].map(translateName);
for (const g of definition.globals) {
  const js = translateName(g);
  if (memberNames.includes(js) || component[js] !== undefined) {
    console.warn(`Global ${g} will collide as ${js}`);
  }
}

Type guard

function globalAccessible(component, jsName) {
  return component[jsName] !== undefined && typeof component[jsName] === 'object';
}

Prevention

When it happens

Trigger: Calling loadFile() or loadSource() on a .slint file where a global's name (after kebab-to-camelCase translation, e.g. 'app-state' -> 'appState') collides with an existing member or another global.

Common situations: A global named like a root property or callback; two globals whose names differ only in case; globals named after Object.prototype members.

Related errors


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

Appendix: source

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

                                get() {
                                    return function () {
                                        return instance!.invoke(
                                            cb,
                                            Array.from(arguments),
                                        );
                                    };
                                },
                                enumerable: true,
                            },
                        );
                    }
                });

                // globals
                instance!.definition().globals.forEach((globalName) => {
                    const jsName = translateName(globalName);
                    if (componentHandle[jsName] !== undefined) {
                        console.warn(
                            "Duplicated property name " +
                                globalName +
                                " (In JS: " +
                                jsName +
                                ")",
                        );
                    } else {
                        const globalObject = Object.create({});

                        instance!
                            .definition()
                            .globalProperties(globalName)
                            ?.forEach((prop) => {
                                const propName = translateName(prop.name);

                                if (globalObject[propName] !== undefined) {
                                    console.warn(
                                        "Duplicated property name " +

View on GitHub (pinned to bb937076de)