Commit graph

54 commits

Author SHA1 Message Date
Collins Abitekaniza
2bb2f9ff68 add baseline tests for spreading instantiable type 2019-05-03 05:31:28 +03:00
Anders Hejlsberg
8e4b90da00
Merge pull request #28234 from Microsoft/genericSpread
Generic spread expressions in object literals
2018-10-31 12:52:16 -07:00
Anders Hejlsberg
2ed627aaf1 Update tests 2018-10-30 16:33:14 -07:00
Anders Hejlsberg
e0d210d027 Add tests 2018-10-30 08:18:18 -07:00
Nathan Shively-Sanders
64ff195426
Set-only accessors spread to undefined (#28213)
* Set-only accessors spread to undefined

Previously they were skipped. The runtime behaviour is to create a
property of type undefined, unlike (for example) spreading numbers or
other primitives. So now spreading a set-only accessor creates a
property of type undefined:

```ts
const o: { foo: undefined } = { ...{ set foo(v: number) { } } }
```

Notably, `o.foo: undefined` not `number`.

Fixes #26337

* Fix isSpreadableProperty oversimplification
2018-10-29 14:51:12 -07:00
Nathan Shively-Sanders
b687caf3eb
No excess property error for spread properties (#26798)
That is, properties in an object literal type that came from a spread
assignment never cause an excess property error.
2018-08-30 16:16:58 -07:00
Andy
639fdcc916
Don't include class getter in spread type (#26287)
* Don't include class getter in spread type

* Code review
2018-08-09 15:34:29 -07:00
Ron Buckton
f67afa098f Unpatch vfs resolver and default lib rename 2018-05-03 14:18:50 -07:00
Nathan Shively-Sanders
4bc0d85d29 Test:spread object retains lefthandside
1. Make sure that spreading `object` doesn't lose everything to the left.
2. Update baselines to show that `{ ...object }` is now `{}`.
2017-12-12 08:37:34 -08:00
Nathan Shively-Sanders
39fd0bf2d1 Merge branch 'master' into fix-spread-contextually-typed-by-binding-pattern 2017-11-13 13:11:05 -08:00
Nathan Shively-Sanders
7788d293c4 Test:spread removes readonly from index signatures 2017-11-06 08:16:15 -08:00
Nathan Shively-Sanders
0cb12b32a5 Test:{} in union from spread gets implicit index signature
Also tighten up the existing test code in the file.
2017-10-05 09:03:03 -07:00
Nathan Shively-Sanders
2c04b5510f Test:spread contextually typed by binding pattern 2017-10-03 12:43:23 -07:00
Nathan Shively-Sanders
cb8d9d6143 Revert spread-falsy-union/fix spread of primitive
Turns out partialising falsy unions wasn't needed -- I was just
returning the wrong thing when spreading primitives.
2017-09-15 16:11:41 -07:00
Nathan Shively-Sanders
f97d5fa11d Update tests with improved spread-falsy-union rules 2017-09-15 10:06:58 -07:00
Nathan Shively-Sanders
18653a5c5d Use removeDefinitelyFalsyTypes for building partial type 2017-09-14 11:18:48 -07:00
Nathan Shively-Sanders
d2e2faad5c Update tests and baselines 2017-09-13 15:13:34 -07:00
Nathan Shively-Sanders
d951c14052 Allow all possibly falsy types in spreads
And update tests to reflect that
2017-09-13 14:56:15 -07:00
Nathan Shively-Sanders
9cddd1aca2 Update spread tests for booleans in spread types 2017-09-13 14:06:15 -07:00
Nathan Shively-Sanders
26ab0cd138 Merge pull request #16530 from Microsoft/excess-property-check-error-span-for-spread-property
Improve excess property check error span for spread property
2017-06-14 16:16:20 -07:00
Nathan Shively-Sanders
19c564d48d Test:error span for spread prop in excess prop check 2017-06-14 11:29:06 -07:00
Nathan Shively-Sanders
657c469d4f Remove undefined from optional spread properties
Fixes #16509 by making the change from #15938 less strict. This is
technically a hole, but it's not as big a hole as before #15938.
2017-06-14 10:31:11 -07:00
Nathan Shively-Sanders
cfb52e0e91 Test spread in unions of null/undefined 2017-06-06 14:13:02 -07:00
Nathan Shively-Sanders
ea830d4fad Move spreadUnion* tests into conformance suite 2017-06-06 13:58:54 -07:00
Nathan Shively-Sanders
db3696c789 Test:retain undefined in spreads w/strictNullChecks
Add test case and update baselines with new errors
2017-05-18 13:59:07 -07:00
Herrington Darkholme
24bb21c55a address code review 2017-01-24 11:24:30 +08:00
Herrington Darkholme
b4c15982ff fix #13556: enable rest/spread on object 2017-01-18 14:57:20 +08:00
Nathan Shively-Sanders
309a361b19 Test method removal of object spread
Test that
1. Only class methods get removed
2. Methods from both left and right get removed.
2017-01-09 08:59:36 -08:00
Mohamed Hegazy
51f5ef6752 Update test 2016-11-29 13:37:21 -08:00
Nathan Shively-Sanders
641948fb0c Test assignability checking of object rests 2016-11-16 13:41:18 -08:00
Nathan Shively-Sanders
fe66d9ef9f Add spread tests and update rest tests 2016-11-14 16:23:40 -08:00
Nathan Shively-Sanders
25462c9571 Merge pull request #12028 from Microsoft/object-rest
Object rest
2016-11-10 09:18:13 -08:00
Nathan Shively-Sanders
9b1f43bdda Add strictNullChecks test for object spread 2016-11-09 13:40:21 -08:00
Nathan Shively-Sanders
9977936190 Do not emit __rest for --target esnext 2016-11-07 11:34:37 -08:00
Nathan Shively-Sanders
d4a5b0855c Add --target esnext tests and update baselines 2016-11-07 09:56:48 -08:00
Nathan Shively-Sanders
a55ed26d2b Spread any types to any 2016-11-04 16:06:33 -07:00
Nathan Shively-Sanders
a077fd104a Remove spread type tests from spread tests 2016-11-03 09:39:58 -07:00
Nathan Shively-Sanders
f65dd2101c Test index [access] types inside spread types 2016-11-02 11:37:52 -07:00
Nathan Shively-Sanders
ff92afd47b Update baselines with new index signature rules 2016-10-21 16:27:32 -07:00
Nathan Shively-Sanders
422f73b1a9 Update and improve spread intersection tests 2016-10-21 10:54:53 -07:00
Nathan Shively-Sanders
d9afa34be1 Update spread w/intersection tests 2016-10-20 09:07:01 -07:00
Nathan Shively-Sanders
ad10ec56c1 Update tests w/spread assignability+apparent type 2016-10-19 15:05:42 -07:00
Nathan Shively-Sanders
62c186872d Update inference test for spread types 2016-10-19 13:14:20 -07:00
Nathan Shively-Sanders
1728ae1cbc Update baselines with spread string's numeric indexers 2016-10-12 09:01:14 -07:00
Nathan Shively-Sanders
4bc4a008bb Test spread type inference+more index signature tests 2016-10-11 16:14:47 -07:00
Nathan Shively-Sanders
0dd1f0c00f Add tests and update baselines.
1. Union/intersection tests.
2. Primitive tests.
3. Update baselines after removing errors.
2016-10-10 10:07:41 -07:00
Nathan Shively-Sanders
98720755bd Spread type:new assignability+simplification tests 2016-10-07 08:58:50 -07:00
Nathan Shively-Sanders
57850ecf1a Add more generic assignability cases 2016-10-03 15:49:23 -07:00
Nathan Shively-Sanders
b9af986df1 Update object spread scenarios test 2016-10-03 15:18:04 -07:00
Nathan Shively-Sanders
0f773c5673 Add object spread scenario tests 2016-09-27 16:17:14 -07:00