{"record":{"id":"91c03cba132cbf7c","repo":"mobxjs/mobx","slug":"static-properties-are-not-supported-property-key","errorCode":null,"errorMessage":"Static properties are not supported ${property.key.loc?.source}","messagePattern":"Static properties are not supported (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/mobx-undecorate/src/undecorate.ts","lineNumber":402,"sourceCode":"        const decorators = property.decorators\n        if (!decorators || decorators.length === 0) {\n            return property\n        }\n        if (decorators.length > 1) {\n            warn(\"Found multiple decorators, skipping..\", property.decorators[0])\n            return property\n        }\n        const decorator = decorators[0]\n        if (!j.Decorator.check(decorator)) {\n            return property\n        }\n        let expr = decorator.expression\n        if (j.Identifier.check(expr) && !decoratorsUsed.has(expr.name)) {\n            warn(`Found non-mobx decorator @${expr.name}`, decorator)\n            return property\n        }\n        if (property.static) {\n            warn(`Static properties are not supported ${property.key.loc?.source}`, property)\n            return property\n        }\n\n        if (options?.keepDecorators !== true) {\n            property.decorators.splice(0)\n        }\n\n        // Replace decorator with @override\n        if ((property as any).override) {\n            const overrideDecorator = j.decorator(j.identifier(\"override\"))\n            if (options?.keepDecorators) {\n                property.decorators[0] = overrideDecorator\n            }\n            expr = overrideDecorator.expression\n        }\n\n        effects.membersMap.push([\n            property.key,","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/mobxjs/mobx/blob/01211a698b64ea94de8e5f276ff8235fcf8ddf96/packages/mobx-undecorate/src/undecorate.ts#L384-L420","documentation":"Static class members decorated with mobx decorators cannot be converted to `makeObservable`, because makeObservable annotations only apply to instances in the constructor. The codemod warns and leaves the static decorated member untouched.","triggerScenarios":"`handleProperty` finds a decorated member with `property.static === true`, e.g. `static @observable count = 0` (or `@observable static count = 0`).","commonSituations":"Classes using static observable state (global counters, registries) that were converted from legacy decorate-based code where statics happened to work.","solutions":["Move the static state to a module-level variable annotated with `observable()` from mobx instead of a static class field.","Remove the decorator and manage the static value with explicit mobx APIs (e.g. `observable.box`).","Keep the decorator and exclude this file from the codemod if static decorators are essential (not supported on modern decorators anyway)."],"exampleFix":"// before\nclass Store { @observable static count = 0 }\n// after\nconst storeCount = observable.box(0)\nclass Store { static get count() { return storeCount.get() } }","handlingStrategy":"validation","validationCode":"if (/static\\s+@\\w+|@\\w+\\s+(?:public\\s+)?static\\s+\\w+/.test(src)) {\n  throw new Error('Decorated static members found; mobx-undecorate cannot convert them')\n}","typeGuard":"function isDecoratedStatic(member) {\n  return member.static && member.decorators && member.decorators.length > 0\n}","tryCatchPattern":null,"preventionTips":["Avoid decorating static class members; use module-level observables instead","Refactor static observable state to a store instance or observable.box","Review codemod warnings about static properties after migration"],"tags":["codemod","decorators","static-members","mobx-undecorate"],"backgroundTag":"unsupported-static-decorator","analyzedSha":"01211a698b64ea94de8e5f276ff8235fcf8ddf96","analyzedAt":"2026-08-28T22:10:08.831Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}