Question about PactJs with Typescript I recently ...
# pact-js
m
Question about PactJs with Typescript I recently began to covert a JS sample repo to TS, here’s the PR What is the correct type of the stateHandlers? based on
node_modules/@pact-foundation/pact/src/dsl/message.d.ts
Copy code
export interface ProviderState {
   name: string;
   params?: {
       [name: string]: string;
   };
}
What if my param is a number, like id?
m
This is actually the correct type, and it should be the same as the Message variant. Doing this is a breaking change though, but it expands the type of
params
.
For now, you could force it to accept a wider type, as you’re correct in noticing it should accept more than just a string