https://www.typescriptlang.org/play?#code/FDDGHsDsGcBcAJrwLz...
(I still think this is actually due to bug in TypeScript, see https://github.com/microsoft/TypeScript/issues/31990 .)