Commit graph

23602 commits

Author SHA1 Message Date
Sheetal Nandi
2ffd35de4d
More updates to program reuse with different option changes (#44276) 2021-05-26 15:57:43 -07:00
Sheetal Nandi
3442d311cf
Fix outFile check (#44277) 2021-05-26 15:57:30 -07:00
Sheetal Nandi
54fbeb511d
Use correct state when getting it from redirected program (#44275)
Eg. program can backup and restore state changing the state object and we want to release program on the correct one
This ensure program is released correctly when there are declaration emit errors during tsc --build
2021-05-26 15:31:26 -07:00
Oliver Joseph Ash
3e29397d74
fix(44249): JSX: "extract to constant" generates invalid code when using fragment syntax (#44252)
Fixes https://github.com/microsoft/TypeScript/issues/44249
2021-05-26 13:24:02 -07:00
Nathan Shively-Sanders
459bd19941
Add unqualified JSDoc member references (#44202)
* Add unqualified JSDoc member references

This allows unqualified references like:

```ts
class Zero {
 /** @param buddy Must be {@link D_HORSE} or {@link D_DOG}. */
 deploy(buddy: number) { }
 static D_HORSE = 1
 static D_DOG = 2
}
```

I surveyed @see and @link again to estimate how common this is. I found
a little over 200 uses, which is around 2%. Sorted by frequency, this
*is* the next feature on the list, along with the `module:` prefix.
So I think this is about the right point to stop adding code.

In this case, however, I liked most of the uses -- there were a lot
of deprecated functions that referenced a function just below, where it
would be wordy to qualify the name, but the reader would benefit from a
link.

Note that unqualified references do *not* work inside type or object
literals. The code I ended up with is quite complicated and I didn't
observe any uses in the wild.

Fixes #43595

* Remove type/object literal container check

Since they don't work anyway
2021-05-26 09:54:05 -07:00
Andrew Casey
3ffa245f07
Cache parsed path mapping patterns (#44078)
* Cache parsed path mapping patterns

If a project has many of them (e.g. 1800), parsing the patterns
repeatedly can take up a lot of time.

* Move cache to ConfigFileSpecs

* Inline constants

* Simplify cache access
2021-05-26 09:40:42 -07:00
Oleksandr T
4559855c64
feat(44190): check misspelled base members in override checks (#44213) 2021-05-25 21:24:28 -07:00
Sheetal Nandi
b7b4856944
Refactor tsbuild watch tests (#44258) 2021-05-25 17:01:06 -07:00
Anders Hejlsberg
3938958d36
Properly remove generic types that are constrained to 'null | undefined' in getNonNullableType (#44219)
* Improve getNonNullableType function

* Add tests

* More closely match previous behavior

* Add non-strict mode test
2021-05-25 11:40:28 -07:00
Jujhar Singh
98f04e224f
IntelliSense doc string.replace typo (#41385)
* Fix IntelliSense doc string.replace typo

* Update IntelliSense doc string.replace

* Update string.replace doc text

* Revert "Fix IntelliSense doc string.replace typo"

This reverts commit 4220ec8a94.

* Reworded string.replace doc text

* Fix doc string.replace text
2021-05-25 08:05:27 -07:00
Zzzen
0e1df66a7c
don't duplicate function properties when emiting definitions of overload signatures (#44235) 2021-05-24 15:52:40 -07:00
Wesley Wigham
fcabb5c0cc
Simplify or optimize regexes with polynomial time worst cases (#44197)
* Simplify or optimize regexes with polynomial time worst cases

* PR feedback & cleanup

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>

* Use builtin scanner function for checking whitespace in fallback method (its faster)

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>
2021-05-24 15:28:52 -07:00
Wesley Wigham
2203228b62
Ensure static index signatures have an errorNode available (#44129)
* Ensure static index signatures have an errorNode available

* Lookup static index signature declarations in the right symbol table, stop checking prototype props
2021-05-24 14:30:59 -07:00
Nathan Shively-Sanders
c4c6a83922
Add @linkcode and @linkplain tags (#44208)
* Add @linkcode and @linkplain tags

They are just like @link tags but request fixed-width and normal
presentation, respectively.

Fixes #43935

* revert JSDocComment -> JSDoc SyntaxKind rename

* update API baselines

* fix lint
2021-05-24 13:01:58 -07:00
Eli Barzilay
fb5f855108 Avoid convertExport when there's a non-identifier or a bogus one
Fixes #44105
2021-05-24 14:24:36 -04:00
Andrew Casey
7954f0c947
Kick out of normalizePath if there's nothing to do (#44173)
* Kick out of normalizePath if there's nothing to do

...using `relativePathSegmentRegExp`.

Bonus: use a regex to handle "/./" to avoid splitting and joining in a
common case.

When building the compiler, for example, it looks like ~95% of arguments
to `normalizePath` do not require any normalization.

* Check normalization before and after . cleanup

* Also cleanup leading ./
2021-05-24 09:38:44 -07:00
ZYSzys
eb7c1ada6f
fix: internal createSignature support undefined declaration (#44109) 2021-05-24 06:50:20 -07:00
Zzzen
756392c1f5
support QualifiedName when narrowing inside loops (#43592)
* support QualifiedName when narrowing inside loops

* add test

* narrow more qualified names

* handle `undefined` of `getFlowCacheKey `

* update comments in test
2021-05-21 10:36:54 -07:00
Andrew Casey
14343bead8
Avoid calling replace in normalizeSlashes when it would do nothing (#44100)
* Make normalizeSlashes a no-op there are no bad slashes

On Windows, there will probably be a negligible slowdown, iterating over
the pre-slash prefix of each unnormalized path (though we might come out
ahead if paths are normalized more than once).

On *nix, this saves work - 1.8s -> 0.4s in the project I'm
investigating.

* Reuse already-computed index
2021-05-21 10:28:22 -07:00
Nathan Shively-Sanders
086423729a
Add jsdoc member names: Class#method (#44150)
* Everything mostly works

A couple of mixed, nested references don't work yet.
The scanner+parser interaction is wrong, the parser consumes one too
many spaces, and the checker+services code needs a little cleanup.

* Cleanup

1. I decided that correctly parsing a#b.c, an entity name containing an
instance reference, is not worth the work.
2. I made the scanner, at least the jsdoc part, emit a # token, and
provided a reScanPrivateIdentifier in order to convert #a to # a.
3. I cleaned up the code in the checker.
2. Unrelated: I added a missing space in linkPart display.

* Cleanup lint + var naming

* investigate+clean up a couple of TODOs

* Fix lint in utilities.ts

* change name to JSDocMemberName

* address PR comments
2021-05-21 07:53:17 -07:00
Nathan Shively-Sanders
71cdf6a920
Private identifiers use standard identifier scanning (#44184)
* Private identifiers use standard identifer scanning

Previously they used an old copy of the identifier scanning code that
didn't handle extended unicode yet.

* gotta fix that const lint
2021-05-20 14:39:31 -07:00
Ron Buckton
4ce12f9f65
Move class name capture for private state until after declaration evaluates (#44186) 2021-05-20 14:35:40 -07:00
Jean Pierre
ab81bf734e
Fix regression no codefix for ts2657 (#43635)
* Fix regression no codefix for ts2657
Fixes #43454

* remove unnecessary check
2021-05-20 12:13:38 -07:00
Andrew Casey
87d0b3e07a
Correct path segment regex (#44149)
The old version incorrectly matched anything with a leading or trailing
slash.  The empty segment should only be detected between two slashes.
2021-05-20 10:54:15 -07:00
Nathan Shively-Sanders
89a737c871
Improve parser recovery for unclosed/mismatched JSX elements (#43780)
* First draft

Everything works, the error messages for unmatched opening elements
could still use improvement, plus there is tonnes of unused and ugly
code.

1. Make sure the parser can recover from all kinds of unclosed tags.
2. Improve the parse tree for unmatched opening tags.
3. Better errors at some point.

* Lots of cleanup

* Improve readability of construction/fix lint

* improve line-length formatting
2021-05-20 07:20:57 -07:00
Mark Fulton
7901f351eb
fix(WeakMapConstructor): readonly iterable items (#43905)
like `MapConstructor`, `WeakMapConstructor` should support receiving `Iterable<readonly [K, V]>` instead of `Iterable<[K, V]>`; otherwise tuples creates with `as const`, etc. cannot be safely passed in without casts, etc.
2021-05-20 07:18:58 -07:00
Nathan Shively-Sanders
4a59b63f35
Error for abstract property with initialiser (#43615)
* Error for abstract property with initialiser

* remove stray LF

* update baselines
2021-05-20 07:18:18 -07:00
Eli Barzilay
5ca7983ebe Fix the code that checks for variadic signatures
This code looks strange, like there's a typo in it (eg, using `lists` in
the `parameterList` loop, etc) -- so I also refactored it a bit to look
more intentional.  The new format makes it clearer that `lists` is
checked once *outside* the loop, as well as the role of
`hasEffectiveRestParameter`.

The actual bug fix is checking `pList.length` in the new `isVariadic()`.

Fixes 41059.
2021-05-20 09:27:57 -04:00
Jesse Trinity
5770434891
Revert #43460 and #40884 (#44175)
* Revert "Only issue matching token errors on non-dupe locations (#43460)"

This reverts commit 76a2ae3d69.

* Revert "Adding Diagnostic message for missing ']' and ')' in Array literal and conditional statements (#40884)"

This reverts commit 555ef73da8.

* re-add clobbered merge lines
2021-05-19 16:54:07 -07:00
Anders Hejlsberg
e67da8a748
Preserve generics in contextual types for rest arguments (#44122)
* Move all getIndexedAccessType flags to AccessFlags enum

* Preserve generics in contextual types for rest arguments

* Add regression test
2021-05-19 13:46:07 -07:00
Anders Hejlsberg
73736d9b84
Fix logic for determining whether to simplify keyof on mapped types (#44042)
* Fix logic for determining whether to simplify keyof on mapped types

* Add regression test

* Improve hasDistributiveNameType check

* Add more tests

* Address code review feedback

* Add more tests
2021-05-19 13:43:22 -07:00
Sang
811b1f696d
improve jsdoc for array fill methods (#43627) 2021-05-18 17:25:38 -07:00
Matas Rastenis
fde2c55652
fix(43799): Support bigint type for Intl.NumberFormat.formatToParts (#44015)
* Add bigint support for formatToParts

* Add tests for Intl.NumberFormat.formatToParts

* Cleanup test

* Fix EOL symbols

* Update baseline test
2021-05-18 17:05:18 -07:00
Oleksandr T
3f9e724c9f
fix(43796): Sort @deprecated completions lower than others (#43880)
* fix(43796): sort deprecated completions lower than others

* Update src/services/completions.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-05-18 13:55:00 -07:00
Oleksandr T
db01e84700
feat(eslint): consistent-type-assertions (#43556) 2021-05-18 06:20:57 -07:00
Eli Barzilay
fc07ee2ad7 skipParenthesesUp() is exactly the same as walkUpParenthesizedExpressions()
Remove the former since the latter is based on the generel `walkUp()`.
2021-05-18 04:40:56 -04:00
David Michon
9136bb13fe
Generate SourceMap mappings string using array of character codes and fewer String.fromCharCode calls (#44031)
* Test normal char code array for source mappings

* Limit buffer size, minor performance tweaks

* Always commit at exactly chunk size

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>
2021-05-17 18:16:32 -07:00
Andrew Branch
271e069af3
Don’t offer import statement completions at from position (#44125)
* Don’t offer import statement completions at `from` position

* Set isGlobalCompletion to false, use indexOf lookup
2021-05-17 17:48:15 -07:00
Wesley Wigham
f414d13679
Dont allow generic narrowing when contextually typed by a binding pattern (#44081) 2021-05-13 16:51:52 -07:00
Ikko Ashimine
493ec4cc26
Fix typo in host.ts (#43930)
encounted -> encountered
2021-05-13 14:00:26 -07:00
Wesley Wigham
f7a97b7759
Cache accessibe symbol chains and serialized type parameter name generation (#43973)
* Cache accessibe symbol chains, type parameter name generation

* Move signature declaration helper length approximation to start of function

* Add node result caching internal to `typeToTypeNodeHelper`

* Suggestion from PR
2021-05-12 12:11:20 -07:00
Eli Barzilay
0454ae4720 Loosen up the first argument type for String.raw
The [String.raw spec](https://tc39.es/ecma262/#sec-string.raw) uses just
the `raw` property of its first argument, which is a useful way of using
it in user-defined tag functions to do the work of interleaving strings
and values as well as converting the values to strings.

Fixes #43609.
2021-05-12 14:13:26 -04:00
Oleksandr T
7aacd6b274
fix(43879): forbid async in the left hand in a for-of statement (#43886) 2021-05-12 06:11:08 -07:00
Oleksandr T
463c79440f
fix(43030): fix instantiated null/undefined type from JS initializer (#43933) 2021-05-11 15:57:16 -07:00
Daniel Rosenwasser
d662d94957
Bump version to 4.4. (#44028)
* Bump version to 4.4.

* Update Baselines and/or Applied Lint Fixes

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-05-10 12:42:48 -07:00
Sheetal Nandi
182b6c90d6
Test for Update the type reference cache with correct project options (#44008)
* Test without change

* Update showing fix in #44004 works
2021-05-10 12:29:36 -07:00
Wenlu Wang
5b1e873b03
Update diagnostic message and quickfix for parameter property (#44010) 2021-05-08 23:22:20 -07:00
Sheetal Nandi
e61d812cbb
Update the type reference cache with correct project options (#44004) 2021-05-07 16:58:41 -07:00
Anders Hejlsberg
42f0cf6ffc
Don't eagerly get apparent type of spread expression contextual type (#44002)
* Don't get apparent type of contextual type for spread expressions

* Add regression test
2021-05-07 15:44:17 -07:00
Ron Buckton
cb9cd898d1
Revert #35877 - fix receiver on calls of imported and exported functions (#43993) 2021-05-07 13:42:12 -07:00
Sheetal Nandi
e5395efe49
Add writeFile and customTransformers to build and buildReferences (#43984) 2021-05-07 12:13:17 -07:00
Orta Therox
6bb481c9d3
Support semantic highlights for JS files (#43992)
* Switches from never allowing semantic highlight on JS to only doing it if we have a valid source file

* Adds a way to test and validate that an arbitrary JS file gets semantic classification results

* Revert to just dropping the if statement
2021-05-07 20:02:26 +01:00
Sheetal Nandi
cfed79b7a2
Correctly use ownMap from module resolution cache (#43986)
* Test showing the moduleResolutionCache reset issue with tsc --b --w

* Fix incorrect usage of ownMap by making it function returning ownMap instead of constant value
2021-05-07 09:56:29 -07:00
Nathan Shively-Sanders
f6303652d2
Improve errors for incorrectly nested export default (#43967)
* Improve errors for incorrectly nested export default

The compiler and services don't handle incorrectly nested
`export default` well right now:

```ts
export = (x,y) => {
  export default { }
}
```

Asking for document highlights, find all references or quick info on
'export' or 'default' cause a crash. After the crash is fixed, the error
message is confusing and wrong: "An export assignment cannot be used outside a module."

This PR:

1. Skips document highlights for incorrectly nested export default.
2. Skips find all refs for incorrectly nested export default.
3. Switches the fallback binding for incorrectly nested export default
from Alias to Property. Neither is correct, but Property doesn't cause a
crash in alias resolution.
4. Improves the error message to reflect a post-ES module world, which
has export default and 'module' means 'ES module', not 'namespace'.

Fixes #40082 and the related bugs mentioned above.

* address PR comments
2021-05-07 08:09:38 -07:00
Andrew Casey
1ce15a4531
Fix perf regression from #42556 (#43949)
PR #42556 was a nice optimization that dramatically sped up comparisons of discriminated unions.  Unfortunately, the cost of determining whether a union is discriminated can be prohibitively high.  In particular, an internal team with a very large repo saw their type count double and their memory usage increase from 6GB to 9GB, breaking their build.  This changes splits the difference by not trying to compute the property types of intersection types - a notoriously slow operation.
2021-05-06 17:06:38 -07:00
Andrew Branch
96c48b746a
Fix package.json auto imports for pnpm without project references (#43892)
* Fix package.json auto imports for pnpm without project references

* Make property optional

* Revert unnecessary unnittest change

* Set symlinked files when setting symlinked directories

* Update `typeDirectiveIsEqualTo`

* Consider symlinks found during type reference directive resolution into `discoverProbableSymlinks`

* Rename `originalFileName` to `originalPath`, make internal
2021-05-06 14:51:30 -07:00
Nathan Shively-Sanders
71f338bad6
Revert "typeRelatedToSomeType passes through intersectionState (#43707)" (#43983)
This reverts commit db09cb5951.
2021-05-06 13:12:36 -07:00
Wesley Wigham
a5607a4eab
Dont allow namespace reexport symbols when looking up valid local names (#43969) 2021-05-06 12:03:48 -07:00
Sheetal Nandi
233f28ca27
When directory watcher is invoked with any file from node_modules package, invalidate for file paths in that package (#43974)
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-05-06 09:48:26 -07:00
Oleksandr T
e0d7703cf3
fix(43939): forbid converting getters to async/await (#43944) 2021-05-06 01:48:54 -07:00
Ikko Ashimine
97f5c62956
Fix typo in system.ts (#43895)
assigment -> assignment
2021-05-06 01:40:00 -07:00
Wesley Wigham
456806b070
Allow filterType to consider union constraints of non-union types when determining never-ness (#43763)
* Allow filterType to consider union constraints of non-union types when determining never-ness

* Move impl to callback

* Baseline change in narrowing behavior into test, fix post-LKG build
2021-05-05 13:35:09 -07:00
Wesley Wigham
b83148fe64
Unwrap substitutions on conditional check types before comparing them (#43888) 2021-05-05 13:33:45 -07:00
Wesley Wigham
84da19efc8
Add single-element fastpath to getSupertypeOrUnion (#43934) 2021-05-05 13:32:23 -07:00
Oleksandr T
6f8c3b0c99
fix(43957): insert Override keyword after static modifier (#43959) 2021-05-05 08:52:50 -07:00
Sheetal Nandi
f7ef1540d3
Use options from referenced project for including resolved imports in the file when using sources of project reference (#43914)
* Test where allowJs present in referenced project affects picking up right set of import files

* use options from referened project for including resolved imports in the file when using sources of project reference
Fixes #43909
2021-05-03 11:35:21 -07:00
Nathan Shively-Sanders
7a8c5a0001
Displayparts resolves non-values in link tags (#43903)
Previously, the name resolution for link tags in displaypart generation
mistakenly required a valueDeclaration. Now it uses the first
declaration if there is no valueDeclaration, so that types and
namespaces will also resolve.

This is another instance of using valueDeclaration as "the default
declaration", which doesn't apply to types.

Fixes #43868
2021-04-30 14:17:54 -07:00
Sheetal Nandi
54096bdb96
Use project relative preference for declaration emit (#42232)
* Test where relative import isnt ideal in the declaration emit

* use project relative preference for declaration emit
Fixes #39117

* Fix incorrect path matching when calculating module specifier

* Use correct baseUrl for the module specifier
2021-04-30 13:22:05 -07:00
Sheetal Nandi
c96b472e0b
Handle localness in special cases by checking exported variable assignment (#43851)
* Handle localness in special cases by checking exported variable assignment
Fixes #42976

* Fix existing tests where arrow now behaves similar to function expression

* Update src/services/goToDefinition.ts
2021-04-30 13:17:59 -07:00
Nathan Shively-Sanders
c9eb62fafb
getExternalModuleMember:always resolve alias of moduleSymbol (#43718)
Previously, getExternalModuleMember passed through its received value of
`dontResolveAlias` to every function that accepted it. That includes (1)
resolution of the module symbol and (2) resolution of the module
specifier. However, in TS, the module symbol is never an alias anyway, so
dontResolveAlias doesn't make a difference. In JS, the module symbol
*can* be an alias, and it should always be resolved. That's what this PR
does.

Fixes #43713
2021-04-30 10:47:45 -07:00
Nathan Shively-Sanders
004b3ae018
Simplify arity errors, rewording spread errors (#43855)
* Scribbles + tests

The second test actually requires node types

* Basically working

The two simple fixes, in arity error reporting, are in, and the
simplification of arity error reporting is half-done. I haven't started
on any improvements to call assignability.

* trim out too-real test case

* Finish cleanup

And reword error a little.

* Simplify and reword spread errors

* handle spreads first

* update baselines

* Address PR comments
2021-04-29 14:38:50 -07:00
Xu Zhuo
4ecb563aa4
Complete constructor keyword after property declaration (#43654)
* Complete `constructor` keyword after property declaration.

* Fix logical errors.

* Fix for more universal situations.

* Only provide completions if property declaration is terminated.

* Simplify many logical conditions.

* Make the fix more reliable.

* Narrowing the fix.
2021-04-29 11:16:51 -07:00
Oleksandr T
3e25424652
fix(43408): emit nullable/optional types on getters (#43476) 2021-04-29 09:20:40 -07:00
Acy Watson
b31b0eb05c
Use single quotes consistently in diagnostic messages. (#43634) 2021-04-29 07:15:31 -07:00
Andrew Branch
a14b22718a
Enforce keyword order of abstract and override (#43829)
* Enforce keyword order of abstract and override

* Update baselines

* Update existing test
2021-04-28 16:41:28 -07:00
Andrew Branch
791c747e06
Allow override as parameter property (#43831)
* Allow `override` as parameter property

* Update other baseline

* Add test for override on normal parameter

* Copy typo fix

* Update baselines

* Update API baseline
2021-04-28 16:41:09 -07:00
Nathan Shively-Sanders
db09cb5951
typeRelatedToSomeType passes through intersectionState (#43707)
* typeRelatedToSomeType passes through intersectionState

Previously it didn't, even though it should have.

* fix parameter name lint
2021-04-28 16:12:20 -07:00
Andrew Branch
58c54127a9
Fix node.getStart() for nodes spanning multiline JSDoc comments (#43854) 2021-04-28 11:37:27 -07:00
Wesley Wigham
7748694d60
Relate non-augmenting subtypes without resorting to structural comparison (#43624)
* Relate non-augmenting array subtypes without resorting to structural comparison

* Fix lint

* Generalize performance enhancement

* Cache results, feed through via getNormalizedType to remove error intermediates

* Use newly freed up object flags to limit member setting, fix crash with those object flags

* Move flags because there is no TypeFlags.Reference 🤦
2021-04-27 22:52:12 -07:00
Wesley Wigham
5e4fcfbfb6
Add instantiation rules for reverse mapped types (#42449)
* Add instantiation rules for reverse mapped types

* Add smaller example of same issue
2021-04-27 15:01:46 -07:00
Wesley Wigham
bbad560912
Refrain from attempting to perform parameter fixing on a generic signature multiple times (#43835)
* Refrain from attempting to perform parameter fixing on a generic signature multiple times

* Remove assertion
2021-04-27 10:49:27 -07:00
Andrew Branch
3de706a852
Don’t create invalid type-only imports during add missing import (#43828) 2021-04-26 11:52:34 -07:00
Nathan Shively-Sanders
d5af89c552
Contextual typing checks property assignments for type annotation (#43598)
Property assignments can have a type annotation in JS. This PR adds a
check for it in contextual typing.

Fixes #43379
2021-04-26 09:19:24 -07:00
Andrew Branch
b9c1e98544
Fix completions of exports elsewhere in same file (#43755)
* Fix completions of exports elsewhere in same file

* Undo messing up JSDoc-annotated module.exports assignments

* Add other failing contextual type test

* Rearrange contextual type logic for special assignments

* Rename helper function
2021-04-26 09:13:09 -07:00
Erik Brinkman
4d4ea66a9c
update contextual discrimination to include omitted members (#43633)
This diff extends the types checked by
discriminateContextualTypeByObjectMembers and
discriminateContextualTypeByJSXAttributes to also include any optional
components in the type union.

fixes #41759 although it doesn't address the better error reporting for
their last repro, which I'm not sure how to address.
2021-04-24 14:26:29 -07:00
Oleksandr T
482f781386
fix(43559): allow renaming in files with no-default-lib enabled (#43579) 2021-04-23 16:56:33 -07:00
Nathan Shively-Sanders
d171eee044
Omit spaces after https in jsdoc comments (#43800)
* Omit spaces after https in jsdoc comments

for tags with names.

Fxes #42581

* fix semicolon lint
2021-04-23 16:23:34 -07:00
Wesley Wigham
dee4903f45
Compute dervied generic-ness for substitutions and create lower priority inferences for substitutes (#43765) 2021-04-23 15:51:05 -07:00
Andrew Branch
bd7d0f26b2
Don’t allow an object literal with a spread as a fallback for destructuring a property not present in all constituents (#43783)
* Add test

* Don’t allow an object literal with a spread as a fallback for destructuring a property not present in all constituents
2021-04-23 14:44:57 -07:00
Zak Miller
c552a4bf82
fix(42829) ignore preceeding jsx whitespace (#43452) 2021-04-22 15:12:05 -07:00
Sheetal Nandi
f6d425e1e3
Module Resolution and Type Reference directive cache updates and its API changes (#43700)
* Make the module resolution cache apis for updating compiler options or clearing it

* Cache package.json lookup results from module resolution

* Use per directory cache for type reference directive resolution as well

* Update Baselines and/or Applied Lint Fixes

* Change trace according to feedback

* Update Baselines and/or Applied Lint Fixes

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-04-21 21:30:18 -07:00
Sheetal Nandi
fb0b1d7295
Handle getter setter quickInfo (#43769)
Fixes #43413
2021-04-21 17:47:11 -07:00
Wesley Wigham
f4b8adca6a
Comment copy edit 2021-04-21 12:51:36 -07:00
Wesley Wigham
8ea4ec9496
Add infer T constraint inference rule matching up mapped type templates across check/extends types (#43649) 2021-04-21 12:49:02 -07:00
Tiago Tristao
3d24b85f9e
Completion list for type literals in type arguments (#43526)
* Completion list for type literals in type arguments

* Add tests

* Refactor for better readability

* - Support non-identifier keys
- Move main logic onto tryGetGlobalSymbols function
2021-04-20 10:24:17 -07:00
Sang
f2705294ac
Fix object literals lack of this references (#43572)
* fix: object literals lack of this references

* test: improve cases
2021-04-20 10:06:08 -07:00
Jean Pierre
8513f78058
Fix getCodeFixesAtPosition for ts(2339) thows error False expression: Token end is child end (#43645)
* Fix getCodeFixesAtPosition for ts(2339) thows error False expression: Token end is child end
Fixes #43191

* Add test
2021-04-20 10:00:34 -07:00
Josh Goldberg
a910c8df13
Added skipDestructiveCodeActions argument to organize imports server command (#43184)
* Stopped removing unused imports in files with syntactic errors

* Added allowDestructiveCodeActions arg

* Updated .d.ts baselines

* Stop factoring syntax errors. Weird that no tests break...

* Have args extend scope so it is not a breaking change

* Update src/harness/harnessLanguageService.ts

Co-authored-by: Jesse Trinity <jetrinit@microsoft.com>

* Fixed API breaking change, and renamed to skip

* Always with the baselines

* One more .d.ts baseline to fix

* Remove blank line in src/harness/harnessLanguageService.ts

Co-authored-by: Jesse Trinity <jetrinit@microsoft.com>
2021-04-20 09:04:17 -07:00
Armando Aguirre
f67ee44379
Instantiate getter when infering setter parameter value (#43564)
* Instantiate getter when infering setter parameter value

* Use esnext on tests

* Instantiate for JsDoc and getter from body

* PR comments

* Updated baseline
2021-04-19 23:23:40 -07:00
Wesley Wigham
167ebcd93b
Check type flags before checking multiple-meaning object flags (#43745) 2021-04-19 22:35:11 -07:00