From 73b1dcb78fbb07e1926827a05fe3b9648ef88d11 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 28 Dec 2018 09:38:24 -1000 Subject: [PATCH] Accept new baselines --- ...ingInitializerContextualTypeFromContext.js | 13 +++++++++++- ...itializerContextualTypeFromContext.symbols | 14 +++++++++++++ ...InitializerContextualTypeFromContext.types | 20 +++++++++++++++++-- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.js b/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.js index 2dd6b4ea11a..1215d343df0 100644 --- a/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.js +++ b/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.js @@ -17,9 +17,16 @@ const Child: SFC = ({ children, name = "Artemis", ...props -}) => `name: ${name} props: ${JSON.stringify(props)}`; +}) => `name: ${name} props: ${JSON.stringify(props)}`; + +// Repro from #29189 + +declare function f(g: (as: string[]) => void): void +f(([_1, _2 = undefined]) => undefined) + //// [destructuringInitializerContextualTypeFromContext.js] +"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { @@ -48,3 +55,7 @@ var Child = function (_a) { var children = _a.children, _b = _a.name, name = _b === void 0 ? "Artemis" : _b, props = __rest(_a, ["children", "name"]); return "name: " + name + " props: " + JSON.stringify(props); }; +f(function (_a) { + var _1 = _a[0], _b = _a[1], _2 = _b === void 0 ? undefined : _b; + return undefined; +}); diff --git a/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.symbols b/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.symbols index 317a09ee105..8ae1b56e20f 100644 --- a/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.symbols +++ b/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.symbols @@ -56,3 +56,17 @@ const Child: SFC = ({ >stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >props : Symbol(props, Decl(destructuringInitializerContextualTypeFromContext.ts, 16, 21)) +// Repro from #29189 + +declare function f(g: (as: string[]) => void): void +>f : Symbol(f, Decl(destructuringInitializerContextualTypeFromContext.ts, 18, 54)) +>g : Symbol(g, Decl(destructuringInitializerContextualTypeFromContext.ts, 22, 19)) +>as : Symbol(as, Decl(destructuringInitializerContextualTypeFromContext.ts, 22, 23)) + +f(([_1, _2 = undefined]) => undefined) +>f : Symbol(f, Decl(destructuringInitializerContextualTypeFromContext.ts, 18, 54)) +>_1 : Symbol(_1, Decl(destructuringInitializerContextualTypeFromContext.ts, 23, 4)) +>_2 : Symbol(_2, Decl(destructuringInitializerContextualTypeFromContext.ts, 23, 7)) +>undefined : Symbol(undefined) +>undefined : Symbol(undefined) + diff --git a/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.types b/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.types index fa76e2eef25..4018d4bed3f 100644 --- a/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.types +++ b/tests/baselines/reference/destructuringInitializerContextualTypeFromContext.types @@ -50,8 +50,24 @@ const Child: SFC = ({ >`name: ${name} props: ${JSON.stringify(props)}` : string >name : "Apollo" | "Artemis" | "Dionysus" | "Persephone" >JSON.stringify(props) : string ->JSON.stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >JSON : JSON ->stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >props : {} +// Repro from #29189 + +declare function f(g: (as: string[]) => void): void +>f : (g: (as: string[]) => void) => void +>g : (as: string[]) => void +>as : string[] + +f(([_1, _2 = undefined]) => undefined) +>f(([_1, _2 = undefined]) => undefined) : void +>f : (g: (as: string[]) => void) => void +>([_1, _2 = undefined]) => undefined : ([_1, _2]: string[]) => undefined +>_1 : string +>_2 : string | undefined +>undefined : undefined +>undefined : undefined +