Commit Graph
3962 Commits
Author SHA1 Message Date
Jake BaileyandWesley Wigham 369b4d8299 Cherry pick #50537 and #50779 to release-4.8 (#50907)
* Retain name and propertyName in declaration emit copies of binding patterns if property name is a keyword (#50537)

* Retain name and propertyName in declaration emit copies of binding patterns if property name is a keyword

* Accept baselines

* Remove out of date file

* Partially revert #41044, restoring parameter destructurings in d.ts files (#50779)

* Update baselines

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
2022-09-22 15:00:51 -07:00
TypeScript BotandAnders Hejlsberg 41e1ade33a Cherry-pick PR #50704 into release-4.8 (#50741)
Component commits:
014fc0e1eb Preserve special intersections in mapped types

5907d7cd07 Add regression test

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
2022-09-22 14:27:38 -07:00
TypeScript BotandJake Bailey 2acf3a3652 Cherry-pick PR #50691 into release-4.8 (#50743)
Component commits:
364495996f Add test case

17f6e5723f Revert removal of nonInferrableAnyType

cafebeeeb5 Rename test

Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
2022-09-22 14:26:37 -07:00
TypeScript BotandAnders Hejlsberg 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
TypeScript BotandAndrew Branch 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 BotandWesley Wigham 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 BotandAndrew Branch 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 BotandAnders Hejlsberg 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 BotandAndrew Branch 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 BotandAnders Hejlsberg 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 BotandMateusz Burzyński 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 BotandWesley Wigham 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 BotandRyan Cavanaugh 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 9236e39374.

Co-authored-by: Ryan Cavanaugh <RyanCavanaugh@users.noreply.github.com>
2022-08-11 15:33:56 -07:00
TypeScript BotandNathan Shively-Sanders 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 040c1216ff.

Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
2022-08-08 17:25:37 -07: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
Jack BatesandRon Buckton 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
Ron Buckton 55f2c0cb49 No synthetic Awaited for unconstrained type when not a type variable (#50100) 2022-08-01 17:19:15 -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
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
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 3afe2d654e Resolve parsingContextErrors TODO (#50011)
* Add a test with broken code

* Resolve TODO
2022-07-26 08:59:06 -07: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
Andrew Branch 6aefc1dcea More fixes to uncalled function checks in && expressions (#49868) 2022-07-22 16:06:16 -07:00
Oleksandr T 5d2e62a810 fix(49854): fix start index to emit statements after super (#49858) 2022-07-20 16:02:30 -07:00
Oleksandr T 5702941c2f fix(49719): Incorrect error 2301 when using ES standard class properties (#49725)
* fix(49719): omit TS2301 error with enabled usedefineforclassfields

* show error for target lower than esnext with useddefineforclassfields enabled

* change target from esnext to es2022
2022-07-20 14:36:35 -07:00
Jake Bailey 05d20760af Don't leak EvolvingArray out of code flow (#49943) 2022-07-18 19:00:18 -07:00
Zzzen efbe03a33c check base constraint when checking operand of plus (#49918) 2022-07-18 09:42:50 -07:00
Anders Hejlsberg 2c68ded954 Improve narrowing logic for instanceof, type predicate functions, and assertion functions (#49625)
* Improve narrowing logic for instanceof, type predicates, and assertions

* Accept new baselines

* Add tests

* Tweak algorithm

* Accept new baselines

* Optimize for discriminated unions
2022-07-15 14:01:55 -10:00
Jake Bailey cf3af3febd Properly propagate ObjectFlags.NonInferrableType, clean up non-inferrable code paths (#49887) 2022-07-14 18:33:09 -07:00
Mateusz Burzyński 2ef3901940 Fixed initializaiton-time inference for class properties assigned through element access (#49374) 2022-07-13 14:43:23 -07:00
Oleksandr T 8ae1e9e7c7 fix(49685): omit incorrect visibility error when setter precedes getter (#49697) 2022-07-06 15:59:05 -07:00
Wesley Wigham 9872184483 Remove dependence on module compiler option to consider mts/cts files always modules (#49815) 2022-07-06 13:26:36 -07:00
Jake Bailey af70f240a1 Always resetErrorInfo if structuredTypeRelatedTo succeeds (#49718) 2022-07-06 12:57:01 -07:00
Mateusz Burzyński 8687940398 Add visible alias statements for non-visible binding patterns when emitting declaration (#48869) 2022-07-06 10:08:17 -07:00
Wesley Wigham 0f868035af Constrain infer type parameters made to preserver distributivity for inlined homomorphic mapped types (#49793) 2022-07-06 09:32:37 -07:00
Jake Bailey 641ab8eb97 Infer rest type without using assignContextualParameterTypes (#49740) 2022-07-06 08:27:56 -07:00
iamharbie 1f0d0f7c66 Set Error.prototype.cause type to unknown (#70) (#49639)
Signed-off-by: Abdul-Azeez Lawal <abdul-azeez.lawal@outlook.com>
2022-07-05 15:43:43 -07:00
Ron Buckton c6ff5f3b52 Fix for Awaited<T> inference (#49748) 2022-07-01 15:00:54 -07:00
Andrew Branch f8aa570b23 Get type arguments lazily for instantiating inferred type parameter constraint (#49744)
* Get type arguments lazily for instantiating inferred constraint

* Use new deferred type mapper
2022-06-30 16:23:07 -07:00
Wesley Wigham 4c34f2c792 Fix mapper used to instantiate distributive conditional manufactured in declaration emit (#49737) 2022-06-30 15:03:25 -07:00
Mateusz Burzyński bd11ce2aeb Fixed an issue with self-referential awaited union (#49677) 2022-06-29 13:01:36 -07:00
Jake Bailey b379e7fc79 Pass contextFlags when getting contextual type of JSX elements/attributes (#49707) 2022-06-28 14:40:26 -07:00
Sheetal Nandi 7e91485bec Use value meaning for computed property name for visibility check (#49678)
* Test

* Use value meaning for computed property name
Fixes #49562
2022-06-27 15:16:33 -07:00
Jake Bailey 569cdf1b07 Disallow expression with type parameters as left side of property access (#49464) 2022-06-24 15:54:21 -07:00
Lawrence Craft ad6d08675c Add case to capture enum subtype reduction
* Add case to capture enum subtype reduction
Signed-off-by: Lawrence Craft <lcraft6@bloomberg.net>
2022-06-24 13:04:44 -07:00
Oleksandr T 8636adbbb9 fix(49449): change error location when passing objects/arrays to an argument of type (#49593) 2022-06-22 10:06:01 -07:00
Jake Bailey 71b5bdf980 Ensure resolved signature is cached before processing call errors (#49598) 2022-06-21 13:15:03 -07:00
jordanmbell db49c6c3ba Add fractionalSecond part type to DateTimeFormat().formatToParts (#49569)
* Add fractionalSecond part type to DateTimeFormat().formatToParts

This change adds the `fractionalSecond` part type as a valid part
to be returned from Intl.DateTimeFormat().formatToParts().

Fixes microsoft#48882

* fixup
2022-06-21 07:52:24 -07:00
Anders Hejlsberg 529ba99e29 Use separate marker types for variance annotation validation (#49616)
* Use separate marker types for variance annotation validation

* Add regression test
2022-06-21 06:42:10 -07:00
Wesley Wigham eb4b8a4d2e Handle this in isEntityNameVisible (#49521) 2022-06-15 10:15:19 -07:00