vue-announcer icon indicating copy to clipboard operation
vue-announcer copied to clipboard

Not possible to use VueAnnouncer plugin (v3.1.2) in TS project

Open pertoyra opened this issue 3 years ago • 9 comments

When following "Basic usage" README section of VueAnnouncer v3.1.2 in a typescript Vue 3 project the below error occurs when installing the plugin using:

createApp(App)
  .use(VueAnnouncer)

Error

Argument of type 'typeof import(".../node_modules/@vue-a11y/announcer/dist/index")' is not assignable to parameter of type 'Plugin_2'.
  Property 'install' is missing in type 'typeof import(".../node_modules/@vue-a11y/announcer/dist/index")' but required in type '{ install: PluginInstallFunction; }'. ts(2345)

Reproducible by creating a simple Vue 3 TS application with Vue CLI.

Environment:

  • VueAnnouncer v3.1.2
  • Vue v3.0.5
  • Typescript v3.9.7

pertoyra avatar Jan 29 '21 10:01 pertoyra

Hi @pertoyra

I will identify and correct this weekend.

Sorry, but I'm starting to learn TypeScript, so if you have any idea how to solve this, I would like to hear it.

ktquez avatar Jan 30 '21 18:01 ktquez

@ktquez Sorry for my late response. If you haven't looked closer at this I might have a look this afternoon.

per-toyra-stratsys avatar Feb 02 '21 10:02 per-toyra-stratsys

I have this same issue, have you looked at this yet?

Evertvdw avatar Apr 06 '21 12:04 Evertvdw

@Evertvdw @per-toyra-stratsys I made some updates, could you test with version 3.1.4?

ktquez avatar Apr 08 '21 14:04 ktquez

@ktquez Just tested to upgrade to 3.1.4 with no other changes and still getting the same problem. Didn't investigate further though and haven't been able to look into this issue.

Are you able to install 3.1.4 in a fresh Vue 3 application created with Vue CLI and use vue-announcer?

per-toyra-stratsys avatar Apr 12 '21 06:04 per-toyra-stratsys

@per-toyra-stratsys

Yeah!

I don't get any more errors in the installation, and now it is possible to know the methods available in the composition useAnnouncer.

I tested on projects created with vue-cli and Vite.

ktquez avatar Apr 12 '21 09:04 ktquez

@ktquez It seems that solves my problem. I can't be completely sure because I'm in the middle of upgrading to Vue 3 and a lot of stuff is broken at the moment. But I do not get this type error anymore at this moment, so I assume that it works.

Evertvdw avatar Apr 13 '21 11:04 Evertvdw

@pertoyra If you need any help to solve this, count on me.

ktquez avatar Apr 13 '21 12:04 ktquez

@ktquez I get a different error now with [email protected]

Argument of type '(app: App<any>, options?: VueAnnouncerOptions | undefined) => void' is not assignable to parameter of type 'Plugin_2'.
  Type '(app: App<any>, options?: VueAnnouncerOptions | undefined) => void' is not assignable to type 'PluginInstallFunction & { install?: PluginInstallFunction | undefined; }'.
    Type '(app: App<any>, options?: VueAnnouncerOptions | undefined) => void' is not assignable to type 'PluginInstallFunction'.
      Types of parameters 'app' and 'app' are incompatible.
        Type 'import("C:/Users/evert/Programming/Mett4Frontend/node_modules/@vue/runtime-core/dist/runtime-core").App<any>' is not assignable to type 'import("C:/Users/evert/Programming/Mett4Frontend/node_modules/@vue-a11y/announcer/node_modules/@vue/runtime-core/dist/runtime-core").App<any>'.
          The types of 'config.isCustomElement' are incompatible between these types.
            Type '((tag: string) => boolean) | undefined' is not assignable to type '(tag: string) => boolean'.
              Type 'undefined' is not assignable to type '(tag: string) => boolean'.

Evertvdw avatar Jun 18 '21 09:06 Evertvdw