{"record":{"id":"d43c282d3fca7c04","repo":"slint-ui/slint","slug":"duplicated-function-name-functionname","errorCode":null,"errorMessage":"Duplicated function name ${functionName}","messagePattern":"Duplicated function name (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"api/node/typescript/index.ts","lineNumber":479,"sourceCode":"                                            cb,\n                                            Array.from(arguments),\n                                        );\n                                    };\n                                },\n                                set(callback) {\n                                    instance!.setCallback(cb, callback);\n                                },\n                                enumerable: true,\n                            },\n                        );\n                    }\n                });\n\n                instance!.definition().functions.forEach((cb) => {\n                    const functionName = translateName(cb);\n\n                    if (componentHandle[functionName] !== undefined) {\n                        console.warn(\n                            \"Duplicated function name \" + functionName,\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                                enumerable: true,\n                            },\n                        );","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/api/node/typescript/index.ts#L461-L497","documentation":"Declared public functions of a Slint component are exposed as callable JS methods on the Component wrapper. When the translated function name already exists on the object (collision with another function, callback, property, or built-in), the function is skipped and this warning is emitted. The function will not be callable under the expected JS name.","triggerScenarios":"Calling loadFile() or loadSource() on a component with two public functions translating to the same JS name (e.g. 'do-work' and 'doWork'), or a function named like an existing Component member.","commonSituations":"Case-only duplicates introduced by edits or tooling; generated Slint code whose function names collide after kebab-to-camel translation.","solutions":["Rename one of the colliding functions in the .slint file","Use the warning text to find the duplicate name in the .slint source and de-duplicate","Fall back to calling the function through the raw instance API if renaming is blocked"],"exampleFix":"// before (file.slint)\nfunction do-work() {}\npublic function doWork() {}\n// after (file.slint)\npublic function do-work() {}\npublic function perform-task() {}","handlingStrategy":"validation","validationCode":"const fnNames = definition.functions.map(translateName);\nconst dupes = fnNames.filter((n, i) => fnNames.indexOf(n) !== i);\nif (dupes.length) throw new Error(`Duplicate function names: ${dupes}`);","typeGuard":"function callableExists(component, name) {\n  return typeof component[name] === 'function';\n}","tryCatchPattern":null,"preventionTips":["Give public functions unique names distinct from callbacks and properties","After kebab-to-camelCase translation, verify uniqueness in tooling","Avoid single-word generic names like 'run' or 'start' that may collide"],"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"}