address code review
This commit is contained in:
parent
b4c15982ff
commit
24bb21c55a
6 changed files with 17 additions and 18 deletions
|
@ -6291,6 +6291,9 @@ namespace ts {
|
|||
if (right.flags & TypeFlags.Union) {
|
||||
return mapType(right, t => getSpreadType(left, t));
|
||||
}
|
||||
if (right.flags & TypeFlags.NonPrimitive) {
|
||||
return emptyObjectType;
|
||||
}
|
||||
|
||||
const members = createMap<Symbol>();
|
||||
const skippedPrivateMembers = createMap<boolean>();
|
||||
|
@ -15719,12 +15722,12 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Static members being set on a constructor function may conflict with built-in properties
|
||||
* of Function. Esp. in ECMAScript 5 there are non-configurable and non-writable
|
||||
* built-in properties. This check issues a transpile error when a class has a static
|
||||
* of Function. Esp. in ECMAScript 5 there are non-configurable and non-writable
|
||||
* built-in properties. This check issues a transpile error when a class has a static
|
||||
* member with the same name as a non-writable built-in property.
|
||||
*
|
||||
*
|
||||
* @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.3
|
||||
* @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.5
|
||||
* @see http://www.ecma-international.org/ecma-262/6.0/#sec-properties-of-the-function-constructor
|
||||
|
|
|
@ -79,8 +79,7 @@ let computedAfter: { a: number, b: string, "at the end": number } =
|
|||
let a = 12;
|
||||
let shortCutted: { a: number, b: string } = { ...o, a }
|
||||
// non primitive
|
||||
let spreadNonPrimitve = { ...<object>{}}
|
||||
|
||||
let spreadNonPrimitive = { ...<object>{}};
|
||||
|
||||
|
||||
//// [objectSpread.js]
|
||||
|
@ -151,5 +150,5 @@ var computedAfter = __assign({}, o, (_c = { b: 'yeah' }, _c['at the end'] = 14,
|
|||
var a = 12;
|
||||
var shortCutted = __assign({}, o, { a: a });
|
||||
// non primitive
|
||||
var spreadNonPrimitve = __assign({}, {});
|
||||
var spreadNonPrimitive = __assign({}, {});
|
||||
var _a, _b, _c;
|
||||
|
|
|
@ -317,7 +317,6 @@ let shortCutted: { a: number, b: string } = { ...o, a }
|
|||
>a : Symbol(a, Decl(objectSpread.ts, 78, 51))
|
||||
|
||||
// non primitive
|
||||
let spreadNonPrimitve = { ...<object>{}}
|
||||
>spreadNonPrimitve : Symbol(spreadNonPrimitve, Decl(objectSpread.ts, 80, 3))
|
||||
|
||||
let spreadNonPrimitive = { ...<object>{}};
|
||||
>spreadNonPrimitive : Symbol(spreadNonPrimitive, Decl(objectSpread.ts, 80, 3))
|
||||
|
||||
|
|
|
@ -408,10 +408,9 @@ let shortCutted: { a: number, b: string } = { ...o, a }
|
|||
>a : number
|
||||
|
||||
// non primitive
|
||||
let spreadNonPrimitve = { ...<object>{}}
|
||||
>spreadNonPrimitve : { constructor: Function; toString(): string; toLocaleString(): string; valueOf(): Object; hasOwnProperty(v: string): boolean; isPrototypeOf(v: Object): boolean; propertyIsEnumerable(v: string): boolean; }
|
||||
>{ ...<object>{}} : { constructor: Function; toString(): string; toLocaleString(): string; valueOf(): Object; hasOwnProperty(v: string): boolean; isPrototypeOf(v: Object): boolean; propertyIsEnumerable(v: string): boolean; }
|
||||
let spreadNonPrimitive = { ...<object>{}};
|
||||
>spreadNonPrimitive : {}
|
||||
>{ ...<object>{}} : {}
|
||||
><object>{} : object
|
||||
>{} : {}
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(37,19): error TS269
|
|||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(42,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(46,12): error TS2339: Property 'b' does not exist on type '{}'.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(52,9): error TS2339: Property 'm' does not exist on type '{ p: number; }'.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(57,11): error TS2339: Property 'a' does not exist on type '{ constructor: Function; toString(): string; toLocaleString(): string; valueOf(): Object; hasOwnProperty(v: string): boolean; isPrototypeOf(v: Object): boolean; propertyIsEnumerable(v: string): boolean; }'.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(57,11): error TS2339: Property 'a' does not exist on type '{}'.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(61,14): error TS2698: Spread types may only be created from object types.
|
||||
tests/cases/conformance/types/spread/objectSpreadNegative.ts(64,14): error TS2698: Spread types may only be created from object types.
|
||||
|
||||
|
@ -107,7 +107,7 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(64,14): error TS269
|
|||
let spreadObj = { ...obj };
|
||||
spreadObj.a; // error 'a' is not in {}
|
||||
~
|
||||
!!! error TS2339: Property 'a' does not exist on type '{ constructor: Function; toString(): string; toLocaleString(): string; valueOf(): Object; hasOwnProperty(v: string): boolean; isPrototypeOf(v: Object): boolean; propertyIsEnumerable(v: string): boolean; }'.
|
||||
!!! error TS2339: Property 'a' does not exist on type '{}'.
|
||||
|
||||
// generics
|
||||
function f<T, U>(t: T, u: U) {
|
||||
|
|
|
@ -79,5 +79,4 @@ let computedAfter: { a: number, b: string, "at the end": number } =
|
|||
let a = 12;
|
||||
let shortCutted: { a: number, b: string } = { ...o, a }
|
||||
// non primitive
|
||||
let spreadNonPrimitve = { ...<object>{}}
|
||||
|
||||
let spreadNonPrimitive = { ...<object>{}};
|
||||
|
|
Loading…
Reference in a new issue