From cccf22a3cff1e5be5f0fb5dc4cd94b86e4ff383f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 2 Dec 2020 13:18:34 -0800 Subject: [PATCH] Accepted baselines. --- .../useUnknownInCatchVariables01.errors.txt | 12 +++++++ .../reference/useUnknownInCatchVariables01.js | 22 ++++++++++++ .../useUnknownInCatchVariables01.symbols | 23 +++++++++++++ .../useUnknownInCatchVariables01.types | 34 +++++++++++++++++++ 4 files changed, 91 insertions(+) diff --git a/tests/baselines/reference/useUnknownInCatchVariables01.errors.txt b/tests/baselines/reference/useUnknownInCatchVariables01.errors.txt index 21f7d8ba354..017c3ada88c 100644 --- a/tests/baselines/reference/useUnknownInCatchVariables01.errors.txt +++ b/tests/baselines/reference/useUnknownInCatchVariables01.errors.txt @@ -30,6 +30,18 @@ tests/cases/compiler/useUnknownInCatchVariables01.ts(8,10): error TS2349: This e e.stack?.toUpperCase(); } if (typeof e === "number") { + e.toExponential(); e++; } + } + + + try { + // ... + } + catch (e: any) { + // All are allowed. + void e.toUpperCase(); + void e.toExponential(); + void e(); } \ No newline at end of file diff --git a/tests/baselines/reference/useUnknownInCatchVariables01.js b/tests/baselines/reference/useUnknownInCatchVariables01.js index 85dc03e4fb0..1e3a867d118 100644 --- a/tests/baselines/reference/useUnknownInCatchVariables01.js +++ b/tests/baselines/reference/useUnknownInCatchVariables01.js @@ -17,8 +17,20 @@ catch (e) { e.stack?.toUpperCase(); } if (typeof e === "number") { + e.toExponential(); e++; } +} + + +try { + // ... +} +catch (e: any) { + // All are allowed. + void e.toUpperCase(); + void e.toExponential(); + void e(); } //// [useUnknownInCatchVariables01.js] @@ -40,6 +52,16 @@ catch (e) { (_a = e.stack) === null || _a === void 0 ? void 0 : _a.toUpperCase(); } if (typeof e === "number") { + e.toExponential(); e++; } } +try { + // ... +} +catch (e) { + // All are allowed. + void e.toUpperCase(); + void e.toExponential(); + void e(); +} diff --git a/tests/baselines/reference/useUnknownInCatchVariables01.symbols b/tests/baselines/reference/useUnknownInCatchVariables01.symbols index 0511ec3daac..f2261f8c36f 100644 --- a/tests/baselines/reference/useUnknownInCatchVariables01.symbols +++ b/tests/baselines/reference/useUnknownInCatchVariables01.symbols @@ -42,7 +42,30 @@ catch (e) { if (typeof e === "number") { >e : Symbol(e, Decl(useUnknownInCatchVariables01.ts, 3, 7)) + e.toExponential(); +>e.toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --)) +>e : Symbol(e, Decl(useUnknownInCatchVariables01.ts, 3, 7)) +>toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --)) + e++; >e : Symbol(e, Decl(useUnknownInCatchVariables01.ts, 3, 7)) } } + + +try { + // ... +} +catch (e: any) { +>e : Symbol(e, Decl(useUnknownInCatchVariables01.ts, 27, 7)) + + // All are allowed. + void e.toUpperCase(); +>e : Symbol(e, Decl(useUnknownInCatchVariables01.ts, 27, 7)) + + void e.toExponential(); +>e : Symbol(e, Decl(useUnknownInCatchVariables01.ts, 27, 7)) + + void e(); +>e : Symbol(e, Decl(useUnknownInCatchVariables01.ts, 27, 7)) +} diff --git a/tests/baselines/reference/useUnknownInCatchVariables01.types b/tests/baselines/reference/useUnknownInCatchVariables01.types index f818272aefa..71a25687af0 100644 --- a/tests/baselines/reference/useUnknownInCatchVariables01.types +++ b/tests/baselines/reference/useUnknownInCatchVariables01.types @@ -60,8 +60,42 @@ catch (e) { >e : unknown >"number" : "number" + e.toExponential(); +>e.toExponential() : string +>e.toExponential : (fractionDigits?: number) => string +>e : number +>toExponential : (fractionDigits?: number) => string + e++; >e++ : number >e : number } } + + +try { + // ... +} +catch (e: any) { +>e : any + + // All are allowed. + void e.toUpperCase(); +>void e.toUpperCase() : undefined +>e.toUpperCase() : any +>e.toUpperCase : any +>e : any +>toUpperCase : any + + void e.toExponential(); +>void e.toExponential() : undefined +>e.toExponential() : any +>e.toExponential : any +>e : any +>toExponential : any + + void e(); +>void e() : undefined +>e() : any +>e : any +}