Hello, do you have a TypeScript example of a provi...
# pact-js
é
Hello, do you have a TypeScript example of a provider verification test? I'm have trouble defining the
stateHandlers
map. The following:
Copy code
import { …, StateHandlers } from '@pact-foundation/pact'
…
      stateHandlers: {
        'Customers are available': (state, params) => Promise.resolve(),
      } as StateHandlers,
Give this error
Copy code
Type 'StateHandlers' is not assignable to type 'StateHandlers & StateHandlers'.
  Type 'import("/workspaces/ms.pact-provider-example-for-typescript/node_modules/@pact-foundation/pact/src/dsl/message").StateHandlers' is not assignable to type 'import("/workspaces/ms.pact-provider-example-for-typescript/node_modules/@pact-foundation/pact/src/dsl/verifier/proxy/types").StateHandlers'.
    'string' index signatures are incompatible.
      Type '(state: string, params?: { [name: string]: string; } | undefined) => Promise<unknown>' is not assignable to type 'StateHandler'.
        Type '(state: string, params?: { [name: string]: string; } | undefined) => Promise<unknown>' is not assignable to type 'StateFunc'.
          Types of parameters 'state' and 'parameters' are incompatible.
            Type 'AnyJson | undefined' is not assignable to type 'string'.
              Type 'undefined' is not assignable to type 'string'.ts(2322)
types.d.ts(42, 5): The expected type comes from property 'stateHandlers' which is declared here on type 'VerifierOptions'