TypeScript type inference/narrowing challenge TypeScript type inference/narrowing challenge typescript typescript