question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatible types for casl v4 and casl/vue

See original GitHub issue

Describe 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:

  1. Setup vue-cli project with @casl/vue and @casl/ability v4.
  2. 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:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
stalniycommented, Jan 22, 2021

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 bug

0reactions
stalniycommented, Jan 23, 2021

I’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 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found