typemoq
typemoq copied to clipboard
Typed `It.isAny` ?
Hello, got a small feature request! The It interface provides an isAny() method that matches anything and returns the type any. For typescript, it's generally frowned to explicitly use any unless there's no other way. For instance, see the typescript-eslint docs https://typescript-eslint.io/rules/no-unsafe-argument. It would be nice if there was a generic typed version of the isAny that returns the generic type to avoid running into these linting errors. This would also make typemoq closer to its C# progenitor.
currently:
const mock = Mock.ofType<IMyType>();
mock.setup((m) => m.methodThatTakesMyOtherType(It.isAny()); // <= Raises warning b/c isAny is 'any'
proposed:
const mock = Mock.ofType<IMyType>();
mock.setup((m) => m.methodThatTakesMyOtherType(It.isAnyOfType<MyOtherType>());