diff --git a/tests/cases/conformance/controlFlow/switchWithConstrainedTypeVariable.ts b/tests/cases/conformance/controlFlow/switchWithConstrainedTypeVariable.ts new file mode 100644 index 00000000000..f6efd36811e --- /dev/null +++ b/tests/cases/conformance/controlFlow/switchWithConstrainedTypeVariable.ts @@ -0,0 +1,14 @@ +// @strict: true + +// Repro from #20840 + +function function1(key: T) { + switch (key) { + case 'a': + key.toLowerCase(); + break; + default: + key.toLowerCase(); + break; + } +}