diff --git a/tests/cases/conformance/expressions/arrayLiterals/arrayLiteralInference.ts b/tests/cases/conformance/expressions/arrayLiterals/arrayLiteralInference.ts new file mode 100644 index 00000000000..311cad6236f --- /dev/null +++ b/tests/cases/conformance/expressions/arrayLiterals/arrayLiteralInference.ts @@ -0,0 +1,36 @@ +// @strict: true +// @target: es2015 + +// Repro from #31204 + +export enum AppType { + HeaderDetail = 'HeaderDetail', + HeaderMultiDetail = 'HeaderMultiDetail', + AdvancedList = 'AdvancedList', + Standard = 'Standard', + Relationship = 'Relationship', + Report = 'Report', + Composite = 'Composite', + ListOnly = 'ListOnly', + ModuleSettings = 'ModuleSettings' +} + +export enum AppStyle { + Tree, + TreeEntity, + Standard, + MiniApp, + PivotTable +} + +const appTypeStylesWithError: Map> = new Map([ + [AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]], + [AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]], + [AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]] +]); + +// Repro from #31204 + +declare function foo(...args: T[]): T[]; +let b1: { x: boolean }[] = foo({ x: true }, { x: false }); +let b2: boolean[][] = foo([true], [false]);