{"id":42278,"library":"vuex-orm-decorators","title":"Vuex ORM Decorators","description":"TypeScript decorators (v2.0.3) for Vuex ORM v0.36, providing typed property access and auto-registration of models via the ORMDatabase plugin. Superseded by Vuex ORM Next; Vuex itself is deprecated in favor of Pinia. Ships TypeScript declarations, targets es2015, and is compatible with Vue 2/Vuex 3 and Vue 3/Vuex 4. Requires manual transpile for es5 targets and Nuxt.js projects.","status":"deprecated","version":"2.0.3","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/TiBianMod/vuex-orm-decorators","tags":["javascript","vue","vuex","vuex-orm","typescript","decorators","ES2015"],"install":[{"cmd":"npm install vuex-orm-decorators","lang":"bash","label":"npm"},{"cmd":"yarn add vuex-orm-decorators","lang":"bash","label":"yarn"},{"cmd":"pnpm add vuex-orm-decorators","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: Vuex ORM core library (v0.36.x). The decorators require this specific version range.","package":"@vuex-orm/core","optional":false},{"reason":"Peer dependency: Vuex v3 (Vue 2) or v4 (Vue 3). Required for the ORMDatabase plugin.","package":"vuex","optional":false}],"imports":[{"note":"ESM-only package; CommonJS require may break in certain bundlers. Use default import for auto-registration.","wrong":"const ORMDatabase = require('vuex-orm-decorators').ORMDatabase","symbol":"ORMDatabase","correct":"import { ORMDatabase } from 'vuex-orm-decorators'"},{"note":"Model is a named export, not a default export.","wrong":"import Model from 'vuex-orm-decorators'","symbol":"Model","correct":"import { Model } from 'vuex-orm-decorators'"},{"note":"Fields decorator is re-exported by vuex-orm-decorators; do not import from the core package.","wrong":"import { Fields } from '@vuex-orm/core'","symbol":"Fields","correct":"import { Fields } from 'vuex-orm-decorators'"}],"quickstart":{"code":"import Vue from 'vue';\nimport Vuex from 'vuex';\nimport { ORMDatabase, Model, Fields, Str, Num } from 'vuex-orm-decorators';\n\nVue.use(Vuex);\n\nconst store = new Vuex.Store({\n  plugins: [ORMDatabase.install({ namespace: 'Models' })]\n});\n\nclass User extends Model {\n  static entity = 'users';\n  static primaryKey = 'id';\n\n  @Fields({\n    id: Num,\n    name: Str,\n    email: Str\n  })\n  declare id: number;\n  declare name: string;\n  declare email: string;\n}\n\n// User is automatically registered.\nconsole.log(store.state.Models.users);","lang":"typescript","description":"Shows auto-registration of a Vuex ORM model using decorators and ORMDatabase plugin."},"warnings":[{"fix":"Migrate to @vuex-orm/plugin or Pinia; see https://next.vuex-orm.org","message":"Vuex ORM is deprecated. Use Vuex ORM Next (vuex-orm-next) or switch to Pinia for new projects.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Consider using Pinia for state management.","message":"Vuex itself is deprecated in favor of Pinia. The library may not receive updates.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Pin @vuex-orm/core to ^0.36.1 in package.json.","message":"Requires @vuex-orm/core@^0.36; incompatible with newer versions (0.37+).","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Add 'declare' before property name: @Fields(...) declare name: string;","message":"Model properties must use 'declare' keyword when decorated; omitting it causes a TypeScript error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually register models using Vuex ORM's Database plugin.","message":"Auto-model registration via ORMDatabase may not work in SSR environments.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"In vue.config.js: transpileDependencies: ['vuex-orm-decorators']","message":"Library targets es2015; using with es5 requires configuring Vue CLI to transpile it.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'2/vuex':48 '3':49 '3/vuex':52 '4':53 'access':14 'auto':17 'auto-registr':16 'compat':45 'declar':40 'decor':3,5,70 'deprec':33 'es2015':42,71 'es5':58 'favor':35 'javascript':63 'manual':55 'model':20 'next':29 'nuxt.js':61 'orm':2,9,28,68 'ormdatabas':23 'pinia':37 'plugin':24 'project':62 'properti':13 'provid':11 'registr':18 'requir':54 'ship':38 'supersed':25 'target':41,59 'transpil':56 'type':12 'typescript':4,39,69 'v0.36':10 'v2.0.3':6 'via':21 'vue':47,51,64 'vuex':1,8,27,30,65,67 'vuex-orm':66","created_at":"2026-06-04T18:56:29.134383+00:00","updated_at":"2026-06-04T18:56:29.134383+00:00","problems":[{"fix":"Ensure package is installed with --save-dev (types included). Set 'moduleResolution' to 'node'.","cause":"TypeScript cannot locate the package or its type definitions.","error":"Cannot find module 'vuex-orm-decorators' or its corresponding type declarations."},{"fix":"Add 'experimentalDecorators': true and 'importHelpers': true to tsconfig.json.","cause":"Missing 'experimentalDecorators': true in tsconfig.json.","error":"Decorators are not valid here. ts(1206)"},{"fix":"Install and call Vue.use(Vuex) before creating the store.","cause":"Vuex not installed or not used before ORMDatabase.install().","error":"TypeError: Cannot read properties of undefined (reading 'install')"},{"fix":"Import the model file to trigger auto-registration, or use ORMDatabase.install().","cause":"Model class not imported/used anywhere before store creation, or ORMDatabase not installed.","error":"Model is not registered in the database."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/TiBianMod/vuex-orm-decorators#readme","github":"ssh://git@github.com/TiBianMod/vuex-orm-decorators","docs":null,"changelog":null,"pypi":null,"npm":"vuex-orm-decorators","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}