#3455·redux

[bug: typescript] `ActionCreator` lose it's arguments type

Author: dabusideCreated Jun 21, 2019Updated Mar 18, 2026
LabelsTypeScript

What is the current behavior?

https://github.com/reduxjs/redux/blob/beb1fc29ca6ebe45226caa3a064476072cd9ed26/test/typescript/actionCreators.ts#L13-L18

We declare the addTodo function that accepts one string argument text, but we could pass any argument to it.

const addTodoAction: AddTodoAction = addTodo(false, 0, null); //no ts error!

There may be a problem (...args: any[]) https://github.com/reduxjs/redux/blob/c676a25525bd7e4f2bf407cf1a135f355a2c1d79/index.d.ts#L440-L442

What is the expected behavior?

Raise a type error