slint-ui/slint · warning

Duplicated property name

Error message

Duplicated property name ${propName} on global ${global}

What it means

For each exported global, loadFile/loadSource exposes its declared properties on the global's JS object. If a translated property name already exists on that global object (collision with another property, callback, function, or built-in), the property is skipped and this warning is printed; the property will be missing under the expected name.

Solutions

  1. Rename the colliding property inside the global's .slint declaration
  2. Use the warning text (propName and global name) to locate and de-duplicate the declaration
  3. Read/write the property via instance.global(name).getProperty/setProperty equivalents on the raw instance if renaming is not an option

Example fix

// before (file.slint)
export global Theme {
    property <color> accent-color;
    property <brush> accentColor; // collides
}
// after (file.slint)
export global Theme {
    property <color> accent-color;
    property <brush> accent-brush;
}
Defensive patterns

Strategy: validation

Validate before calling

const g = instance.global(globalName);
const jsNames = globalProps.map(p => translateName(p.name));
const dupes = jsNames.filter((n, i) => jsNames.indexOf(n) !== i);
if (dupes.length) throw new Error(`Duplicate props on ${globalName}: ${dupes}`);

Type guard

function globalPropertyReadable(globalObj, propName) {
  return globalObj[propName] !== undefined;
}

Prevention

When it happens

Trigger: Calling loadFile() or loadSource() on a project where a global singleton declares two properties translating to the same JS name, or a property named like an existing member of the global object.

Common situations: Case-only duplicates inside a global (e.g. 'max-count' and 'maxCount'); properties named 'value', 'toString', or other Object.prototype members that are !== undefined on the wrapper.

Related errors


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

Appendix: source

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

                    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 " +
                                            propName +
                                            " on global " +
                                            global,
                                    );
                                } else {
                                    Object.defineProperty(
                                        globalObject,
                                        propName,
                                        {
                                            get() {
                                                return instance!.getGlobalProperty(
                                                    globalName,
                                                    prop.name,
                                                );
                                            },
                                            set(value) {
                                                instance!.setGlobalProperty(

View on GitHub (pinned to bb937076de)