{"record":{"id":"701a736b230d58df","repo":"slint-ui/slint","slug":"duplicated-property-name-propname","errorCode":null,"errorMessage":"Duplicated property name ${propName}","messagePattern":"Duplicated property name (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"api/node/typescript/index.ts","lineNumber":432,"sourceCode":"                for (var key in properties) {\n                    const value = properties[key];\n                    // Unknown names are passed through, to be reported by the\n                    // setter below.\n                    const name = declaredName.get(key) ?? key;\n\n                    if (value instanceof Function) {\n                        instance.setCallback(name, value);\n                    } else {\n                        instance.setProperty(name, properties[key]);\n                    }\n                }\n\n                const componentHandle = new Component(instance!);\n                instance!.definition().properties.forEach((prop) => {\n                    const propName = translateName(prop.name);\n\n                    if (componentHandle[propName] !== undefined) {\n                        console.warn(\"Duplicated property name \" + propName);\n                    } else {\n                        Object.defineProperty(componentHandle, propName, {\n                            get() {\n                                return instance!.getProperty(prop.name);\n                            },\n                            set(value) {\n                                instance!.setProperty(prop.name, value);\n                            },\n                            enumerable: true,\n                        });\n                    }\n                });\n\n                instance!.definition().callbacks.forEach((cb) => {\n                    const callbackName = translateName(cb);\n\n                    if (componentHandle[callbackName] !== undefined) {\n                        console.warn(","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/api/node/typescript/index.ts#L414-L450","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","solutions":["Rename one of the colliding properties in the .slint file so each translates to a unique camelCase name","Check the warning text to identify which propName collides and grep the .slint source for that name in both kebab-case and camelCase","Access the property through instance.getProperty('original-name') / setProperty() directly if renaming is impossible"],"exampleFix":"// before (file.slint)\nproperty <int> my-prop;\nproperty <string> myProp;\n// after (file.slint)\nproperty <int> my-prop;\nproperty <string> myLabel;","handlingStrategy":"validation","validationCode":"function hasUniquePropertyNames(translationMap) {\n  const seen = new Set();\n  for (const p of translationMap.properties) {\n    const js = toCamelCase(p.name);\n    if (seen.has(js)) return false;\n    seen.add(js);\n  }\n  return true;\n}","typeGuard":"function isDefinedOn(obj, key) {\n  return Object.prototype.hasOwnProperty.call(obj, key) || obj[key] !== undefined;\n}","tryCatchPattern":null,"preventionTips":["Keep property names unique regardless of casing in .slint files","Avoid naming properties after JS built-ins (toString, valueOf, run, etc.)","Run your .slint through slint-viewer or the LSP to catch duplicates early"],"tags":["nodejs","typescript","naming-collision"],"backgroundTag":"invalid-identifier","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}