How to fix Cannot extend with union type containing 'never' in TypeScript | DevErrors