launchdarkly / jest-launchdarkly-mock

Easily unit test LaunchDarkly feature flagged components with jest
Apache License 2.0
25 stars 19 forks source link

ldClientMock missing alias method? #10

Closed ExplodingCabbage closed 2 years ago

ExplodingCabbage commented 3 years ago

When I try to use the ldClientMock in TypeScript in a place where an LDClient is expected, I get this error:

error TS2345: Argument of type '{ track: Mock<any, any>; identify: Mock<any, any>; allFlags: Mock<any, any>; close: Mock<any, any>; flush: Mock<any, any>; getUser: Mock<any, any>; ... 7 more ...; waitUntilReady: Mock<...>; }' is not assignable to parameter of type 'LDClient'.
  Property 'alias' is missing in type '{ track: Mock<any, any>; identify: Mock<any, any>; allFlags: Mock<any, any>; close: Mock<any, any>; flush: Mock<any, any>; getUser: Mock<any, any>; ... 7 more ...; waitUntilReady: Mock<...>; }' but required in type 'LDClient'.

Versions:

> require('jest-launchdarkly-mock/package').version
'0.2.1'
> require('launchdarkly-js-client-sdk').version
'2.19.1'

It looks like https://github.com/launchdarkly-labs/jest-launchdarkly-mock/pull/5 already fixes this, but has only been merged to the contrib branch, not to master, and wasn't included in the latest release.

yusinto commented 2 years ago

@ExplodingCabbage we have an upcoming release to fix this. I'll update the issue when that's done. Thank you for your patience.

yusinto commented 2 years ago

This is now fixed in v1.0.0.