Commit Graph

11592 Commits

Author SHA1 Message Date
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
cd3bd5522b Fixed an issue with generic naked T not being allowed as async generator's return (#49023) 2022-07-14 15:51:03 -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
Babak K. Shandiz
8e6e87fea6 🐛 Fix smart selection of propery signatures having JSDoc comments (#49804)
* 🐛 Avoid grouping JSDoc nodes of propery signatures with others in smart selection

Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>

* ⚗️ Add test case for JSDoc smart selection (#39618)

Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>

* ⚗️ Add test baseline for JSDoc smart selection (#39618)

Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>

* 🐛 Fix skipping SyntaxList first child's JSDoc in smart selection

Signed-off-by: GitHub <noreply@github.com>

* ⚗️ Add tests to ensure not skipping first SyntaxList child's JSDoc

Signed-off-by: GitHub <noreply@github.com>

* 🔨 Exclude JSDoc token from tokens pivoting property signature

Signed-off-by: GitHub <noreply@github.com>

* ⚗️ Update test case to also include modifier

Signed-off-by: GitHub <noreply@github.com>

* ⚗️ Update test case reference baseline

Signed-off-by: GitHub <noreply@github.com>
2022-07-12 09:04:21 -07:00
Anders Hejlsberg
c2897189cb Defer types like keyof (T & {}) (#49696)
* 'keyof undefined' and 'keyof null same as 'keyof never'

* Update tests

* Defer types like `keyof (T & {})`

* Restore test

* Update test

* Accept new baselines

* Add tests
2022-07-07 11:54:22 -10:00
Anders Hejlsberg
2eaf49f56e Handle pseudo-references in getFlowCacheKey (#49828)
* Handle pseudo-references in getFlowCacheKey

* Add tests

* Accept new baselines
2022-07-07 11:53:30 -10:00
Andrew Branch
9dde56c6fc Add path completions for package.json exports with wildcards (#49644)
* Support path completions for exports wildcards

* Break up results by directory

* Share code between typesVersions and exports processing

* Revert completion kind change

* Add kinds to tests

* Update existing test

* Support nested conditions, improve recursive globbing
2022-07-07 12:26:18 -07:00
Mateusz Burzyński
fefe2208f4 Fixed outdated expectation comments (#49691) 2022-07-07 11:45:52 -07:00
AlCalzone
f6684be95e fix: correct name length criterion for spelling fixes (#49575)
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
2022-07-07 09:08:37 -07:00
Oleksandr T
8ae1e9e7c7 fix(49685): omit incorrect visibility error when setter precedes getter (#49697) 2022-07-06 15:59:05 -07:00
Oleksandr T
7584e6aad6 fix(49642): resolve JsDoc comments/tags if accessors exist in symbol declarations (#49654) 2022-07-06 15:41:50 -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
Oleksandr T
e2e3c1285f fix(49544): allow comma token after accessors (#49545) 2022-07-06 08:54:54 -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
Oleksandr T
cdc1996e87 fix(49426): Object method snippet completions incorrectly add this parameters (#49757)
* fix(49426): omit this parameter

* add OmitThisParameter to TypeFormatFlags

* change flag value
2022-07-05 11:46:19 -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
Wesley Wigham
52f4055174 For missing constraint quickfix insert position, Use node name end rather than related span end (#49673) 2022-06-29 11:46:42 -07:00
Nathan Shively-Sanders
cba184f69b Demote priority of JS completions (#49716)
* Demote priority of JS completions

Fixes #48498

Unchecked JS files gather identifier-based completions. Currently, this search
happens instead of `getCompletionEntriesFromSymbols` for TS/checked JS
files. However, identifier-based completions are much lower quality and
can be ignored by some editors.

Identifier-based completions should be gathered last, after gathering
other completions. That's what this PR does.

* Invert isUncheckedFile to avoid double negative

* dedupe calls to getCompletionEntriesFromSymbols

* Stop re-creating list of entry names

* more deduping + fix lint
2022-06-29 11:05:50 -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
bentongxyz
b24b6a1125 fixes #49491 (#49493) 2022-06-22 13:25:01 -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
Oleksandr T
74d76e93b3 fix(49546): create computed property name for symbol props (#49554) 2022-06-20 13:46:47 -07:00
Oleksandr T
c01afb5ef3 fix(49548): show completions after keywords in block (#49600) 2022-06-20 12:52:28 -07:00
Jake Bailey
d7e58c8ea9 Fix arrow expressions in conditional expressions, take N+1 (#49531) 2022-06-17 16:34:27 -07:00
Andrew Branch
7e7c53961a Add TS Server option to exclude files from auto-imports (#49578)
* Basic functionality

* Add tests

* Add test for ambient modules

* Add to protocol
2022-06-17 14:39:51 -07:00
Andrew Branch
1213c35d57 Add error when importing/exporting types in JS files (#49580)
* Add error when importing/exporting types in JS files

* Ignore type-only imports, update other baselines

* Clean up
2022-06-17 14:39:24 -07:00
Wesley Wigham
5c4caafc2a Allow nongeneric string mapping types to exist (#47050)
* Allow nongeneric string mapping types to exist

* Accept baseline

* Recusive membership testing function

* Fix lint

* Add @DanielRosenwasser's comment
2022-06-16 17:02:31 -07:00
Gabriela Araujo Britto
86d5040031 Fix renaming of node_modules (#49568)
* add bug repro test

* add test and start fix implementation

* adjust for useAlias preference

* fix existing renaming test

* refactor to get rid of options

* fix named bindings & other imports cases

* fix eslint error

* address cr comments

* hopefully actually fix eslint

* clean up stale baseline

* make API change non-breaking

* add/fix comments
2022-06-16 17:01:44 -07:00
Oleksandr T
f83ce9bd9c fix(49566): Implicit this.property completions not returned while writing property (#49574)
* fix(49566): show this.prop completions in class scoped property declaration

* remove duplicate default value
2022-06-16 12:43:50 -07:00
Oleksandr T
180bc4cbea feat(49385): forbid inlay hints for some kind of initialized declarations (#49412)
.
2022-06-15 15:34:57 -07:00
Anders Hejlsberg
18ac37221b Properly re-scan > token in type argument list determination logic (#49560)
* Properly re-scan '>' token in type argument list determination logic

* Add regression test
2022-06-15 12:06:08 -07:00
Wesley Wigham
ccd8b1d27e Allow exports map entries to point at .ts source files (#48563)
* Probably works

* Add tests

* Update baselines for module option rename
2022-06-15 11:23:26 -07:00
Wesley Wigham
ba38fe1df2 Expand constraint suggestion related span and add quick fix (#49481)
* Expand constraint suggestion related span and add quick fix

* Remove circular constraint suggestions

* Add error code

* Style feedback and new error code in quickfix
2022-06-15 10:35:51 -07:00
Wesley Wigham
eb4b8a4d2e Handle this in isEntityNameVisible (#49521) 2022-06-15 10:15:19 -07:00
Oleksandr T
0ada54c006 fix(49483): throw error on await inside non-async function (#49496) 2022-06-14 16:08:25 -07:00