Commit graph

2356 commits

Author SHA1 Message Date
Anders Hejlsberg f929a25407 Add regression test 2019-08-15 10:02:32 -07:00
Wesley Wigham 4ab85bbf35
Add error message for keywords with escapes in them (#32718)
* Add error message for keywords with escapes in them

* Move check into parser during advance to next token to utilize context for contextual keywords

* git add .

* Add tests for extended escapes

* Better error courtesy of @DanielRossenwaser

* Add test of browser-inconsistent case and alter condition to match spec

* Merge adjacent conditions

* Use seperate functions for checking keywords vs not

* Use flags to track unicode escape presence

* Adjust error text
2019-08-12 16:00:38 -07:00
Ron Buckton bf054ae796
Add support for import.meta in System modules (#32797) 2019-08-12 13:00:58 -07:00
Ron Buckton 98b6db81d9
Allow accessors in ambient class declarations (#32787)
* Allow accessors in ambient class declarations

* Update src/compiler/transformers/declarations.ts

Co-Authored-By: Wesley Wigham <wewigham@microsoft.com>
2019-08-09 16:11:25 -07:00
Nathan Shively-Sanders 85b8d27ea3
Remove error on invalid jsdoc tokens (#32769)
* Remove error on invalid jsdoc tokens

In JSDoc:

1. In the scanner, don't issue an error, even for invalid identifiers.
2. In the binder, don't issue an error for reserved (but otherwise valid)
identifiers.

/**
 * Example of 1: "\"
 * Example of 2: @private
 */

* Update baselines

* Add invalid unicode escape test for JSDoc

* Add quotes around invalid unicode escape

* Add another unicode escape JSDoc test
2019-08-09 12:53:15 -07:00
Wesley Wigham f333684179
Fix unicode escapes in jsx identifiers and extended unicode characters in jsdoc (#32716)
* Fix unicode escapes in jsx identifiers and extended unicode characters in jsdoc

* Support unicode escapes in JSDoc

* Add tests for extended escapes
2019-08-06 15:14:32 -07:00
Andrew Branch 73bef22f0b
A merged interface with an inherited member should satisfy an abstract base class member (#32539)
* A merged interface with an inherited member should satisfy an abstract base class member

* Tighten up comments and names
2019-08-01 09:34:11 -07:00
Anders Hejlsberg 4cc6618fc2
Merge pull request #32558 from microsoft/fix32247
Infer between closely matching types in unions and intersections
2019-07-29 11:34:14 -07:00
Andrew Branch 3d09010dc8
Intersect 'this' types in union signatures (#32538)
* Intersect this types in union signatures

* Actually update baselines
2019-07-26 14:56:03 -07:00
Anders Hejlsberg ec38799e2a Add more tests 2019-07-26 13:17:00 -07:00
Anders Hejlsberg b9d27c0f2c Add regression tests 2019-07-25 11:52:08 -07:00
Nathan Shively-Sanders 772bee5e84
Property assignment uses parent type annotation (#32553)
* Property assignment uses parent type annotation

First draft, will write full explanation later.

Also makes sure that jsdoc is ignored in TS. It was not before.

* Update baselines
2019-07-25 10:23:03 -07:00
Anders Hejlsberg 6b29060111 Merge branch 'master' into fix32434 2019-07-20 12:09:03 -07:00
Anders Hejlsberg d96d16e10b Add additional test 2019-07-20 10:01:59 -07:00
Anders Hejlsberg ae1add7210 Update tests 2019-07-17 15:02:20 -07:00
Anders Hejlsberg 7d4259ba9f Update tests 2019-07-17 14:57:26 -07:00
Ron Buckton 049618f7da
Get contextual type of yield from contextual signature of containing function (#32433)
* Get contextual type of yield from contextual signature of containing function

* Add missing baseline
2019-07-16 17:16:21 -07:00
Nathan Shively-Sanders 1de76cd605
Control flow for element access expressions (#31478)
* Control flow for element access expressions

Draft version, just want to see how performance is

* Add baselines

* Fix cast lint

* Cleanup to share code path

* Fix errant diffs
2019-07-16 10:10:58 -07:00
Ron Buckton 17762c480d
Fall back to (Async)IterableIterator if (Async)Generator not found (#32303) 2019-07-15 13:41:17 -07:00
Andrew Branch 4f3412153a
Parse quoted constructors as constructors, not methods (#31949)
* Parse quoted constructors as constructors, not methods

* Update baselines

* Fix disambiguation between quoted constructor and property named constructor

* Clean up parsing a bit

* Support escapes in constructor name

* Update baselines
2019-07-12 14:01:57 -07:00
Andrew Branch 8516127a05
Fix regression of generic T assignability to Partial<T> (#32354) 2019-07-12 07:57:55 -07:00
Anders Hejlsberg de2fb9584e Add regression test 2019-07-04 16:27:03 -10:00
Ron Buckton e8bf9584aa
Improve type checking and inference for Generators and Async Generators (#30790)
* Improve typing for Generators and Async Generators

* Add TReturn and TNext to Iterator, IterableIterator, etc.

* Update ts internal Iterator to be assignable from global Iterator

* Make 'done' optional in IteratorYieldResult

* Revert Iterable and IterableIterator to simpler versions plus other fixes

* Add additional inference tests

* Added additional tests

* PR cleanup and minor async iteration type fix

* Updated diagnostics message and added non-strict tests

* Fix expected arity of Iterator/AsyncIterator
2019-07-03 21:55:59 -07:00
Andrew Branch 16bbb4d002
Merge pull request #32077 from andrewbranch/bug/31114
Fix incorrect noImplicitAny error on contextual union function signature
2019-07-03 10:10:10 -07:00
Anders Hejlsberg 340f81035f
Merge pull request #32178 from microsoft/improveTupleDestructuring
Simplify tuple destructuring logic
2019-07-02 17:25:12 -07:00
Andrew Branch 327bc3cb67
Merge pull request #32071 from andrewbranch/bug/31070
Allow assignability of non-empty object to generic mapped type
2019-07-01 13:18:44 -07:00
Andrew Branch 23f1d5ccb7
Merge pull request #32117 from andrewbranch/bug/31460
Fix declaration emit for negative number properties, allow negative numbers as computed type property names
2019-07-01 10:56:56 -07:00
Anders Hejlsberg f89165d072
Merge pull request #32049 from microsoft/noDuplicateIntersectionSignatures
Remove duplicate signatures in intersections
2019-06-30 19:38:37 -07:00
Anders Hejlsberg 5ad3d1bf08 Add more tests 2019-06-30 08:18:01 -10:00
Nathan Shively-Sanders 8454ef114d JSDoc:Treat tokens between backticks as comments
even `@`, which would otherwise start a new tag.
2019-06-26 16:04:46 -07:00
Klaus Meinhardt 392d775095 allow const-assertion on aliased enum symbol (#32110)
Fixes: #32087
2019-06-26 14:42:06 -07:00
Andrew Branch 5ff3cda078
Add some negative test cases and accept baselines 2019-06-26 14:01:50 -07:00
Andrew Branch 17f6f77de5
Fix declaration emit for negative number property declarations 2019-06-26 11:49:45 -07:00
Andrew Branch 252840ad40
Fix incorrect noImplicitAny error on contextual union function signature 2019-06-24 17:37:14 -07:00
Andrew Branch 7bbd299226
Look at properties of constraint-instantiated optional mapped types when deciding assignability 2019-06-24 15:19:43 -07:00
Anders Hejlsberg 076d9ad2ab Add regression test 2019-06-23 09:19:56 -10:00
Anders Hejlsberg 9223f39f53 Add regression test 2019-06-21 18:07:15 -10:00
Anders Hejlsberg 6def72b3a4
Merge pull request #31950 from microsoft/unionObjectAndArrayLiterals
Union inferences from object and array literals
2019-06-20 09:36:20 -07:00
Anders Hejlsberg 51712fb1ae Add tests 2019-06-17 16:18:13 -10:00
Ron Buckton 179381301e
Move class property transform (#31848)
* Revert "Revert "Move class property transformation into new transformer. (#30467)""

This reverts commit 53467ae4a4.

* Fix emit issues
2019-06-17 14:26:42 -07:00
Anders Hejlsberg 98bbb22bc4 Add tests 2019-06-09 10:18:36 -07:00
Anders Hejlsberg 9cc9fb9bd7 Update tests 2019-06-09 08:00:01 -07:00
Anders Hejlsberg 9d2a2c9634 Add tests 2019-06-06 13:33:36 -07:00
Anders Hejlsberg 59dc85797e Add regression test 2019-05-31 11:04:02 -07:00
Wesley Wigham e70f2af25d
Defer union or intersection property type normalization (#31486)
* Defer union or intersection property type normalization

* Accept moved span
2019-05-28 10:51:47 -07:00
Andrew Branch a06ab8532c
Merge pull request #31560 from andrewbranch/bug/31485
Fix crash when creating a union signature from signatures that do and don’t have `this` types
2019-05-24 10:30:47 -07:00
Ron Buckton dfd28d2751
Fix handling of empty 'types', 'typings', etc. fields in package.json (#31539) 2019-05-23 17:19:32 -07:00
Andrew Branch a2b40292fe
Merge pull request #31542 from andrewbranch/bug/31481
Error when writing to rest element range of readonly tuple
2019-05-23 13:38:09 -07:00
Anders Hejlsberg e6013335b9
Merge pull request #31537 from microsoft/fixIndexedAccessConstraint
Fix indexed access constraint
2019-05-22 18:35:15 -07:00
Andrew Branch 300cbef071
Don’t crash when creating a union signature from signatures that do and don’t have this types 2019-05-22 17:42:05 -07:00
Andrew Branch 9f6791a5ab
Error when writing to readonly tuple in rest element range 2019-05-22 15:03:17 -07:00
Andrew Branch eecb6d9049
Add failing test 2019-05-22 13:39:05 -07:00
Ron Buckton 6a559e37ee
Fix crash when checking invalid object rest (#31530) 2019-05-22 11:20:57 -07:00
Ron Buckton c3055e585d
Fix compiler crash with object rest in catch binding (#31522) 2019-05-22 11:20:07 -07:00
Ron Buckton b3dc32fec7
Reset error record in downlevel for-of (#31519) 2019-05-22 11:18:07 -07:00
Ron Buckton 7611c5b931
Fix for computed properties in instance initializers (#31517) 2019-05-22 11:17:54 -07:00
Nathan Shively-Sanders b36c8a0690
Make anyArray.filter(Boolean) return any[], not unknown[] (#31515)
* Add this-parameter workaround to Array.filter

Allows anys.filter(Boolean) to once again return any[], not unknown[].

* Add any constraint to Boolean factory function

I want to test how well this works.

* Remove Boolean factory type guard

* Remove typeGuardBoolean test
2019-05-22 09:45:41 -07:00
Anders Hejlsberg 2fd4aaee92 Add regression test 2019-05-22 06:54:16 -07:00
Anders Hejlsberg 907664c31c
Merge pull request #31454 from microsoft/fixThisTypeIndexSignature
Permit assignment through index signature of 'this' type
2019-05-20 07:02:52 -07:00
Anders Hejlsberg c6a670d26c Add regression test 2019-05-17 15:59:01 -07:00
Nathan Shively-Sanders eeba30afc8
Fix infinite loop: module.exports alias detection (#31436)
* Fix infinite loop: module.exports alias detection

Previously, module.exports alias detection in the binder could enter an
infinite recursion. Now it does not.

Notably, there are *two* safeguards: a counter limiter that I set at
100, and an already-seen set. I actually prefer the counter limiter code
because it's foolproof and uses less memory. But it takes 100
iterations to escape from loops.

* fix space lint

* Remove already-seen map
2019-05-17 12:50:39 -07:00
Anders Hejlsberg ee59cee381 Add regression test 2019-05-10 09:56:17 -07:00
Collins Abitekaniza 2bb2f9ff68 add baseline tests for spreading instantiable type 2019-05-03 05:31:28 +03:00
Andrew Branch 56b19c9bf0
Merge pull request #31119 from andrewbranch/bug/31020
Emit grammar error on quoted constructors and class fields named “constructor”
2019-05-01 10:42:16 -10:00
Andrew Branch 90d3acf6c7
Merge pull request #31078 from andrewbranch/bug/30752
Fix symbol merging of augmentations to pattern ambient modules
2019-04-30 06:18:23 -10:00
Forbes Lindesay 3ce3cde493 Allow Boolean() to be used to perform a null check (#29955)
* Allow Boolean() to be used to perform a null check

* Add missing test case output
2019-04-30 08:09:31 -07:00
Anders Hejlsberg be409fad84
Merge pull request #31137 from Microsoft/fixConditionalInference
Fix conditional type inference involving any or unknown
2019-04-30 06:26:02 -07:00
Anders Hejlsberg a539887893
Merge pull request #31150 from Microsoft/fixReadonlyIndexedAccess
Fix readonly indexed access used in indexed access type
2019-04-29 16:59:13 -07:00
Ron Buckton 2d8527f3f0
Merge pull request #30779 from Microsoft/relateDiscriminants
Relate source types covered by a target discriminated union
2019-04-29 16:58:27 -07:00
Ron Buckton 26fd6dafa6 Relate a source type that is sufficiently covered by a target discriminated union 2019-04-29 15:46:37 -07:00
Anders Hejlsberg bbce336268 Add additional tests 2019-04-28 14:12:00 -07:00
Anders Hejlsberg 3050c62251 Add regression test 2019-04-28 13:58:58 -07:00
Ron Buckton 57a8ee1507 Fix binder performance regression 2019-04-27 16:47:27 -07:00
Anders Hejlsberg 078375765b Add regression test 2019-04-27 09:56:11 -07:00
Wenlu Wang 454b4280b1 check more case for empty binding patten (#25263)
* check more case for empty binding patten

* refactor binding pattern checking  getWidenedType

* fix spelling

* fix merge and rebase
2019-04-26 14:00:04 -07:00
Clay Miller d934401265 Change the type of 'uriComponent' (passed to 'encodeURIComponent') from 'string' to 'string | number | boolean'. Fixes #18159 (#31103)
- According to the ECMAScript 5.1 spec (§15.1.3.4), 'encodeURIComponent' invokes the abstract operation 'ToString': https://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3.4
- In the spec (§9.8), 'ToString' accepts an 'Undefined', 'Null', 'Boolean', 'Number', 'String' or 'Object' argument: https://www.ecma-international.org/ecma-262/5.1/#sec-9.8
- TypeScript’s 'StringConstructor' accepts an argument with type 'any': b0100100a1/lib/lib.es5.d.ts (L518)
2019-04-26 13:07:14 -07:00
Andrew Branch e81fa2198d
Emit error on class fields named "constructor" 2019-04-25 17:30:41 -07:00
Anders Hejlsberg 95413f0a24
Merge pull request #31000 from Microsoft/ignoreStringIndexSignaturesOnly
Ignore string (but keep numeric) index signatures from constraints
2019-04-25 17:01:46 -07:00
Andrew Branch c5e6913ede
Add grammar error on quoted constructors for TS 3.5 2019-04-25 15:44:23 -07:00
Klaus Meinhardt b45df892a8 emit error on destructuring of rest property (#29609)
Fixes: #26005
2019-04-25 13:33:49 -07:00
Andrew Branch 72f30a8308
Add test for quoted constructors 2019-04-25 11:35:10 -07:00
Wenlu Wang 583edce6b0 fix compiler crash (#25925) 2019-04-25 10:51:36 -07:00
Andrew Branch d69f9f3328
Add bad test case 2019-04-24 08:44:24 -07:00
Andrew Branch f2ec02b971
Add additional test to ensure merging more than augmentations still works 2019-04-23 13:26:00 -07:00
Andrew Branch 7409a04010
Fix merging module augmentations to pattern ambient modules 2019-04-23 12:06:56 -07:00
Daniel Rosenwasser 2eea21636b
Merge pull request #29242 from Kingwl/attach_property_to_default_export
add transformer for emit add property to default export
2019-04-18 23:30:48 -04:00
Andrew Branch b6a0988052
Merge pull request #30776 from andrewbranch/feature/10178
Add flag to allow access to UMD globals from modules
2019-04-18 18:05:44 -07:00
Anders Hejlsberg 3a89fead70 Merge branch 'master' into ignoreStringIndexSignaturesOnly
# Conflicts:
#	tests/baselines/reference/keyofAndIndexedAccess2.errors.txt
#	tests/baselines/reference/keyofAndIndexedAccess2.js
#	tests/baselines/reference/keyofAndIndexedAccess2.symbols
#	tests/baselines/reference/keyofAndIndexedAccess2.types
#	tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts
2019-04-18 11:31:06 -07:00
Anders Hejlsberg 4d0244c798 Add regression test 2019-04-17 15:05:57 -07:00
Anders Hejlsberg 07d259593a Add regression test 2019-04-17 12:37:01 -07:00
Wesley Wigham d405662eb6
Explicitly encode keyof behaviors for never and unknown into getIndexType (#30753)
* Explicitly encode keyof behaviors for never and unknown into getIndexType

* Merge similar cases
2019-04-15 17:52:13 -07:00
Anders Hejlsberg 2c951b3ca9 Add regression test 2019-04-13 08:24:27 -10:00
Anders Hejlsberg 6282645e3c
Merge pull request #30857 from Microsoft/fixInferenceToIntersection
Fix inference to intersections
2019-04-12 07:34:40 -10:00
Anders Hejlsberg 6cd229b4b9
Merge pull request #30769 from Microsoft/saferIndexedAccessTypes
Improve soundness of indexed access types
2019-04-12 07:33:50 -10:00
Anders Hejlsberg a764729b38 Add tests 2019-04-10 17:42:08 -10:00
Anders Hejlsberg 68eb7b9fe2 Add test 2019-04-09 15:29:51 -10:00
Nathan Shively-Sanders 90b304aa5e
Merge pull request #30786 from Microsoft/always-check-class-extends
Always check extends clause of classes
2019-04-08 10:25:05 -07:00
Andrew Branch 6d1d680c0e
Add test 2019-04-08 09:46:47 -07:00
Andrew Branch bafa4c90c1
Merge pull request #30758 from andrewbranch/bug/30647
Fix crash when checking function call
2019-04-08 09:22:39 -07:00
Anders Hejlsberg 2b6e7304c1 Merge branch 'master' into tweakUnionTypeInference 2019-04-06 08:12:45 -10:00
Anders Hejlsberg cd646dab7e Add tests 2019-04-06 07:59:39 -10:00
Anders Hejlsberg 294580287d Merge branch 'master' into saferIndexedAccessTypes 2019-04-05 16:23:48 -10:00
Nathan Shively-Sanders dabf2a6af2 Always check extends clause of classes
Even if (1) @extends is provided and (2) we're not producing
diagnostics. That's because we need to know whether the extends clause
references an imported alias.
2019-04-05 16:37:27 -07:00
Anders Hejlsberg 739acee1c9 Add tests 2019-04-04 16:30:26 -07:00
Wesley Wigham 16450a027a
Change the default type parameter constraints and defaults to unknown from {} (#30637)
* Change the default type parameter constraint and default to unknown from {}

* Relax unknown checking outside of strictNullChecks a bit

* Increase strictness on index signatures with type `unknown` so inference doesnt change surprisingly

* Remove redundant switch
2019-04-04 12:25:15 -07:00
Andrew Branch 8576018af1
Add failing test for function calls that have at least one non-spread argument, a spread argument, and overall potentially too few arguments 2019-04-04 11:47:25 -07:00
Ron Buckton f04a40dd49 Treat hoisted temp variables as a custom prologue 2019-04-02 17:35:26 -07:00
Andrew Branch 3f3444be80
Merge pull request #30699 from andrewbranch/bug/30635
Fix ternaries where "true" is a parenthesized variable and "false" is a function expression
2019-04-02 14:03:11 -07:00
Andrew Branch f383c3c42d
Add test for parenthesized variable and function keyword within ternary 2019-04-01 14:11:30 -07:00
Andrew Branch 9a3149b967
Add failing tests for destructuring void 2019-04-01 13:33:41 -07:00
Nathan Shively-Sanders 32054f1c31
Forbid accessing block-scoped variables on globalThis (#30510)
* Forbid accessing const & let on globalThis

It's just an error; you still get the type of the property.

* Disallow access of blockscoped vars on globalThis

Also change Array, Function, String, et al from `const` to `var` so that
they remain accessible via `globalThis.String`.

* Update baselines after lib.d.ts change

Note especially the change in redefineArray, which is now allowed as
long as you provide a type that is assignable to ArrayConstructor.

* Remove blockscoped vars from typeof globalThis

Unlike forbidding them, this removes the properties entirely.

Unfortunately, this means that accessing these properties is only an
error with noImplicitAny, and that error is quite confusing.

Let's discuss our options. I see 3:

1. Forbid access of block-scoped vars as properties (in all flag
settings), but leave them on the type. Simple to implement.
2. Remove block-scoped vars from the globalThis type. Has the bad
error/flag behaviour described above, but simple to implement.
3. Remove block-scoped vars from the globalThis type. Also, forbid
accessing them by executing another resolveName lookup for failed
property accesses on globalThisSymbol. If the second lookup returns a
blockscoped var, issue an error instead of falling back to the index
signature. This seems too complex to me.

* Update baselines

* Better error for block-scoped usage on globalThis

So that value-space references have as clear an error as type-space
references.

* Update fourslash tests

* Fix semi-colon lint

* Don't copy so much when filtering blockscoped vars
2019-03-25 14:07:48 -07:00
王文璐 35ded510bb Merge branch 'master' into attach_property_to_default_export 2019-03-22 17:40:37 +08:00
Ron Buckton 2932421370
Merge pull request #30495 from Microsoft/fix29427
Adjust offset to account for 'this' parameter when emitting parameter decorators
2019-03-20 12:56:50 -07:00
Ron Buckton 07bec2893f Adjust offset to account for 'this' parameter when emitting parameter decorators 2019-03-19 11:46:18 -07:00
Ron Buckton e19c7f1a45 Prevent substitution of 'super' in async super helper 2019-03-19 11:35:18 -07:00
Ron Buckton 4e54f30fb4 Fix _superIndex emit when super access captured in async arrow 2019-03-19 10:20:08 -07:00
Collins Abitekaniza 7b55d1846b Giving too many arguments should error on the first argument that exceeds arity (#27982)
* span on first arg that exceeds arity

* refactor baseline

* handle cases for spread arguments

* refactor + add coverage for tuple spread cases

* create diagnostic on NodeArray of exceeding args

* test function overloading
2019-03-12 15:57:12 -07:00
Wenlu Wang d2476759e2 add related error span for default exports (#25396)
* add related error span for default exports

* accept baseline

* stash

* accept baseline and fix lint

* update testcase

* Add missing semicolon
2019-03-12 13:15:14 -07:00
Wenlu Wang bd27296ba6 improve stripInternal with inline comments (#23611)
* improve stripInternal with inline comments

* fix lint

* stash

* simptify StripInternal

* fix internal type declaration

* fix internal type declaration again

* accept baseline

* refactor inline

* simply prev check

* remove getTrailingCommentRangesOfNode

* Merge implementation with new isInternalDeclaration method, accept lkg-based baseline
2019-03-12 13:14:47 -07:00
Jack Williams 5bef1aa13c Add regressions for conditional types that affect parameter variance (#30146) 2019-02-28 16:14:16 -08:00
Anders Hejlsberg 7f5052bf7b
Merge pull request #30114 from Microsoft/contextualGenericRestParameter
Improve contextual typing by generic rest parameters
2019-02-28 11:00:12 -10:00
Anders Hejlsberg 237c33b444
Merge pull request #30109 from Microsoft/circularConstraintErrors
Consistently error on circular constraints
2019-02-28 10:57:01 -10:00
Nathan Shively-Sanders be2db9db12
Add globalThis (#29332)
* Restore original code from bind-toplevel-this

With one or two additional comments

* Working in JS, but the symbol is not right.

Still need to

1. Make it work in Typescript.
2. Add test (and make them work) for the other uses of GlobalThis:
window, globalThis, etc.

* Check in TS also; update some tests

Lots of tests still fail, but all but 1 change so far has been correct.

* Update baselines

A couple of tests still fail and need to be fixed.

* Handle type references to globalThis

The type reference must be `typeof globalThis`. Just `globalThis` will
be treated as a value reference in type position -- an error.

* Restore former behaviour of implicitThis errors

I left the noImplicitThis rule for captured use of global this in an
arrow function, even though technically it isn't `any` any more --
it's typeof globalThis.  However, you should still use some other method
to access globals inside an arrow, because captured-global-this is super
confusing there.

* Test values with type globalThis

I ran into a problem with intersecting `Window & typeof globalThis`:

1. This adds a new index signature to Window, which is probably not
desired. In fact, with noImplicitAny, it's not desired on globalThis
either I think.
2. Adding this type requires editing TSJS-lib-generator, not this repo.

So I added the test cases and will probably update them later, when
those two problems are fixed.

* Add esnext declaration for globalThis

* Switch to symbol-based approach

I decided I didn't like the import-type-based approach.

Update baselines to reflect the difference.

* Do not suggest globals for completions at toplevel

* Add tests of element and property access

* Look up globalThis using normal resolution

globalThis is no longer constructed lazily. Its synthetic Identifier
node is also now more realistic.

* Update fourslash tests

* Add missed fourslash test update

* Remove esnext.globalthis.d.ts too

* Add chained globalThis self-lookup test

* Attempt at making globalThis readonly

In progress, had to interrupt for other work.

* Add/update tests

* Addres PR comments:

1. Add parameter to tryGetThisTypeAt to exclude globalThis.
2. Use combined Module flag instead combining them in-place.
3. SymbolDisplay doesn't print 'module globalThis' for this expressions
anymore.
2019-02-27 14:14:34 -08:00
Nathan Shively-Sanders aedffe049d Revert "Merge pull request #27697 from mattmccutchen/issue-27118"
This reverts commit 2dfb6202ed, reversing
changes made to bbf559b9c7.
2019-02-27 11:50:04 -08:00
Anders Hejlsberg 2212f4777a Add regression test 2019-02-26 12:44:12 -08:00
Anders Hejlsberg f19191b081 Add tests 2019-02-19 07:02:50 -10:00
Anders Hejlsberg f93f4f3c62
Merge pull request #29847 from Microsoft/inferToUnionTypes
Improve inference to union and intersection types
2019-02-11 11:34:05 -08:00
Anders Hejlsberg d66000bc47
Merge pull request #29787 from Microsoft/inferToPartiallyHomomorphic
Infer to partially homomorphic types (such as Pick<T, K>)
2019-02-11 11:33:27 -08:00
Anders Hejlsberg ce6c04e9b5 Merge branch 'master' into inferToUnionTypes 2019-02-11 11:00:41 -08:00
Anders Hejlsberg 32b44ac65a
Merge pull request #29858 from Microsoft/fixContextualRestTuple
Fix contextual types computed from rest parameters
2019-02-11 10:59:11 -08:00
Anders Hejlsberg 710826e37e Add regression test 2019-02-11 09:46:02 -08:00
Anders Hejlsberg 35cf397ae3 Add regression tests 2019-02-10 15:29:14 -08:00
Matt McCutchen 1aca1dd036 Make the assignability rule for conditional types require the check
types and distributivity to be identical.

Fixes #27118.
2019-02-09 17:22:08 -05:00
Anders Hejlsberg e49320d1db Add more tests 2019-02-08 06:49:26 -08:00
Kagami Sascha Rosylight a8823f5169
Merge branch 'master' into es2019 2019-02-07 10:08:26 +09:00
Anders Hejlsberg 62c62f4f87 Add tests 2019-02-06 15:41:43 -08:00
Kagami Sascha Rosylight 6249b4c704 Remove ES2018 transforms for ES2018 target (#26315)
* rename esnext.ts as es2018.ts

* remove ES2018 transforms for ES2018 target

* change target from esnext to es2018

* rename tests
2019-02-06 15:35:52 -08:00
Anders Hejlsberg d9ee86723a
Merge pull request #29740 from Microsoft/fixCircularMappedArrayTuple
Fix issues related to circular mapped array and tuple types
2019-02-06 13:24:19 -08:00
Anders Hejlsberg 7c096576bc
Merge pull request #29756 from Microsoft/fixStrictPropertyInitialization
Revert change to strict property initialization checks
2019-02-05 15:10:30 -08:00
Anders Hejlsberg 2d44a40202 Add regression test 2019-02-05 13:08:18 -08:00
Ryan Cavanaugh 1ec8a71949
Merge pull request #29711 from jack-williams/switch-on-unknown
Fix #29710: Narrow unknown in switch
2019-02-05 09:08:52 -08:00
Anders Hejlsberg bee9f1a5e7 Add regression tests 2019-02-04 17:48:53 -08:00
Ron Buckton 55762271af
Merge pull request #29695 from Microsoft/fixDtsTypeReferenceEmit
Fix type reference dts emit failure
2019-02-04 13:03:07 -08:00
Jack Williams 3d0c7f3156 Narrow unknown in switch 2019-02-03 16:07:21 +00:00
Anders Hejlsberg 332861b4fc Add tests 2019-02-02 09:37:52 -08:00
Ron Buckton 4b84f56b21 Fix type reference dts emit failure 2019-02-01 16:09:17 -08:00
Klaus Meinhardt 782622f9cd clarify error message for 'readonly' type operator 2019-01-31 19:44:49 +01:00
Klaus Meinhardt f4747f4667 Merge branch 'master' of github.com:Microsoft/TypeScript into add-to-types2 2019-01-31 11:25:01 +01:00
Anders Hejlsberg 96706a75ed
Merge pull request #29510 from Microsoft/constContexts
Const contexts for literal expressions
2019-01-30 15:55:47 -08:00
Ryan Cavanaugh 0df89cc96f
Merge pull request #26941 from jack-williams/narrow-unknown-with-triple-equals
Fix #25172: Add narrowing for `unknown` with triple equals
2019-01-29 16:43:50 -08:00