33646 Commits

Author SHA1 Message Date
Jake Bailey
57737235d6
Cherry-pick #50724 to release-4.8 (#50760)
Co-authored-by: Oleksandr T <oleksandr.tarasiuk@outlook.com>
2022-09-21 17:21:19 -07:00
TypeScript Bot
a3b3555086
Cherry-pick PR #50797 into release-4.8 (#50798)
Component commits:
23a1dd4d74 Fix bounds check

23784d711e Add regression test

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
2022-09-16 09:44:11 -07:00
Sheetal Nandi
bb8cf903b5
Handle more places where package direcroy is converted to canonical file path (#50740) (#50747)
* Add test for node16 resolution with package json lookup making casing incorrect

* Handle more places where package direcroy is converted to canonical file path
2022-09-12 16:23:21 -07:00
TypeScript Bot
ea348f67aa Bump version to 4.8.3 and LKG v4.8.3 2022-09-07 18:49:12 +00:00
TypeScript Bot
6bb16f105c
Cherry-pick PR #50620 into release-4.8 (#50676)
Component commits:
4635cdcb54 Forward intersection state flag to conditional type target check

Co-authored-by: Andrew Branch <andrew@wheream.io>
2022-09-07 10:56:19 -07:00
TypeScript Bot
ca022ae185
Cherry-pick PR #50261 into release-4.8 (#50621)
Component commits:
460d1e2e82 Forward intersectionState flag when comparing indexed access constraints

Co-authored-by: Wesley Wigham <t-weswig@microsoft.com>
2022-09-07 10:07:06 -07:00
TypeScript Bot
1eec8b3260
Cherry-pick PR #50617 into release-4.8 (#50618)
Component commits:
83a58b0229 Check if its same buildinfo only for directly referenced projects and not recursively Fixes #50545

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2022-09-02 13:38:26 -07:00
TypeScript Bot
451b5ba7f1
Cherry-pick PR #50601 into release-4.8 (#50613)
Component commits:
8fa47f18be Allow `{}` to narrow in same special cases as `unknown`

Co-authored-by: Andrew Branch <andrew@wheream.io>
2022-09-02 10:04:25 -07:00
TypeScript Bot
4083b464c1
Cherry-pick PR #50610 into release-4.8 (#50612)
Component commits:
908548ef90 'in' operator shouldn't narrow {} originating in unknown

517777d3ab Add regression test

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
2022-09-02 09:39:19 -07:00
TypeScript Bot
10870b4f3c
Cherry-pick PR #50592 into release-4.8 (#50596)
Component commits:
46ce0b2582 Use bidirectional comparability (aka comparability) in narrowing

3e227f7973 Rename test, check other CFA branch, test without strictNullChecks

Co-authored-by: Andrew Branch <andrew@wheream.io>
2022-09-01 14:55:41 -07:00
TypeScript Bot
502a9087b6
Cherry-pick PR #50553 into release-4.8 (#50589)
Component commits:
3652682f52 {} & null and {} & undefined should be never in non-strictNullChecks mode

dd32cf8203 Add tests

03cb73ffe1 Address code review feedback

45025535ce Accept new baselines

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
2022-09-01 13:29:31 -07:00
TypeScript Bot
c9e06dc30e
Cherry-pick PR #50540 into release-4.8 (#50588)
Component commits:
00e3926c48 Defer distributing index over generic object types

2ba9ff19c8 Only check if the index type should be deferred for intersection types

873dfea5d2 Add an additional test case

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
2022-09-01 11:55:55 -07:00
TypeScript Bot
1f76a51b1e
Cherry-pick PR #50497 into release-4.8 (#50590)
Component commits:
40a5fc1189 Handle intersections in isGenericTypeWithoutNullableConstraint

7a14338fb8 Add regression test

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
2022-09-01 11:53:39 -07:00
TypeScript Bot
ac0cc8cefe
Cherry-pick PR #50535 into release-4.8 (#50549)
Component commits:
7bd2a6eeb7 Only normalize intersections that include {}

698c3ab770 Accept new baselines

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
2022-09-01 08:25:52 -07:00
TypeScript Bot
8b79b2ffb3
Cherry-pick PR #50557 into release-4.8 (#50576)
Component commits:
0cb4514766 Add test to show how scope messes with casing

a3ea961838 Do not canonicalize the file names when getting absolute paths Fixes #50544

dfb1e401f0 Unnecessary exports

fc35e0a032 Add test for self referencing package

9076f4d57d Fix self reference package with casing

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2022-09-01 06:49:26 -07:00
TypeScript Bot
4b7a7b5ddf
Cherry-pick PR #49814 into release-4.8 (#50578)
Component commits:
e2d22fa5bc Unify default import resolution across specifier target codepaths

b3416997bb Merge main into branch

cf010b517d Use differing type aliases, per request

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
2022-09-01 06:20:47 -07:00
TypeScript Bot
565a444d4b
Cherry-pick PR #50308 into release-4.8 (#50577)
Component commits:
5392e26891 Fix export = error message to not have redundant language

Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
2022-08-31 17:20:25 -07:00
TypeScript Bot
45c6828de0
Cherry-pick PR #50554 into release-4.8 (#50555)
Component commits:
1e963c05ec Rename API to importPlugin

eb6fe9a5eb Make it internal too

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2022-08-31 14:22:46 -07:00
TypeScript Bot
64cec036ca Bump version to 4.8.2 and LKG v4.8.2 2022-08-25 21:17:59 +00:00
TypeScript Bot
577411ca8c Update LKG 2022-08-22 23:53:47 +00:00
Ron Buckton
1e6d76e52a
Make canHaveModifiers/Decorators public (#50405) 2022-08-22 16:42:48 -04:00
TypeScript Bot
aca1aa6897 Update LKG 2022-08-22 04:39:32 +00:00
TypeScript Bot
27a7916239
Cherry-pick PR #50343 into release-4.8 (#50374)
Component commits:
da3e3040e8 Change type of deprecated 'decorators' property

a63f47cf4f fix 'Invalid Arguments' error for create/update constructor in factory

a2588b8125 Update deprecation comments

aebe225dd2 Make 'decorators' optional and 'undefined'

46c30f3e76 Rename '_decorators' to 'illegalDecorators'

6404716139 Update baselines

Co-authored-by: Ron Buckton <rbuckton@microsoft.com>
2022-08-19 17:10:31 -07:00
TypeScript Bot
99b7928a37
Cherry-pick PR #50364 into release-4.8 (#50365)
Component commits:
4a808aa417 Add tests when realpath supresses the casing error

97011d68ba Fix when real path results in value that differs only in case Fixes #49470

1e62da1088 Comment

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2022-08-18 16:47:56 -07:00
TypeScript Bot
ccfc09d82c
Cherry-pick PR #50306 into release-4.8 (#50324)
Component commits:
b73d93bf2a On windows handle the long paths in realpathSync.native Fixes #49470

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2022-08-16 12:09:47 -07:00
TypeScript Bot
745f958edb
Cherry-pick PR #50279 into release-4.8 (#50280)
Component commits:
eff4406f0e Revert "Fixed an issue with contextual type for intersection properties (#48668)"
This reverts commit 9236e39374c0ec9a1e3f9894af4fb9eb34ba0021.

Co-authored-by: Ryan Cavanaugh <RyanCavanaugh@users.noreply.github.com>
2022-08-11 15:33:56 -07:00
TypeScript Bot
60b5167a2a Update LKG v4.8-rc 2022-08-09 00:39:44 +00:00
TypeScript Bot
d2e294146f
Cherry-pick PR #50227 into release-4.8 (#50229)
Component commits:
c28ee659ac Revert "Better typings for Promise.resolve(), like #31117 (#33074)"
This reverts commit 040c1216ff2e9398f648e5475533f1fa80d7aca1.

Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
2022-08-08 17:25:37 -07:00
TypeScript Bot
d605f1bd97 Bump version to 4.8.1-rc and LKG 2022-08-06 02:23:49 +00:00
TypeScript Bot
4f9e546ab0 Merge remote-tracking branch 'origin/main' into release-4.8 2022-08-06 01:19:46 +00:00
Gabriela Araujo Britto
bdb8514b82
Fix contextual typing on yield and return expressions in generator function (#49736)
* add tests and initial fix

* fix contextual return type in generator funcs

* fix return statement contextual typing

* filter using getiterationtypeofgeneratorfunctionreturntype

* update baselines
2022-08-05 11:24:43 -07:00
TypeScript Bot
5c1abd300d Update package-lock.json 2022-08-05 06:06:36 +00:00
Oleksandr T
a44354af7c
fix(50188): omit QF on function arguments (#50189) 2022-08-04 17:52:09 -07:00
Andrew Branch
7afd14f263
Update error messages for CJS imports resolving to ES modules (#50088)
* Update error messages for CJS imports resolving to ES modules

* Update error message

* Use package scope from source file

* Update baselines

* Issue error for JSX/TSX files

* Switch from related info to message chain
2022-08-04 16:58:13 -07:00
Alex Hsu
b1176ce5e8
LEGO: Merge pull request 50179
LEGO: Merge pull request 50179
2022-08-04 03:16:11 -07:00
TypeScript Bot
9499b6eb8e Update package-lock.json 2022-08-04 06:06:34 +00:00
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