Incompatible types for casl v4 and casl/vue
See original GitHub issueDescribe the bug I was using @casl/vue@0.5.1 and @casl/ability@3.4.0 up to now. Then I decided to upgrade. Of course first going to v4 to handle breaking changes incrementally. This is not possible it seems, because:
@casl/vue@1.2.1
does not work with @casl/ability@4.1.6
even though it has ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.1.0
in its peerDependency specification. The following error occurs, among others:
ERROR in /home/bodo/myproject/node_modules/@casl/vue/dist/types/component/can.d.ts(28,135):
28:135 Namespace '"/home/bodo/myproject/node_modules/@casl/ability/dist/types/RuleIndex"' has no exported member 'Public'.
26 | passThrough?: boolean;
27 | };
> 28 | declare const _default: import("vue/types/vue").ExtendedVue<Vue, {}, {}, {}, AllCanProps<import("@casl/ability/dist/types/RuleIndex").Public<import("@casl/ability").PureAbility<any, any>>>>;
| ^
29 | export default _default;
30 |
To Reproduce Steps to reproduce the behavior:
- Setup vue-cli project with @casl/vue and @casl/ability v4.
- Compile
Expected behavior There should not be a typescript error.
CASL Version
@casl/ability
- v4.1.6
@casl/vue
- v1.2.1
Environment:
vue-cli
- v4.4.6
typescript
- v3.9.6
node.js
- v15.6.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Vue error on casl + vue when registering Can component ...
Types of property 'render' are incompatible. Type '((this: undefined, createElement: CreateElement, context: RenderContext>) => VNode | VNode[]) ...
Read more >Installation - CASL
CASL is isomorphic, so can be used in browsers and in Nodejs environments. It requires ES5 compatible environment, that means the lowest supported...
Read more >stalniy-casl/casl - Gitter
Types of parameters 'Vue' and 'Vue' are incompatible. Type 'VueConstructor<Vue>' is not assignable to type 'Vue'. Property '$el' is missing in type ......
Read more >CASL and Cancan. Permissions sharing between UI and API.
CASL + Vue + Rails ... Also it works seamlessly with Ruby's cancan gem (unsupported, ... Update: CASL 4.0 is released, see “CASL...
Read more >@casl/vue - npm
@casl/vue. TypeScript icon, indicating that this package has built-in type declarations. 2.2.1 • Public • Published 10 days ago.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What I meant is that such kind of bugs are really hard to catch, especially if you use
ts-jest
for running tests (as I do). Trying to produce d.ts with TS 4.x, I saw an issue somewhere in TS repo that describes this kind of bugI’ve release @casl/vue@1.2.2 with fixed types for v4. Tested and all good.
Let me know if you have other upgrade issues. Thanks for reporting it back to me 😃