Commit graph

32034 commits

Author SHA1 Message Date
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
TypeScript Bot 046c65af0c Update package-lock.json 2021-04-28 06:08:16 +00: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
athongsavath cfb9a25cc5
Update handbook link in readme (#43813)
Co-authored-by: Andrew Thongsavath <andrew@athongsavath.com>
2021-04-27 19:17:29 +01: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
TypeScript Bot 353dc1814f Update package-lock.json 2021-04-27 06:08:01 +00: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
TypeScript Bot 514d8d8841 Update package-lock.json 2021-04-25 06:07:54 +00: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
TypeScript Bot 0ad158e164 Update package-lock.json 2021-04-24 06:07:33 +00: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
TypeScript Bot 1a41e19957 Update package-lock.json 2021-04-22 06:08:15 +00: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
Andrew Branch ba68dc89b2
Remove pin, it’s fixed (#43766) 2021-04-21 14:18:04 -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
Andrew Branch a433c3c0ce
Pin octokit types (#43762)
* Pin @octokit/types to fix build error

* Allow update package lock to be run on a workflow dispatch
2021-04-21 11:50:29 -07:00
TypeScript Bot 45514d6509 Update package-lock.json 2021-04-21 06:08:19 +00: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
Wesley Wigham 7e4400b9c3
Stop checking getter/setter compatability twice (#43741)
* Stop checking getter/setter compatability twice

* Ensure modifier errors are still emitted on both accessors, accept modified baselines
2021-04-19 15:53:48 -07:00
Anders Hejlsberg 52ec8ce740
Clean up ObjectFlags enum (#43732)
* Clean up ObjectFlags enum

* Accept new baselines
2021-04-19 15:33:36 -07:00
Wesley Wigham 85c9d2cc89
Use faster, stricter prop type comparison when merging props in union prop creation (#43696)
* Use faster, stricter prop type comparison when merging props in union prop creation

* Be better at determining this usage in methods, accept baselines

* Small style change
2021-04-19 15:25:12 -07:00
Armando Aguirre 1a04b17adc
Fix organize imports overlap (#43228)
* Fix organize imports overlap

* Refactored multiline end position

* Added tests for single line trailing trivia

* Fix rearranging imports

* Fix lint error

* PR coments
2021-04-19 15:10:57 -07:00
Andrew Casey c671fe1bc2
Skip up-to-date checks during force build (#43666)
* Skip up-to-date checks during force build

Save work by not checking timestamps or parsing the buildinfo file.
Retain correctness checks (like input file existence).

Suppress project status, which was confusing anyway.

* Print a message to indicate that --force is causing the rebuild

* Don't bother updating buildInfoChecked

* Add missing force check
2021-04-19 13:06:00 -07:00
Ron Buckton e0d551606f
Remove preprinter, add parenthesizer callback to emit (#43652) 2021-04-19 09:34:46 -07:00
Ryan Cavanaugh b1ab2b98be
Wire up 'writing' parameter through protected derived class detection (#43455)
Fixes #43443
2021-04-19 09:20:21 -07:00
TypeScript Bot e4e96c3399 Update package-lock.json 2021-04-18 06:07:36 +00:00
Anders Hejlsberg 0f2dabcd4b
Don't re-alias top-level type aliases with local type aliases (#43701)
* No re-aliasing of top-level type aliases with local type aliases

* Accept new baselines
2021-04-17 07:07:46 -07:00
Sheetal Nandi 01264ac414
Reducing tsbuildinfo size further (#43695)
* Serialize compiler options that are needed from old state when creating new state

* Dont write affectsGlobalScope if not true

* Encode FileInfo for better serialization size

* Update src/compiler/builder.ts

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-04-16 23:22:14 -07:00
TypeScript Bot 9af763d888 Update package-lock.json 2021-04-16 06:08:00 +00:00
Wesley Wigham 0eee64f0eb
Node factory should insert override modifier between static and astnc (#43699) 2021-04-15 17:16:19 -07:00
Andrew Branch 06f25c0390
Enforce keyword order between override and static/async (#43660)
* Enforce keyword order between override and static/async

* Update old tests for new keyword order
2021-04-15 14:03:53 -07:00
Nathan Shively-Sanders 0987ee9e0e
Do not erase signatures in getSignatureOfTypeTag (#43688)
I don't see a reason for it, and it doesn't cause any tests to fail.
2021-04-15 10:53:23 -07:00
TypeScript Bot 931b20af6c Update package-lock.json 2021-04-15 06:07:53 +00:00
Nathan Shively-Sanders 3f93d420bf
Fix @typedef/@callback scope (#43682)
JSDoc typedefs don't actually have hosts, because they're not
semantically attached to a declaration. However, the parser still
attaches them to some declaration (or statement), but that declaration
is not related to the typedef.

Previously, delayedBindJSDocTypedefTag used getJSDocHost to walk past
the unrelated declaration, but #41858 correctly started categorising
typedefs as unattached, with no host, so the binder began falling
back to file scope.

The path to skip the unrelated declaration is always the same, though, so this
PR uses `typeAlias.parent.parent` instead of `getJSDocHost(typeAlias)`.
2021-04-14 16:56:37 -07:00