Subscribe on changes!

Typing error with app.use(), requiring 2nd argument

avatar
Feb 16th 2023

Vue version

3.2.47

Link to minimal reproduction

https://bitbucket.org/hongquan/vue-wrong-argument-for-use

Steps to reproduce

  • Clone the repo above
  • Run yarn build

What is expected?

No error

What is actually happening?

Typing error raises at app.use(fluent)

System Info

System:
    OS: Linux 5.19 Ubuntu 22.10 22.10 (Kinetic Kudu)
    CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
    Memory: 6.45 GB / 11.59 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 18.14.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.3.1 - /usr/bin/npm
  Browsers:
    Chrome: 110.0.5481.100
    Firefox: 110.0
  npmPackages:
    vue: ^3.2.47 => 3.2.47

Any additional comments?

Log:

❯ yarn build
yarn run v1.22.19
$ vue-tsc && vite build
src/main.ts:22:5 - error TS2554: Expected 2 arguments, but got 1.

22 app.use(fluent)
       ~~~~~~~~~~~

  node_modules/@vue/runtime-core/dist/runtime-core.d.ts:78:63
    78     use<Options extends unknown[]>(plugin: Plugin_2<Options>, ...options: Options): this;
                                                                     ~~~~~~~~~~~~~~~~~~~
    Arguments for the rest parameter 'options' were not provided.


Found 1 error in src/main.ts:22
avatar
Feb 16th 2023

#7731

avatar
Feb 16th 2023

Hm, I took another look. I think acutally, our types are fine. The problem is with the types of fluent-vue:

https://github.com/fluent-vue/fluent-vue/blob/fdc1fbcd45053415c55c86b2885534bed26451c6/src/types/typesCompat.ts#L26

export type InstallFunction<TOptions> = (vue: unknown, options: TOptions) => void

FluentVue claims that it needs an options object. It's just that before https://github.com/vuejs/core/commit/c513126c5dd12fec1064bf2df53384099f4000d2, the types for app.use() did not reflect that.

avatar
Feb 16th 2023

This is fluent-vue's bug, so I close this issue.