-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Labels
bugSomething isn't workingSomething isn't workingnextIssue/Pull Request for the next major versionIssue/Pull Request for the next major version
Description
Bug
createProcessFactoryWith is used to create a factory that has pre-applied middleware, but the result process creator doesn't correctly infer types from the commands it's passed.
Package Version: latest
Code
import {
createCallbackDecorator,
createCommandFactory,
createProcessFactoryWith
} from "@dojo/framework/stores/process";
interface State {
foo: string;
bar: number;
}
const createCommand = createCommandFactory<State>();
const middleware = (): void => {
console.log("test");
};
interface Payload {
qux: string;
}
const command = createCommand<Payload>(() => {
return [];
});
const middlewareProcess = createProcessFactoryWith([createCallbackDecorator(middleware)]);
const myProcess = middlewareProcess('process', [command]);Expected behavior:
No errors!
Actual behavior:
Typing error using command with middlewareProcess
Argument of type 'Command<State, Payload>[]' is not assignable to parameter of type '(Command<any, DefaultPayload> | Command<any, DefaultPayload>[])[]'.
Type 'Command<State, Payload>' is not assignable to type 'Command<any, DefaultPayload> | Command<any, DefaultPayload>[]'.
Type 'Command<State, Payload>' is not assignable to type 'Command<any, DefaultPayload>'.
Type 'DefaultPayload' is not assignable to type 'Payload'.
Property 'qux' is missing in type 'DefaultPayload'.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingnextIssue/Pull Request for the next major versionIssue/Pull Request for the next major version