stateTransformer typescript definition

I’m trying to type my createReduxEnhancer.stateTransformer but am having some trouble.
As a simple example I have:

interface IGlobalState {
  user: string;
const stateTransformer: SentryEnhancerOptions['stateTransformer'] = <IGlobalState>(state: IGlobalState | undefined) => {
  if (!state) {
    return {};

  return {
    user: state.user,

but with typescript 3.9.7 this is producing an error when trying to reference state.user
Property 'user' does not exist on type 'IGlobalState'.ts(2339)

removing the generic <IGlobalState> removes this error but then the function signature is no longer correct.

Any help resolving this would be much appreciated