{"record":{"id":"8d9f307c1d088d2d","repo":"slint-ui/slint","slug":"duplicated-property-name-propname-on-global-g","errorCode":null,"errorMessage":"Duplicated property name ${propName} on global ${global}","messagePattern":"Duplicated property name (.+?) on global (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"api/node/typescript/index.ts","lineNumber":521,"sourceCode":"                    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 \" +\n                                            propName +\n                                            \" on global \" +\n                                            global,\n                                    );\n                                } else {\n                                    Object.defineProperty(\n                                        globalObject,\n                                        propName,\n                                        {\n                                            get() {\n                                                return instance!.getGlobalProperty(\n                                                    globalName,\n                                                    prop.name,\n                                                );\n                                            },\n                                            set(value) {\n                                                instance!.setGlobalProperty(","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/api/node/typescript/index.ts#L503-L539","documentation":"Each property of a global is defined on the global's JS object under the camelCase translation of its .slint name. If two members of the same global translate to the same JS key (e.g. item-count and itemCount), the bindings warn 'Duplicated property name <propName> on global <global>' and only the first one is defined - the colliding property silently cannot be read or set from JS.","triggerScenarios":"Inside one global, declaring property <int> item-count together with property <int> itemCount; a property renamed in .slint while the old spelling is still declared elsewhere in the same global.","commonSituations":"Incremental kebab-to-camel refactors leaving dual spellings; copy-paste of properties between globals with style adjustments; generated .slint code mixing naming styles.","solutions":["Rename one of the two colliding properties so their camelCase forms differ.","Smoke-instantiate the component after renames and watch for the console warning.","Standardize on one naming style (kebab-case) inside every global.","Diff the generated .d.ts for the global - the shadowed property is absent."],"exampleFix":"// before (.slint): both keys translate to `itemCount`\nexport global Store {\n    out property <int> item-count;\n    out property <int> itemCount; // collides\n}\n\n// after: unique camelCase keys\nexport global Store {\n    out property <int> item-count;\n    out property <int> total-items;\n}","handlingStrategy":"validation","validationCode":"const globalObj = (instance as any)[jsGlobalName];\nfor (const p of instance.definition().globalProperties(jsGlobalName) ?? []) {\n    const key = p.name.replace(/-(\\w)/g, (_, c: string) => c.toUpperCase());\n    if (globalObj[key] === undefined) {\n        throw new Error(`property \"${p.name}\" on global \"${jsGlobalName}\" is shadowed`);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep one naming style inside each global; renames must be project-wide searches so no dual spellings remain","Smoke-instantiate after renames and watch for the console warning","Verify each expected property appears in the generated .d.ts for the global"],"tags":["typescript","node","naming","properties","globals"],"backgroundTag":"duplicate-identifier-collision","analyzedSha":"3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016","analyzedAt":"2026-08-19T23:23:16.610Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}