{"record":{"id":"20861b6662c608c6","repo":"slint-ui/slint","slug":"duplicated-callback-name-callbackname","errorCode":null,"errorMessage":"Duplicated callback name ${callbackName}","messagePattern":"Duplicated callback name (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"api/node/typescript/index.ts","lineNumber":450,"sourceCode":"                        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(\n                            \"Duplicated callback name \" + callbackName,\n                        );\n                    } else {\n                        Object.defineProperty(\n                            componentHandle,\n                            translateName(cb),\n                            {\n                                get() {\n                                    return function () {\n                                        return instance!.invoke(\n                                            cb,\n                                            Array.from(arguments),\n                                        );\n                                    };\n                                },\n                                set(callback) {\n                                    instance!.setCallback(cb, callback);\n                                },","sourceCodeStart":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/api/node/typescript/index.ts#L432-L468","documentation":"When wrapping a compiled Slint component into a JS Component object, each declared callback is exposed as an invocable property. If the translated callback name already exists on the object (colliding with another callback, property, function, or a built-in member), the callback is skipped and this warning is printed. The callback will be undefined under that name and invoking it will fail at runtime.","triggerScenarios":"Calling loadFile() or loadSource() on a component with two callbacks translating to the same JS name (e.g. 'do-action' and 'doAction'), or a callback named like an existing member of Component such as 'run'.","commonSituations":"Mixed-casing duplicates in hand-edited .slint files; code generators emitting names that differ only in case; callbacks named after Object.prototype members or existing API surface.","solutions":["Rename one of the colliding callbacks in the .slint file to a unique name","Identify the colliding name from the warning and search the .slint source for both kebab-case and camelCase spellings","Invoke the callback via instance.invoke(originalName, ...) if renaming is not possible"],"exampleFix":"// before (file.slint)\ncallback do-action(int);\ncallback doAction(string);\n// after (file.slint)\ncallback do-action(int);\ncallback send-text(string);","handlingStrategy":"validation","validationCode":"const names = definition.callbacks.map(translateName);\nconst dupes = names.filter((n, i) => names.indexOf(n) !== i);\nif (dupes.length) throw new Error(`Duplicate callback names: ${dupes}`);","typeGuard":"function callbackExists(component, name) {\n  return typeof component[name] === 'function';\n}","tryCatchPattern":null,"preventionTips":["Use distinct kebab-case callback names; never rely on casing to disambiguate","Check for collisions against component properties and functions too","Lint .slint files with a naming convention check in CI"],"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"}