TypeScript type-checking bugs with mapState/mapGetters
ffxsam opened this issue · 2 comments
ffxsam commented
Version
3.0.1
Reproduction link
https://github.com/ffxsam/repro-mapstate-bug
Steps to reproduce
- Clone repo
- Run yarn
- Open src/components/HelloWorld.vue
What is expected?
There should be no type errors
What is actually happening?
There is a type error on line 52
If you comment out lines 46-48 (the fake
computed property), the type error on line 52 goes away. It seems mapState
and mapGetters
merges in an interface property, [x: string] => any
whenever they're used. But if other computed properties are added, this fails to exist.
For instance, with lines 46-48 not commented out, I mouse over this
in the method, and I see this:
{
doit(): void;
} & {
fake: string;
} & Readonly<{
msg: string;
}> & Vue
However, if I comment out lines 46-48, hovering over this
reveals:
{
doit(): void;
} & {
[x: string]: any;
} & Readonly<{
msg: string;
}> & Vue