fix: fix type error for commands
This commit is contained in:
@@ -28,7 +28,7 @@ export default class CommandManager {
|
|||||||
return Object.fromEntries(Object
|
return Object.fromEntries(Object
|
||||||
.entries(commands)
|
.entries(commands)
|
||||||
.map(([name, command]) => {
|
.map(([name, command]) => {
|
||||||
const method = (...args: any) => {
|
const method = (...args: never[]) => {
|
||||||
const callback = command(...args)(props)
|
const callback = command(...args)(props)
|
||||||
|
|
||||||
if (!tr.getMeta('preventDispatch')) {
|
if (!tr.getMeta('preventDispatch')) {
|
||||||
@@ -59,7 +59,7 @@ export default class CommandManager {
|
|||||||
|
|
||||||
const chain = {
|
const chain = {
|
||||||
...Object.fromEntries(Object.entries(commands).map(([name, command]) => {
|
...Object.fromEntries(Object.entries(commands).map(([name, command]) => {
|
||||||
const chainedCommand = (...args: any[]) => {
|
const chainedCommand = (...args: never[]) => {
|
||||||
const props = this.buildProps(tr, shouldDispatch)
|
const props = this.buildProps(tr, shouldDispatch)
|
||||||
const callback = command(...args)(props)
|
const callback = command(...args)(props)
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ export default class CommandManager {
|
|||||||
const formattedCommands = Object.fromEntries(Object
|
const formattedCommands = Object.fromEntries(Object
|
||||||
.entries(commands)
|
.entries(commands)
|
||||||
.map(([name, command]) => {
|
.map(([name, command]) => {
|
||||||
return [name, (...args: any[]) => command(...args)({ ...props, dispatch })]
|
return [name, (...args: never[]) => command(...args)({ ...props, dispatch })]
|
||||||
})) as SingleCommands
|
})) as SingleCommands
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -116,7 +116,7 @@ export default class CommandManager {
|
|||||||
return Object.fromEntries(Object
|
return Object.fromEntries(Object
|
||||||
.entries(commands)
|
.entries(commands)
|
||||||
.map(([name, command]) => {
|
.map(([name, command]) => {
|
||||||
return [name, (...args: any[]) => command(...args)(props)]
|
return [name, (...args: never[]) => command(...args)(props)]
|
||||||
})) as SingleCommands
|
})) as SingleCommands
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user