Skip to content

Commit ad3b359

Browse files
committed
Accept new baselines
1 parent 1c2f3d2 commit ad3b359

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//// [destructuringWithConstraint.ts]
2+
// Repro from #22823
3+
4+
interface Props {
5+
foo?: boolean;
6+
}
7+
8+
function foo<P extends Props>(props: Readonly<P>) {
9+
let { foo = false } = props;
10+
if (foo === true) { }
11+
}
12+
13+
14+
//// [destructuringWithConstraint.js]
15+
"use strict";
16+
// Repro from #22823
17+
function foo(props) {
18+
var _a = props.foo, foo = _a === void 0 ? false : _a;
19+
if (foo === true) { }
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
=== tests/cases/compiler/destructuringWithConstraint.ts ===
2+
// Repro from #22823
3+
4+
interface Props {
5+
>Props : Symbol(Props, Decl(destructuringWithConstraint.ts, 0, 0))
6+
7+
foo?: boolean;
8+
>foo : Symbol(Props.foo, Decl(destructuringWithConstraint.ts, 2, 17))
9+
}
10+
11+
function foo<P extends Props>(props: Readonly<P>) {
12+
>foo : Symbol(foo, Decl(destructuringWithConstraint.ts, 4, 1))
13+
>P : Symbol(P, Decl(destructuringWithConstraint.ts, 6, 13))
14+
>Props : Symbol(Props, Decl(destructuringWithConstraint.ts, 0, 0))
15+
>props : Symbol(props, Decl(destructuringWithConstraint.ts, 6, 30))
16+
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
17+
>P : Symbol(P, Decl(destructuringWithConstraint.ts, 6, 13))
18+
19+
let { foo = false } = props;
20+
>foo : Symbol(foo, Decl(destructuringWithConstraint.ts, 7, 9))
21+
>props : Symbol(props, Decl(destructuringWithConstraint.ts, 6, 30))
22+
23+
if (foo === true) { }
24+
>foo : Symbol(foo, Decl(destructuringWithConstraint.ts, 7, 9))
25+
}
26+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
=== tests/cases/compiler/destructuringWithConstraint.ts ===
2+
// Repro from #22823
3+
4+
interface Props {
5+
>Props : Props
6+
7+
foo?: boolean;
8+
>foo : boolean | undefined
9+
}
10+
11+
function foo<P extends Props>(props: Readonly<P>) {
12+
>foo : <P extends Props>(props: Readonly<P>) => void
13+
>P : P
14+
>Props : Props
15+
>props : Readonly<P>
16+
>Readonly : Readonly<T>
17+
>P : P
18+
19+
let { foo = false } = props;
20+
>foo : boolean
21+
>false : false
22+
>props : Readonly<P>
23+
24+
if (foo === true) { }
25+
>foo === true : boolean
26+
>foo : boolean
27+
>true : true
28+
}
29+

0 commit comments

Comments
 (0)