Software versions
Please provide at least OS and version of pact-js
- OS: Arch Linux, Ubuntu, Windows (it's irrelevant)
- Consumer Pact library: Pact JS v12.1.2
- Provider Pact library: Pact JS v12.1.2
- Node Version: v20.11.0
Issue Checklist
Please confirm the following:
Expected behaviour
There are no TypeScript errors when trying to provide a stateHandler with setup and teardown to a Verifier.
Actual behaviour
Trying to provide a stateHandler with setup and teardown results in the following TypeScript error:
error TS2322: Type '{ setup: () => Promise<void>; teardown: () => Promise<void>; }' is not assignable to type 'StateHandler & ((state: string, params?: { [name: string]: string; } | undefined) => Promise<unknown>)'.
Type '{ setup: () => Promise<void>; teardown: () => Promise<void>; }' is not assignable to type 'StateFuncWithSetup & ((state: string, params?: { [name: string]: string; } | undefined) => Promise<unknown>)'.
Type '{ setup: () => Promise<void>; teardown: () => Promise<void>; }' is not assignable to type '(state: string, params?: { [name: string]: string; } | undefined) => Promise<unknown>'.
Type '{ setup: () => Promise<void>; teardown: () => Promise<void>; }' provides no match for the signature '(state: string, params?: { [name: string]: string; } | undefined): Promise<unknown>'.
Steps to reproduce
import { Verifier } from '@pact-foundation/pact';
const verifier = new Verifier({
stateHandlers: {
'name of the stateHandler': { setup: async () => {}, teardown: async () => {} } // this line produces a TypeScript error
}
});
Software versions
Please provide at least OS and version of pact-js
Issue Checklist
Please confirm the following:
Expected behaviour
There are no TypeScript errors when trying to provide a stateHandler with setup and teardown to a
Verifier.Actual behaviour
Trying to provide a stateHandler with setup and teardown results in the following TypeScript error:
Steps to reproduce