I was writing a test and I really wanted to have object intellisense for a object I was passing to jest’s toHaveBeenCalledWith function. So I figured I’d try using typescript’s satisfies keyword and its perfect. It gives me errors for the object I’m typing out without having to first create the object outside the function call with a type annotation.

expect(mockOnSubmit).toHaveBeenCalledWith([{
  category: 'category1',
}] satisfies FilterItem[]);