{"record":{"id":"405b8c72e3dd1ba1","repo":"slint-ui/slint","slug":"duplicated-property-name-globalname-in-js-j","errorCode":null,"errorMessage":"Duplicated property name ${globalName} (In JS: ${jsName})","messagePattern":"Duplicated property name (.+?) \\(In JS: (.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"api/node/typescript/index.ts","lineNumber":504,"sourceCode":"                                get() {\n                                    return function () {\n                                        return instance!.invoke(\n                                            cb,\n                                            Array.from(arguments),\n                                        );\n                                    };\n                                },\n                                enumerable: true,\n                            },\n                        );\n                    }\n                });\n\n                // globals\n                instance!.definition().globals.forEach((globalName) => {\n                    const jsName = translateName(globalName);\n                    if (componentHandle[jsName] !== undefined) {\n                        console.warn(\n                            \"Duplicated property name \" +\n                                globalName +\n                                \" (In JS: \" +\n                                jsName +\n                                \")\",\n                        );\n                    } else {\n                        const globalObject = Object.create({});\n\n                        instance!\n                            .definition()\n                            .globalProperties(globalName)\n                            ?.forEach((prop) => {\n                                const propName = translateName(prop.name);\n\n                                if (globalObject[propName] !== undefined) {\n                                    console.warn(\n                                        \"Duplicated property name \" +","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/api/node/typescript/index.ts#L486-L522","documentation":"The Node bindings expose every exported .slint global as a property on the component handle, using the camelCase translation of its name. Before defining it they check componentHandle[jsName]; if the translated name is already taken (by another global with the other spelling, or by a built-in handle member), they warn 'Duplicated property name <global> (In JS: <jsName>)' and skip the definition - the shadowed global becomes unreachable from JS.","triggerScenarios":"Declaring export global settings-panel and export global settingsPanel (both translate to settingsPanel) in one program; a global whose camelCase name equals an existing handle built-in (e.g. show, hide, run, window); globals from different imported files colliding after translation.","commonSituations":"Mid-project renames from kebab-case to camelCase leaving both spellings alive; merging .slint files that use different naming styles; copy-pasting a global next to its renamed twin.","solutions":["Rename one of the colliding globals so the camelCase forms differ.","Run the app once after adding/renaming globals and check the console for 'Duplicated property name'.","Adopt one naming convention (Slint style: kebab-case) across the project so translations cannot clash.","Verify against the generated .d.ts - a shadowed global is missing from it."],"exampleFix":"// before (.slint): both translate to `settingsPanel` on the handle\nexport global settings-panel { out property <int> count; }\nexport global settingsPanel { out property <int> total; }\n\n// after: distinct camelCase keys after translation\nexport global settings-panel { out property <int> count; }\nexport global panel-settings { out property <int> total; }","handlingStrategy":"validation","validationCode":"// After instantiating, verify every global is reachable under its camelCase name:\nconst instance = new Main();\nfor (const globalName of instance.definition().globals) {\n    const jsName = globalName.replace(/-(\\w)/g, (_, c: string) => c.toUpperCase());\n    if ((instance as any)[jsName] === undefined) {\n        throw new Error(`global \"${globalName}\" shadowed on the handle as \"${jsName}\"`);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use one spelling style for globals project-wide (Slint convention: kebab-case)","After adding or renaming globals, run once and check the console for 'Duplicated property name'","Avoid global names translating to handle built-ins such as show, hide, run, window","Diff the generated .d.ts - a shadowed global is missing from it"],"tags":["typescript","node","naming","globals","codegen"],"backgroundTag":"duplicate-identifier-collision","analyzedSha":"3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016","analyzedAt":"2026-08-19T23:23:16.610Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}