mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 06:41:59 -06:00
Accept new baselines
This commit is contained in:
parent
61f3a829eb
commit
b2d702e423
20
tests/baselines/reference/destructuringWithConstraint.js
Normal file
20
tests/baselines/reference/destructuringWithConstraint.js
Normal file
@ -0,0 +1,20 @@
|
||||
//// [destructuringWithConstraint.ts]
|
||||
// Repro from #22823
|
||||
|
||||
interface Props {
|
||||
foo?: boolean;
|
||||
}
|
||||
|
||||
function foo<P extends Props>(props: Readonly<P>) {
|
||||
let { foo = false } = props;
|
||||
if (foo === true) { }
|
||||
}
|
||||
|
||||
|
||||
//// [destructuringWithConstraint.js]
|
||||
"use strict";
|
||||
// Repro from #22823
|
||||
function foo(props) {
|
||||
var _a = props.foo, foo = _a === void 0 ? false : _a;
|
||||
if (foo === true) { }
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
=== tests/cases/compiler/destructuringWithConstraint.ts ===
|
||||
// Repro from #22823
|
||||
|
||||
interface Props {
|
||||
>Props : Symbol(Props, Decl(destructuringWithConstraint.ts, 0, 0))
|
||||
|
||||
foo?: boolean;
|
||||
>foo : Symbol(Props.foo, Decl(destructuringWithConstraint.ts, 2, 17))
|
||||
}
|
||||
|
||||
function foo<P extends Props>(props: Readonly<P>) {
|
||||
>foo : Symbol(foo, Decl(destructuringWithConstraint.ts, 4, 1))
|
||||
>P : Symbol(P, Decl(destructuringWithConstraint.ts, 6, 13))
|
||||
>Props : Symbol(Props, Decl(destructuringWithConstraint.ts, 0, 0))
|
||||
>props : Symbol(props, Decl(destructuringWithConstraint.ts, 6, 30))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>P : Symbol(P, Decl(destructuringWithConstraint.ts, 6, 13))
|
||||
|
||||
let { foo = false } = props;
|
||||
>foo : Symbol(foo, Decl(destructuringWithConstraint.ts, 7, 9))
|
||||
>props : Symbol(props, Decl(destructuringWithConstraint.ts, 6, 30))
|
||||
|
||||
if (foo === true) { }
|
||||
>foo : Symbol(foo, Decl(destructuringWithConstraint.ts, 7, 9))
|
||||
}
|
||||
|
||||
29
tests/baselines/reference/destructuringWithConstraint.types
Normal file
29
tests/baselines/reference/destructuringWithConstraint.types
Normal file
@ -0,0 +1,29 @@
|
||||
=== tests/cases/compiler/destructuringWithConstraint.ts ===
|
||||
// Repro from #22823
|
||||
|
||||
interface Props {
|
||||
>Props : Props
|
||||
|
||||
foo?: boolean;
|
||||
>foo : boolean | undefined
|
||||
}
|
||||
|
||||
function foo<P extends Props>(props: Readonly<P>) {
|
||||
>foo : <P extends Props>(props: Readonly<P>) => void
|
||||
>P : P
|
||||
>Props : Props
|
||||
>props : Readonly<P>
|
||||
>Readonly : Readonly<T>
|
||||
>P : P
|
||||
|
||||
let { foo = false } = props;
|
||||
>foo : boolean
|
||||
>false : false
|
||||
>props : Readonly<P>
|
||||
|
||||
if (foo === true) { }
|
||||
>foo === true : boolean
|
||||
>foo : boolean
|
||||
>true : true
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user