How to fix Type parameter cannot be constrained with 'this' type in TypeScript | DevErrors