Commit Graph

32018 Commits

Author SHA1 Message Date
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
Wesley Wigham 13c08ab32b Use identity with the permissive instantation to detect nongenric instances and disable variance probing on nongeneric instances (#29981)
* Use identity with the restrictive instantation to detect nongenric instances and disable variance probing on nongeneric instances

* Generalize to also include interfaces, add test case, still perform argument comparisons for postive comparisons if possible

* Actually accept baselines, lol

* Reduce deep nesting limit just a bit so yargs still builds

* Handle circular identities in isNonGeneric

* Use a simple traversal of the types rather than the restrictive instantiation

* Cache the bits using an existing field to further reduce any time nongeneric check takes

* Revert to using an existing mapper, use permissive > restrictive

* Revert constant change

* And revert the comment, too
2019-02-27 14:12:30 -08:00
Sheetal Nandi 03377f70b7 Apply changes in reverse order even in new API to match behaviour with internal api 2019-02-27 14:07:15 -08:00
Nathan Shively-Sanders 0d93eb9218 Merge pull request #30133 from Microsoft/revert-conditional-type-invariance
Revert "Merge pull request #27697 from mattmccutchen/issue-27118"
2019-02-27 13:25:04 -08:00
Nathan Shively-Sanders f77b43ca09 Update baselines 2019-02-27 12:42:30 -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
Sheetal Nandi 4718ff8f21 Merge pull request #30110 from Microsoft/revertExecFileSync
Revert execFileSync
2019-02-27 10:52:49 -08:00
Gabriela Araujo Britto 006fe14bcc refactor utilities 2019-02-26 16:22:08 -08:00
Daniel Rosenwasser e8e7e88b2a Merge pull request #30094 from Kingwl/improve_completions_for_optional_props
check completions with assignable rather than identity
2019-02-26 16:19:50 -08:00
Sheetal Nandi fd10c12116 Revert "Use execFileSync in typing installer"
This reverts commit bc386c11fd.
2019-02-26 14:01:42 -08:00
Sheetal Nandi 3e4b9c07d2 Revert "Do not wrap npm path with quotes"
This reverts commit 1ed5e1c63b.
2019-02-26 14:01:03 -08:00
Anders Hejlsberg 0716b87b75 Merge branch 'master' into contextualGenericRestParameter 2019-02-26 14:00:41 -08:00
Wesley Wigham 288851066b Dont create a union type to infer conditional type branches (#30010) 2019-02-26 13:43:41 -08:00
Wesley Wigham 2533d8294e Make a fresh empty object literal not a subtype of a type with an index signaure (#29975)
* Forbid inferable index checkign during subtype relationship checking

* Merge object.values and object.entries overloads to work around subtype change

* Invert subtype relationship between fresh empty objects and non-empty object types

* Remvoe comment

* Revert lib change

* Remove trailing whitespace ffs
2019-02-26 13:43:22 -08:00
Anders Hejlsberg ecebc9ffeb Accept new baselines 2019-02-26 12:44:18 -08:00
Anders Hejlsberg 2212f4777a Add regression test 2019-02-26 12:44:12 -08:00
Anders Hejlsberg 5270b49bcc Accept new baselines 2019-02-26 12:39:14 -08:00
Anders Hejlsberg ede6b9a5cb Issue errors for all circular type parameter constraints 2019-02-26 12:39:01 -08:00
Sheetal Nandi e6068f405b Make applyChangesToOpenFiles efficient to handle batch file opens, close and changes before updating projects
Fixes #29667
2019-02-26 11:54:29 -08:00
Sheetal Nandi 2258bb2fb7 Add request applyChangesToOpenFiles 2019-02-26 10:21:01 -08:00
Sheetal Nandi 6fd7011870 Add test that batches all the open files to update program only once 2019-02-26 10:21:01 -08:00
Gabriela Araujo Britto 970ec62364 remove unused LeadingTriviaOption and TrailingTriviaOption options 2019-02-26 10:02:57 -08:00
Gabriela Araujo Britto bf5123de6a don't export useNonAjustedPositions 2019-02-26 09:49:10 -08:00
Gabriela Araujo Britto e3a465ffa3 change startPosition and endPosition to leadingTriviaOption and trailingTriviaOption 2019-02-26 09:43:35 -08:00
Sheetal Nandi 4db4c58924 Merge pull request #30095 from Microsoft/nodeExecFileSync
Do not wrap npm path with quotes
2019-02-26 09:10:22 -08:00
Sheetal Nandi 1ed5e1c63b Do not wrap npm path with quotes
Fixes #30086
2019-02-25 19:50:53 -08:00
王文璐 4d7ec380a9 check completions with assignable rather than identity 2019-02-26 10:54:01 +08:00
Wesley Wigham c5061486a9 Retain substitution types through instantiation if possible (#30059) 2019-02-25 17:10:03 -08:00
Wesley Wigham 0e858a6e16 Include misc script outputs in local build (#30092)
* Include other misc script outputs in local build

* Remove comment
2019-02-25 16:33:20 -08:00
Wesley Wigham c2f1998387 Fix baseline accept when there are multiple .delete files (#30091) 2019-02-25 16:18:03 -08:00
Ron Buckton 510bef6856 Remove NewTargetInComputedPropertyName hierachy fact 2019-02-25 14:58:57 -08:00
Gabriela Araujo Britto a5153a94ab add tests 2019-02-25 14:14:28 -08:00
Ron Buckton ad4cef01a3 Removes 'TypeScript' transform flag 2019-02-25 13:26:44 -08:00
Daniel Rosenwasser 9787021540 Merge pull request #30078 from Microsoft/updateNpmIgnore
Fix `.npmignore` by adding the `.git` file and the `.failed-tests` file.
2019-02-25 13:21:53 -08:00
Gabriela Araujo Britto 365967d484 Merge branch 'master' into convert-to-named-parameters 2019-02-25 10:54:58 -08:00
Gabriela Araujo Britto f571866f47 add new tests for bad class references 2019-02-25 10:32:56 -08:00
Gabriela Araujo Britto bc3611d1dd update failing tests 2019-02-25 10:32:28 -08:00
Titian Cernicova-Dragomir 8d66d55de1 Improved argument description for parameters originating from tuples that were extracted from functions. (ie mapped functions) 2019-02-25 18:18:00 +02:00
Daniel Rosenwasser c37254e509 Merge pull request #30062 from jwunderl/quick-fix-any-annotation
Remove any annotation from declare method quickfix
2019-02-24 23:18:06 -08:00
Daniel Rosenwasser 7a391fe613 Fix .npmignore by adding the .git file (as opposed to just a directory, which is not the case for git worktrees) and the .failed-tests file. 2019-02-24 23:05:48 -08:00
Sheetal Nandi 8b0611565b For now disable the new build 2019-02-22 18:19:24 -08:00
Sheetal Nandi 9fa28158bb Enable building typescript.d.ts with current source 2019-02-22 18:11:27 -08:00
Joseph Wunderlich d87e67df58 clarify intent in returnType creation 2019-02-22 18:00:21 -08:00
Joseph Wunderlich 21ab39649c remove any annotation from declare method quickfix 2019-02-22 17:24:21 -08:00
Gabriela Araujo Britto 640424e42c fix comment 2019-02-22 16:32:12 -08:00
Gabriela Araujo Britto ce42aa43a8 check usages of class if refactoring a constructor 2019-02-22 16:31:40 -08:00
Sheetal Nandi 9730cfa845 Dont emit sourceMapUrl from prepend text into the --out file 2019-02-22 14:39:47 -08:00
Sheetal Nandi e1b18ab5fb Merge branch 'master' into incrementalBuildInfo 2019-02-22 14:19:53 -08:00
Sheetal Nandi 415a5db166 Add test when declarationMap and sourcemap are disabled in the referenced project 2019-02-22 14:07:13 -08:00
Sheetal Nandi ab66b1e293 Fix the blank lines for internal enum members with --stripInternal 2019-02-22 13:51:13 -08:00