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

Typescript TypeCheck errors with this package #12

Open
geferon opened this issue Jul 30, 2024 · 1 comment
Open

Typescript TypeCheck errors with this package #12

geferon opened this issue Jul 30, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@geferon
Copy link

geferon commented Jul 30, 2024

node_modules/nuxt-authorization/dist/runtime/components/Can.vue:10:48 - error TS2345: Argument of type 'Ability extends { original: (user: any, ...args: infer Args) => import("D:/Trabajo/NFC/website-public-nuxt/node_modules/nuxt-authorization/dist/utils/index").AuthorizerResponse; } ? Args : never' is not assignable to parameter of type 'Ability extends { original: (user: any, ...args: infer Args) => AuthorizerResponse; } ? Args : never'.
  Type 'unknown[]' is not assignable to type 'Ability extends { original: (user: any, ...args: infer Args) => AuthorizerResponse; } ? Args : never'.

const can = await allows(props.bouncerAbility, ...props.args)
                                                ~~~~~~~~~~~~~

node_modules/nuxt-authorization/dist/runtime/components/Cannot.vue:10:51 - error TS2345: Argument of type 'Ability extends { original: (user: any, ...args: infer Args) => import("D:/Trabajo/NFC/website-public-nuxt/node_modules/nuxt-authorization/dist/utils/index").AuthorizerResponse; } ? Args : never' is not assignable to parameter of type 'Ability extends { original: (user: any, ...args: infer Args) => AuthorizerResponse; } ? Args : never'.
  Type 'unknown[]' is not assignable to type 'Ability extends { original: (user: any, ...args: infer Args) => AuthorizerResponse; } ? Args : never'.

const cannot = await denies(props.bouncerAbility, ...props.args)
                                                   ~~~~~~~~~~~~~

Enabling typescript: {typeCheck: true} in nuxt.config.ts comes up with this error.

@genu
Copy link

genu commented Sep 16, 2024

I can confirm that this is an issue:

For more context:

transforming (6) ../node_modules/nuxt/dist/app/entry.jsnode_modules/nuxt-authorization/dist/runtime/components/Can.vue:12:48 - error TS2345: Argument of type 'PropsArgs' is not assignable to parameter of type 'Ability extends { original: (user: any, ...args: infer Args) => AuthorizerResponse; } ? Args : never'.
  Type 'unknown[]' is not assignable to type 'Ability extends { original: (user: any, ...args: infer Args) => AuthorizerResponse; } ? Args : never'.

12 const can = await allows(props.bouncerAbility, ...(props.args ?? [] as unknown as PropsArgs))
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/nuxt-authorization/dist/runtime/components/Cannot.vue:12:51 - error TS2345: Argument of type 'PropsArgs' is not assignable to parameter of type 'Ability extends { original: (user: any, ...args: infer Args) => AuthorizerResponse; } ? Args : never'.
  Type 'unknown[]' is not assignable to type 'Ability extends { original: (user: any, ...args: infer Args) => AuthorizerResponse; } ? Args : never'.

12 const cannot = await denies(props.bouncerAbility, ...(props.args ?? [] as unknown as PropsArgs))
                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 2 errors in 2 files.

Errors  Files
     1  node_modules/nuxt-authorization/dist/runtime/components/Can.vue:12
     1  node_modules/nuxt-authorization/dist/runtime/components/Cannot.vue:12

@Barbapapazes I also notice that running test and test:types throw errors.

i'm not sure if its related to the release of Nuxt 3.13.2 or vue 3.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants