mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 10:00:13 -06:00
Accept new baselines
This commit is contained in:
parent
caa89cafde
commit
390f20f4fc
@ -0,0 +1,52 @@
|
||||
//// [inferenceAndSelfReferentialConstraint.ts]
|
||||
// @strict
|
||||
|
||||
// Repro from #29520
|
||||
|
||||
type Test<K extends keyof any> = {
|
||||
[P in K | "foo"]: P extends "foo" ? true : () => any
|
||||
}
|
||||
|
||||
function test<T extends Test<keyof T>>(arg: T) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
const res1 = test({
|
||||
foo: true,
|
||||
bar() {
|
||||
}
|
||||
});
|
||||
|
||||
const res2 = test({
|
||||
foo: true,
|
||||
bar: function () {
|
||||
}
|
||||
});
|
||||
|
||||
const res3 = test({
|
||||
foo: true,
|
||||
bar: () => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//// [inferenceAndSelfReferentialConstraint.js]
|
||||
// @strict
|
||||
function test(arg) {
|
||||
return arg;
|
||||
}
|
||||
var res1 = test({
|
||||
foo: true,
|
||||
bar: function () {
|
||||
}
|
||||
});
|
||||
var res2 = test({
|
||||
foo: true,
|
||||
bar: function () {
|
||||
}
|
||||
});
|
||||
var res3 = test({
|
||||
foo: true,
|
||||
bar: function () {
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,63 @@
|
||||
=== tests/cases/compiler/inferenceAndSelfReferentialConstraint.ts ===
|
||||
// @strict
|
||||
|
||||
// Repro from #29520
|
||||
|
||||
type Test<K extends keyof any> = {
|
||||
>Test : Symbol(Test, Decl(inferenceAndSelfReferentialConstraint.ts, 0, 0))
|
||||
>K : Symbol(K, Decl(inferenceAndSelfReferentialConstraint.ts, 4, 10))
|
||||
|
||||
[P in K | "foo"]: P extends "foo" ? true : () => any
|
||||
>P : Symbol(P, Decl(inferenceAndSelfReferentialConstraint.ts, 5, 3))
|
||||
>K : Symbol(K, Decl(inferenceAndSelfReferentialConstraint.ts, 4, 10))
|
||||
>P : Symbol(P, Decl(inferenceAndSelfReferentialConstraint.ts, 5, 3))
|
||||
}
|
||||
|
||||
function test<T extends Test<keyof T>>(arg: T) {
|
||||
>test : Symbol(test, Decl(inferenceAndSelfReferentialConstraint.ts, 6, 1))
|
||||
>T : Symbol(T, Decl(inferenceAndSelfReferentialConstraint.ts, 8, 14))
|
||||
>Test : Symbol(Test, Decl(inferenceAndSelfReferentialConstraint.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(inferenceAndSelfReferentialConstraint.ts, 8, 14))
|
||||
>arg : Symbol(arg, Decl(inferenceAndSelfReferentialConstraint.ts, 8, 39))
|
||||
>T : Symbol(T, Decl(inferenceAndSelfReferentialConstraint.ts, 8, 14))
|
||||
|
||||
return arg;
|
||||
>arg : Symbol(arg, Decl(inferenceAndSelfReferentialConstraint.ts, 8, 39))
|
||||
}
|
||||
|
||||
const res1 = test({
|
||||
>res1 : Symbol(res1, Decl(inferenceAndSelfReferentialConstraint.ts, 12, 5))
|
||||
>test : Symbol(test, Decl(inferenceAndSelfReferentialConstraint.ts, 6, 1))
|
||||
|
||||
foo: true,
|
||||
>foo : Symbol(foo, Decl(inferenceAndSelfReferentialConstraint.ts, 12, 19))
|
||||
|
||||
bar() {
|
||||
>bar : Symbol(bar, Decl(inferenceAndSelfReferentialConstraint.ts, 13, 12))
|
||||
}
|
||||
});
|
||||
|
||||
const res2 = test({
|
||||
>res2 : Symbol(res2, Decl(inferenceAndSelfReferentialConstraint.ts, 18, 5))
|
||||
>test : Symbol(test, Decl(inferenceAndSelfReferentialConstraint.ts, 6, 1))
|
||||
|
||||
foo: true,
|
||||
>foo : Symbol(foo, Decl(inferenceAndSelfReferentialConstraint.ts, 18, 19))
|
||||
|
||||
bar: function () {
|
||||
>bar : Symbol(bar, Decl(inferenceAndSelfReferentialConstraint.ts, 19, 12))
|
||||
}
|
||||
});
|
||||
|
||||
const res3 = test({
|
||||
>res3 : Symbol(res3, Decl(inferenceAndSelfReferentialConstraint.ts, 24, 5))
|
||||
>test : Symbol(test, Decl(inferenceAndSelfReferentialConstraint.ts, 6, 1))
|
||||
|
||||
foo: true,
|
||||
>foo : Symbol(foo, Decl(inferenceAndSelfReferentialConstraint.ts, 24, 19))
|
||||
|
||||
bar: () => {
|
||||
>bar : Symbol(bar, Decl(inferenceAndSelfReferentialConstraint.ts, 25, 12))
|
||||
}
|
||||
});
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
=== tests/cases/compiler/inferenceAndSelfReferentialConstraint.ts ===
|
||||
// @strict
|
||||
|
||||
// Repro from #29520
|
||||
|
||||
type Test<K extends keyof any> = {
|
||||
>Test : Test<K>
|
||||
|
||||
[P in K | "foo"]: P extends "foo" ? true : () => any
|
||||
>true : true
|
||||
}
|
||||
|
||||
function test<T extends Test<keyof T>>(arg: T) {
|
||||
>test : <T extends Test<keyof T>>(arg: T) => T
|
||||
>arg : T
|
||||
|
||||
return arg;
|
||||
>arg : T
|
||||
}
|
||||
|
||||
const res1 = test({
|
||||
>res1 : { foo: true; bar(): void; }
|
||||
>test({ foo: true, bar() { }}) : { foo: true; bar(): void; }
|
||||
>test : <T extends Test<keyof T>>(arg: T) => T
|
||||
>{ foo: true, bar() { }} : { foo: true; bar(): void; }
|
||||
|
||||
foo: true,
|
||||
>foo : true
|
||||
>true : true
|
||||
|
||||
bar() {
|
||||
>bar : () => void
|
||||
}
|
||||
});
|
||||
|
||||
const res2 = test({
|
||||
>res2 : { foo: true; bar: () => void; }
|
||||
>test({ foo: true, bar: function () { }}) : { foo: true; bar: () => void; }
|
||||
>test : <T extends Test<keyof T>>(arg: T) => T
|
||||
>{ foo: true, bar: function () { }} : { foo: true; bar: () => void; }
|
||||
|
||||
foo: true,
|
||||
>foo : true
|
||||
>true : true
|
||||
|
||||
bar: function () {
|
||||
>bar : () => void
|
||||
>function () { } : () => void
|
||||
}
|
||||
});
|
||||
|
||||
const res3 = test({
|
||||
>res3 : { foo: true; bar: () => void; }
|
||||
>test({ foo: true, bar: () => { }}) : { foo: true; bar: () => void; }
|
||||
>test : <T extends Test<keyof T>>(arg: T) => T
|
||||
>{ foo: true, bar: () => { }} : { foo: true; bar: () => void; }
|
||||
|
||||
foo: true,
|
||||
>foo : true
|
||||
>true : true
|
||||
|
||||
bar: () => {
|
||||
>bar : () => void
|
||||
>() => { } : () => void
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user