Commit graph

32040 commits

Author SHA1 Message Date
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
Wesley Wigham 3ab6809e38
Consider identical instances of the same symbol equivalent when creating union and intersection properties (#43560)
* Consider identical instances of the same symbol equivalent when creating union and intersection properties

* Also copy over mapper and type (if available) on cloned symbols

* Editorial feedback
2021-04-14 16:55:45 -07:00
Wesley Wigham 6c7c5e9ec2
Expand exception to contravariant constraint elision to all type variables (#43599)
* Expand exception to contravariant constraint elision to all type variables

* Comment update
2021-04-14 13:13:02 -07:00
Andrew Branch f74f9cac13
Add telemetry properties for import statement completions (#43664) 2021-04-13 16:17:52 -07:00
Oleksandr T e87a0be959
fix(43444): add support JSDoc function signatures on returned function expressions (#43607)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-04-13 16:11:58 -07:00
Nathan Shively-Sanders 6a3d68905c
Add jsdoc to all js statements (#43659)
* Add jsdoc to if statements

This should only happen in JS files, however, and there needs to be some
conditional handling of jsdoc on statements that can't have jsdoc in TS
files.

* Finish change

* Add test
2021-04-13 15:30:22 -07:00
Anders Hejlsberg 5977233fd1
Reinstate constraint check for template literal types (#43661)
* Add missing constraint check for template literal types

* Add regression test
2021-04-13 12:17:55 -10:00
Armando Aguirre 5a6a499d0e
Fix sending correct symbol when using commonjs require and destructuring (#43511)
* Fix sending correct symbol when using commonjs require and destructuring

* Check BindingElement
2021-04-13 15:06:34 -07:00
Wesley Wigham 6002cff776
Trim indexed access and type variable constraint error output (#43540) 2021-04-13 13:13:32 -07:00
Andrew Branch 06a73655d0
Don’t error for missing await when promise is referenced in condition body (#43593) 2021-04-13 12:15:48 -07:00
Nathan Shively-Sanders d6012219e0
@link and @see resolve C.m as a class property reference (#43625)
* Test + Initial scribbles

The test is pretty good, the scribbles are actually cleanup from last
PR, although they break some tests.

* undo scribbles, add nonworking class-hack

* Ad-hoc name resolution for @link and @see

Turns out that you can't reuse check* functions if you want to retrieve
all meanings of a reference.

* fix failing test

* inline hapax function

* Fix find-all-refs baseline print

* Try to resolve C.m as static first

* Add interface tests

Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-04-13 08:13:18 -07:00
Nathan Shively-Sanders 7c10135d9d
Don't start jsdoc tag before whitespace (#43602)
Fixes #43580
2021-04-12 10:20:44 -07:00
Kunal Desai 0487b38d06
Catch hover on as const (#43588)
* Catch hover on as const

* Update test based on feedback
2021-04-12 11:43:47 +01:00
TypeScript Bot 5d8a4a1753 Update package-lock.json 2021-04-12 06:08:08 +00:00
TypeScript Bot 131875bb84 Update package-lock.json 2021-04-10 06:07:35 +00:00
Eli Barzilay 716441d343 Process only existing files and directories in the test harness
`fs.statSync` throws `ENOENT` if there is a symlink to a nonexistent
target.  This can be avoided by checking that the entry exists before
using it.

(This is annoying when editing tests in Emacs, since it keeps lock files
for modified-but-unsaved files, which are `.#foo` symlinks to a
nonexistent target.)
2021-04-09 17:53:23 -04:00
Wenlu Wang b0c2860a68
ignore static and declared member if checking override (#43569)
* ignore static member if checking override

* Ignore declared member when check override

* Check static override too

* Add more tests
2021-04-09 10:43:33 -07:00
Sang a354a77030
Improve rendering of JSDoc comment text with displayparts (#43390)
* feat(services): jsdoc use custom name for display parts

* fix(services): jsdoc typo

* feat(services): revert jsDoc changes

* feat(services): jsdoc improve displayparts with more comment kinds

Improve rendering of JSDoc comment text with displayparts for:

- `@typedef`
- `@callback`
- `@param`
- `@property`

* feat(services): jsdoc improve displayparts for template

* test: accept baseline

* test: update jsdoc parameterName

* feat: resolve pr comments

* test: add fourslash tests for jsdoc callback, typedef

* test: accept baselines

* test: revert changes for api baselines

* refactor: naming

* refactor: code quality

* refactor: clean up code as to pr comments
2021-04-09 09:44:44 -07:00
Sheetal Nandi 75e9c94e50
While writing tsbuildinfo sort the properties of compiler options to make sure they stay same if nothing changes. (#43601)
Fixes #43571
2021-04-08 16:32:09 -07:00
TypeScript Bot 970554733a Update package-lock.json 2021-04-08 08:47:47 +00:00
Josh Goldberg fe4a6709da
Specified diagnostic for CLI flags mismatched with/out --build (#43199)
* Specified diagnostic for CLI flags missing a required --build

* Switched to an alternateMode member

* Added --build-incompatible flags too

* Small fixups to remove a hardcoding

* Switched to ||= factories

* Not a function

* I think I get it now
2021-04-07 16:03:17 -07:00
Armando Aguirre 2f82d02361
Fix Add all missing imports when ordered alphabetically (#43453)
* Refactored insertNodeInlistAfter to use next elements position

* Consider trivia on insertNodeInListAfter
2021-04-07 16:02:26 -07:00
Anders Hejlsberg d41943eb4e
Properly handle tagged primitives in control flow analysis (#43538)
* Ignore object types in intersections with primitive types

* Add regression test

* Also handle instantiable types constrained to object types

* Add another test

* Add ignoreObjects optional parameter to getTypeFacts
2021-04-07 11:29:46 -10:00
Josh Goldberg a4c683be12
Again: Improve error messages for empty DOM interface property access (#43007)
* Again: Improve error messages for empty DOM interface property access

* containerSeemsToBeEmptyDomElement

Co-authored-by: Daniel Rosenwasser <drosenwasser@microsoft.com>

* isEmptyObjectType; unescapeLeadingUnderscores

* Single tick quotes for now

* Undo accidental diagnostic change

* Correct new baseline

Co-authored-by: Daniel Rosenwasser <drosenwasser@microsoft.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-04-07 12:54:27 -07:00
Josh Goldberg 905a1fea39
Corrected parsing for decorators on 'this' parameters (#43175)
* Corrected parsing for decorators on 'this' parameters

* Moved checking to parser and added a specific test

* Remove unrelated checker.ts blank line

* Missed some baseeline updates...
2021-04-07 11:21:28 -07:00
Titian Cernicova-Dragomir 2484210a00
Gh 41788 incorrect output for esprivate with nested class in esnext (#42663)
* If target:esnext,then useDefineForClassFields: true will now be the default.

* Added error if a private identifier is used in a static a initializer if target:ESNext and useDefineForClassFields:false.

* Added test for new useDefineForClassFields default and error message.

* Fixed tests after changing the default of useDefineForClassFields to true for target esnext

* Fixed code review suggestions.

* Updated error message.

* Added missing static check for the containing property. Fixed other code review issues.
2021-04-07 08:23:16 -07:00
Nathan Shively-Sanders 2bb54dc11a
Fix getTypeFromJSDocVariadicType in callback tag (#43562)
* Fix getTypeFromJSDocVariadicType in @callback

Variadics have never worked there, I think.

* add test + fix lint

* remove outdated comment
2021-04-07 08:12:05 -07:00
TypeScript Bot c1923e9cd1 Update package-lock.json 2021-04-07 06:08:06 +00:00
Nathan Shively-Sanders dd1ef88d01
Use control flow to type CommonJS exports (#42751)
* Allow redeclaring CommonJS alias with initial undefined

This allows us to read our own output, plus the times when people
manually write exactly the same pattern.

Fixes #40555

* Use control flow to type commonjs exports

1. Could probably use a *lot* more tests.
2. getTypeOfAlias redoes some work from resolveAlias because it needs to
not resolve the alias completely, just to its export.

* fix lint, improve jsdoc

* Add tests, improve+fix control flow

1. Update the module.exports test to match the exports ones.
2. Add a test of evolving commonjs type.
3. Add a test of assignment as last statement.

(1) exposed a bug that required a better synthetic reference. (3)
exposed a bug that was most easily fixed by giving source files a
`endFlowNode` like functions and setting it in the binder.

* fix lint
2021-04-06 17:07:35 -07:00
Oleksandr T eebb89533b
fix(43495): insert Override keyword after accessibility modifier (#43504) 2021-04-06 12:03:41 -07:00
Oleksandr T 3a22b3e701
fix(43535): preserves 'override' modifier in JavaScript output (#43536) 2021-04-06 11:31:54 -07:00
TypeScript Bot a56baa7394
Update user baselines +cc @sandersn (#42842)
Co-authored-by: typescript-bot <typescript@microsoft.com>
2021-04-06 08:58:43 -07:00
Pig Fang fb87079994
Enforce override precedes readonly (#43545) 2021-04-06 08:48:44 -07:00
Oleksandr T 8581a592bb
fix(43347): fix crash occurred when export type to existing commonJs imported name (#43369) 2021-04-06 08:46:22 -07:00
Wenlu Wang f526a38856
Always grammar checker for override (#43544) 2021-04-06 07:29:57 -07:00
Zen 3cf26e44ee
fix(43160): improve error location for functions without explicit return (#43367)
* fix(43160): improve error location for functions without explicit return

* handle functions returning never
2021-04-06 07:21:02 -07:00
Michael サイトー 中村 Bashurov 3b06ef1a73
Add asserts to type only symbols meaning exclusion (#43382)
Fixes #42180
2021-04-05 15:29:51 -07:00
Andrew Branch ffe925ddd5
Go to definition: pass unverified through server (#43483)
* Pass `unverified` through server

* Update protocol baseline

* Fix unit tests

* Fix other tests
2021-04-05 13:42:25 -07:00
Sheetal Nandi 4b556e37db
Handle document Registry to distinguish between files with same name and document registry key(compiler options affecting source file) but different ScriptKind (#43474)
* Test that fails because of change in scriptKind of untitled file

* buckets are keyed with DocumentRegistryBucketKey

* Use scriptKind in document Registry to distinguish between files
Fixes #42613
2021-04-05 13:27:34 -07:00
Song Gao 2d66517312
fix quickinfo of narrowed private filed (#43356)
* fix quickinfo of narrowed private filed

* add test case.

* adapt review.
2021-04-05 13:24:19 -07:00
Anders Hejlsberg a7a010a994
Fix getRecursionIdentity function to always return some identity (#43527)
* Fix getRecursionIdentity, undo changes from #43435 (but keep tests)

* Remove test that takes excessively long to run

* Accept new baselines

* Fix formatting

* Add regression tests

* Reinstate test
2021-04-05 09:53:38 -10:00
Zuckjet f621d67467
fix(42605): support refactoring for export default assignment without equal (#42936) 2021-04-05 11:59:45 -07:00
Wesley Wigham cf8798d977
Make origin union cache key unique for key lists still under construction (#43339) 2021-04-05 11:47:49 -07:00
Wesley Wigham d1b43429c2
Allow nested reverse mapped type printback (#42485)
* Optimize interning of reverse mapped types

* Style feedback

* Whitespace

* Update baseline
2021-04-05 11:37:51 -07:00
Wesley Wigham 1f1dcd60b5
When reusing input type nodes, only instantiate the type for comparison if it is a this type (#42584) 2021-04-05 11:10:47 -07:00