Hi, I’ve just updated our repo to pact 11.0.0 and ...
# pact-js
k
Hi, I’ve just updated our repo to pact 11.0.0 and was looking through the migration guide. Since updating, all of our
like()
methods are erroring out due to type mismatches. When I looked into the
AnyTemplate
class, I see that it is deprecated. What are my options here?
Copy code
it('should return the correct data from POST call', async () => {
      await mockProvider.addInteraction({
        states: '[]',
        uponReceiving: 'a request to create a tenant',
        withRequest: {
          method: 'POST',
          path: '/tenant',
          body: like(reqBody),
          headers: requestHeaders,
        },
        willRespondWith: {
          status: 201,
          headers: responseHeaders,
          body: like(responseBody),
        },
      });

      const tenant = await lastValueFrom(service.createTenant(requestHeaders, reqBody));
      expect(tenant).toStrictEqual(camelCaseObjectKeys(responseBody));
    });
m
AnyTemplate
was removed from the matchers in 11.0.0. So have you wrapped the interface somehow?
In any case, the type is now
unknown
- so it’s much wider than before
t
This definitely shouldn’t happen - can you put this in a repository that reproduces it?
depending on how you’re building, it might be corruption in some caching layer. Removing node_modules and running
npm install
again might fix it
k
Yup I had to do a clean
npm install
after nuking node_modules
👍 1