vue-simple-acl icon indicating copy to clipboard operation
vue-simple-acl copied to clipboard

typing error in composition api for $can

Open morteza-mortezai opened this issue 2 years ago • 1 comments

Hi,

I'm using $can in component and I'm getting this error

Property '$can' does not exist on type '{ $: ComponentInternalInstance; $data: {} ....

package.json { "name": "", "version": "1.0.0", "private": true, "scripts": { "dev": "vite", "build": "run-p type-check build-only", "preview": "vite preview", "build-only": "vite build", "type-check": "vue-tsc --noEmit", "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", "format": "prettier --write src/" }, "dependencies": { "@element-plus/icons-vue": "^2.1.0", "axios": "^1.3.5", "element-plus": "^2.3.3", "highcharts": "^10.3.3", "jenesius-vue-modal": "^1.8.2", "node-sass": "^8.0.0", "pinia": "^2.0.34", "sass": "^1.61.0", "sass-loader": "^13.2.2", "vue": "^3.2.47", "vue-3-export-excel": "^1.0.8", "vue-router": "^4.1.6", "vue-simple-acl": "^2.0.2" }, "devDependencies": { "@rushstack/eslint-patch": "^1.2.0", "@types/node": "^18.14.2", "@vitejs/plugin-vue": "^4.0.0", "@vue/eslint-config-prettier": "^7.1.0", "@vue/eslint-config-typescript": "^11.0.2", "@vue/tsconfig": "^0.1.3", "eslint": "^8.34.0", "eslint-plugin-vue": "^9.9.0", "npm-run-all": "^4.1.5", "prettier": "^2.8.4", "typescript": "~4.8.4", "vite": "^4.1.4", "vue-tsc": "^1.2.0" } }

morteza-mortezai avatar May 13 '23 12:05 morteza-mortezai

I think this is not related to this package.

However, in any file d.ts you can do this:


declare module 'vue' {
  interface ComponentCustomProperties {
    $currentUser: CurrentUser;
  }
}

In this example I declared a variable that stores the current user.

I hope it can help

blogui91 avatar Jun 04 '23 14:06 blogui91