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

fix(types): improve the accuracy of dispatcher inference #937

Merged
merged 8 commits into from
Oct 11, 2021

Conversation

tianzhich
Copy link
Collaborator

@tianzhich tianzhich commented Sep 30, 2021

@tianzhich
Copy link
Collaborator Author

tianzhich commented Sep 30, 2021

The building process was blocked by rollup because it throws some TS errors(these errors didn't appear in my local with ts@4.4.2), can you have a look? @semoal

I want to formate the types file and also add/amend the documents in the week after next. Next week is China's National Day.

@github-actions
Copy link

github-actions bot commented Oct 11, 2021

size-limit report 📦

Path Size
./packages/core/dist/core.umd.production.min.js 1.46 KB (+2.47% 🔺)
./packages/immer/dist/immer.umd.production.min.js 127 B (+0.8% 🔺)
./packages/loading/dist/loading.umd.production.min.js 706 B (0%)
./packages/persist/dist/persist.umd.production.min.js 172 B (0%)
./packages/select/dist/select.umd.production.min.js 456 B (0%)
./packages/updated/dist/updated.umd.production.min.js 407 B (0%)
./packages/typed-state/dist/typed-state.umd.production.min.js 248 B (0%)

@semoal
Copy link
Member

semoal commented Oct 11, 2021

Feel free to merge when you feel comfortable with :)

@semoal semoal closed this Oct 11, 2021
@semoal semoal reopened this Oct 11, 2021
@ardyfeb
Copy link

ardyfeb commented Oct 18, 2021

I still getting this issue on v2.1.1

export const beepModel = createModel<RootModel>()(
  {
    state: <BeepModel>{
      visible: false
    },
    reducers: {
      showBeep: (state): void => {
        state.visible = true
      },
      hideBeep: (state): void => {
        state.visible = false
      }
    },
  }
)

dispatch.beep.showBeep() // throws "Expected 2 arguments, but got 0."

But works when adding emtpy effects: {} on beepModel

@tianzhich
Copy link
Collaborator Author

@ardyfeb What's your ts version? You should update it to ^4.4.

@ardyfeb
Copy link

ardyfeb commented Oct 19, 2021

@tianzhich i using typescript ^4.4.3

@tianzhich
Copy link
Collaborator Author

Could you create a reproduce repo or sandbox? The codes you posted above works in our tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript error occurred after upgrading the project to version 2.0
3 participants