Description
Version
3.6.2
Reproduction link
Steps to reproduce
-
Look up the Union type of the 'path' argument (initModule method)
-
An error appears about the incompatibility of the types of arguments for the registerModule method, the typing of this method does not support the use of the Union type:
string | string[]
-
Familiarize yourself with the typing of this method by reference and match the union type to the two method declarations:
https://github.com/vuejs/vuex/blob/3.x/types/index.d.ts
For more information, use the resource:
https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#use-union-types
What is expected?
Support Union type: string | string[] given the already described type overloads of the registerModule method, the following errors will be eliminated when resolving the conflict:
1. Argument of type "string | string[]" is not assignable to parameter of type "string[]".
2. Argument of type "string | string[] is not assignable to parameter of type "string".
What is actually happening?
When comparing the type "string | string[]", an error about type incompatibility is thrown, but given the type overloads, it should be possible to put an argument with the union type.