Commit Graph

33865 Commits

Author SHA1 Message Date
Ron Buckton 6bbe6d67d1 Fix return value and error reporting for getIterationTypesOfMethod (#50146) 2022-08-03 19:07:29 -04:00
Sheetal Nandi bc7786b24e Ensure that file watcher is closed only once for affected file locations that share watcher because of different names but same real path (#50150)
* Add test where clearing affected files watcher that also is shared by real path causes Debug failure

* Ensure that file watcher is closed only once for affected file locations that share watcher because of different names but same real path

* Lift up package json map
2022-08-03 15:39:07 -07:00
Ron Buckton d6d26430c7 Add rule to auto-paren optional chain in normal prop or element access (#50156) 2022-08-03 17:17:26 -04:00
Andrew Branch c82c9a9744 Fix bugs in module specifier generation with paths/typesVersions (#49792)
* Write a test and a huge comment

* Finish fixing everything

* Clean up comment

* Remove obsolete comment

* Fix comment trailing off

* Optimize to hit the file system much less
2022-08-03 13:58:15 -07:00
Oleksandr T 59c91f6ce9 fix(50077): skip convertOverloadListToSingleSignature refactoring if position is in function body (#50093) 2022-08-03 13:56:42 -07:00
Jake Bailey a3a5e009a5 Downgrade es5-ext via overrides (#50061) 2022-08-03 10:47:30 -07:00
TypeScript Bot 867512cc97 Update package-lock.json 2022-08-03 06:06:42 +00:00
Anders Hejlsberg 697935da47 Restore ordering of operations involving type parameters and unions (#50116) 2022-08-03 00:32:41 -04:00
Jack Bates 040c1216ff Better typings for Promise.resolve(), like #31117 (#33074)
* Better typings for Promise.resolve(), like #31117

* Add tests

* Update to Awaited<T>

* Fix issue with Awaited affecting jQuery, additional tests

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2022-08-02 13:39:50 -04:00
TypeScript Bot 8493ea16aa Update package-lock.json 2022-08-02 06:07:51 +00:00
Oleksandr T c0072aad80 fix(49935): omit parentheses in the operand of the unary expression (#50111) 2022-08-01 17:22:45 -04:00
Ron Buckton 55f2c0cb49 No synthetic Awaited for unconstrained type when not a type variable (#50100) 2022-08-01 17:19:15 -04:00
Sheetal Nandi 394f51aeed Fix implied formats, file watching, new source file creating during edits (#50098)
* Add test where module resolution cache is not local and hence doesnt report errors in watch mode

* Ensure module resolution cache is passed through in watch mode

* Remove unnecessary setting of impliedFormat which should anyways be done as part of create source file

* Add test for packge.json changing and modifying implied format

* Distinguish between package.json watch and affecting file location watch

* Pass in failed lookup and affected file locations for source file's implied format
Also stop creating options if we already have them

* Add diagnostic for explaining file's implied format if based on package.json

* Watch implied format dependencies for modules and schedule update on change

* For program if implied node format doesnt match create new source file. Handle implied node format in document registry
Fixes #50086

* Modify tests to show package.json being watched irrespective of folder its in

* Check file path if it can be watched before watching package.json file

* Because we are watching package.json files and failed lookups its safe to invalidate package json entries instead of clearing them out everytime program is created

* Remove todos

* Fix the incorrect merge

* Pickup PackageJsonInfo renames from #50088

* Rename
2022-08-01 12:41:37 -07:00
Nathan Shively-Sanders 427d43691a Improve import type support for commonjs exports (#49745)
* Improve import type support for commonjs exports

This PR makes getTypeFromImportTypeNode a little more like
getExternalModuleMember: for JS files, it now uses both
`getTypeOfSymbol` and `getExportsOfSymbol`, and uses whichever one
returns a symbol. This allows using arbitrary properties of a CJS export=
as types in JSDoc; previously a special case in the binder enabled only
CJS export= where all properties were shorthand assignments.

Fixes #49195

* Add js types/value test case

* Improve binding of CJS property assignments

1. Bind property assignments same as shorthand property assignments in
module.exports object literal assignments.
2. Bind all such assignments, even if the object literal contains
non-property assignments. This is different from before, and it requires
slightly smarter code to prefer aliases when checking CJS imports.

* Remove new binder code

Just include the original fix

* revert missed type in binder
2022-08-01 10:57:38 -07:00
TypeScript Bot e1ceb2eb81 Update package-lock.json 2022-08-01 06:14:56 +00:00
Alex Hsu a66a1a6e25 LEGO: Merge pull request 50110
LEGO: Merge pull request 50110
2022-07-31 02:53:01 -07:00
TypeScript Bot 4f8c74033e Update package-lock.json 2022-07-31 06:06:24 +00:00
Alex Hsu 14fb0b06df LEGO: Merge pull request 50104
LEGO: Merge pull request 50104
2022-07-30 03:47:04 -07:00
TypeScript Bot e56942b7a9 Update package-lock.json 2022-07-30 06:06:37 +00:00
Oleksandr T ae7d2325e9 fix(49869): throw an error on optional binding pattern parameter in JavaScript (#50094) 2022-07-29 16:05:34 -07:00
Ron Buckton 88a1e3a1dd Transform decorators that reference private names into a 'static {}' block (#50074) 2022-07-29 15:29:48 -04:00
Mateusz Burzyński 5374fd924e Add an additional test for favoring the asserted type in type predicate narrowing (#50065)
* Add an additional test for favoring the asserted type in type predicate narrowing

* Add requested test cases
2022-07-29 12:12:33 -07:00
Alex Hsu 4caa3f190f LEGO: Merge pull request 50091
LEGO: Merge pull request 50091
2022-07-29 03:24:47 -07:00
TypeScript Bot cc450cf820 Update package-lock.json 2022-07-29 06:06:35 +00:00
Zzzen 1490037f17 fix dts generation of jsdoc (#49904) 2022-07-28 17:44:23 -07:00
Sheetal Nandi 5d790526a1 Pass correct module resolution state when reading package.json info so that they are correctly tracked in the resolution (#50085) 2022-07-28 17:19:10 -07:00
Oleksandr T 949fffb1e0 feat(47983): Negative tuple index access should not be allowed (#49901)
* feat(47983): disallow negative integers for indexing tuple

* change error message

* add additional tests
2022-07-28 14:22:13 -07:00
Andrew Branch b7355e30af Fix trailing formatting edit when range ends mid-token (#50082) 2022-07-28 12:11:22 -07:00
TypeScript Bot c9586f39e9 Update package-lock.json 2022-07-28 06:07:16 +00:00
Oleksandr T 94bb950008 feat(49358): use filename based on exported name (#49875) 2022-07-27 15:41:31 -07:00
Sheetal Nandi 5b0eea48e9 Report error only on local declaration with additional related information (#49746)
* Add test where the errors are reported in different file
Test for #49739

* Report error only on local declaration with additional related information
Fixes #49739

* Handle existing tests
2022-07-27 15:31:45 -07:00
Andrew Casey c0461be025 Update pr_owners.txt
Add Navya
2022-07-27 15:12:08 -07:00
Jake Bailey 1361567ea4 Update to npm 8, pin in package.json via volta and corepack (#49941) 2022-07-27 14:02:24 -07:00
navya9singh 472584f9cd Changes to resolve pr comments 2022-07-27 13:18:35 -07:00
Jake Bailey 8d0c72d5e0 Normalize effective constraint intersection before checking if source is a part of it (#49956) 2022-07-27 10:06:01 -07:00
Jake Bailey adfb20fbeb Don't uninstall typescript before npm ci in GHA (#50062) 2022-07-27 09:42:22 -07:00
Jake Bailey df58836577 Use proper type for result of resultModuleNamesReusingOldState (#50012) 2022-07-27 09:30:52 -07:00
Anders Hejlsberg a4507c9225 Favor asserted type in type predicate narrowing (#50044)
* Favor asserted type in type predicate narrowing

* Accept new baselines
2022-07-26 17:39:35 -07:00
Josh Goldberg ebd42abf95 Account for type parameters in missing function codefix (#49727)
* Account for type parameters in missing function codefix

* Apply suggestions from code review

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* WIP

* Synthesize new type parameters instead of deep unions and intersections

* Pass along type parameter constraints

* E.T. phone home

* Clean up comments just a bit

* Only widen the instance type sometimes

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-07-26 15:22:19 -07:00
Danilo Lekovic 78e2bfd712 Fix(49525): Adds documentation for the Proxy type. (#49674)
* Adds documentation for the Proxy type.

* Removed trailing whitespace.

* Addresses PR feedback.

* Removes trivial comments and adds descriptive names.
2022-07-26 13:25:10 -07:00
Jake Bailey 3afe2d654e Resolve parsingContextErrors TODO (#50011)
* Add a test with broken code

* Resolve TODO
2022-07-26 08:59:06 -07:00
Oleksandr T bcd22b47d2 fix(50048): remove token name from id (#50051) 2022-07-26 01:13:04 -07:00
navya9singh 34c3b9cf49 Fixed changes to previous commit:
Co-authored-by: graphemecluster <graphemecluster@gmail.com>
2022-07-25 14:26:09 -07:00
Jake Bailey b5b02eefc8 Walk tokens with the correct walker (#50042) 2022-07-25 14:26:00 -07:00
Ron Buckton 12dbdf03b1 Parse parameter decorators outside of Await context when appropriate (#50040) 2022-07-25 17:17:27 -04:00
navya9singh 04df1e18d9 Follow up changes to es5.d.ts 2022-07-25 12:25:45 -07:00
navya9singh 3cade4ca24 String.prototype.replace docs fix.
Co-authored-by: graphemecluster <graphemecluster@gmail.com>
2022-07-25 11:53:20 -07:00
TypeScript Bot a179e910dd Update package-lock.json 2022-07-25 06:06:48 +00:00
Anders Hejlsberg 4026c6fd80 Properly handle null and undefined in getCommonSupertype (#50021)
* Properly handle null and undefined in getCommonSupertype

* Add tests

* Add more tests
2022-07-24 08:09:14 -07:00
Alex Hsu 165a1c4a40 LEGO: Merge pull request 50024
LEGO: Merge pull request 50024
2022-07-24 03:31:04 -07:00