Nathan Shively-Sanders
03b658035d
Make @enum,@this tag construction stricter ( #39791 )
...
The type expression is required, so the type should reflect that.
2020-07-28 13:49:42 -07:00
Andrew Branch
8f04f91ef5
Add diagnostic info to getNameForExportedSymbol crash ( #39790 )
...
* Add diagnostic info to getNameForExportedSymbol crash
* Add JS indicator
2020-07-28 12:53:56 -07:00
Andrew Casey
79e2ed2e77
Merge pull request #39776 from amcasey/OverloadErrors
...
Reduce unnecessary error computation
2020-07-28 10:35:22 -07:00
Andrew Branch
1f1521c2f1
Undo accidental change from #39772 ( #39779 )
...
* Undo accidental change
* Delete test
2020-07-27 16:55:59 -07:00
Andrew Branch
68ba670467
Add contextual type for generator return type ( #39772 )
...
* WIP
* Add contextual type for generator return type
2020-07-27 15:14:47 -07:00
Andrew Casey
195fad23a5
Reduce unnecessary error computation
...
...during overload resolution. Based on a trace that was spending 30%
of a (very slow) overload resolution elaborating errors that were then
dropped.
2020-07-27 14:11:24 -07:00
Sheetal Nandi
48e58f44db
Handle unresolved baseType when trying to get completions for static member ( #39731 )
...
* Handle unresolved baseType when trying to get completions for static member
Fixes #38067
* Update src/services/completions.ts
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* correct the condition
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-07-24 16:37:28 -07:00
Anders Hejlsberg
c5d21e7987
Lower priority for speculative variadic tuple inferences ( #39723 )
...
* Inference to [...T, X?] has lower priority than inference to [...T, X]
* Update tests
* Accept new API baselines
2020-07-24 15:00:53 -07:00
Sheetal Nandi
823b69acb3
Fixes slow nav to issue by keeping project with result. ( #39721 )
...
Also cache the result of config file name for open files
Fixes #38491
2020-07-24 13:33:25 -07:00
csigs
7c5ed71ef8
LEGO: check in for master to temporary branch.
2020-07-22 22:10:54 +00:00
Andrew Branch
ec33814616
Make AutoImportProviderProject work with symlinked monorepos ( #39679 )
...
* Hack everything together
* Add test
* Remove realpath from program
* Ensure symlinked directories are directories
* Revert unnecessary change
* Update baselines
* Use host program realpath on AutoImportProviderProject files before program creation
* Which fixes hasRoots() too
* Apply suggestions from code review
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
* Lint
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2020-07-22 13:53:30 -07:00
Wesley Wigham
312a6f0efb
Add a fastpath for comparing common mapped types like Pick which avoids manufacturing intermediate type identities ( #39696 )
2020-07-22 11:59:16 -07:00
Andrew Branch
b834096998
Fix emit/formatting issues in refactors ( #39506 )
...
* Fix #37948
* Fix formatter skipping tab/space fixup on comments, handle trailing commas in list closing line count.
Fixes #37944
* Add newline between imports and main body of new file in moveToNewFile
Fixes #37941
* Update baseline (probably broken before?)
2020-07-22 10:31:42 -07:00
Song
e76d17257a
Fix 38219: signature helper works for optional function condition. ( #39672 )
...
* fix optional fuction condition.
* Adds a test
Co-authored-by: Orta <git@orta.io>
2020-07-22 12:30:21 -04:00
Song
8a05707559
Fix 31995: make cached key more precise to avoid returning wrong cached value. ( #39670 )
...
* fix 31995
* revert useless change only for debug.
* add test
2020-07-22 12:26:17 -04:00
Song
294a0406e3
not escape unicode char for import path string. ( #39463 )
...
* not escape unicode char for import path string.
* fix test.
2020-07-22 11:28:29 -04:00
Sheetal Nandi
34adaaf6aa
Support loading of child project if found project is not pure solution has some of its own files and project references ( #39613 )
...
* Use disableReferencedProjectLoad to stop loading child projects to allow users to disable loading large solutions
Fixes #39144
* Handle indirect references
* Support loading of child project if found project is not pure solution has some of its own files and project references
Fixes #38605
* Fix grammar
2020-07-21 15:02:10 -07:00
Sheetal Nandi
e92afacc44
Add disableReferencedProjectLoad to stop loading child projects to allow users to disable loading large solutions ( #39593 )
...
* Use disableReferencedProjectLoad to stop loading child projects to allow users to disable loading large solutions
Fixes #39144
* Handle indirect references
* PR feedback
2020-07-21 14:24:15 -07:00
Song
5484687384
switch typeof any could be checked for unreachable ( #39389 )
...
* switch typeof any could be checked for unreachable
* fix stupid error
* support unknown
* remvoe use less code.
* fix spelling.
2020-07-21 13:51:27 -04:00
Song
d897646a4a
fix 39453 ( #39579 )
...
* fix 39453
* add restriction.
* add tests
* comment.
* fix as suggestion.
2020-07-21 09:40:25 -07:00
csigs
ea75b00c46
LEGO: check in for master to temporary branch.
2020-07-21 04:10:47 +00:00
Anders Hejlsberg
94d6b4507e
Consistent errors on circular base types ( #39675 )
...
* Properly track and report errors on circular base types
* Accept new baselines
* Add regression test
2020-07-20 20:35:47 -07:00
Anders Hejlsberg
5ae4b5d715
Properly preserve numeric string named properties in declaration files ( #39658 )
...
* Properly preserve names of properties with numeric literal strings
* Accept new baselines
2020-07-20 10:36:46 -07:00
Sheetal Nandi
3b22339df8
Triple slash references must resolve against the resolved file name (.d.ts and not original source file) since they are rewritten in the .d.ts emit ( #39645 )
...
* Add tests corresponding to repro from #37928
* Triple slash references must resolve against the resolved file name (.d.ts and not original source file) since they are rewritten in the .d.ts emit
* Remove the scenario not fixed in this PR
2020-07-17 16:25:32 -07:00
Wesley Wigham
191f4f63ab
Explicitly add dependency on node to compiler tsconfig, remove es6+ string method usage ( #39636 )
2020-07-17 07:02:05 -07:00
Alexander T
4e24b1b00d
fix(39373): add diagnostic message about using a private name for class declarations without name ( #39567 )
2020-07-16 17:05:33 -07:00
Sheetal Nandi
667ba74c93
Resolve only relative references in open files on syntax server ( #39476 )
...
* Resolve only relative references in open files on syntax server
* Support resolving tripleslash references only in the open file
* Apply suggestions from code review
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-07-16 14:31:24 -07:00
Alexander T
c07c885151
fix(39515): fix getting a position for an element before the line break CRLF/LF on the line that contains 'after' element ( #39554 )
2020-07-16 13:56:30 -07:00
Alexander T
6430211f8f
fix(38868): add separator for type parameters ( #39621 )
2020-07-16 10:58:16 -07:00
Anders Hejlsberg
db79030410
Support variadic tuple inference from trailing optional to non-optional ( #39614 )
...
* Permit variadic tuple inference from trailing optional to non-optional
* Add tests
2020-07-15 17:46:48 -07:00
uhyo
b6f09ccf06
Better error message for unparenthesized function/constructor type notation in union/intersection types ( #39570 )
...
* add graceful error message for unparenthesized function types in union and intersection
* add unparenthesizedFunctionTypeInUnionOrIntersection test
* add unparenthesizedConstructorTypeInUnionOrIntersection test
* Update src/compiler/parser.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* pass isInUnionType to parseFunctionOrConstructorTypeToError
* Apply suggestions from code review
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* syntax fix
* refactor isStartOfFunctionType into isStartOfFunctionTypeOrConstructorType
* Update src/compiler/parser.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* hoist isUnionType
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-07-15 14:43:56 -07:00
Sheetal Nandi
37e6e2761c
Do not resolve require calls in typescript files even if it contains dynamic import ( #39617 )
...
* Existing tests showing require in ts file is not used for module resolution
* Do not resolve require calls in typescript files even if it contains dynamic import
Fixes #38611
2020-07-15 14:31:55 -07:00
Wesley Wigham
f2c5643056
Flag mapped types with circular property types and do not attempt to print them structurally ( #39552 )
2020-07-15 11:19:43 -07:00
Wenlu Wang
fcd4fcb3d7
Use combined node flags ( #39403 )
2020-07-15 09:22:12 -07:00
Wenlu Wang
7b728754c0
Fix incorrect deprecated mark ( #39611 )
...
* Fix incorrect deprecated mark
* improve test
2020-07-15 08:47:25 -07:00
Andrew Branch
dd2fc86f2b
Don’t give all instantiated signatures in JS strict arity ( #39606 )
2020-07-14 18:56:50 -07:00
Wesley Wigham
ef9affe2f6
Use jsxFragmentFactory entity name for factory name lookup from checking fragments ( #39475 )
2020-07-14 17:25:45 -07:00
Alexander T
ececf3b0a7
fix(33511): show jsx namespace default import quick fix if it does not exists in the current scope ( #38419 )
2020-07-14 15:43:18 -07:00
Andrew Branch
98ab3a788f
Fix tsc --watch crash on module augmentations when module resolution changes ( #39604 )
...
* Add failing test
* Ensure source files are bound before analyzing them
2020-07-14 15:05:10 -07:00
Michael Crane
f68a8393ef
Load ETW module from a specified path ( #39599 )
2020-07-14 11:52:55 -07:00
Jesse Trinity
17022388bd
Add refactor convertToOptionalChainExpression ( #39135 )
...
* add convertOptionalChain
* cover more cases
* expose containsMatchingReference
* clean up performing edits
* bound start position
* add tests
* refactor and handle edge cases
* update tests
* consider explicit requests for empty spans
* update fourslash to use trigger reason
* add tests cases for trigger reason
* fix errors
* remove type assertion
* fix non ampersand chains
* clean up some logic
* add ternary case
* add diagnostic message
* add nullish check for ternary expressions
* Update src/services/refactors/convertToOptionalChainExpression.ts
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Update src/services/refactors/convertToOptionalChainExpression.ts
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Update tests/cases/fourslash/refactorConvertToOptionalChainExpressionForTriggerReason3.ts
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Update tests/cases/fourslash/refactorConvertToOptionalChainExpressionForTriggerReason1.ts
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* reformat and remove unused checks
* allow any for ternary refactor
* add tests
* add tests
* check return and variable statements
* use isMatchingReference instead of containsMatchingReference
* allow partial selections
* fine tune selection ranges
* recurse for call expressions
* fix spellings
* add recursive cases
* remove isOrContainsMatchingReference
* cleanup
* more refactoring
* cleanup
* rename tests
* address PR comments
* check match syntactically
* handle another call expression case
* some renames
* inline some checks
* add test
* address comments
* add refactorNotAvailableReason
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-07-13 19:33:33 -07:00
Armando Aguirre
6279f981b3
Merge pull request #37029 from armanio123/AddToggleCommentFeature
...
Add ToggleLineComment and ToggleMultilineComment service
2020-07-13 17:48:50 -07:00
Andrew Branch
3c91133f97
Fix find-all-references on undefined ( #39591 )
...
* Fix find-all-references on `undefined`
* Show references in input files in baseline
* Inline commentEachLine
* firstOrUndefined doesn’t take undefined
2020-07-13 17:21:16 -07:00
Armando Aguirre
635ee24a3c
Merge remote-tracking branch 'upstream/master' into AddToggleCommentFeature
2020-07-13 16:58:19 -07:00
Ron Buckton
5ad8532a11
Merge branch 'master' into fix37113
...
# Conflicts:
# src/compiler/transformers/module/module.ts
2020-07-13 11:13:35 -07:00
Ron Buckton
2c08affa0d
Merge pull request #39264 from microsoft/migrateMapsAndSets
...
Migrate maps and sets
2020-07-13 10:38:30 -07:00
Andrew Branch
583bd92bc4
Don’t create expando declarations on alias symbols ( #39558 )
...
* Don’t create expando declarations on alias symbols
* Update other baseline
* Fix brace nesting refactor mistake
2020-07-13 10:05:48 -07:00
Kenn Sarsaba
629dd6487b
Fix typo ( #39585 )
2020-07-13 07:43:53 -07:00
Alexander T
31f75fed09
fix(types/mocha): change deprecated Mocha types ( #39573 )
2020-07-12 21:21:07 -07:00
Armando Aguirre
0d38f09e36
PR comments and minor bugs
2020-07-10 17:44:02 -07:00
Ron Buckton
87fd1827f2
Merge pull request #39537 from microsoft/fix/helpers/use-hasownproperty-call
...
fix(helpers): Use `hasOwnProperty.call`
2020-07-10 16:54:02 -07:00
Sheetal Nandi
8002473ea6
Add ClassExpression, FunctionExpression and ArrowFunction to check for cancellation token from classifier ( #39557 )
...
Fixes #35364
2020-07-10 13:39:09 -07:00
Sheetal Nandi
294fcb537c
Handle typeAcquisition could be undefined ( #39551 )
...
Fixes #36834
2020-07-10 12:56:35 -07:00
Anders Hejlsberg
c335aad665
Remove object literal freshness in control flow based array types ( #39518 )
...
* Remove object literal freshness in control flow based array types
* Add regression test
2020-07-10 10:18:15 -07:00
Nathan Shively-Sanders
3b107fec3b
Fix @param type parameter lookup ( #39532 )
...
Previously, getObjectTypeInstantiation had special-case code to look up
type parameters for `@param` as if they were in the parameter location.
This should occur in the main lookup loop of `getOuterTypeParameters`,
however. The current code only runs once, which is not sufficient, and
it also jumps to the parameter for any type contained in a `@param`,
which skips type parameters that occur in the tag itself.
2020-07-10 08:42:25 -07:00
Armando Aguirre
a534f2aa97
Fixed syntax error
2020-07-09 22:15:02 -07:00
Armando Aguirre
ef81a0d0ee
Merge remote-tracking branch 'upstream/master' into AddToggleCommentFeature
2020-07-09 21:55:36 -07:00
Armando Aguirre
b81f240e96
PR comments
2020-07-09 18:35:54 -07:00
Armando Aguirre
55a1b50e7a
Revert "Removed public commands"
...
This reverts commit 40751ba89b
.
2020-07-09 15:55:51 -07:00
Ron Buckton
3fdd2342e6
Merge branch 'master' into fix/helpers/use-hasownproperty-call
...
# Conflicts:
# tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js
# tests/baselines/reference/tsc/declarationEmit/initial-build/when-pkg-references-sibling-package-through-indirect-symlink.js
2020-07-09 14:57:20 -07:00
Sheetal Nandi
b397d1fd4a
Fixes searches for export * as 'identifier' ( #39533 )
...
* Fixes searches for export * as 'identifier'
Fixes #39006
* Fix the context span to export declaration (was incorrectly set to sourceFile in prev commit)
2020-07-09 13:45:43 -07:00
Ron Buckton
ae2f0068e3
Fix default import/export helper usage
2020-07-09 13:13:48 -07:00
ShuiRuTian
bf1ea6508b
fix static method reference non-static ( #38730 )
...
* fix static method reference non-static
* fix contextRangeIndex
* fix lint.
* fix style.
* update according to suggestion.
* continue fix.
* use every rather than foreach
* format
* fix
* add comment.
* fix according to review suggestions.
* Update src/services/findAllReferences.ts
* Update src/services/findAllReferences.ts
* Update src/services/findAllReferences.ts
* Update src/services/findAllReferences.ts
* Update src/services/findAllReferences.ts
Co-authored-by: Song Gao <song.gao@laserfiche.com>
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2020-07-09 12:21:12 -07:00
Jesse Trinity
8e9de9bed2
Fix39458 ( #39508 )
...
* remove undefined from optional parameter
* accept baselines
* use getTypeWithFacts
2020-07-09 11:17:18 -07:00
Alexander T
7c99086eb8
fix(39524): convert access property suggestion to string ( #39527 )
2020-07-09 11:08:44 -07:00
Andrew Branch
03c79d7422
Insert auto-imports in sorted order ( #39394 )
...
* Sort auto-imports
* Avoid re-checking sort all the time
* Add comment
2020-07-08 15:25:04 -07:00
csigs
468201a4a7
LEGO: check in for master to temporary branch.
2020-07-08 22:11:10 +00:00
Nathan Shively-Sanders
007b82f6d1
Better checking of @param/@property tags ( #39487 )
...
* More consistent checking of @property/@param
1. Use getWidenedTypeForVariableLikeDeclaration, instead of directly
calling tryGetTypeFromEffectiveTypeNode. This requires some changes in
the former function since it can't assume that the declaration has an
initializer.
2. isOptional now calls isOptionalJSDocPropertyLikeTag.
3. isOptionalJSDocPropertyLikeTag now handles JSDocPropertyTag
(previously it was named isOptionalJSDocParameterTag).
* rename to isOptionalJSDocPropertyLikeTag
2020-07-08 13:55:18 -07:00
Alexander T
48c19eebaf
fix(25155): add space before optional parameters/properties ( #38798 )
2020-07-08 13:38:15 -07:00
Sheetal Nandi
0f86c04af3
Fixes searches for symbols exported using export * as ( #39507 )
...
Fixes #39006
2020-07-08 13:31:21 -07:00
Alexander T
ebac7ec08f
fix(39421): omit prefix text for rest binding element ( #39433 )
2020-07-08 13:25:28 -07:00
Sheetal Nandi
305c58b03a
Remove unnecessary assert ( #39483 )
...
This assert made no sense sine we donot use the value from existing structureIsUsed at all
Fixes #36718
2020-07-08 11:02:07 -07:00
csigs
ab79eb2dc2
LEGO: check in for master to temporary branch.
2020-07-08 16:10:43 +00:00
Nathan Shively-Sanders
53a756ea63
Type this
in more constructor functions ( #39447 )
...
* Type `this` in more constructor functions
Previously, `this: this` in constructor functions only when there was
an explicit `@constructor` tag on the function. Now, `this: this` for
any function that's known to be a constructor function.
This improves completions inside constructor functions; also note that
previously the compiler *did* type `this: this` inside methods of constructor
functions, so this fix makes us more consistent. This is reflected in
the large number of baselines that improve.
The fix is a simple switch to `isJSConstructor`, which is the standard
way to detect constructor functions. I'm not sure why the original PR
didn't use this method.
I remember discussing this limitation in the original bug, #25979 , and
I guess I decided that it made sense. But I was heavily primed by the bug's
framing of the problem in terms of `noImplicitThis`, which *should*
require an explicit `@constructor` tag.
With better typing comes better detection of `@readonly` assignment; I
had to fix the readonly detection code to use `isJSConstructor` as well.
* Remove `Add @class tag` fix for noImplicitThis.
The new rules mean that it never applies. It's possible that it should
apply to functions like
```js
function f() {
this.init()
}
```
In which `init` is never defined, but I think this program is incomplete
enough that not offering the fix is fine.
* Fix precedence of `@this`
Previously, both `@class` and `@this` in a jsdoc would cause the `@this`
annotation to be ignored. This became a worse problem with this PR,
because `this` is correctly typed even without the annotation.
This commit makes sure that `@this` is checked first and used if
present.
2020-07-08 08:44:17 -07:00
csigs
41ab50be26
LEGO: check in for master to temporary branch.
2020-07-08 10:10:42 +00:00
csigs
371089bdf3
LEGO: check in for master to temporary branch.
2020-07-08 04:10:45 +00:00
Ron Buckton
5c5f180f8e
Fix namespace import/export helper usage
2020-07-07 17:36:59 -07:00
Anders Hejlsberg
8c6b85835f
Properly handle rest parameters in function declarations with @type annotations ( #39473 )
...
* Properly handle rest parameters in function declarations with @type annotations
* Add tests
2020-07-07 16:35:37 -07:00
Wesley Wigham
d2b32b422f
Ensure type/namespaceish statics are included in the list of namespace merge members ( #38920 )
...
* Ensure type/namespaceish statics are included in the list of namespace merge members
* Simplit into two lines
* Update baseline post-merge
2020-07-07 16:28:09 -07:00
Andrew Branch
2d6d5db33a
Fix getTypeAtLocation for dotted implements clauses ( #39363 )
...
* Fix getTypeAtLocation for dotted implements clauses
* Fix typo
2020-07-07 16:17:07 -07:00
Wesley Wigham
4f375552b5
Fix crash in decorator metadata calculation when serializing template literal type nodes ( #39481 )
2020-07-07 15:29:52 -07:00
Ron Buckton
1359dbd6ca
Merge branch 'master' into migrateMapsAndSets
2020-07-07 15:14:00 -07:00
Ron Buckton
189e883cb9
Move deprecated jsdoc tags to compat/deprecations.ts
2020-07-07 14:01:27 -07:00
Sheetal Nandi
c08c059dae
Dont include auto type reference directives ( #39472 )
2020-07-07 13:58:53 -07:00
Ron Buckton
9d5cd280ef
Merge branch 'master' into migrateMapsAndSets
...
# Conflicts:
# src/compiler/checker.ts
# src/compiler/commandLineParser.ts
# src/compiler/core.ts
# src/compiler/moduleNameResolver.ts
# src/compiler/transformers/declarations.ts
# src/compiler/tsbuildPublic.ts
# src/compiler/types.ts
# src/compiler/utilities.ts
# src/harness/client.ts
# src/server/editorServices.ts
# src/server/typingsCache.ts
# src/server/utilities.ts
# src/services/codefixes/convertToAsyncFunction.ts
# src/services/documentRegistry.ts
# src/services/importTracker.ts
# src/services/refactorProvider.ts
# src/services/refactors/extractSymbol.ts
# src/testRunner/unittests/programApi.ts
# src/typingsInstallerCore/typingsInstaller.ts
# tests/baselines/reference/api/tsserverlibrary.d.ts
# tests/baselines/reference/api/typescript.d.ts
2020-07-07 13:53:46 -07:00
Ron Buckton
b100680a3e
Fix for relating covered discriminants in unions ( #39393 )
2020-07-07 13:11:55 -07:00
Andrew Branch
0c75021860
Process type nodes in codefixes/refactors for auto-imports recursively ( #39130 )
...
* Process type nodes for auto-imports recursively
* Rename function
2020-07-07 13:11:23 -07:00
Nathan Shively-Sanders
1814e2a5c4
Mark @typedef as a type declaration ( #39468 )
...
* Mark @typedef as a type declaration
This is only important right now for marking uses of deprecated tags due
to the way that deprecated type references are computed. But I'm
surprised it hasn't caused problems elsewhere.
Fixes #39466
* Also mark @callback and @enum
Requires making name lookup in isTypeDeclarationName smarter, but this
is only used by services, so shouldn't be too performance sensitive.
2020-07-07 10:37:52 -07:00
Alexander T
6b493f2048
fix(23871): change insertNodeAfter to replaceNode to avoid extra newlines ( #38045 )
2020-07-07 12:54:03 -04:00
csigs
9d0e213f47
LEGO: check in for master to temporary branch.
2020-07-07 16:10:44 +00:00
Orta Therox
6ebd73c84f
Don't narrow against unions of constructor functions with instanceof ( #38099 )
...
* WIP
* Only narrows when the union is not all constructors
2020-07-07 11:34:10 -04:00
Nathan Shively-Sanders
9a65658b28
Parse *= separately in types ( #39457 )
...
* Parse *= separately in types
Previously, when the scanner produced `*=` as a single token, the type
parser ran special-case code to produce an "optional all type", which
only makes sense when the `=` really should be attached to the `*`. This
is often not the case.
The correct solution, which I missed when I first wrote this code, is to
have the scanner go back and produce a separate `=` token, which is what
this PR does.
* add test from #38551
* we ❤️ semicolons
2020-07-07 08:30:42 -07:00
csigs
4f72ae2638
LEGO: check in for master to temporary branch.
2020-07-07 04:10:42 +00:00
Alexander T
2a92a6ea91
fix(39332): handle quotes preference in interface method signatures ( #39348 )
2020-07-06 17:00:35 -07:00
Wenlu Wang
453365284c
Avoid check for union keys ( #39314 )
2020-07-06 15:01:05 -07:00
Nathan Shively-Sanders
0d84f210b7
In JS, assignment to void 0
isn't a declaration ( #39452 )
...
Previously, property assignments with `void 0` initialisers were treated
like any other values. But this causes us to choke when checking our own
commonjs emit. This is something that happens by mistake a fair amount,
so this PR goes back to treating these assignments as normal
assignments.
This should allow us to check our own emit in loose cases without
harming other code bases, since `void 0` is rarely written by hand.
Note that other errors still happen: noImplicitAny forbids
accessing undeclared properties on object literals, and strictNullChecks
forbids assigning `undefined` to properties with a different type.
However, this change is enough to unblock compilation with
`strictNullChecks: false`.
2020-07-06 14:00:12 -07:00
Daniel Rosenwasser
64696225ab
Merge pull request #39418 from a-tarasyuk/feat/25259-diagnostic
...
feat(25259): Better error report for equals instead of colon in object literals / change diagnostic message
2020-07-06 12:13:49 -07:00
Daniel Rosenwasser
77bf2045d8
Merge pull request #39379 from a-tarasyuk/bug/39346
...
fix(39346): Intelligent code completion not working in child class with composited base interface
2020-07-06 11:59:30 -07:00
csigs
222e18770d
LEGO: check in for master to temporary branch.
2020-07-06 16:10:37 +00:00
ShuiRuTian
f29e03eea5
autocomplete works for const assertion. ( #39412 )
...
* fix 39384
* add test
2020-07-06 08:49:50 -04:00
Alexander T
9f8585913b
feat(25259): change diagnostic message
2020-07-04 09:05:47 +03:00
csigs
7eeecee3b3
LEGO: check in for master to temporary branch.
2020-07-04 04:10:46 +00:00
csigs
db785545f2
LEGO: check in for master to temporary branch.
2020-07-03 22:11:08 +00:00
Anders Hejlsberg
2fe2f88047
Fix control flow analysis for nested try-catch-finally statements ( #39399 )
...
* Fix control flow analysis for nested try-catch-finally statements
* Add tests
2020-07-03 09:51:01 -07:00
csigs
bf6c69ba71
LEGO: check in for master to temporary branch.
2020-07-03 16:10:37 +00:00
csigs
7c71a7f034
LEGO: check in for master to temporary branch.
2020-07-03 10:10:39 +00:00
Michael Hensler
2d09da6df5
allow consecutive newlines in jsdoc tag comments ( #38036 )
2020-07-02 14:19:37 -07:00
Nathan Shively-Sanders
93ccc17658
Node-based @deprecated checks ( #39323 )
...
* Node-based @deprecated checks
Switch the checker to syntactic checks for `@deprecated` on
declarations. This requires a bit more checking of declarations in the
checker at times, but it
1. Gets rid of work, and a symbol flag, in the binder.
2. Skips work in the checker unless there is a `@deprecated` tag.
3. Makes it fairly simple to only issue errors on particular signatures
of overloaded functions.
* remove in-progress comment
* remove unused isTypeDeclaration
* ❤️ lint
* support jsx and tagged template functions
* Support decorators too
2020-07-02 14:09:59 -07:00
Ron Buckton
652a1c5950
Emit fallback for decorator metadata for type only imports ( #39337 )
2020-07-02 11:39:27 -07:00
Ron Buckton
8eba362a01
Fix for relating covered discriminants in unions
2020-07-02 11:09:14 -07:00
csigs
3d4422adf1
LEGO: check in for master to temporary branch.
2020-07-02 10:10:42 +00:00
Alexander T
d137e4a23b
fix(39346): show completion in inherited classes from the composited base interface
2020-07-02 11:40:17 +03:00
Ron Buckton
7b942b4fa8
Revert the type change to ts.Map ( #39366 )
2020-07-01 17:00:26 -07:00
csigs
222d47e878
LEGO: check in for master to temporary branch.
2020-07-01 16:10:50 +00:00
Nathan Shively-Sanders
df5981319f
Fix crash on completion in jsdoc namepath ( #39347 )
...
contextToken may be undefined, so the isAssertionExpression call in
filterGlobalCompletion needs to check for undefined.
2020-06-30 15:53:13 -07:00
Nathan Shively-Sanders
0f9d4c78d4
JSDoc uses same newlines as normal scanner ( #39351 )
...
* JSDoc uses same newlines as normal scanner
Previously, scanJsDocToken treated each newline character separately, so
the sequence \r\n would be treated as two lines. This is unexpected, and
not the way the normal scanner does it.
This change makes the jsdoc scanner behave the same as the normal
scanner.
* fix lint in test
2020-06-30 15:16:45 -07:00
Andrew Branch
e2c5a90cc3
Disable signature help on unresolved bare identifiers; add more declaration info on other unresolved calls ( #39352 )
...
* Disable signature help on unresolved bare identifiers; add more declaration info on unresolvedproperty access
* Remove stray ts-ignore
2020-06-30 14:25:27 -07:00
Wesley Wigham
ff1f449b99
Fix type of computed name following spread ( #39319 )
2020-06-30 13:37:59 -07:00
Alexander T
8b6a88700e
fix(32297): add quick-fix action to delete parameter destructuring elements ( #38764 )
2020-06-30 11:44:47 -07:00
Daniel Rosenwasser
a812a7449d
Merge pull request #38792 from microsoft/reportBaseAgainstBooleans
2020-06-30 01:58:51 -07:00
Daniel Rosenwasser
1bbd5ef36b
Merge pull request #38754 from a-tarasyuk/feat/25259
...
feat(25259): Better error report for equals instead of colon in object literals
2020-06-30 01:56:26 -07:00
Daniel
40c3ffec91
Add assertion.
2020-06-30 01:33:32 -07:00
Daniel
ef40ed1ee6
Exempt bare 'boolean's from the check.
2020-06-30 01:12:45 -07:00
Alexander T
21a26ca08a
feat(25259): add better error to report for equals instead of the colon in object literals
2020-06-30 10:33:56 +03:00
Daniel Rosenwasser
619658bd44
Merge pull request #39109 from Kingwl/lambda_span
...
Add outlining spans for call expression or arrow body
2020-06-29 23:33:04 -07:00
Anders Hejlsberg
784396ce95
Infer implied arity before inferring from 'this' argument ( #39328 )
...
* Infer implied arity before inferring from 'this' argument
* Add regression test
2020-06-29 17:38:41 -07:00
Anders Hejlsberg
9458f8acab
Consistent narrowing to 'never' in conditional and switch statements ( #39191 )
...
* Allow unions and unit types to narrow to 'never'
* Remove odd check for TypeFlags.NotUnionOrUnit
* Accept new baselines
* Accept new API baselines
2020-06-29 15:25:00 -07:00
Anders Hejlsberg
b448540644
No speculative inferences for variadic tuples ( #39281 )
...
* No speculative inferences to types like [...T, U?]
* Add tests
2020-06-29 15:24:32 -07:00
Daniel Rosenwasser
57dd722ab6
Merge pull request #38776 from a-tarasyuk/bug/29890
...
fix(29890): JSX: "extract to constant" generates invalid code
2020-06-29 14:09:52 -07:00
Wesley Wigham
99bec5067b
Use mapped rest type member when expanding rest parameter names ( #39317 )
...
* Use mapped rest type member when expanding rest parameter names
* Add test for #39228 which is also fixed by parameters having unique names
2020-06-29 12:30:23 -07:00
Alexander T
ee5c3fa57d
fix(39047): handle extra spaces after the catch statement ( #39306 )
2020-06-29 10:10:44 -07:00
Andrew Branch
58ed610ef1
Allow distinct string enum members with identical property names to form unions in mapped types ( #39101 )
2020-06-29 10:08:17 -07:00
csigs
5f04915ccb
LEGO: check in for master to temporary branch.
2020-06-29 16:10:37 +00:00
csigs
6ed9d56cca
LEGO: check in for master to temporary branch.
2020-06-28 16:10:45 +00:00
Alexander T
c75af697af
fix(29890): wrap variable/method/property to jsx expression
2020-06-28 10:51:11 +03:00
csigs
80482e4af8
LEGO: check in for master to temporary branch.
2020-06-26 22:11:14 +00:00
Andrew Branch
3d22a4fd72
Preserve newlines between try/catch/finally, if/else, do/while ( #39280 )
...
* Preserve newlines between try/catch, if/else, do/while
* Update baselines
2020-06-26 14:48:19 -07:00
ShuiRuTian
4601a786aa
not narrow static property without type annotation in constructor. ( #39252 )
...
* fix #39226
* fix lint.
2020-06-26 11:08:35 -07:00
Ron Buckton
611b77f2e6
Migrate more places to use Map/Set
2020-06-26 10:15:53 -07:00
Ron Buckton
eb2f4e2337
Switch to ES Map/Set internally ( #33771 )
...
* Add full implemention of Map and Set to shims
* Update default Map interface
* Remove WeakMap/WeakSet
* Add tests for set shim
* Update most usages of Map<K, true> to Set
* PR Feedback
* Fix lint issues
* Change key in fsWatchCallback
* Simpler shim, more tests
* Fix typo in collection shim
2020-06-26 10:12:47 -07:00
Alexander T
95690c0aca
fix(38840): omit completions for a spread like argument in a function definition ( #38897 )
2020-06-26 09:38:05 -07:00
Alexander T
59f80970d9
fix(38785): include in NavigationBar child items from default exported functions ( #38915 )
2020-06-26 09:35:27 -07:00
csigs
02d7c1ea1b
LEGO: check in for master to temporary branch.
2020-06-26 16:10:42 +00:00
csigs
bf128ed7c9
LEGO: check in for master to temporary branch.
2020-06-26 04:10:37 +00:00
Wenlu Wang
6b4d0bff40
Avoid effect of element access expression ( #39174 )
...
* Avoid effect of element access expression
* Avoid unnecessary copy
* Add more tests
2020-06-25 17:38:05 -07:00
Anders Hejlsberg
ee4aee0531
Handle 'keyof' for generic tuple types ( #39218 )
...
* Handle keyof T where T is generic tuple type
* Add tests
* Accept new baselines
* Address CR feedback
* Accept new baselines
2020-06-25 13:49:20 -07:00
Anders Hejlsberg
8df85b5cae
Disable unsound T[K] rule in subtype relations ( #39249 )
...
* Disable unsound T[K] rule in subtype relations
* Add test
2020-06-25 10:22:48 -07:00
csigs
4eea47e830
LEGO: check in for master to temporary branch.
2020-06-25 16:10:42 +00:00
Ron Buckton
cc7cb9eadb
Upgrade typescript-eslint version ( #39242 )
...
* Upgrade typescript-eslint version
* Update TS version used by typescript-eslint
2020-06-24 16:43:03 -07:00
Wesley Wigham
a3ee09ddc9
Handle recursive type references up to a certain level of expansion in inference ( #38011 )
...
* Handle recursive type references up to a certain level of expansion in inference
* Move object cases into the same conditional branch
2020-06-24 14:24:34 -07:00