ERROR in src/main.ts:51:5
TS2769: No overload matches this call.
  Overload 1 of 3, '(options?: ThisTypedComponentOptionsWithArrayProps<ExtractComputedReturns<{}> & Record<never, any> & Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>> & ShallowUnwrapRef<...> & Vue<...>, ... 6 more ..., ComponentOptionsMixin>): CombinedVueInstance<...>', gave the following error.
    Argument of type '{ i18n: any; store: Store<any>; }' is not assignable to parameter of type 'ThisTypedComponentOptionsWithArrayProps<ExtractComputedReturns<{}> & Record<never, any> & Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>> & ShallowUnwrapRef<...> & Vue<...>, ... 6 more ..., ComponentOptionsMixin>'.
      Object literal may only specify known properties, and 'i18n' does not exist in type 'ThisTypedComponentOptionsWithArrayProps<ExtractComputedReturns<{}> & Record<never, any> & Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>> & ShallowUnwrapRef<...> & Vue<...>, ... 6 more ..., ComponentOptionsMixin>'.
  Overload 2 of 3, '(options?: ThisTypedComponentOptionsWithRecordProps<ExtractComputedReturns<{}> & Record<never, any> & Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>> & ShallowUnwrapRef<...> & Vue<...>, ... 6 more ..., ComponentOptionsMixin>): CombinedVueInstance<...>', gave the following error.
    Argument of type '{ i18n: any; store: Store<any>; }' is not assignable to parameter of type 'ThisTypedComponentOptionsWithRecordProps<ExtractComputedReturns<{}> & Record<never, any> & Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>> & ShallowUnwrapRef<...> & Vue<...>, ... 6 more ..., ComponentOptionsMixin>'.
      Object literal may only specify known properties, and 'i18n' does not exist in type 'ThisTypedComponentOptionsWithRecordProps<ExtractComputedReturns<{}> & Record<never, any> & Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>> & ShallowUnwrapRef<...> & Vue<...>, ... 6 more ..., ComponentOptionsMixin>'.
  Overload 3 of 3, '(options?: ComponentOptions<ExtractComputedReturns<{}> & Record<never, any> & Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>> & ShallowUnwrapRef<...> & Vue<...>, ... 7 more ..., ComponentOptionsMixin>): CombinedVueInstance<...>', gave the following error.
    Argument of type '{ i18n: any; store: Store<any>; }' is not assignable to parameter of type 'ComponentOptions<ExtractComputedReturns<{}> & Record<never, any> & Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>> & ShallowUnwrapRef<...> & Vue<...>, ... 7 more ..., ComponentOptionsMixin>'.
      Object literal may only specify known properties, and 'i18n' does not exist in type 'ComponentOptions<ExtractComputedReturns<{}> & Record<never, any> & Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>> & ShallowUnwrapRef<...> & Vue<...>, ... 7 more ..., ComponentOptionsMixin>'.
    49 |
    50 | const app = new App({
  > 51 |     i18n,
       |     ^^^^
    52 |     store,
    53 | });
    54 |

最终发现是依赖node_modules/vue-i18n/types类型未引入!

修改tsconfig.json配置,添加vue-i18n/types:

tsconfig.json · TypeScript中文网 · TypeScript——JavaScript的超集

实在不行就忽略类型检查:

// @ts-ignore
const app = new App({ i18n, store });

Logo

前往低代码交流专区

更多推荐