Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typing error in composition api for $can #17

Open
morteza-mortezai opened this issue May 13, 2023 · 1 comment
Open

typing error in composition api for $can #17

morteza-mortezai opened this issue May 13, 2023 · 1 comment

Comments

@morteza-mortezai
Copy link

morteza-mortezai commented May 13, 2023

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" } }

@blogui91
Copy link

blogui91 commented Jun 4, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants