mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 17:05:58 -05:00
Accept new baselines
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
//// [switchWithConstrainedTypeVariable.ts]
|
||||
// Repro from #20840
|
||||
|
||||
function function1<T extends 'a' | 'b'>(key: T) {
|
||||
switch (key) {
|
||||
case 'a':
|
||||
key.toLowerCase();
|
||||
break;
|
||||
default:
|
||||
key.toLowerCase();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [switchWithConstrainedTypeVariable.js]
|
||||
"use strict";
|
||||
// Repro from #20840
|
||||
function function1(key) {
|
||||
switch (key) {
|
||||
case 'a':
|
||||
key.toLowerCase();
|
||||
break;
|
||||
default:
|
||||
key.toLowerCase();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
=== tests/cases/conformance/controlFlow/switchWithConstrainedTypeVariable.ts ===
|
||||
// Repro from #20840
|
||||
|
||||
function function1<T extends 'a' | 'b'>(key: T) {
|
||||
>function1 : Symbol(function1, Decl(switchWithConstrainedTypeVariable.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(switchWithConstrainedTypeVariable.ts, 2, 19))
|
||||
>key : Symbol(key, Decl(switchWithConstrainedTypeVariable.ts, 2, 40))
|
||||
>T : Symbol(T, Decl(switchWithConstrainedTypeVariable.ts, 2, 19))
|
||||
|
||||
switch (key) {
|
||||
>key : Symbol(key, Decl(switchWithConstrainedTypeVariable.ts, 2, 40))
|
||||
|
||||
case 'a':
|
||||
key.toLowerCase();
|
||||
>key.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
|
||||
>key : Symbol(key, Decl(switchWithConstrainedTypeVariable.ts, 2, 40))
|
||||
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
|
||||
|
||||
break;
|
||||
default:
|
||||
key.toLowerCase();
|
||||
>key.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
|
||||
>key : Symbol(key, Decl(switchWithConstrainedTypeVariable.ts, 2, 40))
|
||||
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
=== tests/cases/conformance/controlFlow/switchWithConstrainedTypeVariable.ts ===
|
||||
// Repro from #20840
|
||||
|
||||
function function1<T extends 'a' | 'b'>(key: T) {
|
||||
>function1 : <T extends "a" | "b">(key: T) => void
|
||||
>T : T
|
||||
>key : T
|
||||
>T : T
|
||||
|
||||
switch (key) {
|
||||
>key : T
|
||||
|
||||
case 'a':
|
||||
>'a' : "a"
|
||||
|
||||
key.toLowerCase();
|
||||
>key.toLowerCase() : string
|
||||
>key.toLowerCase : () => string
|
||||
>key : T
|
||||
>toLowerCase : () => string
|
||||
|
||||
break;
|
||||
default:
|
||||
key.toLowerCase();
|
||||
>key.toLowerCase() : string
|
||||
>key.toLowerCase : () => string
|
||||
>key : T
|
||||
>toLowerCase : () => string
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user