Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript type-checking bugs with mapState/mapGetters #1353

Closed
ffxsam opened this issue Jul 25, 2018 · 2 comments
Closed

TypeScript type-checking bugs with mapState/mapGetters #1353

ffxsam opened this issue Jul 25, 2018 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@ffxsam
Copy link

ffxsam commented Jul 25, 2018

Version

3.0.1

Reproduction link

https://github.com/ffxsam/repro-mapstate-bug

Steps to reproduce

  1. Clone repo
  2. Run yarn
  3. 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
@ffxsam ffxsam changed the title fff TypeScript type-checking bugs with mapState/mapGetters Jul 25, 2018
@ktsn
Copy link
Member

ktsn commented Jul 25, 2018

Duplicate of #1119 and #1220
PR is already on #1121

@ktsn ktsn closed this as completed Jul 25, 2018
@ktsn ktsn added the duplicate This issue or pull request already exists label Jul 25, 2018
@ffxsam
Copy link
Author

ffxsam commented Jul 25, 2018

@ktsn That PR is super old. Any ETA on when it'll go live?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants