mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Accepted baselines.
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
tests/cases/compiler/excessPropertyErrorForFunctionExpressionReturns.ts(21,19): error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; b: number; c: number; }'.
|
||||
Property 'c' is missing in type '{ a: number; b: number; }' but required in type '{ a: number; b: number; c: number; }'.
|
||||
tests/cases/compiler/excessPropertyErrorForFunctionExpressionReturns.ts(27,47): error TS2345: Argument of type '{ a: number; b: number; c: number; }' is not assignable to parameter of type 'SomeObj1'.
|
||||
Object literal may only specify known properties, and 'c' does not exist in type 'SomeObj1'.
|
||||
tests/cases/compiler/excessPropertyErrorForFunctionExpressionReturns.ts(38,37): error TS2345: Argument of type '{ a: number; b: number; c: number; }' is not assignable to parameter of type '{ a: number; b: number; }'.
|
||||
Object literal may only specify known properties, and 'c' does not exist in type '{ a: number; b: number; }'.
|
||||
tests/cases/compiler/excessPropertyErrorForFunctionExpressionReturns.ts(64,19): error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; b: number; c: number; }'.
|
||||
Property 'c' is missing in type '{ a: number; b: number; }' but required in type '{ a: number; b: number; c: number; }'.
|
||||
tests/cases/compiler/excessPropertyErrorForFunctionExpressionReturns.ts(72,47): error TS2345: Argument of type '{ a: number; b: number; c: number; }' is not assignable to parameter of type 'SomeObj1'.
|
||||
Object literal may only specify known properties, and 'c' does not exist in type 'SomeObj1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/excessPropertyErrorForFunctionExpressionReturns.ts (5 errors) ====
|
||||
export type SomeObj1 = { a: number, b: number };
|
||||
|
||||
declare function valueOrGetter<T>(x: T, f: () => T): T;
|
||||
|
||||
namespace arrows {
|
||||
declare function consumeObj1(f: () => SomeObj1): void;
|
||||
consumeObj1(() => ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
}));
|
||||
|
||||
function obj1FactoryFactory(): () => SomeObj1 {
|
||||
return () => ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
});
|
||||
}
|
||||
|
||||
valueOrGetter({ a: 100, b: 200 }, () => ({
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; b: number; c: number; }'.
|
||||
!!! error TS2345: Property 'c' is missing in type '{ a: number; b: number; }' but required in type '{ a: number; b: number; c: number; }'.
|
||||
!!! related TS2728 tests/cases/compiler/excessPropertyErrorForFunctionExpressionReturns.ts:24:9: 'c' is declared here.
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
}));
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200, c: 300 }, () => ({
|
||||
~~~~~~
|
||||
!!! error TS2345: Argument of type '{ a: number; b: number; c: number; }' is not assignable to parameter of type 'SomeObj1'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'c' does not exist in type 'SomeObj1'.
|
||||
a: 100,
|
||||
b: 200,
|
||||
}));
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200 }, () => ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
}));
|
||||
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, () => ({
|
||||
~~~~~~
|
||||
!!! error TS2345: Argument of type '{ a: number; b: number; c: number; }' is not assignable to parameter of type '{ a: number; b: number; }'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'c' does not exist in type '{ a: number; b: number; }'.
|
||||
a: 100,
|
||||
b: 200,
|
||||
}));
|
||||
}
|
||||
|
||||
namespace funcExprs {
|
||||
declare function consumeObj1(f: () => SomeObj1): void;
|
||||
consumeObj1(function() {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
};
|
||||
});
|
||||
|
||||
function obj1FactoryFactory(): () => SomeObj1 {
|
||||
return function() {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
valueOrGetter({ a: 100, b: 200 }, function() {
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; b: number; c: number; }'.
|
||||
!!! error TS2345: Property 'c' is missing in type '{ a: number; b: number; }' but required in type '{ a: number; b: number; c: number; }'.
|
||||
!!! related TS2728 tests/cases/compiler/excessPropertyErrorForFunctionExpressionReturns.ts:68:13: 'c' is declared here.
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200, c: 300 }, function() {
|
||||
~~~~~~
|
||||
!!! error TS2345: Argument of type '{ a: number; b: number; c: number; }' is not assignable to parameter of type 'SomeObj1'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'c' does not exist in type 'SomeObj1'.
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200 }, function() {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, function() {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
//// [excessPropertyErrorForFunctionExpressionReturns.ts]
|
||||
export type SomeObj1 = { a: number, b: number };
|
||||
|
||||
declare function valueOrGetter<T>(x: T, f: () => T): T;
|
||||
|
||||
namespace arrows {
|
||||
declare function consumeObj1(f: () => SomeObj1): void;
|
||||
consumeObj1(() => ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
}));
|
||||
|
||||
function obj1FactoryFactory(): () => SomeObj1 {
|
||||
return () => ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
});
|
||||
}
|
||||
|
||||
valueOrGetter({ a: 100, b: 200 }, () => ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
}));
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200, c: 300 }, () => ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
}));
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200 }, () => ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
}));
|
||||
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, () => ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
}));
|
||||
}
|
||||
|
||||
namespace funcExprs {
|
||||
declare function consumeObj1(f: () => SomeObj1): void;
|
||||
consumeObj1(function() {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
};
|
||||
});
|
||||
|
||||
function obj1FactoryFactory(): () => SomeObj1 {
|
||||
return function() {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
valueOrGetter({ a: 100, b: 200 }, function() {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200, c: 300 }, function() {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200 }, function() {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, function() {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
//// [excessPropertyErrorForFunctionExpressionReturns.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var arrows;
|
||||
(function (arrows) {
|
||||
consumeObj1(function () { return ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300
|
||||
}); });
|
||||
function obj1FactoryFactory() {
|
||||
return function () { return ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300
|
||||
}); };
|
||||
}
|
||||
valueOrGetter({ a: 100, b: 200 }, function () { return ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300
|
||||
}); });
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, function () { return ({
|
||||
a: 100,
|
||||
b: 200
|
||||
}); });
|
||||
valueOrGetter({ a: 100, b: 200 }, function () { return ({
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300
|
||||
}); });
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, function () { return ({
|
||||
a: 100,
|
||||
b: 200
|
||||
}); });
|
||||
})(arrows || (arrows = {}));
|
||||
var funcExprs;
|
||||
(function (funcExprs) {
|
||||
consumeObj1(function () {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300
|
||||
};
|
||||
});
|
||||
function obj1FactoryFactory() {
|
||||
return function () {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300
|
||||
};
|
||||
};
|
||||
}
|
||||
valueOrGetter({ a: 100, b: 200 }, function () {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300
|
||||
};
|
||||
});
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, function () {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300
|
||||
};
|
||||
});
|
||||
valueOrGetter({ a: 100, b: 200 }, function () {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300
|
||||
};
|
||||
});
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, function () {
|
||||
return {
|
||||
a: 100,
|
||||
b: 200,
|
||||
c: 300
|
||||
};
|
||||
});
|
||||
})(funcExprs || (funcExprs = {}));
|
||||
@@ -0,0 +1,235 @@
|
||||
=== tests/cases/compiler/excessPropertyErrorForFunctionExpressionReturns.ts ===
|
||||
export type SomeObj1 = { a: number, b: number };
|
||||
>SomeObj1 : Symbol(SomeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 24))
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 35))
|
||||
|
||||
declare function valueOrGetter<T>(x: T, f: () => T): T;
|
||||
>valueOrGetter : Symbol(valueOrGetter, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 48))
|
||||
>T : Symbol(T, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 2, 31))
|
||||
>x : Symbol(x, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 2, 34))
|
||||
>T : Symbol(T, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 2, 31))
|
||||
>f : Symbol(f, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 2, 39))
|
||||
>T : Symbol(T, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 2, 31))
|
||||
>T : Symbol(T, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 2, 31))
|
||||
|
||||
namespace arrows {
|
||||
>arrows : Symbol(arrows, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 2, 55))
|
||||
|
||||
declare function consumeObj1(f: () => SomeObj1): void;
|
||||
>consumeObj1 : Symbol(consumeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 4, 18))
|
||||
>f : Symbol(f, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 5, 33))
|
||||
>SomeObj1 : Symbol(SomeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 0))
|
||||
|
||||
consumeObj1(() => ({
|
||||
>consumeObj1 : Symbol(consumeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 4, 18))
|
||||
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 6, 24))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 7, 15))
|
||||
|
||||
c: 300,
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 8, 15))
|
||||
|
||||
}));
|
||||
|
||||
function obj1FactoryFactory(): () => SomeObj1 {
|
||||
>obj1FactoryFactory : Symbol(obj1FactoryFactory, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 10, 8))
|
||||
>SomeObj1 : Symbol(SomeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 0))
|
||||
|
||||
return () => ({
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 13, 23))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 14, 19))
|
||||
|
||||
c: 300,
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 15, 19))
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
valueOrGetter({ a: 100, b: 200 }, () => ({
|
||||
>valueOrGetter : Symbol(valueOrGetter, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 48))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 20, 19))
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 20, 27))
|
||||
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 20, 46))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 21, 15))
|
||||
|
||||
c: 300,
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 22, 15))
|
||||
|
||||
}));
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200, c: 300 }, () => ({
|
||||
>valueOrGetter : Symbol(valueOrGetter, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 48))
|
||||
>SomeObj1 : Symbol(SomeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 26, 29))
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 26, 37))
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 26, 45))
|
||||
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 26, 64))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 27, 15))
|
||||
|
||||
}));
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200 }, () => ({
|
||||
>valueOrGetter : Symbol(valueOrGetter, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 48))
|
||||
>SomeObj1 : Symbol(SomeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 31, 29))
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 31, 37))
|
||||
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 31, 56))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 32, 15))
|
||||
|
||||
c: 300,
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 33, 15))
|
||||
|
||||
}));
|
||||
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, () => ({
|
||||
>valueOrGetter : Symbol(valueOrGetter, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 48))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 37, 19))
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 37, 27))
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 37, 35))
|
||||
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 37, 54))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 38, 15))
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
namespace funcExprs {
|
||||
>funcExprs : Symbol(funcExprs, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 41, 1))
|
||||
|
||||
declare function consumeObj1(f: () => SomeObj1): void;
|
||||
>consumeObj1 : Symbol(consumeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 43, 21))
|
||||
>f : Symbol(f, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 44, 33))
|
||||
>SomeObj1 : Symbol(SomeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 0))
|
||||
|
||||
consumeObj1(function() {
|
||||
>consumeObj1 : Symbol(consumeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 43, 21))
|
||||
|
||||
return {
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 46, 16))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 47, 19))
|
||||
|
||||
c: 300,
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 48, 19))
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
function obj1FactoryFactory(): () => SomeObj1 {
|
||||
>obj1FactoryFactory : Symbol(obj1FactoryFactory, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 51, 7))
|
||||
>SomeObj1 : Symbol(SomeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 0))
|
||||
|
||||
return function() {
|
||||
return {
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 55, 20))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 56, 23))
|
||||
|
||||
c: 300,
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 57, 23))
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
valueOrGetter({ a: 100, b: 200 }, function() {
|
||||
>valueOrGetter : Symbol(valueOrGetter, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 48))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 63, 19))
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 63, 27))
|
||||
|
||||
return {
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 64, 16))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 65, 19))
|
||||
|
||||
c: 300,
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 66, 19))
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200, c: 300 }, function() {
|
||||
>valueOrGetter : Symbol(valueOrGetter, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 48))
|
||||
>SomeObj1 : Symbol(SomeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 71, 29))
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 71, 37))
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 71, 45))
|
||||
|
||||
return {
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 72, 16))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 73, 19))
|
||||
|
||||
c: 300,
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 74, 19))
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200 }, function() {
|
||||
>valueOrGetter : Symbol(valueOrGetter, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 48))
|
||||
>SomeObj1 : Symbol(SomeObj1, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 79, 29))
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 79, 37))
|
||||
|
||||
return {
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 80, 16))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 81, 19))
|
||||
|
||||
c: 300,
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 82, 19))
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, function() {
|
||||
>valueOrGetter : Symbol(valueOrGetter, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 0, 48))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 87, 19))
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 87, 27))
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 87, 35))
|
||||
|
||||
return {
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 88, 16))
|
||||
|
||||
b: 200,
|
||||
>b : Symbol(b, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 89, 19))
|
||||
|
||||
c: 300,
|
||||
>c : Symbol(c, Decl(excessPropertyErrorForFunctionExpressionReturns.ts, 90, 19))
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
=== tests/cases/compiler/excessPropertyErrorForFunctionExpressionReturns.ts ===
|
||||
export type SomeObj1 = { a: number, b: number };
|
||||
>SomeObj1 : SomeObj1
|
||||
>a : number
|
||||
>b : number
|
||||
|
||||
declare function valueOrGetter<T>(x: T, f: () => T): T;
|
||||
>valueOrGetter : <T>(x: T, f: () => T) => T
|
||||
>x : T
|
||||
>f : () => T
|
||||
|
||||
namespace arrows {
|
||||
>arrows : typeof arrows
|
||||
|
||||
declare function consumeObj1(f: () => SomeObj1): void;
|
||||
>consumeObj1 : (f: () => SomeObj1) => void
|
||||
>f : () => SomeObj1
|
||||
|
||||
consumeObj1(() => ({
|
||||
>consumeObj1(() => ({ a: 100, b: 200, c: 300, })) : void
|
||||
>consumeObj1 : (f: () => SomeObj1) => void
|
||||
>() => ({ a: 100, b: 200, c: 300, }) : () => { a: number; b: number; c: number; }
|
||||
>({ a: 100, b: 200, c: 300, }) : { a: number; b: number; c: number; }
|
||||
>{ a: 100, b: 200, c: 300, } : { a: number; b: number; c: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
c: 300,
|
||||
>c : number
|
||||
>300 : 300
|
||||
|
||||
}));
|
||||
|
||||
function obj1FactoryFactory(): () => SomeObj1 {
|
||||
>obj1FactoryFactory : () => () => SomeObj1
|
||||
|
||||
return () => ({
|
||||
>() => ({ a: 100, b: 200, c: 300, }) : () => { a: number; b: number; c: number; }
|
||||
>({ a: 100, b: 200, c: 300, }) : { a: number; b: number; c: number; }
|
||||
>{ a: 100, b: 200, c: 300, } : { a: number; b: number; c: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
c: 300,
|
||||
>c : number
|
||||
>300 : 300
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
valueOrGetter({ a: 100, b: 200 }, () => ({
|
||||
>valueOrGetter({ a: 100, b: 200 }, () => ({ a: 100, b: 200, c: 300, })) : { a: number; b: number; c: number; }
|
||||
>valueOrGetter : <T>(x: T, f: () => T) => T
|
||||
>{ a: 100, b: 200 } : { a: number; b: number; }
|
||||
>a : number
|
||||
>100 : 100
|
||||
>b : number
|
||||
>200 : 200
|
||||
>() => ({ a: 100, b: 200, c: 300, }) : () => { a: number; b: number; c: number; }
|
||||
>({ a: 100, b: 200, c: 300, }) : { a: number; b: number; c: number; }
|
||||
>{ a: 100, b: 200, c: 300, } : { a: number; b: number; c: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
c: 300,
|
||||
>c : number
|
||||
>300 : 300
|
||||
|
||||
}));
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200, c: 300 }, () => ({
|
||||
>valueOrGetter<SomeObj1>({ a: 100, b: 200, c: 300 }, () => ({ a: 100, b: 200, })) : SomeObj1
|
||||
>valueOrGetter : <T>(x: T, f: () => T) => T
|
||||
>{ a: 100, b: 200, c: 300 } : { a: number; b: number; c: number; }
|
||||
>a : number
|
||||
>100 : 100
|
||||
>b : number
|
||||
>200 : 200
|
||||
>c : number
|
||||
>300 : 300
|
||||
>() => ({ a: 100, b: 200, }) : () => { a: number; b: number; }
|
||||
>({ a: 100, b: 200, }) : { a: number; b: number; }
|
||||
>{ a: 100, b: 200, } : { a: number; b: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
}));
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200 }, () => ({
|
||||
>valueOrGetter<SomeObj1>({ a: 100, b: 200 }, () => ({ a: 100, b: 200, c: 300, })) : SomeObj1
|
||||
>valueOrGetter : <T>(x: T, f: () => T) => T
|
||||
>{ a: 100, b: 200 } : { a: number; b: number; }
|
||||
>a : number
|
||||
>100 : 100
|
||||
>b : number
|
||||
>200 : 200
|
||||
>() => ({ a: 100, b: 200, c: 300, }) : () => { a: number; b: number; c: number; }
|
||||
>({ a: 100, b: 200, c: 300, }) : { a: number; b: number; c: number; }
|
||||
>{ a: 100, b: 200, c: 300, } : { a: number; b: number; c: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
c: 300,
|
||||
>c : number
|
||||
>300 : 300
|
||||
|
||||
}));
|
||||
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, () => ({
|
||||
>valueOrGetter({ a: 100, b: 200, c: 300 }, () => ({ a: 100, b: 200, })) : { a: number; b: number; }
|
||||
>valueOrGetter : <T>(x: T, f: () => T) => T
|
||||
>{ a: 100, b: 200, c: 300 } : { a: number; b: number; c: number; }
|
||||
>a : number
|
||||
>100 : 100
|
||||
>b : number
|
||||
>200 : 200
|
||||
>c : number
|
||||
>300 : 300
|
||||
>() => ({ a: 100, b: 200, }) : () => { a: number; b: number; }
|
||||
>({ a: 100, b: 200, }) : { a: number; b: number; }
|
||||
>{ a: 100, b: 200, } : { a: number; b: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
namespace funcExprs {
|
||||
>funcExprs : typeof funcExprs
|
||||
|
||||
declare function consumeObj1(f: () => SomeObj1): void;
|
||||
>consumeObj1 : (f: () => SomeObj1) => void
|
||||
>f : () => SomeObj1
|
||||
|
||||
consumeObj1(function() {
|
||||
>consumeObj1(function() { return { a: 100, b: 200, c: 300, }; }) : void
|
||||
>consumeObj1 : (f: () => SomeObj1) => void
|
||||
>function() { return { a: 100, b: 200, c: 300, }; } : () => { a: number; b: number; c: number; }
|
||||
|
||||
return {
|
||||
>{ a: 100, b: 200, c: 300, } : { a: number; b: number; c: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
c: 300,
|
||||
>c : number
|
||||
>300 : 300
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
function obj1FactoryFactory(): () => SomeObj1 {
|
||||
>obj1FactoryFactory : () => () => SomeObj1
|
||||
|
||||
return function() {
|
||||
>function() { return { a: 100, b: 200, c: 300, } } : () => { a: number; b: number; c: number; }
|
||||
|
||||
return {
|
||||
>{ a: 100, b: 200, c: 300, } : { a: number; b: number; c: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
c: 300,
|
||||
>c : number
|
||||
>300 : 300
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
valueOrGetter({ a: 100, b: 200 }, function() {
|
||||
>valueOrGetter({ a: 100, b: 200 }, function() { return { a: 100, b: 200, c: 300, }; }) : { a: number; b: number; }
|
||||
>valueOrGetter : <T>(x: T, f: () => T) => T
|
||||
>{ a: 100, b: 200 } : { a: number; b: number; }
|
||||
>a : number
|
||||
>100 : 100
|
||||
>b : number
|
||||
>200 : 200
|
||||
>function() { return { a: 100, b: 200, c: 300, }; } : () => { a: number; b: number; c: number; }
|
||||
|
||||
return {
|
||||
>{ a: 100, b: 200, c: 300, } : { a: number; b: number; c: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
c: 300,
|
||||
>c : number
|
||||
>300 : 300
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200, c: 300 }, function() {
|
||||
>valueOrGetter<SomeObj1>({ a: 100, b: 200, c: 300 }, function() { return { a: 100, b: 200, c: 300, }; }) : SomeObj1
|
||||
>valueOrGetter : <T>(x: T, f: () => T) => T
|
||||
>{ a: 100, b: 200, c: 300 } : { a: number; b: number; c: number; }
|
||||
>a : number
|
||||
>100 : 100
|
||||
>b : number
|
||||
>200 : 200
|
||||
>c : number
|
||||
>300 : 300
|
||||
>function() { return { a: 100, b: 200, c: 300, }; } : () => { a: number; b: number; c: number; }
|
||||
|
||||
return {
|
||||
>{ a: 100, b: 200, c: 300, } : { a: number; b: number; c: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
c: 300,
|
||||
>c : number
|
||||
>300 : 300
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter<SomeObj1>({ a: 100, b: 200 }, function() {
|
||||
>valueOrGetter<SomeObj1>({ a: 100, b: 200 }, function() { return { a: 100, b: 200, c: 300, }; }) : SomeObj1
|
||||
>valueOrGetter : <T>(x: T, f: () => T) => T
|
||||
>{ a: 100, b: 200 } : { a: number; b: number; }
|
||||
>a : number
|
||||
>100 : 100
|
||||
>b : number
|
||||
>200 : 200
|
||||
>function() { return { a: 100, b: 200, c: 300, }; } : () => { a: number; b: number; c: number; }
|
||||
|
||||
return {
|
||||
>{ a: 100, b: 200, c: 300, } : { a: number; b: number; c: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
c: 300,
|
||||
>c : number
|
||||
>300 : 300
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
valueOrGetter({ a: 100, b: 200, c: 300 }, function() {
|
||||
>valueOrGetter({ a: 100, b: 200, c: 300 }, function() { return { a: 100, b: 200, c: 300, }; }) : { a: number; b: number; c: number; }
|
||||
>valueOrGetter : <T>(x: T, f: () => T) => T
|
||||
>{ a: 100, b: 200, c: 300 } : { a: number; b: number; c: number; }
|
||||
>a : number
|
||||
>100 : 100
|
||||
>b : number
|
||||
>200 : 200
|
||||
>c : number
|
||||
>300 : 300
|
||||
>function() { return { a: 100, b: 200, c: 300, }; } : () => { a: number; b: number; c: number; }
|
||||
|
||||
return {
|
||||
>{ a: 100, b: 200, c: 300, } : { a: number; b: number; c: number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : 100
|
||||
|
||||
b: 200,
|
||||
>b : number
|
||||
>200 : 200
|
||||
|
||||
c: 300,
|
||||
>c : number
|
||||
>300 : 300
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user