mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-16 15:51:35 -05:00
Accept new baselines
This commit is contained in:
25
tests/baselines/reference/unionReductionMutualSubtypes.js
Normal file
25
tests/baselines/reference/unionReductionMutualSubtypes.js
Normal file
@@ -0,0 +1,25 @@
|
||||
//// [unionReductionMutualSubtypes.ts]
|
||||
// Repro from #35414
|
||||
|
||||
interface ReturnVal {
|
||||
something(): void;
|
||||
}
|
||||
|
||||
const k: ReturnVal = { something() { } }
|
||||
|
||||
declare const val: ReturnVal;
|
||||
function run(options: { something?(b?: string): void }) {
|
||||
const something = options.something ?? val.something;
|
||||
something('');
|
||||
}
|
||||
|
||||
|
||||
//// [unionReductionMutualSubtypes.js]
|
||||
"use strict";
|
||||
// Repro from #35414
|
||||
var k = { something: function () { } };
|
||||
function run(options) {
|
||||
var _a;
|
||||
var something = (_a = options.something) !== null && _a !== void 0 ? _a : val.something;
|
||||
something('');
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
=== tests/cases/compiler/unionReductionMutualSubtypes.ts ===
|
||||
// Repro from #35414
|
||||
|
||||
interface ReturnVal {
|
||||
>ReturnVal : Symbol(ReturnVal, Decl(unionReductionMutualSubtypes.ts, 0, 0))
|
||||
|
||||
something(): void;
|
||||
>something : Symbol(ReturnVal.something, Decl(unionReductionMutualSubtypes.ts, 2, 21))
|
||||
}
|
||||
|
||||
const k: ReturnVal = { something() { } }
|
||||
>k : Symbol(k, Decl(unionReductionMutualSubtypes.ts, 6, 5))
|
||||
>ReturnVal : Symbol(ReturnVal, Decl(unionReductionMutualSubtypes.ts, 0, 0))
|
||||
>something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 6, 22))
|
||||
|
||||
declare const val: ReturnVal;
|
||||
>val : Symbol(val, Decl(unionReductionMutualSubtypes.ts, 8, 13))
|
||||
>ReturnVal : Symbol(ReturnVal, Decl(unionReductionMutualSubtypes.ts, 0, 0))
|
||||
|
||||
function run(options: { something?(b?: string): void }) {
|
||||
>run : Symbol(run, Decl(unionReductionMutualSubtypes.ts, 8, 29))
|
||||
>options : Symbol(options, Decl(unionReductionMutualSubtypes.ts, 9, 13))
|
||||
>something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 9, 23))
|
||||
>b : Symbol(b, Decl(unionReductionMutualSubtypes.ts, 9, 35))
|
||||
|
||||
const something = options.something ?? val.something;
|
||||
>something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 10, 9))
|
||||
>options.something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 9, 23))
|
||||
>options : Symbol(options, Decl(unionReductionMutualSubtypes.ts, 9, 13))
|
||||
>something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 9, 23))
|
||||
>val.something : Symbol(ReturnVal.something, Decl(unionReductionMutualSubtypes.ts, 2, 21))
|
||||
>val : Symbol(val, Decl(unionReductionMutualSubtypes.ts, 8, 13))
|
||||
>something : Symbol(ReturnVal.something, Decl(unionReductionMutualSubtypes.ts, 2, 21))
|
||||
|
||||
something('');
|
||||
>something : Symbol(something, Decl(unionReductionMutualSubtypes.ts, 10, 9))
|
||||
}
|
||||
|
||||
38
tests/baselines/reference/unionReductionMutualSubtypes.types
Normal file
38
tests/baselines/reference/unionReductionMutualSubtypes.types
Normal file
@@ -0,0 +1,38 @@
|
||||
=== tests/cases/compiler/unionReductionMutualSubtypes.ts ===
|
||||
// Repro from #35414
|
||||
|
||||
interface ReturnVal {
|
||||
something(): void;
|
||||
>something : () => void
|
||||
}
|
||||
|
||||
const k: ReturnVal = { something() { } }
|
||||
>k : ReturnVal
|
||||
>{ something() { } } : { something(): void; }
|
||||
>something : () => void
|
||||
|
||||
declare const val: ReturnVal;
|
||||
>val : ReturnVal
|
||||
|
||||
function run(options: { something?(b?: string): void }) {
|
||||
>run : (options: { something?(b?: string | undefined): void; }) => void
|
||||
>options : { something?(b?: string | undefined): void; }
|
||||
>something : ((b?: string | undefined) => void) | undefined
|
||||
>b : string | undefined
|
||||
|
||||
const something = options.something ?? val.something;
|
||||
>something : (b?: string | undefined) => void
|
||||
>options.something ?? val.something : (b?: string | undefined) => void
|
||||
>options.something : ((b?: string | undefined) => void) | undefined
|
||||
>options : { something?(b?: string | undefined): void; }
|
||||
>something : ((b?: string | undefined) => void) | undefined
|
||||
>val.something : () => void
|
||||
>val : ReturnVal
|
||||
>something : () => void
|
||||
|
||||
something('');
|
||||
>something('') : void
|
||||
>something : (b?: string | undefined) => void
|
||||
>'' : ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user