{"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":505,"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":487,"sourceCodeEnd":523,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/api/node/typescript/index.ts#L487-L523","documentation":"After exposing instance properties, loadFile/loadSource also expose each exported global singleton as a sub-object on the Component. If the translated global name already exists on the Component object (collision with a property, callback, function, or another global), the global is skipped and this warning is printed. The global will not be reachable under the expected JS name.","triggerScenarios":"Calling loadFile() or loadSource() on a .slint file where a global's name (after kebab-to-camelCase translation, e.g. 'app-state' -> 'appState') collides with an existing member or another global.","commonSituations":"A global named like a root property or callback; two globals whose names differ only in case; globals named after Object.prototype members.","solutions":["Rename the global in the .slint file to a unique identifier","Check the warning (it names both the original and JS name) and de-duplicate against existing root members","Access the global via instance.global('original-name') if renaming is not possible"],"exampleFix":"// before (file.slint)\nexport global App-State {}\nproperty <int> app-state; // collides: appState\n// after (file.slint)\nexport global App-State {} // accessed as component.appState\nproperty <int> counter;","handlingStrategy":"validation","validationCode":"const memberNames = [...definition.properties, ...definition.callbacks, ...definition.functions].map(translateName);\nfor (const g of definition.globals) {\n  const js = translateName(g);\n  if (memberNames.includes(js) || component[js] !== undefined) {\n    console.warn(`Global ${g} will collide as ${js}`);\n  }\n}","typeGuard":"function globalAccessible(component, jsName) {\n  return component[jsName] !== undefined && typeof component[jsName] === 'object';\n}","tryCatchPattern":null,"preventionTips":["Prefix globals distinctly (e.g. 'AppState', 'ThemeService') to avoid root-member collisions","Prefer accessing globals via instance.global(name) when names may collide","Keep a registry of root member names and check new globals against it"],"tags":["nodejs","typescript","globals","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"}