From 2cc585668d604c454e41cd006a222c3c7299acf1 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Thu, 6 Feb 2020 14:38:21 -0800
Subject: [PATCH 1/6] Support property declarations in jsdoc template
generation (#36658)
* Support property declarations in jsdoc template generation
* fix lint and add test
---
src/services/jsDoc.ts | 6 ++-
.../docCommentTemplateClassDeclProperty01.ts | 39 +++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
create mode 100644 tests/cases/fourslash/docCommentTemplateClassDeclProperty01.ts
diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts
index 56e0a0ae50ed6..995561c016b7d 100644
--- a/src/services/jsDoc.ts
+++ b/src/services/jsDoc.ts
@@ -251,7 +251,6 @@ namespace ts.JsDoc {
* @param position The (character-indexed) position in the file where the check should
* be performed.
*/
-
export function getDocCommentTemplateAtPosition(newLine: string, sourceFile: SourceFile, position: number): TextInsertion | undefined {
const tokenAtPos = getTokenAtPosition(sourceFile, position);
const existingDocComment = findAncestor(tokenAtPos, isJSDoc);
@@ -370,6 +369,11 @@ namespace ts.JsDoc {
const parameters = isFunctionLike(be.right) ? be.right.parameters : emptyArray;
return { commentOwner, parameters };
}
+ case SyntaxKind.PropertyDeclaration:
+ const init = (commentOwner as PropertyDeclaration).initializer;
+ if (init && (isFunctionExpression(init) || isArrowFunction(init))) {
+ return { commentOwner, parameters: init.parameters };
+ }
}
}
diff --git a/tests/cases/fourslash/docCommentTemplateClassDeclProperty01.ts b/tests/cases/fourslash/docCommentTemplateClassDeclProperty01.ts
new file mode 100644
index 0000000000000..ee235f34cec3b
--- /dev/null
+++ b/tests/cases/fourslash/docCommentTemplateClassDeclProperty01.ts
@@ -0,0 +1,39 @@
+///
+
+const singleLineOffset = 3;
+const multiLineOffset = 12;
+
+
+////class C {
+//// /** /*0*/ */
+//// foo = (p0) => {
+//// return p0;
+//// };
+//// /*1*/
+//// bar = (p1) => {
+//// return p1;
+//// }
+//// /*2*/
+//// baz = function (p2, p3) {
+//// return p2;
+//// }
+////}
+
+verify.docCommentTemplateAt("0", multiLineOffset,
+ `/**
+ *
+ * @param p0
+ */`);
+verify.docCommentTemplateAt("1", multiLineOffset,
+ `/**
+ *
+ * @param p1
+ */`);
+verify.docCommentTemplateAt("2", multiLineOffset,
+ `/**
+ *
+ * @param p2
+ * @param p3
+ */`);
+
+
From 1e48cbe2c92d4e0338179f1ac512ae3bbb6f5c40 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Fri, 7 Feb 2020 08:35:40 -0800
Subject: [PATCH 2/6] Fix jsdoc comment parsing initial state (#36661)
* Fix jsdoc comment parsing initial state
Jsdoc comment parsing can be invoked in two modes:
1. top-level parsing, for comments not inside a tag.
2. tag parsing, for comment that occur after the semantic parts of a
tag.
Top-level parsing skips an initial * because it assumes that it is starting
at the very beginning of a JSDoc comment. Tag parsing does not.
The two modes are distinguished by an optional second parameter named
`margin`. When `margin` is provided, it provides an initial indent used
for comment alignment.
Previously, the check for `margin` was a truthy check `if (margin)`.
This check incorrectly treats `margin=""` the same as
`margin=undefined`.
This PR changes the check to `if (margin !== undefined)`, which
correctly treats `margin=""` the same as `margin=" "`.
* Fixes for broken tests
1. Use SawAsterisk start state.
2. @template needs to skip asterisk in addition to whitespace while
parsing type parameter names.
* undo code move
---
src/compiler/parser.ts | 10 +++--
.../quickInfoDisplayPartsParameters.baseline | 44 +++++++++++--------
.../quickInfoDisplayPartsParameters.ts | 15 ++++---
3 files changed, 39 insertions(+), 30 deletions(-)
diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts
index 621725827584b..78938bd6a2a01 100644
--- a/src/compiler/parser.ts
+++ b/src/compiler/parser.ts
@@ -7017,10 +7017,12 @@ namespace ts {
comments.push(text);
indent += text.length;
}
- if (initialMargin) {
+ if (initialMargin !== undefined) {
// jump straight to saving comments if there is some initial indentation
- pushComment(initialMargin);
- state = JSDocState.SavingComments;
+ if (initialMargin !== "") {
+ pushComment(initialMargin);
+ }
+ state = JSDocState.SawAsterisk;
}
let tok = token() as JSDocSyntaxKind;
loop: while (true) {
@@ -7558,7 +7560,7 @@ namespace ts {
const typeParameter = createNode(SyntaxKind.TypeParameter);
typeParameter.name = parseJSDocIdentifierName(Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
finishNode(typeParameter);
- skipWhitespace();
+ skipWhitespaceOrAsterisk();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(SyntaxKind.CommaToken));
diff --git a/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline b/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline
index 45f6128c2b117..c9bb71314dee3 100644
--- a/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline
+++ b/tests/baselines/reference/quickInfoDisplayPartsParameters.baseline
@@ -2,13 +2,13 @@
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts",
- "position": 9
+ "position": 33
},
"quickInfo": {
"kind": "function",
"kindModifiers": "",
"textSpan": {
- "start": 9,
+ "start": 33,
"length": 3
},
"displayParts": [
@@ -153,19 +153,25 @@
"kind": "keyword"
}
],
- "documentation": []
+ "documentation": [],
+ "tags": [
+ {
+ "name": "return",
+ "text": "*crunch*"
+ }
+ ]
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts",
- "position": 13
+ "position": 37
},
"quickInfo": {
"kind": "parameter",
"kindModifiers": "",
"textSpan": {
- "start": 13,
+ "start": 37,
"length": 5
},
"displayParts": [
@@ -208,13 +214,13 @@
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts",
- "position": 28
+ "position": 52
},
"quickInfo": {
"kind": "parameter",
"kindModifiers": "",
"textSpan": {
- "start": 28,
+ "start": 52,
"length": 13
},
"displayParts": [
@@ -257,13 +263,13 @@
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts",
- "position": 52
+ "position": 76
},
"quickInfo": {
"kind": "parameter",
"kindModifiers": "",
"textSpan": {
- "start": 52,
+ "start": 76,
"length": 20
},
"displayParts": [
@@ -306,13 +312,13 @@
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts",
- "position": 87
+ "position": 111
},
"quickInfo": {
"kind": "parameter",
"kindModifiers": "",
"textSpan": {
- "start": 87,
+ "start": 111,
"length": 9
},
"displayParts": [
@@ -363,13 +369,13 @@
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts",
- "position": 114
+ "position": 138
},
"quickInfo": {
"kind": "parameter",
"kindModifiers": "",
"textSpan": {
- "start": 114,
+ "start": 138,
"length": 5
},
"displayParts": [
@@ -412,13 +418,13 @@
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts",
- "position": 135
+ "position": 159
},
"quickInfo": {
"kind": "parameter",
"kindModifiers": "",
"textSpan": {
- "start": 135,
+ "start": 159,
"length": 13
},
"displayParts": [
@@ -461,13 +467,13 @@
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts",
- "position": 164
+ "position": 188
},
"quickInfo": {
"kind": "parameter",
"kindModifiers": "",
"textSpan": {
- "start": 164,
+ "start": 188,
"length": 20
},
"displayParts": [
@@ -510,13 +516,13 @@
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts",
- "position": 200
+ "position": 224
},
"quickInfo": {
"kind": "parameter",
"kindModifiers": "",
"textSpan": {
- "start": 200,
+ "start": 224,
"length": 9
},
"displayParts": [
diff --git a/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts b/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts
index 58cc8159b926c..b330d87b22324 100644
--- a/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts
+++ b/tests/cases/fourslash/quickInfoDisplayPartsParameters.ts
@@ -1,10 +1,11 @@
///
-////function /*1*/foo(/*2*/param: string, /*3*/optionalParam?: string, /*4*/paramWithInitializer = "hello", .../*5*/restParam: string[]) {
-//// /*6*/param = "Hello";
-//// /*7*/optionalParam = "World";
-//// /*8*/paramWithInitializer = "Hello";
-//// /*9*/restParam[0] = "World";
-////}
+//// /** @return *crunch* */
+//// function /*1*/foo(/*2*/param: string, /*3*/optionalParam?: string, /*4*/paramWithInitializer = "hello", .../*5*/restParam: string[]) {
+//// /*6*/param = "Hello";
+//// /*7*/optionalParam = "World";
+//// /*8*/paramWithInitializer = "Hello";
+//// /*9*/restParam[0] = "World";
+//// }
-verify.baselineQuickInfo();
\ No newline at end of file
+verify.baselineQuickInfo();
From 71c1da020f310ece5297e506233c839c8dd55cf5 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Fri, 7 Feb 2020 09:55:29 -0800
Subject: [PATCH 3/6] redo #28564 (#36665)
---
src/compiler/checker.ts | 2 +-
.../argumentExpressionContextualTyping.types | 2 +-
.../reference/arrayAssignmentTest3.types | 4 +-
.../baselines/reference/baseCheck.errors.txt | 8 +-
tests/baselines/reference/bigintWithLib.types | 8 +-
.../reference/bigintWithoutLib.types | 2 +-
...ScopedSameNameFunctionDeclarationES5.types | 6 +-
...ScopedSameNameFunctionDeclarationES6.types | 6 +-
...onWithIncorrectNumberOfTypeArguments.types | 40 ++---
...ShouldBeResolvedBeforeSpecialization.types | 2 +-
.../reference/callWithMissingVoid.types | 8 +-
.../callWithWrongNumberOfTypeArguments.types | 4 +-
...ConstrainedToOtherTypeParameter.errors.txt | 6 +-
...terConstrainedToOtherTypeParameter.symbols | 2 +
...meterConstrainedToOtherTypeParameter.types | 12 +-
...eterConstrainedToOtherTypeParameter2.types | 4 +-
...ckJsdocTypeTagOnObjectProperty2.errors.txt | 5 +-
.../classCanExtendConstructorFunction.types | 8 +-
.../classWithBaseClassButNoConstructor.types | 16 +-
.../reference/classWithConstructors.types | 24 +--
.../classWithoutExplicitConstructor.types | 8 +-
tests/baselines/reference/cloduleTest2.types | 16 +-
...ericRecursiveBaseClassReference.errors.txt | 5 +-
...edGenericRecursiveBaseClassReference.types | 4 +-
.../reference/constructorFunctions.types | 4 +-
...structorInvocationWithTooFewTypeArgs.types | 4 +-
.../constructorOverloads1.errors.txt | 8 +-
.../reference/constructorOverloads1.types | 12 +-
...ontextualSignatureInstantiation.errors.txt | 14 +-
.../contextualSignatureInstantiation.types | 6 +-
...pingOfGenericFunctionTypedArguments1.types | 8 +-
...extualTypingWithFixedTypeParameters1.types | 4 +-
...TypedStringLiteralsInJsxAttributes01.types | 4 +-
...TypedStringLiteralsInJsxAttributes02.types | 10 +-
.../reference/controlFlowArrayErrors.types | 2 +-
.../controlFlowIterationErrors.types | 14 +-
.../reference/controlFlowLoopAnalysis.types | 2 +-
.../couldNotSelectGenericOverload.types | 4 +-
.../declarationsAndAssignments.types | 8 +-
.../reference/decoratorOnArrowFunction.types | 2 +-
.../decoratorOnClassMethod8.errors.txt | 7 +-
.../reference/deepKeysIndexing.types | 6 +-
...efaultArgsInFunctionExpressions.errors.txt | 5 +-
...defaultBestCommonTypesHaveDecls.errors.txt | 8 +-
.../defaultBestCommonTypesHaveDecls.types | 8 +-
...rivedClassWithoutExplicitConstructor.types | 8 +-
...ivedClassWithoutExplicitConstructor2.types | 8 +-
...ivedClassWithoutExplicitConstructor3.types | 16 +-
...estructuringParameterDeclaration1ES5.types | 8 +-
...ringParameterDeclaration1ES5iterable.types | 8 +-
...estructuringParameterDeclaration1ES6.types | 8 +-
.../destructuringParameterDeclaration2.types | 12 +-
...estructuringParameterDeclaration3ES5.types | 10 +-
...ringParameterDeclaration3ES5iterable.types | 10 +-
...estructuringParameterDeclaration3ES6.types | 10 +-
.../destructuringParameterDeclaration4.types | 4 +-
.../destructuringParameterDeclaration5.types | 8 +-
.../destructuringParameterDeclaration8.types | 20 +--
.../destructuringParameterProperties2.symbols | 6 +
.../destructuringParameterProperties2.types | 24 +--
...structuringParameterProperties5.errors.txt | 19 ++-
.../destructuringParameterProperties5.types | 16 +-
.../reference/destructuringTuple.errors.txt | 25 +++-
.../reference/destructuringTuple.types | 10 +-
...ionsForExpressionsWhichCouldBeCalled.types | 2 +-
...ForwardReferenceForwadingConstructor.types | 4 +-
...portAssignmentConstrainedGenericType.types | 4 +-
.../extractInferenceImprovement.errors.txt | 7 +-
.../extractInferenceImprovement.types | 8 +-
...rameterInSignatureWithRestParameters.types | 2 +-
...fixingTypeParametersRepeatedly2.errors.txt | 8 +-
.../fixingTypeParametersRepeatedly2.types | 6 +-
tests/baselines/reference/for-of39.types | 20 +--
...unctionCallOnConstrainedTypeVariable.types | 8 +-
.../functionConstraintSatisfaction2.types | 42 +++---
.../reference/functionOverloads.types | 4 +-
.../reference/functionOverloads2.types | 4 +-
.../reference/functionOverloads27.types | 4 +-
.../reference/functionOverloads29.types | 4 +-
.../reference/functionOverloads34.types | 4 +-
.../reference/functionOverloads37.types | 4 +-
.../reference/functionOverloads40.types | 4 +-
.../reference/functionOverloads41.types | 4 +-
.../functionTypeArgumentArityErrors.types | 18 +--
.../reference/generatorTypeCheck63.types | 4 +-
...nericArgumentCallSigAssignmentCompat.types | 4 +-
...rloadedMethodWithOverloadedArguments.types | 16 +-
...ithConstraintsTypeArgumentInference2.types | 4 +-
...icCallWithConstructorTypedArguments5.types | 8 +-
...enericCallWithFunctionTypedArguments.types | 22 +--
...nericCallWithFunctionTypedArguments2.types | 8 +-
...nericCallWithFunctionTypedArguments5.types | 8 +-
...icCallWithGenericSignatureArguments2.types | 14 +-
...icCallWithGenericSignatureArguments3.types | 8 +-
.../genericCallWithObjectLiteralArgs.types | 4 +-
...nericCallWithObjectLiteralArguments1.types | 20 +--
.../genericCallWithObjectTypeArgs.types | 4 +-
...allWithObjectTypeArgsAndConstraints3.types | 4 +-
...allWithObjectTypeArgsAndConstraints4.types | 8 +-
...allWithObjectTypeArgsAndConstraints5.types | 12 +-
...OverloadedConstructorTypedArguments2.types | 4 +-
...ithOverloadedFunctionTypedArguments2.types | 4 +-
...lassWithFunctionTypedMemberArguments.types | 18 +--
.../reference/genericCombinators2.types | 8 +-
.../reference/genericConstraint1.types | 2 +-
.../reference/genericConstraint2.types | 4 +-
.../genericConstraintSatisfaction1.types | 2 +-
.../reference/genericDefaultsErrors.types | 6 +-
.../reference/genericFunctionInference1.types | 2 +-
...ericFunctionsWithOptionalParameters2.types | 2 +-
.../reference/genericNewInterface.types | 4 +-
.../baselines/reference/genericRestArgs.types | 16 +-
.../reference/genericRestArity.types | 4 +-
.../reference/genericRestArityStrict.types | 4 +-
.../reference/genericRestParameters3.js | 2 +-
.../reference/genericRestParameters3.types | 20 +--
.../genericTypeArgumentInference1.types | 6 +-
.../genericWithOpenTypeParameters1.types | 12 +-
.../reference/grammarAmbiguities1.errors.txt | 14 +-
.../reference/incompatibleTypes.types | 4 +-
...rOfTypeArgumentsDuringErrorReporting.types | 2 +-
...peUnknownStillRequiresIndexSignature.types | 2 +-
.../indexSignatureTypeInference.errors.txt | 6 +-
.../indexSignatureTypeInference.types | 2 +-
.../reference/indexedAccessRelation.types | 2 +-
...inferFromGenericFunctionReturnTypes3.types | 18 +--
.../inferenceShouldFailOnEvolvingArrays.types | 14 +-
.../reference/infiniteConstraints.types | 4 +-
.../inheritedConstructorWithRestParams.types | 4 +-
.../inheritedConstructorWithRestParams2.types | 6 +-
...sxFactoryDeclarationsLocalTypes.errors.txt | 13 +-
...cClassWithWrongNumberOfTypeArguments.types | 8 +-
...tiateNonGenericTypeWithTypeArguments.types | 4 +-
.../reference/interfaceAssignmentCompat.types | 2 +-
.../invariantGenericErrorElaboration.types | 4 +-
.../reference/iterableArrayPattern28.types | 10 +-
.../reference/iteratorSpreadInArray6.types | 2 +-
.../reference/iteratorSpreadInCall10.types | 2 +-
.../reference/iteratorSpreadInCall7.types | 2 +-
.../reference/iteratorSpreadInCall8.types | 2 +-
.../reference/iteratorSpreadInCall9.types | 2 +-
.../jsdocDisallowedInTypescript.types | 2 +-
.../reference/jsdocTemplateTag3.types | 2 +-
.../jsxChildrenGenericContextualTypes.types | 6 +-
.../keyofAndIndexedAccessErrors.types | 12 +-
.../reference/keyofDoesntContainSymbols.types | 12 +-
...literalTypeNameAssertionNotTriggered.types | 2 +-
.../reference/mappedTypeErrors.types | 20 +--
.../mappedTypeInferenceErrors.symbols | 1 -
.../reference/mappedTypeInferenceErrors.types | 10 +-
.../mappedTypeRecursiveInference.symbols | 10 ++
.../mappedTypeRecursiveInference.types | 28 ++--
.../baselines/reference/maxConstraints.types | 4 +-
.../reference/methodChainError.symbols | 2 +
.../reference/methodChainError.types | 6 +-
...plicitTypeParameterAndArgumentType.symbols | 4 +
...ExplicitTypeParameterAndArgumentType.types | 32 ++--
...narrowingGenericTypeFromInstanceof01.types | 2 +-
tests/baselines/reference/newMap.types | 2 +-
.../reference/noErrorsInCallback.types | 8 +-
.../noImplicitAnyLoopCrash.errors.txt | 8 +-
.../reference/nonPrimitiveInGeneric.types | 12 +-
...reationExpressionInFunctionParameter.types | 6 +-
.../reference/objectLiteralNormalization.js | 12 +-
.../objectLiteralNormalization.types | 16 +-
...erationsAvailableOnPromisedType.errors.txt | 7 +-
.../optionalBindingParameters1.types | 2 +-
...ptionalBindingParametersInOverloads1.types | 2 +-
...attersForSignatureGroupIdentity.errors.txt | 10 +-
...rderMattersForSignatureGroupIdentity.types | 4 +-
tests/baselines/reference/overload1.types | 12 +-
.../reference/overloadResolution.types | 6 +-
.../overloadResolutionClassConstructors.types | 24 +--
.../overloadResolutionConstructors.types | 6 +-
...rloadResolutionOnDefaultConstructor1.types | 4 +-
.../reference/overloadResolutionTest1.types | 12 +-
.../reference/overloadingOnConstants2.types | 4 +-
...nWithConstraintCheckingDeferred.errors.txt | 66 +++++++--
...lutionWithConstraintCheckingDeferred.types | 14 +-
.../overloadsAndTypeArgumentArityErrors.types | 4 +-
.../overloadsWithProvisionalErrors.types | 4 +-
...TypesWhenAppropriatelyContextualized.types | 4 +-
.../reference/parser15.4.4.14-9-2.errors.txt | 14 +-
.../reference/parser15.4.4.14-9-2.symbols | 8 +
.../reference/parser15.4.4.14-9-2.types | 36 ++---
.../parserConstructorAmbiguity3.types | 2 +-
...IOnCallAfterFunctionExpression1.errors.txt | 5 +-
...iallyAnnotatedFunctionInferenceError.types | 6 +-
.../reference/primitiveConstraints1.types | 4 +-
.../reference/primitiveConstraints2.types | 4 +-
.../reference/promiseChaining1.errors.txt | 6 +-
.../reference/promiseChaining1.symbols | 4 +
.../reference/promiseChaining1.types | 20 +--
.../reference/promiseChaining2.errors.txt | 6 +-
.../reference/promiseChaining2.symbols | 4 +
.../reference/promiseChaining2.types | 20 +--
.../reference/promisePermutations.types | 132 ++++++++---------
.../reference/promisePermutations2.types | 132 ++++++++---------
.../reference/promisePermutations3.types | 140 +++++++++---------
.../reference/promiseTypeInference.types | 4 +-
.../recursiveClassReferenceTest.types | 2 +-
.../reference/recursiveFunctionTypes.types | 8 +-
.../reference/recursiveTypeReferences1.types | 6 +-
.../reference/recursiveTypeRelations.types | 8 +-
.../reference/restTupleElements1.types | 20 +--
.../reference/strictBindCallApply1.types | 104 ++++++-------
.../reference/symbolProperty21.types | 6 +-
...ateStringsTypeArgumentInference.errors.txt | 6 +-
...TemplateStringsTypeArgumentInference.types | 6 +-
...StringsTypeArgumentInferenceES6.errors.txt | 6 +-
...plateStringsTypeArgumentInferenceES6.types | 6 +-
...tringsWithIncompatibleTypedTags.errors.txt | 5 +-
...teStringsWithIncompatibleTypedTags.symbols | 6 +
...lateStringsWithIncompatibleTypedTags.types | 26 ++--
...ngsWithIncompatibleTypedTagsES6.errors.txt | 5 +-
...tringsWithIncompatibleTypedTagsES6.symbols | 6 +
...eStringsWithIncompatibleTypedTagsES6.types | 26 ++--
...mplateStringsWithOverloadResolution1.types | 32 ++--
...teStringsWithOverloadResolution1_ES6.types | 32 ++--
...mplateStringsWithOverloadResolution3.types | 4 +-
...teStringsWithOverloadResolution3_ES6.types | 4 +-
...esWithIncompleteTemplateExpressions3.types | 2 +-
...esWithIncompleteTemplateExpressions4.types | 2 +-
...esWithIncompleteTemplateExpressions5.types | 2 +-
...esWithIncompleteTemplateExpressions6.types | 2 +-
...ggedTemplatesWithTypeArguments2.errors.txt | 5 +-
.../taggedTemplatesWithTypeArguments2.types | 4 +-
...ionInCallExpressionWithTypeArguments.types | 6 +-
.../reference/tooManyTypeParameters1.types | 8 +-
.../tsxElementResolution10.errors.txt | 8 +-
.../tsxElementResolution9.errors.txt | 14 +-
.../tsxSpreadAttributesResolution10.types | 4 +-
.../tsxSpreadAttributesResolution12.types | 10 +-
.../tsxSpreadAttributesResolution2.types | 8 +-
.../tsxSpreadAttributesResolution6.types | 2 +-
...entPartialDefinitionStillErrors.errors.txt | 5 +-
.../typeArgInference2WithError.types | 4 +-
.../typeArgumentConstraintResolution1.types | 2 +-
.../typeArgumentInference.errors.txt | 6 +-
.../reference/typeArgumentInference.types | 12 +-
...entInferenceConstructSignatures.errors.txt | 6 +-
...ArgumentInferenceConstructSignatures.types | 12 +-
.../typeArgumentInferenceErrors.types | 8 +-
...ntInferenceWithClassExpression2.errors.txt | 7 +-
...rgumentInferenceWithClassExpression2.types | 2 +-
...tInferenceWithConstraintAsCommonRoot.types | 2 +-
...rgumentInferenceWithConstraints.errors.txt | 11 +-
...typeArgumentInferenceWithConstraints.types | 36 ++---
...peArgumentInferenceWithObjectLiteral.types | 4 +-
...gumentsWithStringLiteralTypes01.errors.txt | 50 ++++++-
.../typeArgumentsWithStringLiteralTypes01.js | 12 +-
...ypeArgumentsWithStringLiteralTypes01.types | 120 +++++++--------
.../typeAssertionToGenericFunctionType.types | 4 +-
.../typeInferenceConflictingCandidates.types | 8 +-
.../baselines/reference/typeOfOnTypeArg.types | 2 +-
...eParameterAsTypeParameterConstraint2.types | 14 +-
...FixingWithContextSensitiveArguments2.types | 4 +-
...FixingWithContextSensitiveArguments3.types | 4 +-
.../typesWithPublicConstructor.errors.txt | 9 +-
.../typesWithPublicConstructor.symbols | 2 +
.../typesWithPublicConstructor.types | 10 +-
.../undeclaredModuleError.errors.txt | 5 +-
.../baselines/reference/underscoreTest1.types | 4 +-
.../reference/unionThisTypeInFunctions.types | 2 +-
.../unionTypeCallSignatures.errors.txt | 7 +-
.../reference/unionTypeCallSignatures.types | 88 +++++------
.../reference/unionTypeCallSignatures4.types | 4 +-
.../reference/unionTypeCallSignatures5.types | 2 +-
.../reference/unionTypeCallSignatures6.types | 10 +-
.../unionTypeConstructSignatures.errors.txt | 7 +-
.../unionTypeConstructSignatures.types | 84 +++++------
.../reference/unionTypeInference.types | 8 +-
.../reference/unionTypeMembers.types | 2 +-
.../wrappedAndRecursiveConstraints4.types | 4 +-
274 files changed, 1691 insertions(+), 1374 deletions(-)
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 44d6ca66853a6..dfe87338dbfae 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -24886,7 +24886,7 @@ namespace ts {
}
}
- return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
+ return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
function chooseOverload(candidates: Signature[], relation: Map, signatureHelpTrailingComma = false) {
candidatesForArgumentError = undefined;
diff --git a/tests/baselines/reference/argumentExpressionContextualTyping.types b/tests/baselines/reference/argumentExpressionContextualTyping.types
index 46ef3a3857027..a67b0b5e609f4 100644
--- a/tests/baselines/reference/argumentExpressionContextualTyping.types
+++ b/tests/baselines/reference/argumentExpressionContextualTyping.types
@@ -122,7 +122,7 @@ baz(array); // Error
baz(["string", 1, true, ...array]); // Error
>baz(["string", 1, true, ...array]) : void
>baz : (x: [string, number, boolean]) => void
->["string", 1, true, ...array] : (string | number | boolean)[]
+>["string", 1, true, ...array] : [string, number, true, ...(string | number | boolean)[]]
>"string" : "string"
>1 : 1
>true : true
diff --git a/tests/baselines/reference/arrayAssignmentTest3.types b/tests/baselines/reference/arrayAssignmentTest3.types
index ec1b5de51b27d..df87d9d7fc481 100644
--- a/tests/baselines/reference/arrayAssignmentTest3.types
+++ b/tests/baselines/reference/arrayAssignmentTest3.types
@@ -17,8 +17,8 @@ class a {
var xx = new a(null, 7, new B());
->xx : any
->new a(null, 7, new B()) : any
+>xx : a
+>new a(null, 7, new B()) : a
>a : typeof a
>null : null
>7 : 7
diff --git a/tests/baselines/reference/baseCheck.errors.txt b/tests/baselines/reference/baseCheck.errors.txt
index 67358a1033834..634ce2b66a647 100644
--- a/tests/baselines/reference/baseCheck.errors.txt
+++ b/tests/baselines/reference/baseCheck.errors.txt
@@ -1,15 +1,13 @@
tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. Did you mean 'ELoc'?
tests/cases/compiler/baseCheck.ts(17,53): error TS2554: Expected 2 arguments, but got 1.
-tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/baseCheck.ts(18,62): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
-tests/cases/compiler/baseCheck.ts(19,68): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/baseCheck.ts(22,9): error TS2304: Cannot find name 'x'.
tests/cases/compiler/baseCheck.ts(23,7): error TS2304: Cannot find name 'x'.
tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
-==== tests/cases/compiler/baseCheck.ts (9 errors) ====
+==== tests/cases/compiler/baseCheck.ts (7 errors) ====
class C { constructor(x: number, y: number) { } }
class ELoc extends C {
constructor(x: number) {
@@ -33,16 +31,12 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
~~~~~~~~~~~~~
!!! error TS2554: Expected 2 arguments, but got 1.
!!! related TS6210 tests/cases/compiler/baseCheck.ts:1:34: An argument for 'y' was not provided.
- ~~~~
-!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
class E extends C { constructor(public z: number) { super(0, this.z) } }
~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
class F extends C { constructor(public z: number) { super("hello", this.z) } } // first param type
~~~~~~~
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
- ~~~~
-!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
function f() {
if (x<10) {
diff --git a/tests/baselines/reference/bigintWithLib.types b/tests/baselines/reference/bigintWithLib.types
index a1d79119cf6e5..6715dc70c3b2b 100644
--- a/tests/baselines/reference/bigintWithLib.types
+++ b/tests/baselines/reference/bigintWithLib.types
@@ -94,9 +94,9 @@ bigIntArray = new BigInt64Array([1n, 2n, 3n]);
>3n : 3n
bigIntArray = new BigInt64Array([1, 2, 3]); // should error
->bigIntArray = new BigInt64Array([1, 2, 3]) : any
+>bigIntArray = new BigInt64Array([1, 2, 3]) : BigInt64Array
>bigIntArray : BigInt64Array
->new BigInt64Array([1, 2, 3]) : any
+>new BigInt64Array([1, 2, 3]) : BigInt64Array
>BigInt64Array : BigInt64ArrayConstructor
>[1, 2, 3] : number[]
>1 : 1
@@ -174,9 +174,9 @@ bigUintArray = new BigUint64Array([1n, 2n, 3n]);
>3n : 3n
bigUintArray = new BigUint64Array([1, 2, 3]); // should error
->bigUintArray = new BigUint64Array([1, 2, 3]) : any
+>bigUintArray = new BigUint64Array([1, 2, 3]) : BigUint64Array
>bigUintArray : BigUint64Array
->new BigUint64Array([1, 2, 3]) : any
+>new BigUint64Array([1, 2, 3]) : BigUint64Array
>BigUint64Array : BigUint64ArrayConstructor
>[1, 2, 3] : number[]
>1 : 1
diff --git a/tests/baselines/reference/bigintWithoutLib.types b/tests/baselines/reference/bigintWithoutLib.types
index 6881b53b7da12..24470aa45db6e 100644
--- a/tests/baselines/reference/bigintWithoutLib.types
+++ b/tests/baselines/reference/bigintWithoutLib.types
@@ -56,7 +56,7 @@ let stringVal: string = bigintVal.toString(); // should not error - bigintVal in
>toString : () => string
stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {}
->stringVal = bigintVal.toString(2) : any
+>stringVal = bigintVal.toString(2) : string
>stringVal : string
>bigintVal.toString(2) : string
>bigintVal.toString : () => string
diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.types b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.types
index ca53002f949f7..28a718cb328be 100644
--- a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.types
+++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.types
@@ -16,7 +16,7 @@ function foo(a: number) {
>foo : { (): void; (): void; }
foo(10); // not ok
->foo(10) : any
+>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10
}
@@ -29,12 +29,12 @@ function foo(a: number) {
>foo : { (): void; (): void; }
foo(10); // not ok
->foo(10) : any
+>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10
}
foo(10); // not ok
->foo(10) : any
+>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10
diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.types b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.types
index 982ace6809c46..967ec902a16e4 100644
--- a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.types
+++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.types
@@ -16,7 +16,7 @@ function foo(a: number) {
>foo : { (): void; (): void; }
foo(10); // not ok
->foo(10) : any
+>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10
}
@@ -29,12 +29,12 @@ function foo(a: number) {
>foo : { (): void; (): void; }
foo(10);// not ok
->foo(10) : any
+>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10
}
foo(10); // not ok
->foo(10) : any
+>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10
diff --git a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.types b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.types
index 9d5d0e19ebb64..0ce7d67b618f2 100644
--- a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.types
+++ b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.types
@@ -9,15 +9,15 @@ function f(x: T, y: U): T { return null; }
>null : null
var r1 = f(1, '');
->r1 : any
->f(1, '') : any
+>r1 : number
+>f(1, '') : number
>f : (x: T, y: U) => T
>1 : 1
>'' : ""
var r1b = f(1, '');
->r1b : any
->f(1, '') : any
+>r1b : number
+>f(1, '') : number
>f : (x: T, y: U) => T
>1 : 1
>'' : ""
@@ -30,15 +30,15 @@ var f2 = (x: T, y: U): T => { return null; }
>null : null
var r2 = f2(1, '');
->r2 : any
->f2(1, '') : any
+>r2 : number
+>f2(1, '') : number
>f2 : (x: T, y: U) => T
>1 : 1
>'' : ""
var r2b = f2(1, '');
->r2b : any
->f2(1, '') : any
+>r2b : number
+>f2(1, '') : number
>f2 : (x: T, y: U) => T
>1 : 1
>'' : ""
@@ -49,15 +49,15 @@ var f3: { (x: T, y: U): T; }
>y : U
var r3 = f3(1, '');
->r3 : any
->f3(1, '') : any
+>r3 : number
+>f3(1, '') : number
>f3 : (x: T, y: U) => T
>1 : 1
>'' : ""
var r3b = f3(1, '');
->r3b : any
->f3(1, '') : any
+>r3b : number
+>f3(1, '') : number
>f3 : (x: T, y: U) => T
>1 : 1
>'' : ""
@@ -75,8 +75,8 @@ class C {
}
}
var r4 = (new C()).f(1, '');
->r4 : any
->(new C()).f(1, '') : any
+>r4 : number
+>(new C()).f(1, '') : number
>(new C()).f : (x: T, y: U) => T
>(new C()) : C
>new C() : C
@@ -86,8 +86,8 @@ var r4 = (new C()).f(1, '');
>'' : ""
var r4b = (new C()).f(1, '');
->r4b : any
->(new C()).f(1, '') : any
+>r4b : number
+>(new C()).f(1, '') : number
>(new C()).f : (x: T, y: U) => T
>(new C()) : C
>new C() : C
@@ -106,8 +106,8 @@ var i: I;
>i : I
var r5 = i.f(1, '');
->r5 : any
->i.f(1, '') : any
+>r5 : number
+>i.f(1, '') : number
>i.f : (x: T, y: U) => T
>i : I
>f : (x: T, y: U) => T
@@ -115,8 +115,8 @@ var r5 = i.f(1, '');
>'' : ""
var r5b = i.f(1, '');
->r5b : any
->i.f(1, '') : any
+>r5b : number
+>i.f(1, '') : number
>i.f : (x: T, y: U) => T
>i : I
>f : (x: T, y: U) => T
diff --git a/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.types b/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.types
index da2b23747a5ae..f0d875055337c 100644
--- a/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.types
+++ b/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.types
@@ -19,7 +19,7 @@ function foo() {
>"expects boolean instead of string" : "expects boolean instead of string"
test(true); // should error - string expected
->test(true) : any
+>test(true) : void
>test : I1
>true : true
}
diff --git a/tests/baselines/reference/callWithMissingVoid.types b/tests/baselines/reference/callWithMissingVoid.types
index 4fbcbbf5d1b8f..6f9638daae567 100644
--- a/tests/baselines/reference/callWithMissingVoid.types
+++ b/tests/baselines/reference/callWithMissingVoid.types
@@ -99,7 +99,7 @@ new MyPromise(resolve => resolve()); // no error
new MyPromise(resolve => resolve()); // error, `any` arguments cannot be omitted
>new MyPromise(resolve => resolve()) : MyPromise
>MyPromise : typeof MyPromise
->resolve => resolve() : (resolve: (value: any) => void) => any
+>resolve => resolve() : (resolve: (value: any) => void) => void
>resolve : (value: any) => void
>resolve() : void
>resolve : (value: any) => void
@@ -107,7 +107,7 @@ new MyPromise(resolve => resolve()); // error, `any` arguments cannot be om
new MyPromise(resolve => resolve()); // error, `unknown` arguments cannot be omitted
>new MyPromise(resolve => resolve()) : MyPromise
>MyPromise : typeof MyPromise
->resolve => resolve() : (resolve: (value: unknown) => void) => any
+>resolve => resolve() : (resolve: (value: unknown) => void) => void
>resolve : (value: unknown) => void
>resolve() : void
>resolve : (value: unknown) => void
@@ -115,7 +115,7 @@ new MyPromise(resolve => resolve()); // error, `unknown` arguments cann
new MyPromise(resolve => resolve()); // error, `never` arguments cannot be omitted
>new MyPromise(resolve => resolve()) : MyPromise
>MyPromise : typeof MyPromise
->resolve => resolve() : (resolve: (value: never) => void) => any
+>resolve => resolve() : (resolve: (value: never) => void) => void
>resolve : (value: never) => void
>resolve() : void
>resolve : (value: never) => void
@@ -234,7 +234,7 @@ declare function call(
>args : TS
call((x: number, y: number) => x + y) // error
->call((x: number, y: number) => x + y) : any
+>call((x: number, y: number) => x + y) : void
>call : (handler: (...args: TS) => unknown, ...args: TS) => void
>(x: number, y: number) => x + y : (x: number, y: number) => number
>x : number
diff --git a/tests/baselines/reference/callWithWrongNumberOfTypeArguments.types b/tests/baselines/reference/callWithWrongNumberOfTypeArguments.types
index 29d4ea5ec4b22..557c48e49e30b 100644
--- a/tests/baselines/reference/callWithWrongNumberOfTypeArguments.types
+++ b/tests/baselines/reference/callWithWrongNumberOfTypeArguments.types
@@ -3,7 +3,7 @@ function f() { }
>f : () => void
f();
->f() : any
+>f() : void
>f : () => void
f();
@@ -11,6 +11,6 @@ f();
>f : () => void
f();
->f() : any
+>f() : void
>f : () => void
diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt
index 2e39f19d86ad3..777130d8893b6 100644
--- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt
+++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt
@@ -1,7 +1,8 @@
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,64): error TS2741: Property 'z' is missing in type 'B' but required in type 'C'.
+tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,81): error TS2739: Type 'A' is missing the following properties from type 'C': z, y
-==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (1 errors) ====
+==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (2 errors) ====
class Chain {
constructor(public value: T) { }
then(cb: (x: T) => S): Chain {
@@ -24,4 +25,7 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete
~~~~~
!!! error TS2741: Property 'z' is missing in type 'B' but required in type 'C'.
!!! related TS2728 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:15:5: 'z' is declared here.
+!!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature.
+ ~~~~~
+!!! error TS2739: Type 'A' is missing the following properties from type 'C': z, y
!!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature.
\ No newline at end of file
diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.symbols b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.symbols
index c4a3f7b5f4d77..164005d035c32 100644
--- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.symbols
+++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.symbols
@@ -46,6 +46,7 @@ class C extends B {
// Ok to go down the chain, but error to try to climb back up
(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A);
+>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
>(new Chain(new A)).then(a => new B).then(b => new C).then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
>(new Chain(new A)).then(a => new B).then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
>(new Chain(new A)).then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
@@ -60,6 +61,7 @@ class C extends B {
>then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
>c : Symbol(c, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 18, 58))
>B : Symbol(B, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 9, 1))
+>then : Symbol(Chain.then, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 1, 36))
>b : Symbol(b, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 18, 75))
>A : Symbol(A, Decl(chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts, 5, 1))
diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.types b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.types
index 3716b9b56f1d5..d6712329fc42f 100644
--- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.types
+++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.types
@@ -38,9 +38,9 @@ class C extends B {
// Ok to go down the chain, but error to try to climb back up
(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A);
->(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A) : any
->(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then : any
->(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B) : any
+>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A) : Chain
+>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then : (cb: (x: C) => S) => Chain
+>(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B) : Chain
>(new Chain(new A)).then(a => new B).then(b => new C).then : (cb: (x: C) => S) => Chain
>(new Chain(new A)).then(a => new B).then(b => new C) : Chain
>(new Chain(new A)).then(a => new B).then : (cb: (x: B) => S) => Chain
@@ -66,9 +66,9 @@ class C extends B {
>c : C
>new B : B
>B : typeof B
->then : any
->b => new A : (b: any) => A
->b : any
+>then : (cb: (x: C) => S) => Chain
+>b => new A : (b: C) => A
+>b : C
>new A : A
>A : typeof A
diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.types b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.types
index 59627a5f620df..91b0d4fcb37cd 100644
--- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.types
+++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.types
@@ -18,7 +18,7 @@ class Chain {
// Ok to go down the chain, but error to climb up the chain
(new Chain(t)).then(tt => s).then(ss => t);
->(new Chain(t)).then(tt => s).then(ss => t) : any
+>(new Chain(t)).then(tt => s).then(ss => t) : Chain
>(new Chain(t)).then(tt => s).then : (cb: (x: S) => S) => Chain
>(new Chain(t)).then(tt => s) : Chain
>(new Chain(t)).then : (cb: (x: T) => S) => Chain
@@ -37,7 +37,7 @@ class Chain {
// But error to try to climb up the chain
(new Chain(s)).then(ss => t);
->(new Chain(s)).then(ss => t) : any
+>(new Chain(s)).then(ss => t) : Chain
>(new Chain(s)).then : (cb: (x: S) => S) => Chain
>(new Chain(s)) : Chain
>new Chain(s) : Chain
diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt
index 3d1051fdfd441..a94d8f7a3ba36 100644
--- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt
+++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt
@@ -4,10 +4,11 @@ tests/cases/conformance/jsdoc/0.js(11,20): error TS2322: Type '"lol"' is not ass
tests/cases/conformance/jsdoc/0.js(13,15): error TS2322: Type '"0"' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/0.js(15,3): error TS2322: Type 'undefined' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/0.js(19,5): error TS2322: Type 'number' is not assignable to type 'string'.
+tests/cases/conformance/jsdoc/0.js(22,5): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"' is not assignable to parameter of type 'number'.
-==== tests/cases/conformance/jsdoc/0.js (7 errors) ====
+==== tests/cases/conformance/jsdoc/0.js (8 errors) ====
// @ts-check
var lol;
const obj = {
@@ -42,5 +43,7 @@ tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"'
/** @type {string} */
var s1 = obj.method2("0");
+ ~~
+!!! error TS2322: Type 'number' is not assignable to type 'string'.
~~~
!!! error TS2345: Argument of type '"0"' is not assignable to parameter of type 'number'.
\ No newline at end of file
diff --git a/tests/baselines/reference/classCanExtendConstructorFunction.types b/tests/baselines/reference/classCanExtendConstructorFunction.types
index d2de5468efd0c..b7a379caf1140 100644
--- a/tests/baselines/reference/classCanExtendConstructorFunction.types
+++ b/tests/baselines/reference/classCanExtendConstructorFunction.types
@@ -284,13 +284,13 @@ chowder.flavour.claim
>claim : "ignorant" | "malicious"
var errorNoArgs = new Chowder();
->errorNoArgs : any
->new Chowder() : any
+>errorNoArgs : Chowder
+>new Chowder() : Chowder
>Chowder : typeof Chowder
var errorArgType = new Chowder(0);
->errorArgType : any
->new Chowder(0) : any
+>errorArgType : Chowder
+>new Chowder(0) : Chowder
>Chowder : typeof Chowder
>0 : 0
diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.types b/tests/baselines/reference/classWithBaseClassButNoConstructor.types
index 1b8aa28818441..7c7af56a2d2ee 100644
--- a/tests/baselines/reference/classWithBaseClassButNoConstructor.types
+++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.types
@@ -19,8 +19,8 @@ var r = C;
>C : typeof C
var c = new C(); // error
->c : any
->new C() : any
+>c : C
+>new C() : C
>C : typeof C
var c2 = new C(1); // ok
@@ -49,8 +49,8 @@ var r2 = D;
>D : typeof D
var d = new D(); // error
->d : any
->new D() : any
+>d : D
+>new D() : D
>D : typeof D
var d2 = new D(1); // ok
@@ -73,8 +73,8 @@ var r3 = D2;
>D2 : typeof D2
var d3 = new D(); // error
->d3 : any
->new D() : any
+>d3 : D
+>new D() : D
>D : typeof D
var d4 = new D(1); // ok
@@ -96,8 +96,8 @@ var r4 = D3;
>D3 : typeof D3
var d5 = new D(); // error
->d5 : any
->new D() : any
+>d5 : D
+>new D() : D
>D : typeof D
var d6 = new D(1); // ok
diff --git a/tests/baselines/reference/classWithConstructors.types b/tests/baselines/reference/classWithConstructors.types
index 07a5be543eb8c..dcac0e7e254f5 100644
--- a/tests/baselines/reference/classWithConstructors.types
+++ b/tests/baselines/reference/classWithConstructors.types
@@ -10,8 +10,8 @@ module NonGeneric {
}
var c = new C(); // error
->c : any
->new C() : any
+>c : C
+>new C() : C
>C : typeof C
var c2 = new C(''); // ok
@@ -34,8 +34,8 @@ module NonGeneric {
}
var c3 = new C2(); // error
->c3 : any
->new C2() : any
+>c3 : C2
+>new C2() : C2
>C2 : typeof C2
var c4 = new C2(''); // ok
@@ -55,8 +55,8 @@ module NonGeneric {
>C2 : C2
var d = new D(); // error
->d : any
->new D() : any
+>d : D
+>new D() : D
>D : typeof D
var d2 = new D(1); // ok
@@ -83,8 +83,8 @@ module Generics {
}
var c = new C(); // error
->c : any
->new C() : any
+>c : C
+>new C() : C
>C : typeof C
var c2 = new C(''); // ok
@@ -108,8 +108,8 @@ module Generics {
}
var c3 = new C2(); // error
->c3 : any
->new C2() : any
+>c3 : C2
+>new C2() : C2
>C2 : typeof C2
var c4 = new C2(''); // ok
@@ -130,8 +130,8 @@ module Generics {
>C2 : C2
var d = new D(); // error
->d : any
->new D() : any
+>d : D
+>new D() : D
>D : typeof D
var d2 = new D(1); // ok
diff --git a/tests/baselines/reference/classWithoutExplicitConstructor.types b/tests/baselines/reference/classWithoutExplicitConstructor.types
index 4fdf46227bf50..682baa38e6e06 100644
--- a/tests/baselines/reference/classWithoutExplicitConstructor.types
+++ b/tests/baselines/reference/classWithoutExplicitConstructor.types
@@ -17,8 +17,8 @@ var c = new C();
>C : typeof C
var c2 = new C(null); // error
->c2 : any
->new C(null) : any
+>c2 : C
+>new C(null) : C
>C : typeof C
>null : null
@@ -40,8 +40,8 @@ var d = new D();
>D : typeof D
var d2 = new D(null); // error
->d2 : any
->new D(null) : any
+>d2 : D
+>new D(null) : D
>D : typeof D
>null : null
diff --git a/tests/baselines/reference/cloduleTest2.types b/tests/baselines/reference/cloduleTest2.types
index 2dbd5f13e953a..74204130c261c 100644
--- a/tests/baselines/reference/cloduleTest2.types
+++ b/tests/baselines/reference/cloduleTest2.types
@@ -14,8 +14,8 @@ module T1 {
>bar : () => any
var r = new m3d(); // error
->r : any
->new m3d() : any
+>r : m3d
+>new m3d() : m3d
>m3d : typeof m3d
}
@@ -34,8 +34,8 @@ module T2 {
>2 : 2
var r = new m3d(); // error
->r : any
->new m3d() : any
+>r : m3d
+>new m3d() : m3d
>m3d : typeof m3d
}
@@ -123,8 +123,8 @@ declare class m3d { constructor(foo); foo(): void; static bar(); }
>bar : () => any
var r = new m3d(); // error
->r : any
->new m3d() : any
+>r : m3d
+>new m3d() : m3d
>m3d : typeof m3d
declare class m4d extends m3d { }
@@ -132,7 +132,7 @@ declare class m4d extends m3d { }
>m3d : m3d
var r2 = new m4d(); // error
->r2 : any
->new m4d() : any
+>r2 : m4d
+>new m4d() : m4d
>m4d : typeof m4d
diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.errors.txt b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.errors.txt
index fde460bb0f424..3e9f17e4d205b 100644
--- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.errors.txt
+++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.errors.txt
@@ -1,8 +1,9 @@
tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(1,7): error TS2506: 'S18' is referenced directly or indirectly in its own base expression.
tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(4,10): error TS2554: Expected 0 arguments, but got 1.
+tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(4,16): error TS2339: Property 'S18' does not exist on type 'S18'.
-==== tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts (2 errors) ====
+==== tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts (3 errors) ====
class S18 extends S18
~~~
!!! error TS2506: 'S18' is referenced directly or indirectly in its own base expression.
@@ -11,4 +12,6 @@ tests/cases/compiler/complicatedGenericRecursiveBaseClassReference.ts(4,10): err
(new S18(123)).S18 = 0;
~~~
!!! error TS2554: Expected 0 arguments, but got 1.
+ ~~~
+!!! error TS2339: Property 'S18' does not exist on type 'S18'.
\ No newline at end of file
diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.types b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.types
index 0e03c6df8aa0d..445ac37884681 100644
--- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.types
+++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.types
@@ -8,8 +8,8 @@ class S18 extends S18
(new S18(123)).S18 = 0;
>(new S18(123)).S18 = 0 : 0
>(new S18(123)).S18 : any
->(new S18(123)) : any
->new S18(123) : any
+>(new S18(123)) : S18
+>new S18(123) : S18
>S18 : typeof S18
>123 : 123
>S18 : any
diff --git a/tests/baselines/reference/constructorFunctions.types b/tests/baselines/reference/constructorFunctions.types
index 05f3998a09c11..ba2fedb66438e 100644
--- a/tests/baselines/reference/constructorFunctions.types
+++ b/tests/baselines/reference/constructorFunctions.types
@@ -178,7 +178,7 @@ function C7(num) {}
>num : number
var c7_v1 = new C7();
->c7_v1 : any
->new C7() : any
+>c7_v1 : C7
+>new C7() : C7
>C7 : typeof C7
diff --git a/tests/baselines/reference/constructorInvocationWithTooFewTypeArgs.types b/tests/baselines/reference/constructorInvocationWithTooFewTypeArgs.types
index bd93ce518e9b3..28c8b2c8e64b8 100644
--- a/tests/baselines/reference/constructorInvocationWithTooFewTypeArgs.types
+++ b/tests/baselines/reference/constructorInvocationWithTooFewTypeArgs.types
@@ -11,7 +11,7 @@ class D {
}
var d = new D();
->d : any
->new D() : any
+>d : D
+>new D() : D
>D : typeof D
diff --git a/tests/baselines/reference/constructorOverloads1.errors.txt b/tests/baselines/reference/constructorOverloads1.errors.txt
index 8bc0c1ecdbb26..0692c9ddda51f 100644
--- a/tests/baselines/reference/constructorOverloads1.errors.txt
+++ b/tests/baselines/reference/constructorOverloads1.errors.txt
@@ -9,9 +9,9 @@ tests/cases/compiler/constructorOverloads1.ts(16,18): error TS2769: No overload
Argument of type 'Foo' is not assignable to parameter of type 'number'.
tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2769: No overload matches this call.
Overload 1 of 2, '(s: string): Foo', gave the following error.
- Argument of type 'any[]' is not assignable to parameter of type 'string'.
+ Argument of type 'Foo[]' is not assignable to parameter of type 'string'.
Overload 2 of 2, '(n: number): Foo', gave the following error.
- Argument of type 'any[]' is not assignable to parameter of type 'number'.
+ Argument of type 'Foo[]' is not assignable to parameter of type 'number'.
==== tests/cases/compiler/constructorOverloads1.ts (6 errors) ====
@@ -53,9 +53,9 @@ tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2769: No overload
~~~~~~~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 2, '(s: string): Foo', gave the following error.
-!!! error TS2769: Argument of type 'any[]' is not assignable to parameter of type 'string'.
+!!! error TS2769: Argument of type 'Foo[]' is not assignable to parameter of type 'string'.
!!! error TS2769: Overload 2 of 2, '(n: number): Foo', gave the following error.
-!!! error TS2769: Argument of type 'any[]' is not assignable to parameter of type 'number'.
+!!! error TS2769: Argument of type 'Foo[]' is not assignable to parameter of type 'number'.
f1.bar1();
f1.bar2();
diff --git a/tests/baselines/reference/constructorOverloads1.types b/tests/baselines/reference/constructorOverloads1.types
index 40a806b9e71c6..312f52fc9b64b 100644
--- a/tests/baselines/reference/constructorOverloads1.types
+++ b/tests/baselines/reference/constructorOverloads1.types
@@ -36,19 +36,19 @@ var f2 = new Foo(0);
>0 : 0
var f3 = new Foo(f1);
->f3 : any
->new Foo(f1) : any
+>f3 : Foo
+>new Foo(f1) : Foo
>Foo : typeof Foo
>f1 : Foo
var f4 = new Foo([f1,f2,f3]);
->f4 : any
->new Foo([f1,f2,f3]) : any
+>f4 : Foo
+>new Foo([f1,f2,f3]) : Foo
>Foo : typeof Foo
->[f1,f2,f3] : any[]
+>[f1,f2,f3] : Foo[]
>f1 : Foo
>f2 : Foo
->f3 : any
+>f3 : Foo
f1.bar1();
>f1.bar1() : void
diff --git a/tests/baselines/reference/contextualSignatureInstantiation.errors.txt b/tests/baselines/reference/contextualSignatureInstantiation.errors.txt
index 6c14ad3c1503a..497937c7a4e82 100644
--- a/tests/baselines/reference/contextualSignatureInstantiation.errors.txt
+++ b/tests/baselines/reference/contextualSignatureInstantiation.errors.txt
@@ -1,15 +1,18 @@
+tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(19,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(19,13): error TS2345: Argument of type '(x: T, y: T) => T' is not assignable to parameter of type '(x: number, y: string) => number'.
Types of parameters 'y' and 'y' are incompatible.
Type 'string' is not assignable to type 'number'.
+tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(20,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(20,23): error TS2345: Argument of type '(x: T, y: T) => T' is not assignable to parameter of type '(x: number, y: string) => number'.
Types of parameters 'y' and 'y' are incompatible.
Type 'string' is not assignable to type 'number'.
+tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(21,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts(21,23): error TS2345: Argument of type '(x: T, y: T) => T' is not assignable to parameter of type '(x: string, y: number) => string'.
Types of parameters 'y' and 'y' are incompatible.
Type 'number' is not assignable to type 'string'.
-==== tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts (3 errors) ====
+==== tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts (6 errors) ====
// TypeScript Spec, section 4.12.2:
// If e is an expression of a function type that contains exactly one generic call signature and no other members,
// and T is a function type with exactly one non - generic call signature and no other members, then any inferences
@@ -29,16 +32,25 @@ tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatur
var b: number | string;
var b = foo(g); // Error, number and string are disjoint types
+ ~
+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
+!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts:18:5: 'b' was also declared here.
~
!!! error TS2345: Argument of type '(x: T, y: T) => T' is not assignable to parameter of type '(x: number, y: string) => number'.
!!! error TS2345: Types of parameters 'y' and 'y' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
var b = bar(1, "one", g); // Error, number and string are disjoint types
+ ~
+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
+!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts:18:5: 'b' was also declared here.
~
!!! error TS2345: Argument of type '(x: T, y: T) => T' is not assignable to parameter of type '(x: number, y: string) => number'.
!!! error TS2345: Types of parameters 'y' and 'y' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
var b = bar("one", 1, g); // Error, number and string are disjoint types
+ ~
+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'string | number', but here has type 'unknown'.
+!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts:18:5: 'b' was also declared here.
~
!!! error TS2345: Argument of type '(x: T, y: T) => T' is not assignable to parameter of type '(x: string, y: number) => string'.
!!! error TS2345: Types of parameters 'y' and 'y' are incompatible.
diff --git a/tests/baselines/reference/contextualSignatureInstantiation.types b/tests/baselines/reference/contextualSignatureInstantiation.types
index ae5a40005377e..a98e9d95b56a7 100644
--- a/tests/baselines/reference/contextualSignatureInstantiation.types
+++ b/tests/baselines/reference/contextualSignatureInstantiation.types
@@ -61,13 +61,13 @@ var b: number | string;
var b = foo(g); // Error, number and string are disjoint types
>b : string | number
->foo(g) : any
+>foo(g) : unknown
>foo : (cb: (x: number, y: string) => T) => T
>g : (x: T, y: T) => T
var b = bar(1, "one", g); // Error, number and string are disjoint types
>b : string | number
->bar(1, "one", g) : any
+>bar(1, "one", g) : unknown
>bar : (x: T, y: U, cb: (x: T, y: U) => V) => V
>1 : 1
>"one" : "one"
@@ -75,7 +75,7 @@ var b = bar(1, "one", g); // Error, number and string are disjoint types
var b = bar("one", 1, g); // Error, number and string are disjoint types
>b : string | number
->bar("one", 1, g) : any
+>bar("one", 1, g) : unknown
>bar : (x: T, y: U, cb: (x: T, y: U) => V) => V
>"one" : "one"
>1 : 1
diff --git a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.types b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.types
index c7466ec2ebb87..dc3e1e40599cc 100644
--- a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.types
+++ b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.types
@@ -37,8 +37,8 @@ var f = (x: number) => { return x.toFixed() };
>toFixed : (fractionDigits?: number) => string
var r5 = _.forEach(c2, f);
->r5 : any
->_.forEach(c2, f) : any
+>r5 : void
+>_.forEach(c2, f) : void
>_.forEach : (c: Collection, f: (x: T) => Date) => void
>_ : Combinators
>forEach : (c: Collection, f: (x: T) => Date) => void
@@ -46,8 +46,8 @@ var r5 = _.forEach(c2, f);
>f : (x: number) => string
var r6 = _.forEach(c2, (x) => { return x.toFixed() });
->r6 : any
->_.forEach(c2, (x) => { return x.toFixed() }) : any
+>r6 : void
+>_.forEach(c2, (x) => { return x.toFixed() }) : void
>_.forEach : (c: Collection, f: (x: T) => Date) => void
>_ : Combinators
>forEach : (c: Collection, f: (x: T) => Date) => void
diff --git a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.types b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.types
index cd2e946ed7263..35784d79f3cc0 100644
--- a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.types
+++ b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.types
@@ -19,8 +19,8 @@ f10('', () => a => a.foo, ''); // a is ""
>'' : ""
var r9 = f10('', () => (a => a.foo), 1); // error
->r9 : any
->f10('', () => (a => a.foo), 1) : any
+>r9 : string
+>f10('', () => (a => a.foo), 1) : ""
>f10 : (x: T, b: () => (a: T) => void, y: T) => T
>'' : ""
>() => (a => a.foo) : () => (a: "") => any
diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.types b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.types
index 01b5e85100786..3ce1ee12915b8 100644
--- a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.types
+++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.types
@@ -36,11 +36,11 @@ const FooComponent = (props: { foo: "A" | "B" | "C" }) => {props.foo};
> : JSX.Element
>FooComponent : (props: { foo: "A" | "B" | "C"; }) => JSX.Element
->foo : string
+>foo : "f"
>"f" : "f"
;
> : JSX.Element
>FooComponent : (props: { foo: "A" | "B" | "C"; }) => JSX.Element
->foo : string
+>foo : "f"
diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.types b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.types
index badb7b0d4e97c..1f69721445968 100644
--- a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.types
+++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.types
@@ -95,8 +95,8 @@ const b3 = ; // goTo has type"home" | "c
>b3 : JSX.Element
> : JSX.Element
>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; }
->{goTo:"home"} : { goTo: string; }
->goTo : string
+>{goTo:"home"} : { goTo: "home"; }
+>goTo : "home"
>"home" : "home"
>extra : true
@@ -104,7 +104,7 @@ const b4 = ; // goTo has type "home" | "contact
>b4 : JSX.Element
> : JSX.Element
>MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; }
->goTo : string
+>goTo : "home"
>extra : true
export function NoOverload(buttonProps: ButtonProps): JSX.Element { return undefined }
@@ -138,8 +138,8 @@ const d1 = ; // goTo has type "home" |
>d1 : JSX.Element
> : JSX.Element
>NoOverload1 : (linkProps: LinkProps) => JSX.Element
->{goTo:"home"} : { goTo: string; }
->goTo : string
+>{goTo:"home"} : { goTo: "home"; }
+>goTo : "home"
>"home" : "home"
>extra : true
diff --git a/tests/baselines/reference/controlFlowArrayErrors.types b/tests/baselines/reference/controlFlowArrayErrors.types
index eee5ed5a6abcf..c69c5a22785e7 100644
--- a/tests/baselines/reference/controlFlowArrayErrors.types
+++ b/tests/baselines/reference/controlFlowArrayErrors.types
@@ -152,7 +152,7 @@ function f6() {
>x : (string | number)[] | boolean[]
x.push(99); // Error
->x.push(99) : any
+>x.push(99) : number
>x.push : ((...items: (string | number)[]) => number) | ((...items: boolean[]) => number)
>x : (string | number)[] | boolean[]
>push : ((...items: (string | number)[]) => number) | ((...items: boolean[]) => number)
diff --git a/tests/baselines/reference/controlFlowIterationErrors.types b/tests/baselines/reference/controlFlowIterationErrors.types
index 7312944e3bf37..2635ca168e2d3 100644
--- a/tests/baselines/reference/controlFlowIterationErrors.types
+++ b/tests/baselines/reference/controlFlowIterationErrors.types
@@ -27,7 +27,7 @@ function f1() {
>cond : boolean
x = len(x);
->x = len(x) : any
+>x = len(x) : number
>x : string | number | boolean
>len(x) : number
>len : (s: string) => number
@@ -58,7 +58,7 @@ function f2() {
>x : string | number
x = len(x);
->x = len(x) : any
+>x = len(x) : number
>x : string | number | boolean
>len(x) : number
>len : (s: string) => number
@@ -91,14 +91,14 @@ function g1() {
>cond : boolean
x = foo(x);
->x = foo(x) : any
+>x = foo(x) : never
>x : string | number | boolean
->foo(x) : any
+>foo(x) : never
>foo : { (x: string): number; (x: number): string; }
>x : string | number
x;
->x : string | number | boolean
+>x : never
}
x;
>x : string | number
@@ -122,9 +122,9 @@ function g2() {
>x : string | number
x = foo(x);
->x = foo(x) : any
+>x = foo(x) : never
>x : string | number | boolean
->foo(x) : any
+>foo(x) : never
>foo : { (x: string): number; (x: number): string; }
>x : string | number
}
diff --git a/tests/baselines/reference/controlFlowLoopAnalysis.types b/tests/baselines/reference/controlFlowLoopAnalysis.types
index c38a0d735e7d7..f3aa3bd2bd0da 100644
--- a/tests/baselines/reference/controlFlowLoopAnalysis.types
+++ b/tests/baselines/reference/controlFlowLoopAnalysis.types
@@ -25,7 +25,7 @@ function test1() {
>cond : true
x = foo(x);
->x = foo(x) : any
+>x = foo(x) : number
>x : number | undefined
>foo(x) : number
>foo : (x: number) => number
diff --git a/tests/baselines/reference/couldNotSelectGenericOverload.types b/tests/baselines/reference/couldNotSelectGenericOverload.types
index 3fbcd77647d51..ad1e9ab4e15aa 100644
--- a/tests/baselines/reference/couldNotSelectGenericOverload.types
+++ b/tests/baselines/reference/couldNotSelectGenericOverload.types
@@ -11,8 +11,8 @@ var b = [1, ""];
>"" : ""
var b1G = makeArray(1, ""); // any, no error
->b1G : any
->makeArray(1, "") : any
+>b1G : unknown[]
+>makeArray(1, "") : unknown[]
>makeArray : (items: T[]) => T[]
>1 : 1
>"" : ""
diff --git a/tests/baselines/reference/declarationsAndAssignments.types b/tests/baselines/reference/declarationsAndAssignments.types
index ed157a7e69ce5..3d4da894fdd86 100644
--- a/tests/baselines/reference/declarationsAndAssignments.types
+++ b/tests/baselines/reference/declarationsAndAssignments.types
@@ -463,12 +463,12 @@ f14([2, ["abc", { x: 0 }]]);
f14([2, ["abc", { y: false }]]); // Error, no x
>f14([2, ["abc", { y: false }]]) : void
>f14 : ([a, [b, { x, y: c }]]: [number, [string, { x: any; y?: boolean; }]]) => void
->[2, ["abc", { y: false }]] : (number | (string | { y: boolean; })[])[]
+>[2, ["abc", { y: false }]] : [number, [string, { y: false; }]]
>2 : 2
->["abc", { y: false }] : (string | { y: boolean; })[]
+>["abc", { y: false }] : [string, { y: false; }]
>"abc" : "abc"
->{ y: false } : { y: boolean; }
->y : boolean
+>{ y: false } : { y: false; }
+>y : false
>false : false
module M {
diff --git a/tests/baselines/reference/decoratorOnArrowFunction.types b/tests/baselines/reference/decoratorOnArrowFunction.types
index 5edbff0e92113..84ca4a9ffbe88 100644
--- a/tests/baselines/reference/decoratorOnArrowFunction.types
+++ b/tests/baselines/reference/decoratorOnArrowFunction.types
@@ -6,6 +6,6 @@ declare function dec(target: T): T;
var F = @dec () => {
>F : any
> : any
->dec () : any
+>dec () : unknown
>dec : (target: T) => T
}
diff --git a/tests/baselines/reference/decoratorOnClassMethod8.errors.txt b/tests/baselines/reference/decoratorOnClassMethod8.errors.txt
index 3ada30296b6b1..adfd69b9dff99 100644
--- a/tests/baselines/reference/decoratorOnClassMethod8.errors.txt
+++ b/tests/baselines/reference/decoratorOnClassMethod8.errors.txt
@@ -1,11 +1,16 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
+tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
+ Type 'C' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
-==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts (1 errors) ====
+==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts (2 errors) ====
declare function dec(target: T): T;
class C {
@dec method() {}
~~~~
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
+ ~~~~
+!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
+!!! error TS1241: Type 'C' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/deepKeysIndexing.types b/tests/baselines/reference/deepKeysIndexing.types
index 8e115412c20f0..2ab3088178153 100644
--- a/tests/baselines/reference/deepKeysIndexing.types
+++ b/tests/baselines/reference/deepKeysIndexing.types
@@ -91,7 +91,7 @@ const bar = new Bar();
// all 3 of the below should error on passing `true` for `"1"`
bar.broken("a", "1", true); // was broken in the past - with 2nd argument incorrectly of type "1" | "2" | "3".
->bar.broken("a", "1", true) : any
+>bar.broken("a", "1", true) : void
>bar.broken : , V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
>bar : Bar
>broken : , V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
@@ -100,7 +100,7 @@ bar.broken("a", "1", true); // was broken in the past - with 2nd argument incorr
>true : true
bar.working("a", "1", true); // ok - true is not allowed
->bar.working("a", "1", true) : any
+>bar.working("a", "1", true) : void
>bar.working : , V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
>bar : Bar
>working : , V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
@@ -109,7 +109,7 @@ bar.working("a", "1", true); // ok - true is not allowed
>true : true
bar.workaround("a", "1", true); // ok - true is not allowed
->bar.workaround("a", "1", true) : any
+>bar.workaround("a", "1", true) : void
>bar.workaround : , V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
>bar : Bar
>workaround : , V extends Foo[K1][K2]>(k1: K1, k2: K2, value: V) => void
diff --git a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt
index 805f25d8dbcd6..ef919a768ec6d 100644
--- a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt
+++ b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt
@@ -1,3 +1,4 @@
+tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,5): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,19): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(5,1): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(8,20): error TS2322: Type '3' is not assignable to type 'string'.
@@ -8,11 +9,13 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(20,62): error TS2352: C
tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: Cannot use namespace 'T' as a value.
-==== tests/cases/compiler/defaultArgsInFunctionExpressions.ts (8 errors) ====
+==== tests/cases/compiler/defaultArgsInFunctionExpressions.ts (9 errors) ====
var f = function (a = 3) { return a; }; // Type should be (a?: number) => number
var n: number = f(4);
n = f();
var s: string = f('');
+ ~
+!!! error TS2322: Type 'number' is not assignable to type 'string'.
~~
!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'.
s = f();
diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt
index a59e8c59fdfcb..5b8772a881566 100644
--- a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt
+++ b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.errors.txt
@@ -1,9 +1,11 @@
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(2,6): error TS2339: Property 'length' does not exist on type '{}'.
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(5,6): error TS2339: Property 'length' does not exist on type 'Object'.
tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,24): error TS2345: Argument of type '""' is not assignable to parameter of type '1'.
+tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(9,27): error TS2339: Property 'length' does not exist on type 'number'.
+tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(13,28): error TS2339: Property 'length' does not exist on type 'number'.
-==== tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts (3 errors) ====
+==== tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts (5 errors) ====
var obj1: {};
obj1.length;
~~~~~~
@@ -19,9 +21,13 @@ tests/cases/compiler/defaultBestCommonTypesHaveDecls.ts(8,24): error TS2345: Arg
~~
!!! error TS2345: Argument of type '""' is not assignable to parameter of type '1'.
var elementCount = result.length;
+ ~~~~~~
+!!! error TS2339: Property 'length' does not exist on type 'number'.
function concat2(x: T, y: U) { return null; }
var result2 = concat2(1, ""); // result2 will be number|string
var elementCount2 = result.length;
+ ~~~~~~
+!!! error TS2339: Property 'length' does not exist on type 'number'.
\ No newline at end of file
diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.types b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.types
index 7fb09643d899f..90e1c6df9a339 100644
--- a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.types
+++ b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.types
@@ -22,8 +22,8 @@ function concat(x: T, y: T): T { return null; }
>null : null
var result = concat(1, ""); // error
->result : any
->concat(1, "") : any
+>result : number
+>concat(1, "") : 1
>concat : (x: T, y: T) => T
>1 : 1
>"" : ""
@@ -31,7 +31,7 @@ var result = concat(1, ""); // error
var elementCount = result.length;
>elementCount : any
>result.length : any
->result : any
+>result : number
>length : any
function concat2(x: T, y: U) { return null; }
@@ -50,7 +50,7 @@ var result2 = concat2(1, ""); // result2 will be number|string
var elementCount2 = result.length;
>elementCount2 : any
>result.length : any
->result : any
+>result : number
>length : any
diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.types b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.types
index 3a719ebd59790..04dd1ee3717e7 100644
--- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.types
+++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.types
@@ -29,8 +29,8 @@ class Derived extends Base {
}
var r = new Derived(); // error
->r : any
->new Derived() : any
+>r : Derived
+>new Derived() : Derived
>Derived : typeof Derived
var r2 = new Derived(1);
@@ -68,8 +68,8 @@ class D extends Base2 {
}
var d = new D(); // error
->d : any
->new D() : any
+>d : D
+>new D() : D
>D : typeof D
var d2 = new D(new Date()); // ok
diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.types b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.types
index bfe6cf18613cd..a7561b044e460 100644
--- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.types
+++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.types
@@ -38,8 +38,8 @@ class Derived extends Base {
}
var r = new Derived(); // error
->r : any
->new Derived() : any
+>r : Derived
+>new Derived() : Derived
>Derived : typeof Derived
var r2 = new Derived(1);
@@ -101,8 +101,8 @@ class D extends Base2 {
}
var d = new D(); // error
->d : any
->new D() : any
+>d : D
+>new D() : D
>D : typeof D
var d2 = new D(new Date()); // ok
diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.types b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.types
index bb63fe1ab615b..b674626ec0038 100644
--- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.types
+++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.types
@@ -57,13 +57,13 @@ class Derived2 extends Derived {
}
var r = new Derived(); // error
->r : any
->new Derived() : any
+>r : Derived
+>new Derived() : Derived
>Derived : typeof Derived
var r2 = new Derived2(1); // error
->r2 : any
->new Derived2(1) : any
+>r2 : Derived2
+>new Derived2(1) : Derived2
>Derived2 : typeof Derived2
>1 : 1
@@ -130,13 +130,13 @@ class D2 extends D {
}
var d = new D2(); // error
->d : any
->new D2() : any
+>d : D2
+>new D2() : D2
>D2 : typeof D2
var d2 = new D2(new Date()); // error
->d2 : any
->new D2(new Date()) : any
+>d2 : D2
+>new D2(new Date()) : D2
>D2 : typeof D2
>new Date() : Date
>Date : DateConstructor
diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES5.types b/tests/baselines/reference/destructuringParameterDeclaration1ES5.types
index a346856223a65..9b36241c7b0cd 100644
--- a/tests/baselines/reference/destructuringParameterDeclaration1ES5.types
+++ b/tests/baselines/reference/destructuringParameterDeclaration1ES5.types
@@ -54,7 +54,7 @@ a1([1, 2, [["world"]]]);
a1([1, 2, [["world"]], 3]);
>a1([1, 2, [["world"]], 3]) : void
>a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void
->[1, 2, [["world"]], 3] : (number | string[][])[]
+>[1, 2, [["world"]], 3] : [number, number, string[][], number]
>1 : 1
>2 : 2
>[["world"]] : string[][]
@@ -302,11 +302,11 @@ c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]
c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]]
>c5([1, 2, [["string"]], false, true]) : void
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
->[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
+>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
>1 : 1
>2 : 2
->[["string"]] : string[][]
->["string"] : string[]
+>[["string"]] : [[string]]
+>["string"] : [string]
>"string" : "string"
>false : false
>true : true
diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.types b/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.types
index 3797a5da9570e..9b7c194480c87 100644
--- a/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.types
+++ b/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.types
@@ -54,7 +54,7 @@ a1([1, 2, [["world"]]]);
a1([1, 2, [["world"]], 3]);
>a1([1, 2, [["world"]], 3]) : void
>a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void
->[1, 2, [["world"]], 3] : (number | string[][])[]
+>[1, 2, [["world"]], 3] : [number, number, string[][], number]
>1 : 1
>2 : 2
>[["world"]] : string[][]
@@ -302,11 +302,11 @@ c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]
c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]]
>c5([1, 2, [["string"]], false, true]) : void
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
->[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
+>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
>1 : 1
>2 : 2
->[["string"]] : string[][]
->["string"] : string[]
+>[["string"]] : [[string]]
+>["string"] : [string]
>"string" : "string"
>false : false
>true : true
diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES6.types b/tests/baselines/reference/destructuringParameterDeclaration1ES6.types
index 04d282c76b75c..d91aebfc1bf7e 100644
--- a/tests/baselines/reference/destructuringParameterDeclaration1ES6.types
+++ b/tests/baselines/reference/destructuringParameterDeclaration1ES6.types
@@ -56,7 +56,7 @@ a1([1, 2, [["world"]]]);
a1([1, 2, [["world"]], 3]);
>a1([1, 2, [["world"]], 3]) : void
>a1 : ([a, b, [[c]]]: [number, number, string[][]]) => void
->[1, 2, [["world"]], 3] : (number | string[][])[]
+>[1, 2, [["world"]], 3] : [number, number, string[][], number]
>1 : 1
>2 : 2
>[["world"]] : string[][]
@@ -285,11 +285,11 @@ c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]
c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]]
>c5([1, 2, [["string"]], false, true]) : void
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
->[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
+>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
>1 : 1
>2 : 2
->[["string"]] : string[][]
->["string"] : string[]
+>[["string"]] : [[string]]
+>["string"] : [string]
>"string" : "string"
>false : false
>true : true
diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.types b/tests/baselines/reference/destructuringParameterDeclaration2.types
index 27ab690860681..6780d97d02667 100644
--- a/tests/baselines/reference/destructuringParameterDeclaration2.types
+++ b/tests/baselines/reference/destructuringParameterDeclaration2.types
@@ -13,7 +13,7 @@ function a0([a, b, [[c]]]: [number, number, string[][]]) { }
a0([1, "string", [["world"]]); // Error
>a0([1, "string", [["world"]]) : void
>a0 : ([a, b, [[c]]]: [number, number, string[][]]) => void
->[1, "string", [["world"]] : (string | number | string[][])[]
+>[1, "string", [["world"]] : [number, string, string[][]]
>1 : 1
>"string" : "string"
>[["world"]] : string[][]
@@ -23,7 +23,7 @@ a0([1, "string", [["world"]]); // Error
a0([1, 2, [["world"]], "string"]); // Error
>a0([1, 2, [["world"]], "string"]) : void
>a0 : ([a, b, [[c]]]: [number, number, string[][]]) => void
->[1, 2, [["world"]], "string"] : (string | number | string[][])[]
+>[1, 2, [["world"]], "string"] : [number, number, string[][], string]
>1 : 1
>2 : 2
>[["world"]] : string[][]
@@ -183,7 +183,7 @@ c3({ b: true }); // Error, implied type is { b: number|string }.
c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]]
>c5([1, 2, false, true]) : void
>c5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
->[1, 2, false, true] : (number | boolean)[]
+>[1, 2, false, true] : [number, number, boolean, boolean]
>1 : 1
>2 : 2
>false : false
@@ -192,11 +192,11 @@ c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]]
c6([1, 2, [["string"]]]); // Error, implied type is [any, any, [[number]]] // Use initializer
>c6([1, 2, [["string"]]]) : void
>c6 : ([a, b, [[c]]]: [any, any, [[number?]]]) => void
->[1, 2, [["string"]]] : (number | string[][])[]
+>[1, 2, [["string"]]] : [number, number, [[string]]]
>1 : 1
>2 : 2
->[["string"]] : string[][]
->["string"] : string[]
+>[["string"]] : [[string]]
+>["string"] : [string]
>"string" : "string"
// A parameter can be marked optional by following its name or binding pattern with a question mark (?)
diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5.types b/tests/baselines/reference/destructuringParameterDeclaration3ES5.types
index a18a2c4f0a960..feaaef5858ead 100644
--- a/tests/baselines/reference/destructuringParameterDeclaration3ES5.types
+++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5.types
@@ -85,11 +85,11 @@ a1(...array);
a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]]
>a9([1, 2, [["string"]], false, true]) : void
>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
->[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
+>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
>1 : 1
>2 : 2
->[["string"]] : string[][]
->["string"] : string[]
+>[["string"]] : [[string]]
+>["string"] : [string]
>"string" : "string"
>false : false
>true : true
@@ -109,7 +109,7 @@ a10([1, 2, [["string"]], false, true]); // Parameter type is any[]
a10([1, 2, 3, false, true]); // Parameter type is any[]
>a10([1, 2, 3, false, true]) : void
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
->[1, 2, 3, false, true] : (number | boolean)[]
+>[1, 2, 3, false, true] : [number, number, number, boolean, boolean]
>1 : 1
>2 : 2
>3 : 3
@@ -119,7 +119,7 @@ a10([1, 2, 3, false, true]); // Parameter type is any[]
a10([1, 2]); // Parameter type is any[]
>a10([1, 2]) : void
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
->[1, 2] : number[]
+>[1, 2] : [number, number]
>1 : 1
>2 : 2
diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.types b/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.types
index e41c2e5d75acf..429073b17a669 100644
--- a/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.types
+++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.types
@@ -85,11 +85,11 @@ a1(...array);
a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]]
>a9([1, 2, [["string"]], false, true]) : void
>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
->[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
+>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
>1 : 1
>2 : 2
->[["string"]] : string[][]
->["string"] : string[]
+>[["string"]] : [[string]]
+>["string"] : [string]
>"string" : "string"
>false : false
>true : true
@@ -109,7 +109,7 @@ a10([1, 2, [["string"]], false, true]); // Parameter type is any[]
a10([1, 2, 3, false, true]); // Parameter type is any[]
>a10([1, 2, 3, false, true]) : void
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
->[1, 2, 3, false, true] : (number | boolean)[]
+>[1, 2, 3, false, true] : [number, number, number, boolean, boolean]
>1 : 1
>2 : 2
>3 : 3
@@ -119,7 +119,7 @@ a10([1, 2, 3, false, true]); // Parameter type is any[]
a10([1, 2]); // Parameter type is any[]
>a10([1, 2]) : void
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
->[1, 2] : number[]
+>[1, 2] : [number, number]
>1 : 1
>2 : 2
diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES6.types b/tests/baselines/reference/destructuringParameterDeclaration3ES6.types
index 4adacfd11ffd2..3b59fdb0da52c 100644
--- a/tests/baselines/reference/destructuringParameterDeclaration3ES6.types
+++ b/tests/baselines/reference/destructuringParameterDeclaration3ES6.types
@@ -85,11 +85,11 @@ a1(...array);
a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]]
>a9([1, 2, [["string"]], false, true]) : void
>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
->[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
+>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean]
>1 : 1
>2 : 2
->[["string"]] : string[][]
->["string"] : string[]
+>[["string"]] : [[string]]
+>["string"] : [string]
>"string" : "string"
>false : false
>true : true
@@ -109,7 +109,7 @@ a10([1, 2, [["string"]], false, true]); // Parameter type is any[]
a10([1, 2, 3, false, true]); // Parameter type is any[]
>a10([1, 2, 3, false, true]) : void
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
->[1, 2, 3, false, true] : (number | boolean)[]
+>[1, 2, 3, false, true] : [number, number, number, boolean, boolean]
>1 : 1
>2 : 2
>3 : 3
@@ -119,7 +119,7 @@ a10([1, 2, 3, false, true]); // Parameter type is any[]
a10([1, 2]); // Parameter type is any[]
>a10([1, 2]) : void
>a10 : ([a, b, [[c]], ...x]: [any, any, [[any]], ...any[]]) => void
->[1, 2] : number[]
+>[1, 2] : [number, number]
>1 : 1
>2 : 2
diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.types b/tests/baselines/reference/destructuringParameterDeclaration4.types
index 2c3a7dc5f9586..5d1ac7e4f4c1f 100644
--- a/tests/baselines/reference/destructuringParameterDeclaration4.types
+++ b/tests/baselines/reference/destructuringParameterDeclaration4.types
@@ -69,7 +69,7 @@ a1(...array2); // Error parameter type is (number|string)[]
a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]]
>a5([1, 2, "string", false, true]) : void
>a5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
->[1, 2, "string", false, true] : (string | number | boolean)[]
+>[1, 2, "string", false, true] : [number, number, string, boolean, boolean]
>1 : 1
>2 : 2
>"string" : "string"
@@ -79,7 +79,7 @@ a5([1, 2, "string", false, true]); // Error, parameter type is [any, any,
a5([1, 2]); // Error, parameter type is [any, any, [[any]]]
>a5([1, 2]) : void
>a5 : ([a, b, [[c]]]: [any, any, [[any]]]) => void
->[1, 2] : number[]
+>[1, 2] : [number, number]
>1 : 1
>2 : 2
diff --git a/tests/baselines/reference/destructuringParameterDeclaration5.types b/tests/baselines/reference/destructuringParameterDeclaration5.types
index e3066702b7dc1..859b391f71c54 100644
--- a/tests/baselines/reference/destructuringParameterDeclaration5.types
+++ b/tests/baselines/reference/destructuringParameterDeclaration5.types
@@ -156,7 +156,7 @@ d3({ y: new SubClass() });
// Error
d3({ y: new Class() });
->d3({ y: new Class() }) : any
+>d3({ y: new Class() }) : void
>d3 : ({ y }: { y: D; }) => void
>{ y: new Class() } : { y: Class; }
>y : Class
@@ -164,19 +164,19 @@ d3({ y: new Class() });
>Class : typeof Class
d3({});
->d3({}) : any
+>d3({}) : void
>d3 : ({ y }: { y: D; }) => void
>{} : {}
d3({ y: 1 });
->d3({ y: 1 }) : any
+>d3({ y: 1 }) : void
>d3 : ({ y }: { y: D; }) => void
>{ y: 1 } : { y: number; }
>y : number
>1 : 1
d3({ y: "world" });
->d3({ y: "world" }) : any
+>d3({ y: "world" }) : void
>d3 : ({ y }: { y: D; }) => void
>{ y: "world" } : { y: string; }
>y : string
diff --git a/tests/baselines/reference/destructuringParameterDeclaration8.types b/tests/baselines/reference/destructuringParameterDeclaration8.types
index 6ca691fcff158..870cbd057647a 100644
--- a/tests/baselines/reference/destructuringParameterDeclaration8.types
+++ b/tests/baselines/reference/destructuringParameterDeclaration8.types
@@ -49,22 +49,22 @@ test({ method: 'x', nested: { p: 'a' } })
test({ method: 'z', nested: { p: 'b' } })
>test({ method: 'z', nested: { p: 'b' } }) : void
>test : ({ method, nested: { p } }: { method?: "x" | "y"; nested?: { p: "a" | "b"; }; }) => void
->{ method: 'z', nested: { p: 'b' } } : { method: string; nested: { p: string; }; }
->method : string
+>{ method: 'z', nested: { p: 'b' } } : { method: "z"; nested: { p: "b"; }; }
+>method : "z"
>'z' : "z"
->nested : { p: string; }
->{ p: 'b' } : { p: string; }
->p : string
+>nested : { p: "b"; }
+>{ p: 'b' } : { p: "b"; }
+>p : "b"
>'b' : "b"
test({ method: 'one', nested: { p: 'a' } })
>test({ method: 'one', nested: { p: 'a' } }) : void
>test : ({ method, nested: { p } }: { method?: "x" | "y"; nested?: { p: "a" | "b"; }; }) => void
->{ method: 'one', nested: { p: 'a' } } : { method: string; nested: { p: string; }; }
->method : string
+>{ method: 'one', nested: { p: 'a' } } : { method: "one"; nested: { p: "a"; }; }
+>method : "one"
>'one' : "one"
->nested : { p: string; }
->{ p: 'a' } : { p: string; }
->p : string
+>nested : { p: "a"; }
+>{ p: 'a' } : { p: "a"; }
+>p : "a"
>'a' : "a"
diff --git a/tests/baselines/reference/destructuringParameterProperties2.symbols b/tests/baselines/reference/destructuringParameterProperties2.symbols
index 3b1662111e49b..b89a8fdb791dc 100644
--- a/tests/baselines/reference/destructuringParameterProperties2.symbols
+++ b/tests/baselines/reference/destructuringParameterProperties2.symbols
@@ -57,9 +57,15 @@ var [x_a, x_b, x_c] = [x.getA(), x.getB(), x.getC()];
>x_a : Symbol(x_a, Decl(destructuringParameterProperties2.ts, 21, 5))
>x_b : Symbol(x_b, Decl(destructuringParameterProperties2.ts, 21, 9))
>x_c : Symbol(x_c, Decl(destructuringParameterProperties2.ts, 21, 14))
+>x.getA : Symbol(C1.getA, Decl(destructuringParameterProperties2.ts, 5, 5))
>x : Symbol(x, Decl(destructuringParameterProperties2.ts, 20, 3))
+>getA : Symbol(C1.getA, Decl(destructuringParameterProperties2.ts, 5, 5))
+>x.getB : Symbol(C1.getB, Decl(destructuringParameterProperties2.ts, 9, 5))
>x : Symbol(x, Decl(destructuringParameterProperties2.ts, 20, 3))
+>getB : Symbol(C1.getB, Decl(destructuringParameterProperties2.ts, 9, 5))
+>x.getC : Symbol(C1.getC, Decl(destructuringParameterProperties2.ts, 13, 5))
>x : Symbol(x, Decl(destructuringParameterProperties2.ts, 20, 3))
+>getC : Symbol(C1.getC, Decl(destructuringParameterProperties2.ts, 13, 5))
var y = new C1(10, [0, "", true]);
>y : Symbol(y, Decl(destructuringParameterProperties2.ts, 23, 3))
diff --git a/tests/baselines/reference/destructuringParameterProperties2.types b/tests/baselines/reference/destructuringParameterProperties2.types
index 3b9ea8d273f3a..54b6959f8fbcf 100644
--- a/tests/baselines/reference/destructuringParameterProperties2.types
+++ b/tests/baselines/reference/destructuringParameterProperties2.types
@@ -71,11 +71,11 @@ class C1 {
}
var x = new C1(undefined, [0, undefined, ""]);
->x : any
->new C1(undefined, [0, undefined, ""]) : any
+>x : C1
+>new C1(undefined, [0, undefined, ""]) : C1
>C1 : typeof C1
>undefined : undefined
->[0, undefined, ""] : (string | number)[]
+>[0, undefined, ""] : [number, undefined, string]
>0 : 0
>undefined : undefined
>"" : ""
@@ -86,17 +86,17 @@ var [x_a, x_b, x_c] = [x.getA(), x.getB(), x.getC()];
>x_c : any
>[x.getA(), x.getB(), x.getC()] : [any, any, any]
>x.getA() : any
->x.getA : any
->x : any
->getA : any
+>x.getA : () => any
+>x : C1
+>getA : () => any
>x.getB() : any
->x.getB : any
->x : any
->getB : any
+>x.getB : () => any
+>x : C1
+>getB : () => any
>x.getC() : any
->x.getC : any
->x : any
->getC : any
+>x.getC : () => any
+>x : C1
+>getC : () => any
var y = new C1(10, [0, "", true]);
>y : C1
diff --git a/tests/baselines/reference/destructuringParameterProperties5.errors.txt b/tests/baselines/reference/destructuringParameterProperties5.errors.txt
index fa57ae150a053..6e0f017341da5 100644
--- a/tests/baselines/reference/destructuringParameterProperties5.errors.txt
+++ b/tests/baselines/reference/destructuringParameterProperties5.errors.txt
@@ -11,9 +11,14 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(1
Object literal may only specify known properties, and 'x1' does not exist in type 'ObjType1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,47): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,51): error TS2322: Type 'false' is not assignable to type 'string'.
+tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,39): error TS2339: Property 'x1' does not exist on type 'C1'.
+tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,45): error TS2339: Property 'x2' does not exist on type 'C1'.
+tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,51): error TS2339: Property 'x3' does not exist on type 'C1'.
+tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,57): error TS2339: Property 'y' does not exist on type 'C1'.
+tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,62): error TS2339: Property 'z' does not exist on type 'C1'.
-==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts (12 errors) ====
+==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts (17 errors) ====
type ObjType1 = { x: number; y: string; z: boolean }
type TupleType1 = [ObjType1, number, string]
@@ -50,4 +55,14 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(1
!!! error TS2322: Type 'string' is not assignable to type 'number'.
~~~~~
!!! error TS2322: Type 'false' is not assignable to type 'string'.
- var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
\ No newline at end of file
+ var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
+ ~~
+!!! error TS2339: Property 'x1' does not exist on type 'C1'.
+ ~~
+!!! error TS2339: Property 'x2' does not exist on type 'C1'.
+ ~~
+!!! error TS2339: Property 'x3' does not exist on type 'C1'.
+ ~
+!!! error TS2339: Property 'y' does not exist on type 'C1'.
+ ~
+!!! error TS2339: Property 'z' does not exist on type 'C1'.
\ No newline at end of file
diff --git a/tests/baselines/reference/destructuringParameterProperties5.types b/tests/baselines/reference/destructuringParameterProperties5.types
index 976b79e94957b..58d3b6d005dc6 100644
--- a/tests/baselines/reference/destructuringParameterProperties5.types
+++ b/tests/baselines/reference/destructuringParameterProperties5.types
@@ -55,10 +55,10 @@ class C1 {
}
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false]);
->a : any
->new C1([{ x1: 10, x2: "", x3: true }, "", false]) : any
+>a : C1
+>new C1([{ x1: 10, x2: "", x3: true }, "", false]) : C1
>C1 : typeof C1
->[{ x1: 10, x2: "", x3: true }, "", false] : (string | boolean | { x1: number; x2: string; x3: boolean; })[]
+>[{ x1: 10, x2: "", x3: true }, "", false] : [{ x1: number; x2: string; x3: boolean; }, string, boolean]
>{ x1: 10, x2: "", x3: true } : { x1: number; x2: string; x3: boolean; }
>x1 : number
>10 : 10
@@ -77,18 +77,18 @@ var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
>a_z : any
>[a.x1, a.x2, a.x3, a.y, a.z] : [any, any, any, any, any]
>a.x1 : any
->a : any
+>a : C1
>x1 : any
>a.x2 : any
->a : any
+>a : C1
>x2 : any
>a.x3 : any
->a : any
+>a : C1
>x3 : any
>a.y : any
->a : any
+>a : C1
>y : any
>a.z : any
->a : any
+>a : C1
>z : any
diff --git a/tests/baselines/reference/destructuringTuple.errors.txt b/tests/baselines/reference/destructuringTuple.errors.txt
index 0f3c3c3618230..67700d89b5ad2 100644
--- a/tests/baselines/reference/destructuringTuple.errors.txt
+++ b/tests/baselines/reference/destructuringTuple.errors.txt
@@ -1,4 +1,11 @@
-tests/cases/compiler/destructuringTuple.ts(11,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
+tests/cases/compiler/destructuringTuple.ts(11,7): error TS2461: Type 'number' is not an array type.
+tests/cases/compiler/destructuringTuple.ts(11,48): error TS2769: No overload matches this call.
+ Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
+ Type 'never[]' is not assignable to type 'number'.
+ Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
+ Type 'never[]' is not assignable to type '[]'.
+ Types of property 'length' are incompatible.
+ Type 'number' is not assignable to type '0'.
tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload matches this call.
Overload 1 of 2, '(...items: ConcatArray[]): never[]', gave the following error.
Argument of type 'number' is not assignable to parameter of type 'ConcatArray'.
@@ -6,7 +13,7 @@ tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload mat
Argument of type 'number' is not assignable to parameter of type 'ConcatArray'.
-==== tests/cases/compiler/destructuringTuple.ts (2 errors) ====
+==== tests/cases/compiler/destructuringTuple.ts (3 errors) ====
declare var tuple: [boolean, number, ...string[]];
const [a, b, c, ...rest] = tuple;
@@ -18,8 +25,18 @@ tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload mat
// Repros from #32140
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
- ~~~~~
-!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
+ ~~~~~~~
+!!! error TS2461: Type 'number' is not an array type.
+ ~~~~~~~~~~~~~~~
+!!! error TS2769: No overload matches this call.
+!!! error TS2769: Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
+!!! error TS2769: Type 'never[]' is not assignable to type 'number'.
+!!! error TS2769: Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
+!!! error TS2769: Type 'never[]' is not assignable to type '[]'.
+!!! error TS2769: Types of property 'length' are incompatible.
+!!! error TS2769: Type 'number' is not assignable to type '0'.
+!!! related TS6502 /.ts/lib.es5.d.ts:1350:24: The expected type comes from the return type of this signature.
+!!! related TS6502 /.ts/lib.es5.d.ts:1356:27: The expected type comes from the return type of this signature.
~~
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 2, '(...items: ConcatArray[]): never[]', gave the following error.
diff --git a/tests/baselines/reference/destructuringTuple.types b/tests/baselines/reference/destructuringTuple.types
index 466e4495a1646..dc946bd3d3d66 100644
--- a/tests/baselines/reference/destructuringTuple.types
+++ b/tests/baselines/reference/destructuringTuple.types
@@ -23,23 +23,23 @@ declare var receiver: typeof tuple;
// Repros from #32140
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
->oops1 : undefined
->[1, 2, 3].reduce((accu, el) => accu.concat(el), []) : []
+>oops1 : any
+>[1, 2, 3].reduce((accu, el) => accu.concat(el), []) : number
>[1, 2, 3].reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
>[1, 2, 3] : number[]
>1 : 1
>2 : 2
>3 : 3
>reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
->(accu, el) => accu.concat(el) : (accu: [], el: number) => any
+>(accu, el) => accu.concat(el) : (accu: [], el: number) => never[]
>accu : []
>el : number
->accu.concat(el) : any
+>accu.concat(el) : never[]
>accu.concat : { (...items: ConcatArray[]): never[]; (...items: ConcatArray[]): never[]; }
>accu : []
>concat : { (...items: ConcatArray[]): never[]; (...items: ConcatArray[]): never[]; }
>el : number
->[] : []
+>[] : never[]
const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);
>oops2 : number
diff --git a/tests/baselines/reference/didYouMeanElaborationsForExpressionsWhichCouldBeCalled.types b/tests/baselines/reference/didYouMeanElaborationsForExpressionsWhichCouldBeCalled.types
index bd60a27864513..8bf53bf6dd025 100644
--- a/tests/baselines/reference/didYouMeanElaborationsForExpressionsWhichCouldBeCalled.types
+++ b/tests/baselines/reference/didYouMeanElaborationsForExpressionsWhichCouldBeCalled.types
@@ -71,7 +71,7 @@ foo({
}, getNum(), [
>getNum() : number
>getNum : () => number
->[ 1, 2, getNum] : (number | (() => number))[]
+>[ 1, 2, getNum] : [number, number, () => number]
1,
>1 : 1
diff --git a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.types b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.types
index 5610ea98be071..1cbecfbd3e351 100644
--- a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.types
+++ b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.types
@@ -5,8 +5,8 @@ function f() {
>f : () => void
var d1 = new derived();
->d1 : any
->new derived() : any
+>d1 : derived
+>new derived() : derived
>derived : typeof derived
var d2 = new derived(4);
diff --git a/tests/baselines/reference/exportAssignmentConstrainedGenericType.types b/tests/baselines/reference/exportAssignmentConstrainedGenericType.types
index f70d2001a112f..08ac4560e108e 100644
--- a/tests/baselines/reference/exportAssignmentConstrainedGenericType.types
+++ b/tests/baselines/reference/exportAssignmentConstrainedGenericType.types
@@ -3,8 +3,8 @@ import foo = require("./foo_0");
>foo : typeof foo
var x = new foo(true); // Should error
->x : any
->new foo(true) : any
+>x : foo<{ a: string; b: number; }>
+>new foo(true) : foo<{ a: string; b: number; }>
>foo : typeof foo
>true : true
diff --git a/tests/baselines/reference/extractInferenceImprovement.errors.txt b/tests/baselines/reference/extractInferenceImprovement.errors.txt
index b3582f6b02227..74b2f61451505 100644
--- a/tests/baselines/reference/extractInferenceImprovement.errors.txt
+++ b/tests/baselines/reference/extractInferenceImprovement.errors.txt
@@ -1,8 +1,10 @@
tests/cases/compiler/extractInferenceImprovement.ts(26,26): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'never'.
+tests/cases/compiler/extractInferenceImprovement.ts(28,1): error TS2322: Type 'string | number' is not assignable to type 'string'.
+ Type 'number' is not assignable to type 'string'.
tests/cases/compiler/extractInferenceImprovement.ts(28,26): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type '"first" | "second"'.
-==== tests/cases/compiler/extractInferenceImprovement.ts (2 errors) ====
+==== tests/cases/compiler/extractInferenceImprovement.ts (3 errors) ====
// repro mostly from https://github.com/Microsoft/TypeScript/issues/25065
function getProperty2(obj: T, key: Extract): T[K] {
return obj[key];
@@ -33,6 +35,9 @@ tests/cases/compiler/extractInferenceImprovement.ts(28,26): error TS2345: Argume
!!! error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'never'.
prop = getProperty3(obj, s);
+ ~~~~
+!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
+!!! error TS2322: Type 'number' is not assignable to type 'string'.
~
!!! error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type '"first" | "second"'.
\ No newline at end of file
diff --git a/tests/baselines/reference/extractInferenceImprovement.types b/tests/baselines/reference/extractInferenceImprovement.types
index 0e18dc30ee005..e14e293e8197a 100644
--- a/tests/baselines/reference/extractInferenceImprovement.types
+++ b/tests/baselines/reference/extractInferenceImprovement.types
@@ -65,17 +65,17 @@ prop = getProperty3(obj, 'first');
// Should fail
prop = getProperty2(obj, s);
->prop = getProperty2(obj, s) : any
+>prop = getProperty2(obj, s) : string
>prop : string
->getProperty2(obj, s) : any
+>getProperty2(obj, s) : string
>getProperty2 : (obj: T, key: Extract) => T[K]
>obj : StrNum
>s : unique symbol
prop = getProperty3(obj, s);
->prop = getProperty3(obj, s) : any
+>prop = getProperty3(obj, s) : string | number
>prop : string
->getProperty3(obj, s) : any
+>getProperty3(obj, s) : string | number
>getProperty3 : >(obj: T, key: K) => T[K]
>obj : StrNum
>s : unique symbol
diff --git a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types
index 776ecd2fc5d61..e097957fcdfc0 100644
--- a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types
+++ b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.types
@@ -5,7 +5,7 @@ function bar(item1: T, item2: T) { }
>item2 : T
bar(1, ""); // Should be ok
->bar(1, "") : any
+>bar(1, "") : void
>bar : (item1: T, item2: T) => void
>1 : 1
>"" : ""
diff --git a/tests/baselines/reference/fixingTypeParametersRepeatedly2.errors.txt b/tests/baselines/reference/fixingTypeParametersRepeatedly2.errors.txt
index 24aa0d124ca19..7ef4455e3d821 100644
--- a/tests/baselines/reference/fixingTypeParametersRepeatedly2.errors.txt
+++ b/tests/baselines/reference/fixingTypeParametersRepeatedly2.errors.txt
@@ -1,7 +1,8 @@
tests/cases/compiler/fixingTypeParametersRepeatedly2.ts(11,32): error TS2741: Property 'toBase' is missing in type 'Base' but required in type 'Derived'.
+tests/cases/compiler/fixingTypeParametersRepeatedly2.ts(17,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'result' must be of type 'Derived', but here has type 'Base'.
-==== tests/cases/compiler/fixingTypeParametersRepeatedly2.ts (1 errors) ====
+==== tests/cases/compiler/fixingTypeParametersRepeatedly2.ts (2 errors) ====
interface Base {
baseProp;
}
@@ -22,4 +23,7 @@ tests/cases/compiler/fixingTypeParametersRepeatedly2.ts(11,32): error TS2741: Pr
// The same error should be observed in both cases.
declare function bar(x: T, func: (p: T) => T): T;
declare function bar(x: T, func: (p: T) => T): T;
- var result = bar(derived, d => d.toBase());
\ No newline at end of file
+ var result = bar(derived, d => d.toBase());
+ ~~~~~~
+!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'result' must be of type 'Derived', but here has type 'Base'.
+!!! related TS6203 tests/cases/compiler/fixingTypeParametersRepeatedly2.ts:11:5: 'result' was also declared here.
\ No newline at end of file
diff --git a/tests/baselines/reference/fixingTypeParametersRepeatedly2.types b/tests/baselines/reference/fixingTypeParametersRepeatedly2.types
index 204e83fe60048..52fb38c025c43 100644
--- a/tests/baselines/reference/fixingTypeParametersRepeatedly2.types
+++ b/tests/baselines/reference/fixingTypeParametersRepeatedly2.types
@@ -18,8 +18,8 @@ declare function foo(x: T, func: (p: T) => T): T;
>p : T
var result = foo(derived, d => d.toBase());
->result : any
->foo(derived, d => d.toBase()) : any
+>result : Derived
+>foo(derived, d => d.toBase()) : Derived
>foo : (x: T, func: (p: T) => T) => T
>derived : Derived
>d => d.toBase() : (d: Derived) => Base
@@ -44,7 +44,7 @@ declare function bar(x: T, func: (p: T) => T): T;
>p : T
var result = bar(derived, d => d.toBase());
->result : any
+>result : Derived
>bar(derived, d => d.toBase()) : Base
>bar : { (x: T, func: (p: T) => T): T; (x: T, func: (p: T) => T): T; }
>derived : Derived
diff --git a/tests/baselines/reference/for-of39.types b/tests/baselines/reference/for-of39.types
index 0b69e4d1b3063..fe0b788c3b31d 100644
--- a/tests/baselines/reference/for-of39.types
+++ b/tests/baselines/reference/for-of39.types
@@ -1,24 +1,24 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of39.ts ===
var map = new Map([["", true], ["", 0]]);
->map : any
->new Map([["", true], ["", 0]]) : any
+>map : Map
+>new Map([["", true], ["", 0]]) : Map
>Map : MapConstructor
->[["", true], ["", 0]] : ((string | boolean)[] | (string | number)[])[]
->["", true] : (string | boolean)[]
+>[["", true], ["", 0]] : ([string, number] | [string, true])[]
+>["", true] : [string, true]
>"" : ""
>true : true
->["", 0] : (string | number)[]
+>["", 0] : [string, number]
>"" : ""
>0 : 0
for (var [k, v] of map) {
->k : any
->v : any
->map : any
+>k : string
+>v : boolean
+>map : Map
k;
->k : any
+>k : string
v;
->v : any
+>v : boolean
}
diff --git a/tests/baselines/reference/functionCallOnConstrainedTypeVariable.types b/tests/baselines/reference/functionCallOnConstrainedTypeVariable.types
index 173f8c8e3ecab..cc053d93d0592 100644
--- a/tests/baselines/reference/functionCallOnConstrainedTypeVariable.types
+++ b/tests/baselines/reference/functionCallOnConstrainedTypeVariable.types
@@ -23,7 +23,7 @@ function call0(p: A | B) {
>p : A | B
p.a("s"); // Error
->p.a("s") : any
+>p.a("s") : string
>p.a : ((x: number) => string) | ((x: boolean) => string)
>p : A | B
>a : ((x: number) => string) | ((x: boolean) => string)
@@ -35,7 +35,7 @@ function callN(p: T) {
>p : T
p.a("s"); // Error
->p.a("s") : any
+>p.a("s") : string
>p.a : ((x: number) => string) | ((x: boolean) => string)
>p : T
>a : ((x: number) => string) | ((x: boolean) => string)
@@ -48,12 +48,12 @@ function callN(p: T) {
>a : ((x: number) => string) | ((x: boolean) => string)
a(""); // Error
->a("") : any
+>a("") : string
>a : T["a"]
>"" : ""
a("", "", "", ""); // Error
->a("", "", "", "") : any
+>a("", "", "", "") : string
>a : T["a"]
>"" : ""
>"" : ""
diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.types b/tests/baselines/reference/functionConstraintSatisfaction2.types
index f0a0f3b61f221..2bfb78286db1f 100644
--- a/tests/baselines/reference/functionConstraintSatisfaction2.types
+++ b/tests/baselines/reference/functionConstraintSatisfaction2.types
@@ -7,18 +7,18 @@ function foo(x: T): T { return x; }
>x : T
foo(1);
->foo(1) : any
+>foo(1) : Function
>foo : (x: T) => T
>1 : 1
foo(() => { }, 1);
->foo(() => { }, 1) : any
+>foo(() => { }, 1) : () => void
>foo : (x: T) => T
>() => { } : () => void
>1 : 1
foo(1, () => { });
->foo(1, () => { }) : any
+>foo(1, () => { }) : Function
>foo : (x: T) => T
>1 : 1
>() => { } : () => void
@@ -52,29 +52,29 @@ var b2: { new (x: T): T };
>x : T
var r = foo2(new Function());
->r : any
->foo2(new Function()) : any
+>r : (x: string) => string
+>foo2(new Function()) : (x: string) => string
>foo2 : string>(x: T) => T
>new Function() : Function
>Function : FunctionConstructor
var r2 = foo2((x: string[]) => x);
->r2 : any
->foo2((x: string[]) => x) : any
+>r2 : (x: string) => string
+>foo2((x: string[]) => x) : (x: string) => string
>foo2 : string>(x: T) => T
>(x: string[]) => x : (x: string[]) => string[]
>x : string[]
>x : string[]
var r6 = foo2(C);
->r6 : any
->foo2(C) : any
+>r6 : (x: string) => string
+>foo2(C) : (x: string) => string
>foo2 : string>(x: T) => T
>C : typeof C
var r7 = foo2(b);
->r7 : any
->foo2(b) : any
+>r7 : (x: string) => string
+>foo2(b) : (x: string) => string
>foo2 : string>(x: T) => T
>b : new (x: string) => string
@@ -87,8 +87,8 @@ var r8 = foo2((x: U) => x); // no error expected
>x : U
var r11 = foo2((x: U, y: V) => x);
->r11 : any
->foo2((x: U, y: V) => x) : any
+>r11 : (x: string) => string
+>foo2((x: U, y: V) => x) : (x: string) => string
>foo2 : string>(x: T) => T
>(x: U, y: V) => x : (x: U, y: V) => U
>x : U
@@ -96,14 +96,14 @@ var r11 = foo2((x: U, y: V) => x);
>x : U
var r13 = foo2(C2);
->r13 : any
->foo2(C2) : any
+>r13 : (x: string) => string
+>foo2(C2) : (x: string) => string
>foo2 : string>(x: T) => T
>C2 : typeof C2
var r14 = foo2(b2);
->r14 : any
->foo2(b2) : any
+>r14 : (x: string) => string
+>foo2(b2) : (x: string) => string
>foo2 : string>(x: T) => T
>b2 : new (x: T) => T
@@ -114,8 +114,8 @@ var f2: F2;
>f2 : F2
var r16 = foo2(f2);
->r16 : any
->foo2(f2) : any
+>r16 : (x: string) => string
+>foo2(f2) : (x: string) => string
>foo2 : string>(x: T) => T
>f2 : F2
@@ -125,12 +125,12 @@ function fff(x: T, y: U) {
>y : U
foo2(x);
->foo2(x) : any
+>foo2(x) : (x: string) => string
>foo2 : string>(x: T) => T
>x : T
foo2(y);
->foo2(y) : any
+>foo2(y) : (x: string) => string
>foo2 : string>(x: T) => T
>y : U
}
diff --git a/tests/baselines/reference/functionOverloads.types b/tests/baselines/reference/functionOverloads.types
index f3fd68f1cb7a1..b3e2616832914 100644
--- a/tests/baselines/reference/functionOverloads.types
+++ b/tests/baselines/reference/functionOverloads.types
@@ -12,8 +12,8 @@ function foo(bar?: string): any { return "" };
>"" : ""
var x = foo(5);
->x : any
->foo(5) : any
+>x : never
+>foo(5) : never
>foo : { (): string; (bar: string): number; }
>5 : 5
diff --git a/tests/baselines/reference/functionOverloads2.types b/tests/baselines/reference/functionOverloads2.types
index 4b6c7edce6c0c..d6075a93af856 100644
--- a/tests/baselines/reference/functionOverloads2.types
+++ b/tests/baselines/reference/functionOverloads2.types
@@ -13,8 +13,8 @@ function foo(bar: any): any { return bar };
>bar : any
var x = foo(true);
->x : any
->foo(true) : any
+>x : never
+>foo(true) : never
>foo : { (bar: string): string; (bar: number): number; }
>true : true
diff --git a/tests/baselines/reference/functionOverloads27.types b/tests/baselines/reference/functionOverloads27.types
index 49e4d80571786..c976e42d93ad6 100644
--- a/tests/baselines/reference/functionOverloads27.types
+++ b/tests/baselines/reference/functionOverloads27.types
@@ -12,8 +12,8 @@ function foo(bar?:any):any{ return '' }
>'' : ""
var x = foo(5);
->x : any
->foo(5) : any
+>x : never
+>foo(5) : never
>foo : { (): string; (bar: string): number; }
>5 : 5
diff --git a/tests/baselines/reference/functionOverloads29.types b/tests/baselines/reference/functionOverloads29.types
index cf24c2b1f24b0..adc25ad5c0ab2 100644
--- a/tests/baselines/reference/functionOverloads29.types
+++ b/tests/baselines/reference/functionOverloads29.types
@@ -13,7 +13,7 @@ function foo(bar:any):any{ return bar }
>bar : any
var x = foo();
->x : any
->foo() : any
+>x : never
+>foo() : never
>foo : { (bar: string): string; (bar: number): number; }
diff --git a/tests/baselines/reference/functionOverloads34.types b/tests/baselines/reference/functionOverloads34.types
index e49f86b5f5a94..8e979aaa96f47 100644
--- a/tests/baselines/reference/functionOverloads34.types
+++ b/tests/baselines/reference/functionOverloads34.types
@@ -16,7 +16,7 @@ function foo(bar:{a:any;}):any{ return bar }
>bar : { a: any; }
var x = foo();
->x : any
->foo() : any
+>x : never
+>foo() : never
>foo : { (bar: { a: number; }): string; (bar: { a: boolean; }): number; }
diff --git a/tests/baselines/reference/functionOverloads37.types b/tests/baselines/reference/functionOverloads37.types
index ccb7db26e5833..99087180604f3 100644
--- a/tests/baselines/reference/functionOverloads37.types
+++ b/tests/baselines/reference/functionOverloads37.types
@@ -16,7 +16,7 @@ function foo(bar:{a:any;}[]):any{ return bar }
>bar : { a: any; }[]
var x = foo();
->x : any
->foo() : any
+>x : never
+>foo() : never
>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; }
diff --git a/tests/baselines/reference/functionOverloads40.types b/tests/baselines/reference/functionOverloads40.types
index 7d744c5b10c67..3ba5b993b5d86 100644
--- a/tests/baselines/reference/functionOverloads40.types
+++ b/tests/baselines/reference/functionOverloads40.types
@@ -16,8 +16,8 @@ function foo(bar:{a:any;}[]):any{ return bar }
>bar : { a: any; }[]
var x = foo([{a:'bar'}]);
->x : any
->foo([{a:'bar'}]) : any
+>x : never
+>foo([{a:'bar'}]) : never
>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; }
>[{a:'bar'}] : { a: string; }[]
>{a:'bar'} : { a: string; }
diff --git a/tests/baselines/reference/functionOverloads41.types b/tests/baselines/reference/functionOverloads41.types
index d16c412737ca4..6dfeb47f22e77 100644
--- a/tests/baselines/reference/functionOverloads41.types
+++ b/tests/baselines/reference/functionOverloads41.types
@@ -16,8 +16,8 @@ function foo(bar:{a:any;}[]):any{ return bar }
>bar : { a: any; }[]
var x = foo([{}]);
->x : any
->foo([{}]) : any
+>x : never
+>foo([{}]) : never
>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; }
>[{}] : {}[]
>{} : {}
diff --git a/tests/baselines/reference/functionTypeArgumentArityErrors.types b/tests/baselines/reference/functionTypeArgumentArityErrors.types
index c91cf39674fe8..3bb8e7ee0c846 100644
--- a/tests/baselines/reference/functionTypeArgumentArityErrors.types
+++ b/tests/baselines/reference/functionTypeArgumentArityErrors.types
@@ -7,11 +7,11 @@ declare function f1(): void;
>f1 : { (): void; (): void; }
f1();
->f1() : any
+>f1() : void
>f1 : { (): void; (): void; }
f1