From 83d6a3d8dbadd3fcdcfb91a0660d6eb37c617b5b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:07:18 +0000 Subject: [PATCH 1/3] Initial plan From bd4ead17a329d14d93e0071b8040eea6a51d7cb5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:22:57 +0000 Subject: [PATCH 2/3] Change default target from ES5 to ESNext in compiler Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> --- src/compiler/commandLineParser.ts | 2 +- src/compiler/utilities.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 345eff350521b..9ff0bf0930bc7 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -583,7 +583,7 @@ export const targetOptionDeclaration: CommandLineOptionOfCustomType = { showInSimplifiedHelpView: true, category: Diagnostics.Language_and_Environment, description: Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations, - defaultValueDescription: ScriptTarget.ES5, + defaultValueDescription: ScriptTarget.ESNext, }; /** @internal */ diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 3f79843f31a30..add8b7a98d796 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -8989,7 +8989,7 @@ const _computedOptions = createComputedCompilerOptions({ (compilerOptions.module === ModuleKind.Node18 && ScriptTarget.ES2022) || (compilerOptions.module === ModuleKind.Node20 && ScriptTarget.ES2023) || (compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) || - ScriptTarget.ES5); + ScriptTarget.ESNext); }, }, module: { From 6770702a27d7015125472382116f0bb10ec80a12 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:32:55 +0000 Subject: [PATCH 3/3] Accept baseline changes for default target ESNext change Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> --- ...onAmbientClassWithSameNameAndCommonRoot.js | 9 +- ...hModuleMemberThatUsesClassTypeParameter.js | 53 +- ...GenericClassStaticFunctionOfTheSameName.js | 11 +- ...GenericClassStaticFunctionOfTheSameName.js | 11 +- ...dStaticFunctionUsingClassPrivateStatics.js | 11 +- ...nctionAndExportedFunctionThatShareAName.js | 22 +- ...ionAndNonExportedFunctionThatShareAName.js | 22 +- ...ticVariableAndExportedVarThatShareAName.js | 22 +- ...VariableAndNonExportedVarThatShareAName.js | 22 +- ...ClassAndModuleWithSameNameAndCommonRoot.js | 19 +- .../EnumAndModuleWithSameNameAndCommonRoot.js | 9 +- ...ichExtendsInterfaceWithInaccessibleType.js | 13 +- ...sClassHeritageListMemberTypeAnnotations.js | 43 +- ...naccessibleTypeInIndexerTypeAnnotations.js | 16 +- ...accessibleTypeInTypeParameterConstraint.js | 47 +- ...TypesInParameterAndReturnTypeAnnotation.js | 18 +- ...ccessibleTypesInParameterTypeAnnotation.js | 18 +- ...InaccessibleTypesInReturnTypeAnnotation.js | 18 +- ...WithAccessibleTypesOnItsExportedMembers.js | 22 +- ...hAccessibleTypesInMemberTypeAnnotations.js | 9 +- ...sibleTypesInNestedMemberTypeAnnotations.js | 9 +- ...cTypeWithInaccessibleTypeAsTypeArgument.js | 8 +- ...WithInaccessibleTypeAsTypeArgument.symbols | 4 +- ...ctionAndModuleWithSameNameAndCommonRoot.js | 2 +- ...oduleWithSameNameAndDifferentCommonRoot.js | 2 +- .../reference/FunctionDeclaration8_es6.js | 3 +- ...ModuleAndClassWithSameNameAndCommonRoot.js | 19 +- .../ModuleAndEnumWithSameNameAndCommonRoot.js | 9 +- ...uleAndFunctionWithSameNameAndCommonRoot.js | 4 +- ...ModuleWithExportedAndNonExportedClasses.js | 36 +- .../ModuleWithExportedAndNonExportedEnums.js | 4 +- ...leWithExportedAndNonExportedImportAlias.js | 9 +- .../NonInitializedExportInInternalModule.js | 20 +- .../reference/TemplateExpression1.js | 2 +- ...ortedAndNonExportedClassesOfTheSameName.js | 40 +- ...tedAndNonExportedLocalVarsOfTheSameName.js | 13 +- ...rgeEachWithExportedClassesOfTheSameName.js | 38 +- ...eEachWithExportedLocalVarsOfTheSameName.js | 27 +- ...rgeEachWithExportedModulesOfTheSameName.js | 22 +- ...esWithTheSameNameAndDifferentCommonRoot.js | 17 +- ...ModulesWithTheSameNameAndSameCommonRoot.js | 13 +- .../reference/TypeGuardWithArrayUnion.js | 8 +- .../reference/TypeGuardWithArrayUnion.symbols | 2 +- .../reference/abstractPropertyInitializer.js | 7 +- .../accessorsAreNotContextuallyTyped.js | 19 +- .../additionOperatorWithAnyAndEveryType.js | 12 +- ...ionOperatorWithConstrainedTypeParameter.js | 3 +- .../additionOperatorWithInvalidOperands.js | 10 +- ...dditionOperatorWithInvalidOperands.symbols | 2 +- ...OperatorWithNullValueAndInvalidOperator.js | 2 +- ...torWithNullValueAndInvalidOperator.symbols | 2 +- .../additionOperatorWithTypeParameter.js | 2 +- ...torWithUndefinedValueAndInvalidOperands.js | 2 +- ...thUndefinedValueAndInvalidOperands.symbols | 2 +- ...ragraphAndLineSeparatorsInStringLiteral.js | 6 +- tests/baselines/reference/ambient.js | 15 +- .../ambientDeclarationsExternal.errors.txt | 30 + .../reference/ambientDeclarationsExternal.js | 5 +- .../ambientDeclarationsExternal.types | 1 + .../reference/ambientDeclarationsPatterns.js | 14 +- .../ambientDeclarationsPatterns_merging1.js | 6 +- .../ambientDeclarationsPatterns_merging2.js | 6 +- .../ambientDeclarationsPatterns_merging3.js | 3 +- ...ationWithReservedIdentifierInDottedPath.js | 5 +- ...tionWithReservedIdentifierInDottedPath2.js | 5 +- .../reference/ambientShorthand.errors.txt | 17 + tests/baselines/reference/ambientShorthand.js | 9 +- .../reference/ambientShorthand.types | 8 + .../reference/ambientShorthand_duplicate.js | 3 +- .../reference/ambientShorthand_merging.js | 3 +- .../reference/ambientShorthand_reExport.js | 32 +- .../amdImportNotAsPrimaryExpression.js | 11 +- .../argumentExpressionContextualTyping.js | 19 +- ...thmeticOperatorWithInvalidOperands.symbols | 2 +- .../arrayAssignmentPatternWithAny.js | 2 +- .../arrayLiteralExpressionContextualTyping.js | 15 +- .../baselines/reference/arrayLiteralSpread.js | 31 +- .../arrayLiteralSpreadES5iterable.js | 47 +- tests/baselines/reference/arrayLiterals.js | 51 +- .../baselines/reference/arrayLiterals.symbols | 2 +- .../baselines/reference/arrayLiterals2ES5.js | 41 +- .../reference/arrayLiterals2ES5.symbols | 10 +- tests/baselines/reference/arrayLiterals3.js | 17 +- .../reference/arrayLiterals3.symbols | 10 +- .../reference/arrowFunctionContexts.js | 101 +- .../reference/arrowFunctionExpressions.js | 94 +- .../reference/arrowFunctionExpressions.types | 8 +- tests/baselines/reference/asOperator1.symbols | 2 +- tests/baselines/reference/asOperator3.js | 20 +- tests/baselines/reference/asOperator4.js | 2 +- tests/baselines/reference/asOperatorASI.js | 13 +- .../reference/asOperatorContextualType.js | 2 +- .../asiPreventsParsingAsNamespace04.js | 2 +- .../asiPreventsParsingAsNamespace05.js | 2 +- .../reference/assertionTypePredicates1.js | 132 +- .../assertionTypePredicates1.symbols | 12 +- .../reference/assertionTypePredicates1.types | 8 +- .../reference/assertionTypePredicates2.js | 10 +- ...assertionsAndNonReturningFunctions.symbols | 8 +- .../assignmentGenericLookupTypeNarrowing.js | 6 +- .../reference/assignmentLHSIsValue.js | 48 +- .../assignmentToParenthesizedIdentifiers.js | 13 +- .../reference/assignmentTypeNarrowing.js | 22 +- .../reference/assignmentTypeNarrowing.symbols | 2 +- tests/baselines/reference/assignments.js | 7 +- .../reference/binaryIntegerLiteralError.js | 6 +- .../bitwiseNotOperatorWithAnyOtherType.js | 14 +- .../bitwiseNotOperatorWithBooleanType.js | 10 +- .../bitwiseNotOperatorWithNumberType.js | 12 +- .../bitwiseNotOperatorWithStringType.js | 12 +- tests/baselines/reference/callChain.2.js | 7 +- tests/baselines/reference/callChain.3.js | 11 +- tests/baselines/reference/callChain.js | 66 +- .../baselines/reference/callChainInference.js | 4 +- tests/baselines/reference/callOverload.js | 13 +- .../baselines/reference/callOverload.symbols | 2 +- .../reference/callWithMissingVoid.js | 44 +- tests/baselines/reference/callWithSpread.js | 102 +- .../reference/callWithSpread.symbols | 2 +- tests/baselines/reference/callWithSpread2.js | 45 +- tests/baselines/reference/callWithSpread3.js | 45 +- tests/baselines/reference/callWithSpread5.js | 13 +- .../reference/callbackOnConstructor.js | 16 +- .../reference/callbackTagVariadicType.js | 8 +- .../canFollowGetSetKeyword.errors.txt | 7 +- .../reference/canFollowGetSetKeyword.js | 67 +- tests/baselines/reference/chained.js | 22 +- tests/baselines/reference/chained2.js | 33 +- ...heckExportsObjectAssignProperty.errors.txt | 8 +- .../checkExportsObjectAssignProperty.symbols | 25 +- .../checkExportsObjectAssignProperty.types | 35 - ...tsObjectAssignPrototypeProperty.errors.txt | 5 +- ...portsObjectAssignPrototypeProperty.symbols | 2 +- .../reference/checkJsdocSatisfiesTag15.js | 28 +- .../baselines/reference/checkJsdocTypeTag1.js | 8 +- .../baselines/reference/checkJsdocTypeTag2.js | 8 +- .../checkJsdocTypeTagOnObjectProperty1.js | 28 +- .../checkJsdocTypeTagOnObjectProperty2.js | 13 +- .../checkJsdocTypedefOnlySourceFile.js | 2 +- .../checkJsxChildrenCanBeTupleType.js | 45 +- .../checkJsxChildrenProperty1.errors.txt | 28 + .../reference/checkJsxChildrenProperty1.js | 10 +- .../reference/checkJsxChildrenProperty10.js | 20 +- .../reference/checkJsxChildrenProperty11.js | 20 +- .../checkJsxChildrenProperty12.errors.txt | 38 + .../reference/checkJsxChildrenProperty12.js | 45 +- .../checkJsxChildrenProperty13.errors.txt | 5 +- .../reference/checkJsxChildrenProperty13.js | 43 +- .../checkJsxChildrenProperty14.errors.txt | 5 +- .../reference/checkJsxChildrenProperty14.js | 42 +- .../checkJsxChildrenProperty15.errors.txt | 5 +- .../reference/checkJsxChildrenProperty15.js | 16 +- .../checkJsxChildrenProperty16.errors.txt | 32 + .../checkJsxChildrenProperty2.errors.txt | 5 +- .../reference/checkJsxChildrenProperty2.js | 22 +- .../checkJsxChildrenProperty3.errors.txt | 45 + .../reference/checkJsxChildrenProperty3.js | 36 +- .../reference/checkJsxChildrenProperty3.types | 2 + .../checkJsxChildrenProperty4.errors.txt | 5 +- .../reference/checkJsxChildrenProperty4.js | 38 +- .../checkJsxChildrenProperty5.errors.txt | 5 +- .../reference/checkJsxChildrenProperty5.js | 38 +- .../checkJsxChildrenProperty6.errors.txt | 49 + .../reference/checkJsxChildrenProperty6.js | 40 +- .../reference/checkJsxChildrenProperty6.types | 1 + .../checkJsxChildrenProperty7.errors.txt | 5 +- .../reference/checkJsxChildrenProperty7.js | 38 +- .../checkJsxChildrenProperty8.errors.txt | 35 + .../reference/checkJsxChildrenProperty8.js | 40 +- .../reference/checkJsxChildrenProperty8.types | 1 + .../checkJsxChildrenProperty9.errors.txt | 12 + .../reference/checkJsxChildrenProperty9.js | 10 +- .../reference/checkJsxChildrenProperty9.types | 2 + .../checkJsxGenericTagHasCorrectInferences.js | 12 +- .../checkJsxIntersectionElementPropsType.js | 28 +- .../checkJsxSubtleSkipContextSensitiveBug.js | 76 +- ...UnionSFXContextualTypeInferredCorrectly.js | 19 +- .../checkObjectDefineProperty.errors.txt | 20 +- .../checkObjectDefineProperty.symbols | 159 --- .../reference/checkObjectDefineProperty.types | 420 +----- .../reference/circularImportAlias.js | 33 +- .../reference/circularReference.errors.txt | 10 +- .../baselines/reference/circularReference.js | 34 +- .../reference/cjsImportInES2015.symbols | 2 +- .../reference/classAbstractAsIdentifier.js | 9 +- ...bstractAssignabilityConstructorFunction.js | 7 +- .../classAbstractClinterfaceAssignability.js | 9 +- .../reference/classAbstractConstructor.js | 8 +- .../classAbstractConstructorAssignability.js | 40 +- .../reference/classAbstractCrashedOnce.js | 35 +- .../reference/classAbstractExtends.js | 62 +- .../reference/classAbstractFactoryFunction.js | 31 +- .../reference/classAbstractGeneric.js | 85 +- .../classAbstractImportInstantiation.js | 7 +- .../reference/classAbstractInAModule.js | 31 +- .../reference/classAbstractInheritance1.js | 101 +- .../reference/classAbstractInheritance2.js | 40 +- .../reference/classAbstractInstantiations1.js | 40 +- .../reference/classAbstractInstantiations2.js | 86 +- .../reference/classAbstractManyKeywords.js | 33 +- .../classAbstractMergedDeclaration.js | 56 +- .../classAbstractMethodInNonAbstractClass.js | 16 +- .../classAbstractMethodWithImplementation.js | 9 +- .../classAbstractMixedWithModifiers.js | 7 +- .../reference/classAbstractOverloads.js | 17 +- .../classAbstractOverrideWithAbstract.js | 73 +- .../reference/classAbstractProperties.js | 7 +- .../reference/classAbstractSingleLineDecl.js | 21 +- .../reference/classAbstractSuperCalls.js | 72 +- .../classAbstractUsingAbstractMethod1.js | 42 +- .../classAbstractUsingAbstractMethods2.js | 98 +- .../classAndInterfaceWithSameName.js | 16 +- .../reference/classAndVariableWithSameName.js | 16 +- .../classAppearsToHaveMembersOfObject.js | 8 +- .../reference/classBodyWithStatements.js | 23 +- .../classConstructorAccessibility.js | 48 +- .../classConstructorAccessibility2.js | 107 +- .../classConstructorAccessibility3.js | 38 +- .../classConstructorAccessibility4.js | 73 +- .../classConstructorAccessibility5.js | 43 +- .../classConstructorOverloadsAccessibility.js | 28 +- ...classConstructorParametersAccessibility.js | 52 +- ...lassConstructorParametersAccessibility2.js | 52 +- ...lassConstructorParametersAccessibility3.js | 39 +- .../reference/classDeclarationLoop.js | 16 +- .../classDoesNotDependOnPrivateMember.js | 8 +- tests/baselines/reference/classExpression.js | 21 +- tests/baselines/reference/classExpression1.js | 7 +- tests/baselines/reference/classExpression2.js | 31 +- tests/baselines/reference/classExpression3.js | 46 +- tests/baselines/reference/classExpression4.js | 13 +- tests/baselines/reference/classExpression5.js | 11 +- .../reference/classExpressionLoop.js | 16 +- .../reference/classExtendingBuiltinType.js | 105 +- .../classExtendingBuiltinType.symbols | 16 +- .../reference/classExtendingClass.js | 59 +- .../reference/classExtendingClassLikeType.js | 89 +- .../reference/classExtendingNonConstructor.js | 78 +- .../baselines/reference/classExtendingNull.js | 51 +- .../reference/classExtendingOptionalChain.js | 38 +- .../reference/classExtendingPrimitive.js | 156 +-- .../reference/classExtendingPrimitive2.js | 30 +- .../reference/classExtendsEveryObjectType.js | 69 +- .../reference/classExtendsEveryObjectType2.js | 33 +- .../baselines/reference/classExtendsItself.js | 42 +- .../reference/classExtendsItselfIndirectly.js | 75 +- .../classExtendsItselfIndirectly2.js | 79 +- .../classExtendsItselfIndirectly3.js | 150 +- ...classExtendsShadowedConstructorFunction.js | 33 +- .../classExtendsValidConstructorFunction.js | 24 +- .../classImplementsMergedClassInterface.js | 32 +- tests/baselines/reference/classInsideBlock.js | 7 +- .../classIsSubtypeOfBaseType.errors.txt | 8 +- .../reference/classIsSubtypeOfBaseType.js | 43 +- .../reference/classPropertyAsPrivate.js | 29 +- .../reference/classPropertyAsProtected.js | 29 +- .../classPropertyIsPublicByDefault.js | 29 +- .../baselines/reference/classStaticBlock19.js | 11 +- .../baselines/reference/classStaticBlock20.js | 23 +- .../baselines/reference/classStaticBlock21.js | 13 +- .../classStaticBlock24(module=amd).js | 12 +- .../classStaticBlock24(module=commonjs).js | 12 +- .../classStaticBlock24(module=es2015).js | 13 +- .../classStaticBlock24(module=es2020).js | 13 +- .../classStaticBlock24(module=es2022).js | 13 +- .../classStaticBlock24(module=esnext).js | 13 +- .../classStaticBlock24(module=system).js | 12 +- .../classStaticBlock24(module=umd).js | 12 +- .../baselines/reference/classStaticBlock27.js | 35 +- .../baselines/reference/classStaticBlock28.js | 13 +- .../reference/classStaticBlock6.errors.txt | 5 +- .../baselines/reference/classStaticBlock6.js | 203 +-- .../reference/classStaticBlock7.errors.txt | 2 - .../baselines/reference/classStaticBlock7.js | 128 +- .../reference/classStaticBlock7.types | 8 +- .../baselines/reference/classStaticBlock8.js | 70 +- .../classWithBaseClassButNoConstructor.js | 71 +- .../reference/classWithConstructors.js | 65 +- .../baselines/reference/classWithEmptyBody.js | 18 +- .../classWithNoConstructorOrBaseClass.js | 17 +- .../classWithPredefinedTypesAsNames.js | 28 +- .../classWithPredefinedTypesAsNames2.js | 7 +- .../classWithSemicolonClassElement1.js | 7 +- .../classWithSemicolonClassElement2.js | 7 +- .../reference/classWithStaticMembers.js | 45 +- .../classWithTwoConstructorDefinitions.js | 18 +- .../classWithoutExplicitConstructor.js | 22 +- .../classWithoutExplicitConstructor.symbols | 2 +- ...ommaOperatorWithSecondOperandObjectType.js | 8 +- ...peratorWithSecondOperandObjectType.symbols | 4 +- ...peratorWithSecondOperandStringType.symbols | 4 +- .../commentEmittingInPreserveJsx1.errors.txt | 36 + .../commentEmittingInPreserveJsx1.js | 4 +- .../commonJSImportAsPrimaryExpression.js | 13 +- .../commonJSImportNotAsPrimaryExpression.js | 11 +- .../comparisonOperatorWithIdenticalObjects.js | 71 +- ...ithNoRelationshipObjectsOnCallSignature.js | 41 +- ...lationshipObjectsOnConstructorSignature.js | 41 +- ...thNoRelationshipObjectsOnIndexSignature.js | 41 +- ...nshipObjectsOnInstantiatedCallSignature.js | 41 +- ...jectsOnInstantiatedConstructorSignature.js | 41 +- ...atorWithNoRelationshipObjectsOnProperty.js | 32 +- ...omparisonOperatorWithNumberOperand.symbols | 2 +- ...peratorWithSubtypeObjectOnCallSignature.js | 33 +- ...WithSubtypeObjectOnConstructorSignature.js | 33 +- ...eratorWithSubtypeObjectOnIndexSignature.js | 33 +- ...ubtypeObjectOnInstantiatedCallSignature.js | 33 +- ...bjectOnInstantiatedConstructorSignature.js | 33 +- ...isonOperatorWithSubtypeObjectOnProperty.js | 69 +- .../reference/compoundAssignmentLHSIsValue.js | 65 +- ...ponentiationAssignmentLHSCanBeAssigned1.js | 30 +- ...nentiationAssignmentLHSCannotBeAssigned.js | 88 +- ...dExponentiationAssignmentLHSIsReference.js | 17 +- ...poundExponentiationAssignmentLHSIsValue.js | 123 +- .../reference/computedPropertyNames49_ES5.js | 57 +- .../reference/computedPropertyNames50_ES5.js | 53 +- .../reference/computedPropertyNames51_ES5.js | 9 +- ...onditionalOperatorConditionIsObjectType.js | 16 +- ...ionalOperatorConditionIsObjectType.symbols | 6 +- .../conditionalOperatorWithIdenticalBCT.js | 51 +- .../conditionalOperatorWithoutIdenticalBCT.js | 53 +- tests/baselines/reference/constEnum2.js | 2 +- tests/baselines/reference/constEnum2.symbols | 8 +- .../constLocalsInFunctionExpressions.js | 20 +- .../constructableDecoratorOnClass01.js | 20 +- ...constructorDefaultValuesReferencingThis.js | 55 +- ...uctorFunctionTypeIsAssignableToBaseType.js | 45 +- ...ctorFunctionTypeIsAssignableToBaseType2.js | 46 +- .../constructorHasPrototypeProperty.js | 53 +- ...structorImplementationWithDefaultValues.js | 24 +- ...torImplementationWithDefaultValues.symbols | 2 +- ...tructorImplementationWithDefaultValues2.js | 27 +- ...orImplementationWithDefaultValues2.symbols | 4 +- .../constructorOverloadsWithDefaultValues.js | 16 +- ...structorOverloadsWithOptionalParameters.js | 16 +- .../constructorParameterProperties.js | 20 +- .../constructorParameterProperties2.js | 36 +- ...ctorParameterShadowsOuterScopes.errors.txt | 8 +- .../constructorParameterShadowsOuterScopes.js | 18 +- ...nstructorParameterShadowsOuterScopes.types | 16 +- ...nstructorWithAssignableReturnExpression.js | 39 +- .../constructorWithExpressionLessReturn.js | 31 +- ...FunctionExpressionsAndReturnAnnotations.js | 6 +- .../reference/contextuallyTypedIife.js | 78 +- .../reference/contextuallyTypedIifeStrict.js | 78 +- .../reference/controlFlowAliasing.js | 154 +-- ...ables(useunknownincatchvariables=false).js | 4 +- ...iables(useunknownincatchvariables=true).js | 4 +- .../controlFlowAssignmentExpression.js | 8 +- .../controlFlowBinaryAndExpression.js | 4 +- .../controlFlowBinaryOrExpression.js | 7 +- .../reference/controlFlowBindingElement.js | 54 +- .../controlFlowBindingElement.symbols | 4 +- .../reference/controlFlowCommaOperator.js | 4 +- .../controlFlowConditionalExpression.js | 4 +- .../reference/controlFlowDeleteOperator.js | 2 +- .../controlFlowDestructuringDeclaration.js | 38 +- .../reference/controlFlowDoWhileStatement.js | 16 +- .../controlFlowDoWhileStatement.symbols | 8 +- .../reference/controlFlowElementAccess.js | 4 +- .../reference/controlFlowForInStatement.js | 8 +- .../controlFlowForInStatement.symbols | 4 +- .../reference/controlFlowForInStatement2.js | 6 +- .../reference/controlFlowForOfStatement.js | 7 +- .../controlFlowForOfStatement.symbols | 2 +- .../reference/controlFlowForStatement.js | 14 +- .../reference/controlFlowForStatement.symbols | 2 +- .../reference/controlFlowGenericTypes.js | 63 +- .../reference/controlFlowIfStatement.js | 10 +- .../reference/controlFlowIfStatement.symbols | 6 +- .../reference/controlFlowInOperator.js | 18 +- .../reference/controlFlowInOperator.symbols | 4 +- ...ntrolFlowInstanceOfGuardPrimitives.symbols | 4 +- .../controlFlowInstanceofExtendsFunction.js | 29 +- ...ntrolFlowInstanceofExtendsFunction.symbols | 6 +- .../reference/controlFlowIteration.js | 4 +- .../reference/controlFlowIterationErrors.js | 22 +- .../reference/controlFlowNullishCoalesce.js | 8 +- .../reference/controlFlowOptionalChain.js | 249 ++-- .../controlFlowOptionalChain.symbols | 6 +- .../reference/controlFlowOptionalChain2.js | 24 +- .../reference/controlFlowParameter.js | 26 +- .../reference/controlFlowParameter.symbols | 2 +- .../controlFlowSuperPropertyAccess.js | 35 +- .../reference/controlFlowTruthiness.js | 16 +- .../reference/controlFlowWhileStatement.js | 22 +- .../controlFlowWhileStatement.symbols | 8 +- .../controlFlowWithTemplateLiterals.js | 4 +- .../reference/declarationEmitReadonly.js | 8 +- .../declarationEmitThisPredicates01.js | 35 +- .../declarationEmitThisPredicates02.js | 4 +- ...tionEmitThisPredicatesWithPrivateName01.js | 35 +- ...tionEmitThisPredicatesWithPrivateName02.js | 4 +- .../declarationEmitWorkWithInlineComments.js | 39 +- .../reference/declarationWithNoInitializer.js | 4 +- .../declarationsAndAssignments.errors.txt | 8 +- .../reference/declarationsAndAssignments.js | 130 +- .../reference/decoratorCallGeneric.js | 16 +- .../decoratorMetadataWithTypeOnlyImport2.js | 34 +- .../reference/decoratorOnFunctionParameter.js | 9 +- .../decrementOperatorWithAnyOtherType.js | 8 +- ...eratorWithAnyOtherTypeInvalidOperations.js | 14 +- .../decrementOperatorWithNumberType.js | 8 +- ...OperatorWithNumberTypeInvalidOperations.js | 14 +- ...ementOperatorWithUnsupportedBooleanType.js | 14 +- ...rementOperatorWithUnsupportedStringType.js | 14 +- .../reference/definiteAssignmentAssertions.js | 61 +- ...AssignmentAssertionsWithObjectShortHand.js | 8 +- tests/baselines/reference/deleteChain.js | 27 +- .../deleteOperatorInvalidOperations.js | 8 +- .../deleteOperatorWithAnyOtherType.js | 14 +- .../deleteOperatorWithBooleanType.js | 10 +- .../reference/deleteOperatorWithNumberType.js | 12 +- .../reference/deleteOperatorWithStringType.js | 12 +- ...derivedClassConstructorWithoutSuperCall.js | 77 +- ...ClassFunctionOverridesBaseClassAccessor.js | 47 +- .../derivedClassIncludesInheritedMembers.js | 70 +- ...rivedClassIncludesInheritedMembers.symbols | 2 +- ...idesIndexersWithAssignmentCompatibility.js | 47 +- .../derivedClassOverridesPrivates.js | 51 +- ...ClassOverridesProtectedMembers4.errors.txt | 8 +- .../derivedClassOverridesProtectedMembers4.js | 43 +- ...ivedClassOverridesPublicMembers.errors.txt | 71 + .../derivedClassOverridesPublicMembers.js | 97 +- ...vedClassOverridesWithoutSubtype.errors.txt | 29 + .../derivedClassOverridesWithoutSubtype.js | 51 +- .../derivedClassOverridesWithoutSubtype.types | 2 + ...derivedClassParameterProperties.errors.txt | 8 +- .../derivedClassParameterProperties.js | 185 +-- ...dClassSuperCallsInNonConstructorMembers.js | 80 +- .../derivedClassSuperCallsWithThisArg.js | 77 +- .../reference/derivedClassTransitivity.js | 46 +- .../reference/derivedClassTransitivity2.js | 46 +- .../reference/derivedClassTransitivity3.js | 46 +- .../reference/derivedClassTransitivity4.js | 46 +- .../reference/derivedClassWithAny.errors.txt | 8 +- .../reference/derivedClassWithAny.js | 116 +- ...hPrivateInstanceShadowingPublicInstance.js | 57 +- ...sWithPrivateStaticShadowingPublicStatic.js | 57 +- .../derivedClassWithoutExplicitConstructor.js | 64 +- ...vedClassWithoutExplicitConstructor.symbols | 4 +- ...derivedClassWithoutExplicitConstructor2.js | 64 +- ...edClassWithoutExplicitConstructor2.symbols | 14 +- ...derivedClassWithoutExplicitConstructor3.js | 94 +- ...edClassWithoutExplicitConstructor3.symbols | 8 +- .../derivedGenericClassWithAny.errors.txt | 8 +- .../reference/derivedGenericClassWithAny.js | 89 +- ...sesHiddenBaseCallViaSuperPropertyAccess.js | 45 +- .../derivedTypeDoesNotRequireExtendsClause.js | 42 +- ...ninitializedPropertyDeclaration.errors.txt | 14 +- ...derivedUninitializedPropertyDeclaration.js | 175 +-- ...ingArrayBindingPatternAndAssignment1ES5.js | 41 +- ...BindingPatternAndAssignment1ES5iterable.js | 57 +- ...rayBindingPatternAndAssignment2.errors.txt | 16 +- ...turingArrayBindingPatternAndAssignment2.js | 23 +- ...gArrayBindingPatternAndAssignment2.symbols | 4 +- ...ingArrayBindingPatternAndAssignment2.types | 4 + ...turingArrayBindingPatternAndAssignment3.js | 15 +- ...PatternAndAssignment5SiblingInitializer.js | 14 +- ...destructuringAssignabilityCheck.errors.txt | 16 +- .../destructuringAssignabilityCheck.js | 16 +- .../baselines/reference/destructuringCatch.js | 12 +- .../reference/destructuringControlFlow.js | 35 +- .../reference/destructuringInFunctionType.js | 5 +- ...ngObjectBindingPatternAndAssignment1ES5.js | 22 +- ...uringObjectBindingPatternAndAssignment3.js | 12 +- ...uringObjectBindingPatternAndAssignment4.js | 14 +- ...uringObjectBindingPatternAndAssignment5.js | 18 +- ...PatternAndAssignment9SiblingInitializer.js | 14 +- .../destructuringParameterDeclaration1ES5.js | 120 +- ...cturingParameterDeclaration1ES5iterable.js | 136 +- .../destructuringParameterDeclaration2.js | 76 +- .../destructuringParameterDeclaration4.js | 64 +- ...destructuringParameterDeclaration4.symbols | 16 +- .../destructuringParameterDeclaration5.js | 68 +- .../destructuringParameterDeclaration6.js | 39 +- .../destructuringParameterDeclaration6.types | 4 +- .../destructuringParameterDeclaration8.js | 3 +- .../destructuringParameterProperties1.js | 31 +- .../destructuringParameterProperties2.js | 28 +- .../destructuringParameterProperties3.js | 30 +- .../destructuringParameterProperties5.js | 11 +- .../reference/destructuringSameNames.js | 45 +- .../reference/destructuringSpread.js | 39 +- .../destructuringVariableDeclaration1ES5.js | 35 +- ...ucturingVariableDeclaration1ES5iterable.js | 51 +- .../destructuringVariableDeclaration2.js | 10 +- .../baselines/reference/destructuringVoid.js | 2 +- .../destructuringVoidStrictNullChecks.js | 2 +- .../destructuringWithLiteralInitializers.js | 48 +- .../destructuringWithLiteralInitializers2.js | 80 +- .../disallowLineTerminatorBeforeArrow.js | 83 +- .../duplicateExportAssignments.errors.txt | 43 +- .../reference/duplicateExportAssignments.js | 30 +- .../duplicatePropertiesInTypeAssertions01.js | 2 +- .../duplicatePropertiesInTypeAssertions02.js | 2 +- ...ynamicImportDeferInvalidStandalone.symbols | 2 +- .../reference/elementAccessChain.2.js | 11 +- .../reference/elementAccessChain.3.js | 59 +- .../baselines/reference/elementAccessChain.js | 33 +- ...tionWithPropertyAccessInHeritageClause1.js | 31 +- .../emptyArrayBindingPatternParameter01.js | 4 +- .../emptyArrayBindingPatternParameter01.types | 4 +- .../emptyArrayBindingPatternParameter02.js | 4 +- .../emptyArrayBindingPatternParameter02.types | 4 +- .../emptyArrayBindingPatternParameter03.js | 4 +- .../emptyArrayBindingPatternParameter03.types | 4 +- .../emptyArrayBindingPatternParameter04.js | 3 +- .../emptyObjectBindingPatternParameter01.js | 2 +- .../emptyObjectBindingPatternParameter02.js | 2 +- .../emptyObjectBindingPatternParameter03.js | 2 +- .../emptyObjectBindingPatternParameter04.js | 3 +- .../reference/enumClassification.symbols | 2 +- .../enumConstantMemberWithTemplateLiterals.js | 6 +- ...mberWithTemplateLiteralsEmitDeclaration.js | 2 +- ...umErrorOnConstantBindingWithInitializer.js | 2 +- tests/baselines/reference/enumErrors.js | 4 +- tests/baselines/reference/enumErrors.symbols | 6 +- tests/baselines/reference/enumMerging.js | 18 +- .../baselines/reference/enumMergingErrors.js | 30 +- .../reference/enumShadowedInfinityNaN.js | 12 +- tests/baselines/reference/enums.js | 15 +- .../errorOnFunctionReturnType.errors.txt | 7 +- tests/baselines/reference/errorSuperCalls.js | 147 +- .../errorSuperPropertyAccess.errors.txt | 55 +- .../reference/errorSuperPropertyAccess.js | 210 ++- .../reference/exhaustiveSwitchStatements1.js | 25 +- .../exhaustiveSwitchStatements1.symbols | 10 +- .../exponentiationOperatorWithAnyAndNumber.js | 16 +- .../exponentiationOperatorWithEnum.js | 24 +- .../exponentiationOperatorWithEnumUnion.js | 24 +- ...ponentiationOperatorWithInvalidOperands.js | 96 +- ...tiationOperatorWithInvalidOperands.symbols | 2 +- ...ithInvalidSimpleUnaryExpressionOperands.js | 56 +- .../exponentiationOperatorWithNew.js | 6 +- ...OperatorWithNullValueAndInvalidOperands.js | 24 +- ...onOperatorWithNullValueAndValidOperands.js | 16 +- ...eratorWithOnlyNullValueOrUndefinedValue.js | 8 +- ...exponentiationOperatorWithTypeParameter.js | 22 +- ...torWithUndefinedValueAndInvalidOperands.js | 24 +- ...ratorWithUndefinedValueAndValidOperands.js | 16 +- .../exportAsNamespace1(module=commonjs).js | 2 +- .../exportAsNamespace1(module=es2015).js | 4 +- .../exportAsNamespace1(module=esnext).js | 4 +- .../exportAsNamespace1(module=umd).js | 2 +- .../exportAsNamespace2(module=commonjs).js | 2 +- .../exportAsNamespace2(module=es2015).js | 4 +- .../exportAsNamespace2(module=esnext).js | 4 +- .../exportAsNamespace2(module=umd).js | 2 +- .../exportAsNamespace3(module=amd).js | 2 +- .../exportAsNamespace3(module=commonjs).js | 4 +- .../exportAsNamespace3(module=es2015).js | 6 +- .../exportAsNamespace3(module=esnext).js | 6 +- .../exportAsNamespace3(module=umd).js | 4 +- .../exportAsNamespace4(module=commonjs).js | 6 +- .../exportAsNamespace4(module=es2015).js | 4 +- .../exportAsNamespace4(module=esnext).js | 4 +- .../exportAsNamespace4(module=umd).js | 6 +- .../exportAsNamespace_missingEmitHelpers.js | 2 +- .../exportAssignDottedName.errors.txt | 17 + .../reference/exportAssignDottedName.js | 9 +- .../exportAssignImportedIdentifier.errors.txt | 24 + .../exportAssignImportedIdentifier.js | 13 +- .../exportAssignNonIdentifier.errors.txt | 35 +- .../reference/exportAssignNonIdentifier.js | 28 +- .../exportAssignNonIdentifier.symbols | 4 +- .../reference/exportAssignTypes.errors.txt | 96 ++ .../baselines/reference/exportAssignTypes.js | 31 +- .../reference/exportAssignTypes.symbols | 2 +- .../reference/exportAssignTypes.types | 3 + .../exportAssignmentAndDeclaration.js | 7 +- .../exportAssignmentConstrainedGenericType.js | 11 +- .../reference/exportAssignmentGenericType.js | 10 +- .../reference/exportAssignmentMergedModule.js | 4 +- .../exportAssignmentTopLevelClodule.js | 9 +- tests/baselines/reference/exportBinding.js | 29 +- tests/baselines/reference/exportCodeGen.js | 24 +- ...xportDeclaration(isolatedmodules=false).js | 7 +- ...exportDeclaration(isolatedmodules=true).js | 7 +- ...aration_moduleSpecifier-isolatedModules.js | 6 +- .../exportDeclaration_moduleSpecifier.js | 17 +- .../reference/exportDeclaration_value.js | 10 +- .../reference/exportDeclaredModule.errors.txt | 18 + .../reference/exportDeclaredModule.js | 7 +- .../reference/exportDefault.errors.txt | 5 +- tests/baselines/reference/exportDefault.js | 100 +- .../exportDefaultExpressionComments.js | 4 +- .../reference/exportDefaultNamespace.js | 5 +- .../baselines/reference/exportImportAlias.js | 26 +- tests/baselines/reference/exportNamespace1.js | 35 +- .../baselines/reference/exportNamespace10.js | 19 +- .../baselines/reference/exportNamespace11.js | 20 +- .../baselines/reference/exportNamespace12.js | 12 +- tests/baselines/reference/exportNamespace2.js | 23 +- tests/baselines/reference/exportNamespace3.js | 26 +- tests/baselines/reference/exportNamespace4.js | 23 +- tests/baselines/reference/exportNamespace5.js | 71 +- tests/baselines/reference/exportNamespace6.js | 47 +- tests/baselines/reference/exportNamespace7.js | 60 +- tests/baselines/reference/exportNamespace8.js | 66 +- tests/baselines/reference/exportNamespace9.js | 48 +- .../baselines/reference/exportNamespace_js.js | 18 +- .../exportNonInitializedVariablesAMD.js | 16 +- .../exportNonInitializedVariablesCommonJS.js | 16 +- ...nIfThenStatementNoCrash1(module=esnext).js | 2 +- .../exportNonInitializedVariablesSystem.js | 14 +- .../exportNonInitializedVariablesUMD.js | 16 +- .../reference/exportNonLocalDeclarations.js | 4 +- .../reference/exportNonVisibleType.errors.txt | 45 + .../reference/exportNonVisibleType.js | 25 +- tests/baselines/reference/exportSpecifiers.js | 6 +- .../reference/exportSpellingSuggestion.js | 8 +- .../exportSpellingSuggestion.symbols | 2 +- ...portTypeMergedWithExportStarAsNamespace.js | 16 +- .../baselines/reference/exportsAndImports1.js | 9 +- .../baselines/reference/exportsAndImports2.js | 2 +- .../baselines/reference/exportsAndImports3.js | 9 +- .../extendClassExpressionFromModule.js | 33 +- tests/baselines/reference/extendsClause.js | 50 +- .../reference/filterNamespace_import.js | 30 +- .../reference/fixSignatureCaching.symbols | 20 +- tests/baselines/reference/forgottenNew.js | 7 +- .../baselines/reference/functionCalls.symbols | 4 +- .../functionExpressionContextualTyping1.js | 46 +- ...unctionExpressionContextualTyping1.symbols | 2 +- .../functionExpressionContextualTyping2.js | 2 +- .../functionExpressionContextualTyping3.js | 2 +- .../functionImplementationErrors.errors.txt | 5 +- .../reference/functionImplementationErrors.js | 63 +- .../functionImplementationErrors.symbols | 2 +- .../functionImplementationErrors.types | 12 +- .../reference/functionImplementations.js | 72 +- .../reference/functionOverloadErrors.js | 11 +- .../reference/functionOverloadErrors.symbols | 4 +- ...UseStrictAndSimpleParameterList.errors.txt | 131 ++ ...tionWithUseStrictAndSimpleParameterList.js | 50 +- .../reference/generatedContextualTyping.js | 1227 ++++++----------- .../generatedContextualTyping.symbols | 62 +- tests/baselines/reference/generic.js | 23 +- .../genericClassExpressionInFunction.js | 89 +- .../globalAugmentationModuleResolution.js | 3 +- ...balAugmentationModuleResolution.trace.json | 1063 +++++++++++++- .../reference/globalThisAmbientModules.js | 2 +- .../globalThisBlockscopedProperties.js | 4 +- .../globalThisBlockscopedProperties.symbols | 4 +- .../globalThisBlockscopedProperties.types | 4 +- .../reference/globalThisReadonlyProperties.js | 2 +- tests/baselines/reference/grammarErrors.js | 10 +- ...ngAnInterfaceExtendingClassWithPrivates.js | 41 +- ...gAnInterfaceExtendingClassWithPrivates2.js | 154 +-- ...aceExtendingClassWithProtecteds.errors.txt | 5 +- ...AnInterfaceExtendingClassWithProtecteds.js | 96 +- tests/baselines/reference/implementsClause.js | 23 +- .../reference/importAliasIdentifiers.js | 17 +- .../reference/importAssertion4.errors.txt | 4 +- tests/baselines/reference/importAssertion4.js | 3 +- .../reference/importAssertion5.errors.txt | 4 +- tests/baselines/reference/importAssertion5.js | 3 +- .../reference/importAttributes4.errors.txt | 4 +- .../baselines/reference/importAttributes4.js | 3 +- .../reference/importAttributes5.errors.txt | 4 +- .../baselines/reference/importAttributes5.js | 3 +- .../baselines/reference/importAttributes7.js | 50 +- ...ExpressionNoModuleKindSpecified.errors.txt | 11 +- ...portCallExpressionNoModuleKindSpecified.js | 94 +- .../reference/importClause_default.js | 18 +- .../reference/importClause_namedImports.js | 18 +- .../reference/importClause_namespaceImport.js | 36 +- .../reference/importDefaultNamedType.js | 13 +- .../reference/importDefaultNamedType2.js | 13 +- .../reference/importDefaultNamedType3.js | 14 +- .../reference/importElisionConstEnumMerge1.js | 11 +- ...importEmptyFromModuleNotExisted.errors.txt | 4 +- .../importEmptyFromModuleNotExisted.js | 3 +- .../reference/importEquals1.errors.txt | 15 +- tests/baselines/reference/importEquals1.js | 63 +- .../reference/importEquals2.errors.txt | 10 +- tests/baselines/reference/importEquals2.js | 51 +- tests/baselines/reference/importEquals3.js | 23 +- .../importEqualsDeclaration.errors.txt | 15 +- .../reference/importEqualsDeclaration.js | 27 +- .../reference/importImportOnlyModule.js | 11 +- .../baselines/reference/importSpecifiers1.js | 6 +- tests/baselines/reference/importStatements.js | 9 +- tests/baselines/reference/importTag13.symbols | 8 + tests/baselines/reference/importTag13.types | 7 + .../baselines/reference/importTsBeforeDTs.js | 2 +- .../reference/importsImplicitlyReadonly.js | 8 +- .../importsNotUsedAsValues_error.errors.txt | 20 +- .../reference/importsNotUsedAsValues_error.js | 79 +- .../inOperatorWithInvalidOperands.js | 7 +- .../incrementOperatorWithAnyOtherType.js | 8 +- ...eratorWithAnyOtherTypeInvalidOperations.js | 14 +- .../incrementOperatorWithNumberType.js | 8 +- ...OperatorWithNumberTypeInvalidOperations.js | 14 +- ...ementOperatorWithUnsupportedBooleanType.js | 14 +- ...rementOperatorWithUnsupportedStringType.js | 14 +- .../reference/indexersInClassType.js | 13 +- .../reference/indexersInClassType.symbols | 4 +- .../reference/inferFromBindingPattern.js | 20 +- ...initializerReferencingConstructorLocals.js | 26 +- ...eferencingConstructorParameters.errors.txt | 22 +- ...ializerReferencingConstructorParameters.js | 45 +- .../instanceMemberAssignsToClassPrototype.js | 21 +- .../instanceMemberInitialization.errors.txt | 24 + .../reference/instanceMemberInitialization.js | 19 +- .../instanceMemberInitialization.types | 2 + .../instanceMemberWithComputedPropertyName.js | 15 +- ...nstancePropertiesInheritedIntoClassType.js | 83 +- .../reference/instancePropertyInClassType.js | 48 +- .../instanceofOperatorWithInvalidOperands.js | 9 +- .../instanceofOperatorWithLHSIsObject.js | 7 +- .../instanceofOperatorWithLHSIsObject.symbols | 2 +- ...OperatorWithRHSIsSubtypeOfFunction.symbols | 4 +- .../baselines/reference/instantiatedModule.js | 15 +- .../reference/interfaceExtendingClass.js | 18 +- .../reference/interfaceExtendingClass2.js | 18 +- .../interfaceExtendingClassWithPrivates.js | 8 +- .../interfaceExtendingClassWithPrivates2.js | 24 +- .../interfaceExtendingClassWithProtecteds.js | 8 +- .../interfaceExtendingClassWithProtecteds2.js | 24 +- .../interfaceExtendingOptionalChain.js | 7 +- .../interfaceExtendsObjectIntersection.js | 125 +- ...ExtendsObjectIntersectionErrors.errors.txt | 11 +- ...nterfaceExtendsObjectIntersectionErrors.js | 65 +- .../interfaceWithPropertyOfEveryType.js | 12 +- ...faceWithPropertyThatIsPrivateInBaseType.js | 16 +- ...aceWithPropertyThatIsPrivateInBaseType2.js | 18 +- .../intlDateTimeFormatRangeES2021.js | 2 +- ...aryIntegerLiteralAndOctalIntegerLiteral.js | 8 +- .../invalidImportAliasIdentifiers.js | 8 +- .../reference/invalidInstantiatedModule.js | 9 +- .../invalidModuleWithStatementsOfEveryKind.js | 159 +-- .../invalidModuleWithVarStatements.js | 4 +- .../reference/invalidNestedModules.js | 30 +- .../invalidSyntaxNamespaceImportWithAMD.js | 7 +- ...nvalidSyntaxNamespaceImportWithCommonjs.js | 9 +- .../invalidSyntaxNamespaceImportWithSystem.js | 7 +- ...arationsExportDoubleAssignmentInClosure.js | 2 +- .../jsDeclarationsExportedClassAliases.js | 31 +- ...jsDeclarationsExportedClassAliases.symbols | 4 +- .../reference/jsDeclarationsFunctions.js | 45 +- .../reference/jsDeclarationsFunctionsCjs.js | 7 +- .../jsDeclarationsImportTypeBundled.js | 4 +- ...onsReusesExistingNodesMappingJSDocTypes.js | 19 +- ...bclassWithExplicitNoArgumentConstructor.js | 38 +- .../reference/jsDeclarationsThisTypes.js | 40 +- .../reference/jsDeclarationsTypeAliases.js | 25 +- ...arationsTypeReassignmentFromDeclaration.js | 2 +- ...rationsTypeReassignmentFromDeclaration2.js | 2 +- .../jsDeclarationsTypedefAndImportTypes.js | 21 +- ...tionsTypedefPropertyAndExportAssignment.js | 18 +- .../reference/jsdocDisallowedInTypescript.js | 2 +- .../jsdocDisallowedInTypescript.symbols | 10 +- .../reference/jsdocImplements_class.symbols | 2 +- tests/baselines/reference/jsdocLinkTag1.js | 6 +- tests/baselines/reference/jsdocLinkTag3.js | 8 +- tests/baselines/reference/jsdocLinkTag4.js | 8 +- tests/baselines/reference/jsdocLinkTag5.js | 3 +- tests/baselines/reference/jsdocLinkTag6.js | 35 +- ...jsdocParseDotDotDotInJSDocFunction.symbols | 2 +- .../reference/jsdocParseErrorsInTypescript.js | 4 +- .../reference/jsdocTemplateTagDefault.js | 8 +- .../jsdocTemplateTagNameResolution.js | 4 +- tests/baselines/reference/jsdocTypeTagCast.js | 42 +- .../reference/jsxAndTypeAssertion.js | 7 +- .../jsxCheckJsxNoTypeArgumentsAllowed.js | 8 +- tests/baselines/reference/jsxParsingError1.js | 6 +- tests/baselines/reference/jsxParsingError2.js | 10 +- tests/baselines/reference/jsxParsingError3.js | 12 +- .../jsxParsingError4(strict=false).js | 4 +- .../jsxParsingError4(strict=true).js | 4 +- ...ingErrorImmediateSpreadInAttributeValue.js | 4 +- ...SpreadOverwritesAttributeStrict.errors.txt | 5 +- .../jsxSpreadOverwritesAttributeStrict.js | 20 +- .../reference/logicalAndOperatorStrictMode.js | 144 +- .../baselines/reference/logicalAssignment9.js | 5 +- .../logicalNotOperatorWithAnyOtherType.js | 14 +- .../logicalNotOperatorWithBooleanType.js | 10 +- .../logicalNotOperatorWithNumberType.js | 12 +- .../logicalNotOperatorWithStringType.js | 12 +- ...gicalOrExpressionIsNotContextuallyTyped.js | 2 +- ...FunctionOverloadMixingStaticAndInstance.js | 28 +- .../memberFunctionsWithPrivateOverloads.js | 30 +- .../memberFunctionsWithPublicOverloads.js | 30 +- ...mberFunctionsWithPublicPrivateOverloads.js | 38 +- .../reference/mergeThreeInterfaces2.js | 6 +- .../reference/mergeTwoInterfaces2.js | 4 +- .../reference/mergedClassInterface.js | 14 +- .../mergedInheritedClassInterface.js | 56 +- ...rgedInheritedMembersSatisfyAbstractBase.js | 40 +- .../mergedInterfacesWithInheritedPrivates.js | 28 +- .../mergedInterfacesWithInheritedPrivates2.js | 55 +- .../mergedInterfacesWithInheritedPrivates3.js | 58 +- .../mergedInterfacesWithMultipleBases.js | 54 +- .../mergedInterfacesWithMultipleBases2.js | 90 +- .../mergedInterfacesWithMultipleBases3.js | 45 +- ...mergedInterfacesWithMultipleBases3.symbols | 2 +- .../mergedInterfacesWithMultipleBases4.js | 45 +- .../reference/mergedWithLocalValue.js | 8 +- .../reference/missingAndExcessProperties.js | 34 +- .../reference/mixinAccessModifiers.js | 191 +-- .../reference/mixinClassesAnnotated.js | 99 +- .../reference/mixinClassesAnonymous.js | 113 +- .../reference/mixinClassesAnonymous.symbols | 2 +- .../reference/mixinClassesMembers.js | 81 +- ...ifierOnClassDeclarationMemberInFunction.js | 13 +- ...difierOnClassExpressionMemberInFunction.js | 15 +- .../moduleResolutionWithExtensions.js | 13 +- .../moduleResolutionWithExtensions.trace.json | 1075 ++++++++++++++- .../reference/moduleScoping.errors.txt | 26 + tests/baselines/reference/moduleScoping.js | 11 +- .../moduleWithStatementsOfEveryKind.js | 115 +- tests/baselines/reference/multiline.js | 20 +- .../reference/multipleExportDefault1.js | 7 +- .../reference/multipleExportDefault2.js | 7 +- .../reference/multipleExportDefault3.js | 12 +- .../reference/multipleExportDefault4.js | 12 +- .../reference/multipleExportDefault5.js | 13 +- .../reference/multipleExportDefault6.js | 6 +- tests/baselines/reference/nameCollision.js | 14 +- .../reference/nameDelimitedBySlashes.js | 2 +- .../reference/nameWithFileExtension.js | 2 +- .../reference/nameWithRelativePaths.js | 6 +- .../reference/namespaceImportTypeQuery.js | 27 +- .../reference/namespaceImportTypeQuery2.js | 23 +- .../namespaceImportTypeQuery3.errors.txt | 4 +- .../reference/namespaceImportTypeQuery3.js | 20 +- .../namespaceImportTypeQuery4.errors.txt | 4 +- .../reference/namespaceImportTypeQuery4.js | 16 +- .../reference/namespaceMemberAccess.js | 17 +- .../negateOperatorWithAnyOtherType.js | 14 +- .../negateOperatorWithBooleanType.js | 10 +- .../reference/negateOperatorWithNumberType.js | 12 +- .../reference/negateOperatorWithStringType.js | 12 +- .../reference/nestedClassDeclaration.js | 24 +- tests/baselines/reference/nestedModules.js | 4 +- tests/baselines/reference/nestedNamespace.js | 17 +- .../reference/neverReturningFunctions1.js | 91 +- .../neverReturningFunctions1.symbols | 8 +- .../reference/newOperatorConformance.js | 23 +- .../reference/newOperatorErrorCases.js | 23 +- tests/baselines/reference/newWithSpread.js | 86 +- .../noAssertForUnparseableTypedefs.errors.txt | 4 +- .../noPropertyAccessFromIndexSignature1.js | 8 +- .../reference/nonInstantiatedModule.js | 10 +- .../reference/nonIterableRestElement1.js | 2 +- .../reference/nonIterableRestElement3.js | 2 +- .../reference/nullishCoalescingOperator1.js | 40 +- .../reference/nullishCoalescingOperator10.js | 3 +- .../reference/nullishCoalescingOperator11.js | 2 +- .../reference/nullishCoalescingOperator2.js | 18 +- .../reference/nullishCoalescingOperator3.js | 3 +- .../reference/nullishCoalescingOperator4.js | 4 +- .../reference/nullishCoalescingOperator5.js | 25 +- .../reference/nullishCoalescingOperator6.js | 4 +- .../reference/nullishCoalescingOperator7.js | 8 +- .../reference/nullishCoalescingOperator8.js | 7 +- .../reference/nullishCoalescingOperator9.js | 4 +- .../nullishCoalescingOperator_not_strict.js | 18 +- ...bjectBindingPatternKeywordIdentifiers01.js | 2 +- ...bjectBindingPatternKeywordIdentifiers02.js | 2 +- ...bjectBindingPatternKeywordIdentifiers03.js | 2 +- ...bjectBindingPatternKeywordIdentifiers04.js | 2 +- ...bjectBindingPatternKeywordIdentifiers05.js | 2 +- ...bjectBindingPatternKeywordIdentifiers06.js | 2 +- .../objectLiteralGettersAndSetters.js | 8 +- .../objectLiteralGettersAndSetters.symbols | 6 +- .../reference/objectLiteralNormalization.js | 37 +- ...ectLiteralShorthandPropertiesAssignment.js | 8 +- ...teralShorthandPropertiesAssignmentError.js | 6 +- ...iesAssignmentErrorFromMissingIdentifier.js | 6 +- ...opertiesErrorFromNoneExistingIdentifier.js | 4 +- ...ndPropertiesErrorFromNotUsingIdentifier.js | 15 +- ...teralShorthandPropertiesErrorWithModule.js | 3 +- ...eralShorthandPropertiesFunctionArgument.js | 2 +- ...ralShorthandPropertiesFunctionArgument2.js | 2 +- .../reference/octalIntegerLiteralError.js | 6 +- .../reference/optionalBindingParameters1.js | 3 +- .../reference/optionalBindingParameters2.js | 3 +- .../optionalBindingParametersInOverloads1.js | 6 +- .../optionalBindingParametersInOverloads2.js | 6 +- .../reference/optionalChainingInference.js | 32 +- .../reference/overloadResolution.errors.txt | 5 +- .../baselines/reference/overloadResolution.js | 58 +- .../reference/overloadResolution.symbols | 8 +- ...loadResolutionClassConstructors.errors.txt | 5 +- .../overloadResolutionClassConstructors.js | 101 +- ...verloadResolutionClassConstructors.symbols | 6 +- .../overloadResolutionConstructors.errors.txt | 5 +- .../overloadResolutionConstructors.js | 58 +- .../overloadResolutionConstructors.symbols | 8 +- tests/baselines/reference/overloadTag1.js | 8 +- .../baselines/reference/overloadTag1.symbols | 2 +- ...rInitializersForwardReferencing.errors.txt | 13 +- ...parameterInitializersForwardReferencing.js | 53 +- ...eterInitializersForwardReferencing.symbols | 4 +- ...InitializersForwardReferencing1.errors.txt | 13 +- ...arameterInitializersForwardReferencing1.js | 42 +- ...terInitializersForwardReferencing1.symbols | 6 +- ...meterInitializersForwardReferencing1.types | 26 +- tests/baselines/reference/parentheses.js | 9 +- .../parenthesizedContexualTyping1.js | 32 +- .../parenthesizedContexualTyping1.symbols | 8 +- .../parenthesizedContexualTyping2.js | 38 +- .../parenthesizedContexualTyping2.symbols | 8 +- .../reference/plusOperatorWithAnyOtherType.js | 14 +- .../reference/plusOperatorWithBooleanType.js | 10 +- .../reference/plusOperatorWithNumberType.js | 12 +- .../reference/plusOperatorWithStringType.js | 12 +- ...erveValueImports(isolatedmodules=false).js | 4 +- ...serveValueImports(isolatedmodules=true).js | 4 +- ...ueImports_errors(isolatedmodules=false).js | 7 +- ...lueImports_errors(isolatedmodules=true).js | 7 +- ...ivateClassPropertyAccessibleWithinClass.js | 85 +- tests/baselines/reference/privateIndexer.js | 21 +- tests/baselines/reference/privateIndexer2.js | 8 +- ...vateInstanceMemberAccessibility.errors.txt | 8 +- .../privateInstanceMemberAccessibility.js | 42 +- .../privateNameBadDeclaration.errors.txt | 8 +- .../reference/privateNameBadDeclaration.js | 28 +- .../reference/privateNameInObjectLiteral-1.js | 4 +- .../reference/privateNameInObjectLiteral-2.js | 4 +- .../privateNameInObjectLiteral-3.errors.txt | 5 +- .../reference/privateNameInObjectLiteral-3.js | 4 +- .../privateNameJsBadDeclaration.errors.txt | 8 +- .../reference/privateNamesAndDecorators.js | 13 +- ...tedMembersAreNotAccessibleDestructuring.js | 60 +- .../privateStaticMemberAccessibility.js | 37 +- .../privateStaticNotAccessibleInClodule.js | 9 +- .../privateStaticNotAccessibleInClodule2.js | 34 +- tests/baselines/reference/propertyAccess.js | 35 +- .../reference/propertyAccessChain.2.js | 7 +- .../reference/propertyAccessChain.3.js | 59 +- .../reference/propertyAccessChain.js | 19 +- .../propertyAccessNumericLiterals.js | 6 +- .../propertyAccessStringIndexSignature.js | 4 +- ...AccessStringIndexSignatureNoImplicitAny.js | 4 +- .../reference/propertyAccessWidening.js | 12 +- .../propertyAndAccessorWithSameName.js | 49 +- .../propertyAndFunctionWithSameName.js | 20 +- .../reference/propertyNamedConstructor.js | 18 +- .../reference/propertyNamedPrototype.js | 9 +- ...AccessibleWithinNestedSubclass1.errors.txt | 5 +- ...PropertyAccessibleWithinNestedSubclass1.js | 127 +- ...opertyAccessibleWithinSubclass2.errors.txt | 5 +- ...dClassPropertyAccessibleWithinSubclass2.js | 72 +- ...opertyAccessibleWithinSubclass3.errors.txt | 4 +- ...dClassPropertyAccessibleWithinSubclass3.js | 40 +- ...ctedInstanceMemberAccessibility.errors.txt | 4 +- .../protectedInstanceMemberAccessibility.js | 55 +- ...icClassPropertyAccessibleWithinSubclass.js | 61 +- ...opertyAccessibleWithinSubclass2.errors.txt | 30 - ...cClassPropertyAccessibleWithinSubclass2.js | 54 +- .../protectedStaticNotAccessibleInClodule.js | 9 +- tests/baselines/reference/publicIndexer.js | 21 +- .../baselines/reference/quotedConstructors.js | 41 +- .../reExportAliasMakesInstantiated.js | 7 +- .../readonlyConstructorAssignment.js | 76 +- .../readonlyInConstructorParameters.js | 24 +- tests/baselines/reference/readonlyReadonly.js | 9 +- .../reference/readonlyRestParameters.js | 43 +- .../reference/reexportClassDefinition.js | 35 +- .../reference/relativePathMustResolve.js | 2 +- .../relativePathToDeclarationFile.errors.txt | 36 + .../relativePathToDeclarationFile.js | 6 +- tests/baselines/reference/renamed.js | 19 +- .../restElementWithAssignmentPattern3.js | 3 +- .../restElementWithAssignmentPattern4.js | 3 +- .../restElementWithAssignmentPattern5.js | 3 +- .../restElementWithBindingPattern.js | 2 +- .../restElementWithBindingPattern2.js | 2 +- .../reference/restElementWithInitializer1.js | 2 +- .../reference/restElementWithInitializer2.js | 3 +- .../restElementWithNullInitializer.errors.txt | 12 +- .../restElementWithNullInitializer.js | 12 +- .../restPropertyWithBindingPattern.errors.txt | 4 +- .../restPropertyWithBindingPattern.js | 20 +- .../restPropertyWithBindingPattern.types | 8 +- .../reference/scopeResolutionIdentifiers.js | 16 +- .../scopeResolutionIdentifiers.symbols | 4 +- tests/baselines/reference/seeTag1.js | 6 +- tests/baselines/reference/seeTag2.js | 14 +- tests/baselines/reference/seeTag4.js | 2 +- .../reference/shadowedInternalModule.js | 10 +- .../staticAndNonStaticPropertiesSameName.js | 13 +- tests/baselines/reference/staticFactory1.js | 37 +- .../reference/staticIndexSignature1.js | 11 +- .../reference/staticIndexSignature2.js | 11 +- .../reference/staticIndexSignature3.js | 65 +- .../reference/staticIndexSignature4.js | 14 +- .../reference/staticIndexSignature5.js | 7 +- .../reference/staticIndexSignature6.js | 13 +- .../reference/staticIndexSignature7.js | 18 +- tests/baselines/reference/staticIndexers.js | 21 +- ...mberAssignsToConstructorFunctionMembers.js | 21 +- .../reference/staticMemberInitialization.js | 9 +- .../staticPropertyAndFunctionWithSameName.js | 19 +- .../reference/staticPropertyNotInClassType.js | 40 +- .../reference/strictBindCallApply1.js | 112 +- .../reference/strictBindCallApply2.js | 2 +- .../reference/stringEnumInElementAccess01.js | 2 +- .../superCallBeforeThisAccessing1.js | 37 +- .../superCallBeforeThisAccessing2.js | 35 +- .../superCallBeforeThisAccessing3.js | 39 +- .../superCallBeforeThisAccessing4.js | 43 +- .../superCallBeforeThisAccessing5.js | 24 +- .../superCallBeforeThisAccessing6.js | 35 +- .../superCallBeforeThisAccessing7.js | 39 +- .../superCallBeforeThisAccessing8.js | 40 +- ...HasNoBaseTypeButWithSameSymbolInterface.js | 9 +- ...BaseTypeButWithSameSymbolInterface.symbols | 2 +- .../superCallInConstructorWithNoBaseType.js | 20 +- .../superCallParameterContextualTyping1.js | 33 +- ...uperCallParameterContextualTyping1.symbols | 2 +- .../superCallParameterContextualTyping2.js | 33 +- ...uperCallParameterContextualTyping2.symbols | 2 +- .../superCallParameterContextualTyping3.js | 45 +- tests/baselines/reference/superCalls.js | 57 +- ...perPropertyInConstructorBeforeSuperCall.js | 50 +- .../reference/taggedTemplateChain.js | 8 +- ...sPlainCharactersThatArePartsOfEscapes01.js | 12 +- ...sPlainCharactersThatArePartsOfEscapes02.js | 2 +- ...gedTemplateStringsTypeArgumentInference.js | 60 +- ...mplateStringsTypeArgumentInference.symbols | 4 +- ...emplateStringsWithIncompatibleTypedTags.js | 26 +- ...StringsWithManyCallAndMemberExpressions.js | 6 +- ...dTemplateStringsWithOverloadResolution1.js | 22 +- ...mplateStringsWithOverloadResolution1.types | 4 + ...dTemplateStringsWithOverloadResolution2.js | 20 +- ...mplateStringsWithOverloadResolution2.types | 4 + ...eStringsWithOverloadResolution3.errors.txt | 5 +- ...dTemplateStringsWithOverloadResolution3.js | 48 +- ...lateStringsWithOverloadResolution3.symbols | 2 +- ...aggedTemplateStringsWithTagNamedDeclare.js | 12 +- ...taggedTemplateStringsWithTagsTypedAsAny.js | 28 +- ...tionExpressionsInSubstitutionExpression.js | 12 +- .../taggedTemplateStringsWithTypedTags.js | 24 +- .../taggedTemplateUntypedTagCall01.js | 6 +- .../taggedTemplateUntypedTagCall01.symbols | 2 +- .../taggedTemplateWithConstructableTag01.js | 13 +- .../taggedTemplateWithConstructableTag02.js | 6 +- .../reference/templateInsideCallback.js | 11 +- .../templateStringBinaryOperations.js | 96 +- .../templateStringBinaryOperationsInvalid.js | 192 +-- ...templateStringControlCharacterEscapes01.js | 2 +- ...templateStringControlCharacterEscapes02.js | 2 +- ...templateStringControlCharacterEscapes03.js | 2 +- ...templateStringControlCharacterEscapes04.js | 2 +- .../reference/templateStringInArray.js | 2 +- .../templateStringInArrowFunction.js | 2 +- .../templateStringInCallExpression.js | 2 +- .../reference/templateStringInConditional.js | 2 +- .../templateStringInDeleteExpression.js | 2 +- .../reference/templateStringInDivision.js | 2 +- .../templateStringInEqualityChecks.js | 8 +- .../templateStringInFunctionExpression.js | 4 +- .../reference/templateStringInInOperator.js | 2 +- .../templateStringInIndexExpression.js | 2 +- .../reference/templateStringInInstanceOf.js | 2 +- .../templateStringInInstanceOf.symbols | 2 +- .../reference/templateStringInModuleName.js | 8 +- .../reference/templateStringInModulo.js | 2 +- .../templateStringInMultiplication.js | 2 +- .../templateStringInNewExpression.js | 2 +- .../reference/templateStringInNewOperator.js | 2 +- .../templateStringInObjectLiteral.js | 8 +- .../reference/templateStringInParentheses.js | 2 +- .../templateStringInPropertyAssignment.js | 2 +- .../templateStringInPropertyName1.js | 6 +- .../templateStringInPropertyName2.js | 6 +- .../templateStringInSwitchAndCase.js | 10 +- .../templateStringInTaggedTemplate.js | 6 +- .../templateStringInTypeAssertion.js | 2 +- .../reference/templateStringInTypeOf.js | 2 +- .../reference/templateStringInUnaryPlus.js | 2 +- .../reference/templateStringInWhile.js | 4 +- .../reference/templateStringMultiline1.js | 4 +- .../reference/templateStringMultiline2.js | 4 +- .../reference/templateStringMultiline3.js | 4 +- ...gPlainCharactersThatArePartsOfEscapes01.js | 2 +- ...gPlainCharactersThatArePartsOfEscapes02.js | 2 +- .../reference/templateStringTermination1.js | 2 +- .../reference/templateStringTermination2.js | 2 +- .../reference/templateStringTermination3.js | 2 +- .../reference/templateStringTermination4.js | 2 +- .../reference/templateStringTermination5.js | 2 +- .../reference/templateStringUnterminated1.js | 2 +- .../reference/templateStringUnterminated2.js | 2 +- .../reference/templateStringUnterminated3.js | 2 +- .../reference/templateStringUnterminated4.js | 2 +- .../reference/templateStringUnterminated5.js | 2 +- .../templateStringWhitespaceEscapes1.js | 2 +- .../templateStringWhitespaceEscapes2.js | 2 +- .../templateStringWithBackslashEscapes01.js | 8 +- ...mplateStringWithCommentsInArrowFunction.js | 18 +- .../templateStringWithEmbeddedAddition.js | 2 +- .../templateStringWithEmbeddedArray.js | 2 +- ...templateStringWithEmbeddedArrowFunction.js | 2 +- .../templateStringWithEmbeddedComments.js | 8 +- .../templateStringWithEmbeddedConditional.js | 2 +- .../templateStringWithEmbeddedDivision.js | 2 +- ...ateStringWithEmbeddedFunctionExpression.js | 2 +- .../templateStringWithEmbeddedInOperator.js | 2 +- .../templateStringWithEmbeddedInstanceOf.js | 2 +- ...mplateStringWithEmbeddedInstanceOf.symbols | 2 +- .../templateStringWithEmbeddedModulo.js | 2 +- ...emplateStringWithEmbeddedMultiplication.js | 2 +- .../templateStringWithEmbeddedNewOperator.js | 2 +- ...plateStringWithEmbeddedNewOperator.symbols | 2 +- ...templateStringWithEmbeddedObjectLiteral.js | 2 +- ...emplateStringWithEmbeddedTemplateString.js | 2 +- ...ringWithEmbeddedTypeAssertionOnAddition.js | 2 +- ...emplateStringWithEmbeddedTypeOfOperator.js | 2 +- .../templateStringWithEmbeddedUnaryPlus.js | 2 +- ...eStringWithEmbeddedYieldKeyword.errors.txt | 2 - .../templateStringWithEmbeddedYieldKeyword.js | 42 +- ...mplateStringWithEmbeddedYieldKeyword.types | 4 +- .../templateStringWithEmptyLiteralPortions.js | 26 +- ...ateStringWithOpenCommentInStringPortion.js | 2 +- .../templateStringWithPropertyAccess.js | 2 +- ...tionExpressionsInSubstitutionExpression.js | 2 +- .../thisInInstanceMemberInitializer.js | 19 +- .../reference/thisInInvalidContexts.js | 57 +- ...InInvalidContextsExternalModule.errors.txt | 7 +- .../thisInInvalidContextsExternalModule.js | 60 +- .../reference/thisInObjectLiterals.js | 14 +- .../reference/topLevelAmbientModule.js | 2 +- .../baselines/reference/topLevelFileModule.js | 4 +- .../reference/topLevelFileModuleMissing.js | 2 +- .../topLevelModuleDeclarationAndFile.js | 2 +- .../trailingCommasInBindingPatterns.js | 31 +- .../reference/trailingCommasInGetter.js | 13 +- .../reference/ts-expect-error-nocheck.js | 2 +- .../reference/tsNoCheckForTypescript.js | 15 +- .../tsNoCheckForTypescriptComments1.js | 15 +- .../tsNoCheckForTypescriptComments2.js | 15 +- .../publicApi/with-custom-transformers.js | 111 +- .../reference/tsxAttributeResolution10.js | 10 +- .../reference/tsxAttributeResolution11.js | 10 +- .../reference/tsxAttributeResolution12.js | 2 +- .../tsxAttributeResolution15.errors.txt | 5 +- .../reference/tsxAttributeResolution15.js | 40 +- .../tsxAttributeResolution16.errors.txt | 30 + .../reference/tsxAttributeResolution16.js | 35 +- .../reference/tsxAttributeResolution2.js | 6 +- .../reference/tsxAttributeResolution4.js | 4 +- .../reference/tsxAttributeResolution9.js | 10 +- .../tsxCorrectlyParseLessThanComparison1.js | 32 +- ...tsxDefaultAttributesResolution1.errors.txt | 19 + .../tsxDefaultAttributesResolution1.js | 34 +- ...tsxDefaultAttributesResolution2.errors.txt | 19 + .../tsxDefaultAttributesResolution2.js | 34 +- ...tsxDefaultAttributesResolution3.errors.txt | 5 +- .../tsxDefaultAttributesResolution3.js | 34 +- .../baselines/reference/tsxDynamicTagName5.js | 37 +- .../baselines/reference/tsxDynamicTagName6.js | 4 +- .../baselines/reference/tsxDynamicTagName7.js | 37 +- .../baselines/reference/tsxDynamicTagName8.js | 37 +- .../baselines/reference/tsxDynamicTagName9.js | 37 +- .../reference/tsxElementResolution.js | 21 +- .../reference/tsxElementResolution19.js | 7 +- tests/baselines/reference/tsxEmit1.js | 31 +- tests/baselines/reference/tsxEmit3.js | 19 +- tests/baselines/reference/tsxEmit3.js.map | 4 +- .../reference/tsxEmit3.sourcemap.txt | 432 +++--- .../reference/tsxExternalModuleEmit1.js | 62 +- .../reference/tsxExternalModuleEmit2.js | 15 +- .../tsxGenericArrowFunctionParsing.js | 6 +- .../tsxGenericAttributesType1.errors.txt | 19 + .../reference/tsxGenericAttributesType1.js | 16 +- .../tsxGenericAttributesType2.errors.txt | 11 + .../reference/tsxGenericAttributesType2.js | 8 +- .../tsxGenericAttributesType3.errors.txt | 18 + .../reference/tsxGenericAttributesType3.js | 43 +- .../tsxGenericAttributesType4.errors.txt | 18 + .../reference/tsxGenericAttributesType4.js | 43 +- .../tsxGenericAttributesType5.errors.txt | 22 + .../reference/tsxGenericAttributesType5.js | 44 +- .../tsxGenericAttributesType6.errors.txt | 22 + .../reference/tsxGenericAttributesType6.js | 44 +- .../tsxGenericAttributesType7.errors.txt | 16 + .../reference/tsxGenericAttributesType7.js | 8 +- .../tsxGenericAttributesType8.errors.txt | 16 + .../reference/tsxGenericAttributesType8.js | 8 +- .../tsxGenericAttributesType9.errors.txt | 19 + .../reference/tsxGenericAttributesType9.js | 34 +- .../baselines/reference/tsxInArrowFunction.js | 8 +- .../reference/tsxLibraryManagedAttributes.js | 139 +- .../reference/tsxNamespacedAttributeName1.js | 4 +- .../reference/tsxNamespacedAttributeName2.js | 4 +- .../reference/tsxNamespacedTagName1.js | 8 +- .../reference/tsxNamespacedTagName2.js | 8 +- ...ponentWithDefaultTypeParameter1.errors.txt | 18 + ...ReactComponentWithDefaultTypeParameter1.js | 6 +- ...ponentWithDefaultTypeParameter2.errors.txt | 19 + ...ReactComponentWithDefaultTypeParameter2.js | 8 +- ...ponentWithDefaultTypeParameter3.errors.txt | 5 +- ...ReactComponentWithDefaultTypeParameter3.js | 10 +- tests/baselines/reference/tsxReactEmit1.js | 31 +- tests/baselines/reference/tsxReactEmit2.js | 21 +- tests/baselines/reference/tsxReactEmit4.js | 13 +- tests/baselines/reference/tsxReactEmit5.js | 15 +- tests/baselines/reference/tsxReactEmit6.js | 13 +- .../reference/twoAccessorsWithSameName2.js | 45 +- ...InterfacesWithDifferentConstraints.symbols | 14 +- .../twoInterfacesDifferentRootModule2.js | 2 +- ...edInterfacesWithDifferingOverloads.symbols | 12 +- .../reference/typeAndNamespaceExportMerge.js | 19 +- .../reference/typeArgumentInference.js | 38 +- .../reference/typeArgumentInference.symbols | 8 +- ...ypeArgumentInferenceConstructSignatures.js | 44 +- .../reference/typeArgumentInferenceErrors.js | 6 +- ...mentInferenceTransitiveConstraints.symbols | 10 +- ...peArgumentInferenceWithClassExpression1.js | 20 +- ...peArgumentInferenceWithClassExpression2.js | 20 +- ...peArgumentInferenceWithClassExpression3.js | 18 +- .../typeArgumentInferenceWithConstraints.js | 44 +- .../typeArgumentInferenceWithObjectLiteral.js | 18 +- tests/baselines/reference/typeAssertions.js | 41 +- tests/baselines/reference/typeGuardEnums.js | 2 +- .../baselines/reference/typeGuardFunction.js | 58 +- .../reference/typeGuardFunctionErrors.js | 87 +- .../reference/typeGuardFunctionGenerics.js | 49 +- .../reference/typeGuardFunctionOfFormThis.js | 137 +- .../typeGuardFunctionOfFormThisErrors.js | 60 +- tests/baselines/reference/typeGuardInClass.js | 20 +- .../reference/typeGuardIntersectionTypes.js | 12 +- .../typeGuardNarrowsPrimitiveIntersection.js | 2 +- .../typeGuardNarrowsToLiteralType.js | 2 +- .../typeGuardNarrowsToLiteralTypeUnion.js | 2 +- tests/baselines/reference/typeGuardNesting.js | 18 +- .../reference/typeGuardOfFormExpr1AndExpr2.js | 8 +- .../reference/typeGuardOfFormExpr1OrExpr2.js | 8 +- .../reference/typeGuardOfFormInstanceOf.js | 49 +- .../reference/typeGuardOfFormIsType.js | 41 +- .../reference/typeGuardOfFormTypeOfBoolean.js | 16 +- ...eGuardOfFormTypeOfEqualEqualHasNoEffect.js | 8 +- .../typeGuardOfFormTypeOfFunction.js | 7 +- ...ypeGuardOfFormTypeOfNotEqualHasNoEffect.js | 8 +- .../reference/typeGuardOfFormTypeOfNumber.js | 16 +- .../reference/typeGuardOfFormTypeOfOther.js | 16 +- .../typeGuardOfFormTypeOfPrimitiveSubtype.js | 16 +- .../reference/typeGuardOfFormTypeOfString.js | 16 +- .../typeGuardOfFromPropNameInUnionType.js | 116 +- ...typeGuardOfFromPropNameInUnionType.symbols | 4 +- .../typeGuardTautologicalConsistiency.js | 2 +- .../reference/typeGuardsAsAssertions.js | 33 +- tests/baselines/reference/typeGuardsDefeat.js | 2 +- .../reference/typeGuardsInClassMethods.js | 23 +- .../reference/typeGuardsInDoStatement.js | 2 +- .../reference/typeGuardsInForStatement.js | 2 +- .../reference/typeGuardsInFunction.js | 2 +- .../typeGuardsInFunctionAndModuleBlock.js | 10 +- .../baselines/reference/typeGuardsInModule.js | 2 +- .../reference/typeGuardsInWhileStatement.js | 2 +- .../reference/typeGuardsNestedAssignments.js | 24 +- .../typeGuardsNestedAssignments.symbols | 2 +- .../reference/typeGuardsOnClassProperty.js | 16 +- .../typeGuardsOnClassProperty.symbols | 4 +- .../reference/typeGuardsOnClassProperty.types | 8 +- .../reference/typeGuardsTypeParameters.js | 22 +- .../reference/typeGuardsWithInstanceOf.js | 13 +- .../typeGuardsWithInstanceOf.symbols | 2 +- ...thInstanceOfByConstructorSignature.symbols | 2 +- .../reference/typeOfThisInAccessor.js | 59 +- .../typeOfThisInConstructorParamList.js | 9 +- .../typeOfThisInFunctionExpression.js | 23 +- .../reference/typeOfThisInInstanceMember.js | 25 +- .../reference/typeOfThisInInstanceMember2.js | 26 +- .../reference/typeOfThisInMemberFunctions.js | 43 +- .../typeOfThisInMemberFunctions.symbols | 2 +- .../reference/typeOfThisInStaticMembers.js | 27 +- .../reference/typeOfThisInStaticMembers2.js | 22 +- .../reference/typeOfThisInStaticMembers6.js | 35 +- ...nstanceMemberNarrowedWithLoopAntecedent.js | 29 +- tests/baselines/reference/typeOnlyMerge1.js | 16 +- tests/baselines/reference/typeOnlyMerge2.js | 16 +- tests/baselines/reference/typeOnlyMerge3.js | 13 +- tests/baselines/reference/typeQuery.js | 16 +- .../reference/typeReferenceRelatedFiles.js | 5 +- tests/baselines/reference/typeSatisfaction.js | 16 +- .../typeSatisfaction_contextualTyping1.js | 6 +- .../typeSatisfaction_contextualTyping2.js | 8 +- ...typeSatisfaction_contextualTyping3.symbols | 2 +- .../typeSatisfaction_ensureInterfaceImpl.js | 8 +- ...eSatisfaction_optionalMemberConformance.js | 4 +- .../typeSatisfaction_propNameConstraining.js | 8 +- ...ypeSatisfaction_propertyNameFulfillment.js | 8 +- ...propertyaccessfromindexsignature=false).js | 6 +- ...opropertyaccessfromindexsignature=true).js | 6 +- ...rmance2(nouncheckedindexedaccess=false).js | 6 +- ...ormance2(nouncheckedindexedaccess=true).js | 6 +- ...eSatisfaction_propertyValueConformance3.js | 5 +- ...on_vacuousIntersectionOfContextualTypes.js | 4 +- tests/baselines/reference/typeTagNoErasure.js | 2 +- .../typedefOnSemicolonClassElement.js | 15 +- .../reference/typedefOnStatements.js | 5 +- .../reference/typedefOnStatements.symbols | 2 +- .../reference/typeofImportTypeOnlyExport.js | 28 +- .../typeofOperatorWithAnyOtherType.js | 14 +- .../typeofOperatorWithBooleanType.js | 10 +- .../reference/typeofOperatorWithNumberType.js | 12 +- .../reference/typeofOperatorWithStringType.js | 12 +- ...typesOnlyExternalModuleStillHasInstance.js | 2 +- .../baselines/reference/umd-augmentation-1.js | 8 +- .../baselines/reference/umd-augmentation-2.js | 6 +- .../baselines/reference/umd-augmentation-3.js | 8 +- .../baselines/reference/umd-augmentation-4.js | 6 +- tests/baselines/reference/umd1.js | 4 +- tests/baselines/reference/umd2.js | 4 +- tests/baselines/reference/umd3.js | 6 +- tests/baselines/reference/umd4.js | 6 +- tests/baselines/reference/umd5.js | 8 +- tests/baselines/reference/umd6.js | 2 +- tests/baselines/reference/umd7.js | 2 +- tests/baselines/reference/umd8.js | 6 +- .../reference/valuesMergingAcrossModules.js | 14 +- .../verbatimModuleSyntaxNoElisionESM.js | 18 +- .../reference/voidOperatorWithAnyOtherType.js | 12 +- .../reference/voidOperatorWithBooleanType.js | 10 +- .../reference/voidOperatorWithNumberType.js | 12 +- .../reference/voidOperatorWithStringType.js | 12 +- .../voidParamAssignmentCompatibility.js | 2 +- 1324 files changed, 13637 insertions(+), 20747 deletions(-) create mode 100644 tests/baselines/reference/ambientDeclarationsExternal.errors.txt create mode 100644 tests/baselines/reference/ambientShorthand.errors.txt create mode 100644 tests/baselines/reference/checkJsxChildrenProperty1.errors.txt create mode 100644 tests/baselines/reference/checkJsxChildrenProperty12.errors.txt create mode 100644 tests/baselines/reference/checkJsxChildrenProperty16.errors.txt create mode 100644 tests/baselines/reference/checkJsxChildrenProperty3.errors.txt create mode 100644 tests/baselines/reference/checkJsxChildrenProperty6.errors.txt create mode 100644 tests/baselines/reference/checkJsxChildrenProperty8.errors.txt create mode 100644 tests/baselines/reference/checkJsxChildrenProperty9.errors.txt create mode 100644 tests/baselines/reference/commentEmittingInPreserveJsx1.errors.txt create mode 100644 tests/baselines/reference/derivedClassOverridesPublicMembers.errors.txt create mode 100644 tests/baselines/reference/derivedClassOverridesWithoutSubtype.errors.txt create mode 100644 tests/baselines/reference/exportAssignDottedName.errors.txt create mode 100644 tests/baselines/reference/exportAssignImportedIdentifier.errors.txt create mode 100644 tests/baselines/reference/exportAssignTypes.errors.txt create mode 100644 tests/baselines/reference/exportDeclaredModule.errors.txt create mode 100644 tests/baselines/reference/exportNonVisibleType.errors.txt create mode 100644 tests/baselines/reference/functionWithUseStrictAndSimpleParameterList.errors.txt create mode 100644 tests/baselines/reference/instanceMemberInitialization.errors.txt create mode 100644 tests/baselines/reference/moduleScoping.errors.txt delete mode 100644 tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.errors.txt create mode 100644 tests/baselines/reference/relativePathToDeclarationFile.errors.txt create mode 100644 tests/baselines/reference/tsxAttributeResolution16.errors.txt create mode 100644 tests/baselines/reference/tsxDefaultAttributesResolution1.errors.txt create mode 100644 tests/baselines/reference/tsxDefaultAttributesResolution2.errors.txt create mode 100644 tests/baselines/reference/tsxGenericAttributesType1.errors.txt create mode 100644 tests/baselines/reference/tsxGenericAttributesType2.errors.txt create mode 100644 tests/baselines/reference/tsxGenericAttributesType3.errors.txt create mode 100644 tests/baselines/reference/tsxGenericAttributesType4.errors.txt create mode 100644 tests/baselines/reference/tsxGenericAttributesType5.errors.txt create mode 100644 tests/baselines/reference/tsxGenericAttributesType6.errors.txt create mode 100644 tests/baselines/reference/tsxGenericAttributesType7.errors.txt create mode 100644 tests/baselines/reference/tsxGenericAttributesType8.errors.txt create mode 100644 tests/baselines/reference/tsxGenericAttributesType9.errors.txt create mode 100644 tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter1.errors.txt create mode 100644 tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter2.errors.txt diff --git a/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js b/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js index b9338ff0ab505..eb45397a21612 100644 --- a/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.js @@ -25,13 +25,14 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000 //// [classPoint.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } A.Point = Point; })(A || (A = {})); //// [test.js] diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js index 8dc0f6cd84cc4..8ea3695f594d4 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js @@ -53,44 +53,37 @@ module clodule4 { //// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js] // all expected to be errors -var clodule1 = /** @class */ (function () { - function clodule1() { - } - return clodule1; -}()); +class clodule1 { + id; + value; +} (function (clodule1) { function f(x) { } })(clodule1 || (clodule1 = {})); -var clodule2 = /** @class */ (function () { - function clodule2() { - } - return clodule2; -}()); +class clodule2 { + id; + value; +} (function (clodule2) { var x; - var D = /** @class */ (function () { - function D() { - } - return D; - }()); -})(clodule2 || (clodule2 = {})); -var clodule3 = /** @class */ (function () { - function clodule3() { + class D { + id; + value; } - return clodule3; -}()); +})(clodule2 || (clodule2 = {})); +class clodule3 { + id; + value; +} (function (clodule3) { clodule3.y = { id: T }; })(clodule3 || (clodule3 = {})); -var clodule4 = /** @class */ (function () { - function clodule4() { - } - return clodule4; -}()); +class clodule4 { + id; + value; +} (function (clodule4) { - var D = /** @class */ (function () { - function D() { - } - return D; - }()); + class D { + name; + } })(clodule4 || (clodule4 = {})); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js index 30517849bd828..2594366170240 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js @@ -18,12 +18,11 @@ module clodule { //// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.js] -var clodule = /** @class */ (function () { - function clodule() { - } - clodule.fn = function (id) { }; - return clodule; -}()); +class clodule { + id; + value; + static fn(id) { } +} (function (clodule) { // error: duplicate identifier expected function fn(x, y) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js index 58640ad1de03c..4f75c9d9f5742 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js @@ -18,12 +18,11 @@ module clodule { //// [ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndNonGenericClassStaticFunctionOfTheSameName.js] -var clodule = /** @class */ (function () { - function clodule() { - } - clodule.fn = function (id) { }; - return clodule; -}()); +class clodule { + id; + value; + static fn(id) { } +} (function (clodule) { // error: duplicate identifier expected function fn(x, y) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js index dea890d7551cb..8f04d7ff61637 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js @@ -18,12 +18,11 @@ module clodule { //// [ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js] -var clodule = /** @class */ (function () { - function clodule() { - } - clodule.sfn = function (id) { return 42; }; - return clodule; -}()); +class clodule { + id; + value; + static sfn(id) { return 42; } +} (function (clodule) { // error: duplicate identifier expected function fn(x, y) { diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js index 4b9db74210d12..d839f1f9c5df0 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js @@ -25,28 +25,30 @@ module A { } //// [ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js] -var Point = /** @class */ (function () { - function Point(x, y) { +class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 - return Point; -}()); + static Origin() { return { x: 0, y: 0 }; } // unexpected error here bug 840246 +} (function (Point) { function Origin() { return null; } //expected duplicate identifier error Point.Origin = Origin; })(Point || (Point = {})); var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 - return Point; - }()); + static Origin() { return { x: 0, y: 0 }; } // unexpected error here bug 840246 + } A.Point = Point; (function (Point) { function Origin() { return ""; } //expected duplicate identifier error diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js index 05a7992430e6e..d0d9b0c8dff36 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js @@ -25,27 +25,29 @@ module A { } //// [ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js] -var Point = /** @class */ (function () { - function Point(x, y) { +class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = function () { return { x: 0, y: 0 }; }; - return Point; -}()); + static Origin() { return { x: 0, y: 0 }; } +} (function (Point) { function Origin() { return ""; } // not an error, since not exported })(Point || (Point = {})); var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = function () { return { x: 0, y: 0 }; }; - return Point; - }()); + static Origin() { return { x: 0, y: 0 }; } + } A.Point = Point; (function (Point) { function Origin() { return ""; } // not an error since not exported diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js index 24a032ed00385..39e18b2db231e 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js @@ -25,27 +25,29 @@ module A { } //// [ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.js] -var Point = /** @class */ (function () { - function Point(x, y) { +class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = { x: 0, y: 0 }; - return Point; -}()); + static Origin = { x: 0, y: 0 }; +} (function (Point) { Point.Origin = ""; //expected duplicate identifier error })(Point || (Point = {})); var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = { x: 0, y: 0 }; - return Point; - }()); + static Origin = { x: 0, y: 0 }; + } A.Point = Point; (function (Point) { Point.Origin = ""; //expected duplicate identifier error diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js index 9d84a57d7de15..04d056c1e268e 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js @@ -25,27 +25,29 @@ module A { } //// [ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.js] -var Point = /** @class */ (function () { - function Point(x, y) { +class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = { x: 0, y: 0 }; - return Point; -}()); + static Origin = { x: 0, y: 0 }; +} (function (Point) { var Origin = ""; // not an error, since not exported })(Point || (Point = {})); var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - Point.Origin = { x: 0, y: 0 }; - return Point; - }()); + static Origin = { x: 0, y: 0 }; + } A.Point = Point; (function (Point) { var Origin = ""; // not an error since not exported diff --git a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js index a6ca39648ae61..19721ca0d41c6 100644 --- a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js @@ -45,13 +45,14 @@ var X; (function (X) { var Y; (function (Y) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + x; + y; + } Y.Point = Point; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); @@ -60,7 +61,7 @@ var X; (function (X) { var Y; (function (Y) { - var Point; + let Point; (function (Point) { Point.Origin = new Point(0, 0); })(Point = Y.Point || (Y.Point = {})); @@ -71,11 +72,9 @@ var X; var cl = new X.Y.Point(1, 1); var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ? //// [simple.js] -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { + id; +} (function (A) { A.Instance = new A(); })(A || (A = {})); diff --git a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js index a1f1d12ba161b..c22cabcf7f817 100644 --- a/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.js @@ -25,13 +25,14 @@ var enumdule; enumdule[enumdule["Blue"] = 1] = "Blue"; })(enumdule || (enumdule = {})); (function (enumdule) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } enumdule.Point = Point; })(enumdule || (enumdule = {})); var x; diff --git a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js index 1feeb5834938e..4d35f4cf23ca4 100644 --- a/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js +++ b/tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.js @@ -24,15 +24,16 @@ module A { //// [ExportClassWhichExtendsInterfaceWithInaccessibleType.js] var A; (function (A) { - var Point2d = /** @class */ (function () { - function Point2d(x, y) { + class Point2d { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - Point2d.prototype.fromOrigin = function (p) { + fromOrigin(p) { return 1; - }; - return Point2d; - }()); + } + } A.Point2d = Point2d; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index 1e847b1f1829e..aa285ddcd22e0 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -23,45 +23,26 @@ module A { //// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + x; + y; + } A.Point = Point; A.Origin = { x: 0, y: 0 }; - var Point3d = /** @class */ (function (_super) { - __extends(Point3d, _super); - function Point3d() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Point3d; - }(Point)); + class Point3d extends Point { + z; + } A.Point3d = Point3d; A.Origin3d = { x: 0, y: 0, z: 0 }; - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + start; + end; + constructor(start, end) { this.start = start; this.end = end; } - return Line; - }()); + } A.Line = Line; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js index c989af97c4961..3c40228cf7d44 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js @@ -20,15 +20,11 @@ module A { //// [ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); - var points = /** @class */ (function () { - function points() { - } - return points; - }()); + class Point { + x; + y; + } + class points { + } A.points = points; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index eb5cab521ba77..fe0f2c5013aa5 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -27,47 +27,28 @@ module A { //// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + x; + y; + } A.Origin = { x: 0, y: 0 }; - var Point3d = /** @class */ (function (_super) { - __extends(Point3d, _super); - function Point3d() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Point3d; - }(Point)); + class Point3d extends Point { + z; + } A.Point3d = Point3d; A.Origin3d = { x: 0, y: 0, z: 0 }; - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + start; + end; + constructor(start, end) { this.start = start; this.end = end; } - Line.fromorigin2d = function (p) { + static fromorigin2d(p) { return null; - }; - return Line; - }()); + } + } A.Line = Line; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js index a2484637bbdd8..99ffc66ff2d9e 100644 --- a/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js +++ b/tests/baselines/reference/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js @@ -20,19 +20,19 @@ module A { //// [ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + x; + y; + } A.Point = Point; - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + start; + end; + constructor(start, end) { this.start = start; this.end = end; } - return Line; - }()); + } A.Line = Line; function fromOrigin(p) { return new Line({ x: 0, y: 0 }, p); diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js index 43b5800156161..ed4ee11fe3b81 100644 --- a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js @@ -20,18 +20,18 @@ module A { //// [ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); - var Line = /** @class */ (function () { - function Line(start, end) { + class Point { + x; + y; + } + class Line { + start; + end; + constructor(start, end) { this.start = start; this.end = end; } - return Line; - }()); + } A.Line = Line; function fromOrigin(p) { return new Line({ x: 0, y: 0 }, p); diff --git a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js index fabf8e908d7f6..0312b8e3f6048 100644 --- a/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js +++ b/tests/baselines/reference/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js @@ -20,19 +20,19 @@ module A { //// [ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + x; + y; + } A.Point = Point; - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + start; + end; + constructor(start, end) { this.start = start; this.end = end; } - return Line; - }()); + } function fromOrigin(p) { return new Line({ x: 0, y: 0 }, p); } diff --git a/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js b/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js index 0ca38c274534a..90b5e3dd7ca06 100644 --- a/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js +++ b/tests/baselines/reference/ExportModuleWithAccessibleTypesOnItsExportedMembers.js @@ -25,25 +25,25 @@ module A { //// [ExportModuleWithAccessibleTypesOnItsExportedMembers.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } A.Point = Point; - var B; + let B; (function (B) { B.Origin = new Point(0, 0); - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + constructor(start, end) { } - Line.fromOrigin = function (p) { + static fromOrigin(p) { return new Line({ x: 0, y: 0 }, p); - }; - return Line; - }()); + } + } B.Line = Line; })(B = A.B || (A.B = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js index 0862ac319de28..24a36f8db9a2e 100644 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js @@ -16,13 +16,14 @@ module A { //// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } A.Origin = { x: 0, y: 0 }; A.Unity = { start: new Point(0, 0), end: new Point(1, 0) }; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js index 3949eba847d04..0128d36a336dc 100644 --- a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js @@ -16,12 +16,13 @@ module A { //// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } A.UnitSquare = null; })(A || (A = {})); diff --git a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js index 28ceb3cd41c94..c400f08c02091 100644 --- a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js +++ b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js @@ -13,10 +13,8 @@ module A { //// [ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.js] var A; (function (A) { - var B = /** @class */ (function () { - function B() { - } - return B; - }()); + class B { + id; + } A.beez2 = new Array(); })(A || (A = {})); diff --git a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.symbols b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.symbols index cc5f8b384a33b..ec52750a39cd6 100644 --- a/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.symbols +++ b/tests/baselines/reference/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.symbols @@ -13,11 +13,11 @@ module A { export var beez: Array; >beez : Symbol(beez, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 5, 14)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >B : Symbol(B, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 0, 10)) export var beez2 = new Array(); >beez2 : Symbol(beez2, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 6, 14)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >B : Symbol(B, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 0, 10)) } diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js index daa56620014bd..754b2a0f666c9 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.js @@ -54,7 +54,7 @@ var A; //// [module.js] var A; (function (A) { - var Point; + let Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = A.Point || (A.Point = {})); diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js index 13302ea391a09..91a018432dff9 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndDifferentCommonRoot.js @@ -33,7 +33,7 @@ var A; //// [module.js] var B; (function (B) { - var Point; + let Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = B.Point || (B.Point = {})); diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js index 99453bca92a8a..114f8a31dfc09 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.js +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -4,5 +4,4 @@ var v = { [yield]: foo } //// [FunctionDeclaration8_es6.js] -var _a; -var v = (_a = {}, _a[yield] = foo, _a); +var v = { [yield]: foo }; diff --git a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js index 699e7ce7678c5..2800d105ad2e6 100644 --- a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.js @@ -36,7 +36,7 @@ var X; (function (X) { var Y; (function (Y) { - var Point; + let Point; (function (Point) { Point.Origin = new Point(0, 0); })(Point = Y.Point || (Y.Point = {})); @@ -48,13 +48,14 @@ var X; var Y; (function (Y) { // duplicate identifier - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + x; + y; + } Y.Point = Point; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); @@ -64,8 +65,6 @@ var A; A.Instance = new A(); })(A || (A = {})); // duplicate identifier -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { + id; +} diff --git a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js index 3d0b677e3a6f5..ffcf34d086491 100644 --- a/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ModuleAndEnumWithSameNameAndCommonRoot.js @@ -21,13 +21,14 @@ var y = new enumdule.Point(0, 0); //// [ModuleAndEnumWithSameNameAndCommonRoot.js] var enumdule; (function (enumdule) { - var Point = /** @class */ (function () { - function Point(x, y) { + class Point { + x; + y; + constructor(x, y) { this.x = x; this.y = y; } - return Point; - }()); + } enumdule.Point = Point; })(enumdule || (enumdule = {})); (function (enumdule) { diff --git a/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js b/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js index e9b8f44f89543..20798ccd180a7 100644 --- a/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js +++ b/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.js @@ -32,7 +32,7 @@ module B { //// [module.js] var A; (function (A) { - var Point; + let Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = A.Point || (A.Point = {})); @@ -49,7 +49,7 @@ var A; //// [simple.js] var B; (function (B) { - var Point; + let Point; (function (Point) { Point.Origin = { x: 0, y: 0 }; })(Point = B.Point || (B.Point = {})); diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js index af72b31e8b739..b09fb3d0b12d2 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedClasses.js @@ -38,28 +38,24 @@ var ag2 = new A.A2(); //// [ModuleWithExportedAndNonExportedClasses.js] var A; (function (A_1) { - var A = /** @class */ (function () { - function A() { - } - return A; - }()); + class A { + id; + name; + } A_1.A = A; - var AG = /** @class */ (function () { - function AG() { - } - return AG; - }()); + class AG { + id; + name; + } A_1.AG = AG; - var A2 = /** @class */ (function () { - function A2() { - } - return A2; - }()); - var AG2 = /** @class */ (function () { - function AG2() { - } - return AG2; - }()); + class A2 { + id; + name; + } + class AG2 { + id; + name; + } })(A || (A = {})); // no errors expected, these are all exported var a; diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js index c554648284727..64f93674e4689 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedEnums.js @@ -16,12 +16,12 @@ var b = A.Day.Monday; //// [ModuleWithExportedAndNonExportedEnums.js] var A; (function (A) { - var Color; + let Color; (function (Color) { Color[Color["Red"] = 0] = "Red"; Color[Color["Blue"] = 1] = "Blue"; })(Color = A.Color || (A.Color = {})); - var Day; + let Day; (function (Day) { Day[Day["Monday"] = 0] = "Monday"; Day[Day["Tuesday"] = 1] = "Tuesday"; diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js index 6546aab5783e7..495b6712f0415 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedImportAlias.js @@ -44,13 +44,14 @@ var line = Geometry.Lines.Line; //// [ModuleWithExportedAndNonExportedImportAlias.js] var B; (function (B) { - var Line = /** @class */ (function () { - function Line(start, end) { + class Line { + start; + end; + constructor(start, end) { this.start = start; this.end = end; } - return Line; - }()); + } B.Line = Line; })(B || (B = {})); var Geometry; diff --git a/tests/baselines/reference/NonInitializedExportInInternalModule.js b/tests/baselines/reference/NonInitializedExportInInternalModule.js index 0e4bd13bfb8ea..e7aa96fd60d07 100644 --- a/tests/baselines/reference/NonInitializedExportInInternalModule.js +++ b/tests/baselines/reference/NonInitializedExportInInternalModule.js @@ -41,17 +41,14 @@ var Inner; (function (Inner) { var ; let; - var ; - var A = /** @class */ (function () { - function A() { - } - return A; - }()); - var B; + const ; + class A { + } + let B; (function (B) { B.a = 1, B.c = 2; })(B || (B = {})); - var C; + let C; (function (C) { C.a = 1, C.c = 2; })(C || (C = {})); @@ -60,11 +57,8 @@ var Inner; Inner.b1 = 1; Inner.c1 = 'a'; Inner.d1 = 1; - var D = /** @class */ (function () { - function D() { - } - return D; - }()); + class D { + } Inner.e1 = new D; Inner.f1 = new D; Inner.g1 = new D; diff --git a/tests/baselines/reference/TemplateExpression1.js b/tests/baselines/reference/TemplateExpression1.js index 5bd36658939ec..ada7989792446 100644 --- a/tests/baselines/reference/TemplateExpression1.js +++ b/tests/baselines/reference/TemplateExpression1.js @@ -4,4 +4,4 @@ var v = `foo ${ a //// [TemplateExpression1.js] -var v = "foo ".concat(a); +var v = `foo ${a; diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js index 1edd319cfb27c..86c2d5b7be140 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js @@ -45,22 +45,18 @@ var l: X.Y.Z.Line; //// [TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + x; + y; + } A.Point = Point; })(A || (A = {})); (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - Point.prototype.fromCarthesian = function (p) { + class Point { + fromCarthesian(p) { return { x: p.x, y: p.y }; - }; - return Point; - }()); + } + } })(A || (A = {})); // ensure merges as expected var p; @@ -71,25 +67,21 @@ var X; (function (Y) { var Z; (function (Z) { - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + length; + } Z.Line = Line; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); (function (X) { - var Y; + let Y; (function (Y) { - var Z; + let Z; (function (Z) { - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + name; + } })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js index 16c37108d3f0a..ed1f12d40db33 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.js @@ -44,7 +44,7 @@ var p = new A.Utils.Plane(o, { x: 1, y: 1 }); //// [part1.js] var A; (function (A) { - var Utils; + let Utils; (function (Utils) { function mirror(p) { return { x: p.y, y: p.x }; @@ -58,15 +58,16 @@ var A; (function (A) { // not a collision, since we don't export var Origin = "0,0"; - var Utils; + let Utils; (function (Utils) { - var Plane = /** @class */ (function () { - function Plane(tl, br) { + class Plane { + tl; + br; + constructor(tl, br) { this.tl = tl; this.br = br; } - return Plane; - }()); + } Utils.Plane = Plane; })(Utils = A.Utils || (A.Utils = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js index ebf2a9b46a003..0ff7e62145a80 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js @@ -37,20 +37,18 @@ module X { //// [TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.js] var A; (function (A) { - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + x; + y; + } A.Point = Point; })(A || (A = {})); (function (A) { // expected error - var Point = /** @class */ (function () { - function Point() { - } - return Point; - }()); + class Point { + origin; + angle; + } A.Point = Point; })(A || (A = {})); var X; @@ -59,26 +57,22 @@ var X; (function (Y) { var Z; (function (Z) { - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + length; + } Z.Line = Line; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); (function (X) { - var Y; + let Y; (function (Y) { - var Z; + let Z; (function (Z) { // expected error - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + name; + } Z.Line = Line; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js index 4779ddb70e037..a7e55f4ac51e5 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js @@ -30,12 +30,9 @@ export module A { //// [part1.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = void 0; -var A; +export var A; (function (A) { - var Utils; + let Utils; (function (Utils) { function mirror(p) { return { x: p.y, y: p.x }; @@ -43,24 +40,22 @@ var A; Utils.mirror = mirror; })(Utils = A.Utils || (A.Utils = {})); A.Origin = { x: 0, y: 0 }; -})(A || (exports.A = A = {})); +})(A || (A = {})); //// [part2.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = void 0; -var A; +export var A; (function (A) { // collision with 'Origin' var in other part of merged module A.Origin = { x: 0, y: 0 }; - var Utils; + let Utils; (function (Utils) { - var Plane = /** @class */ (function () { - function Plane(tl, br) { + class Plane { + tl; + br; + constructor(tl, br) { this.tl = tl; this.br = br; } - return Plane; - }()); + } Utils.Plane = Plane; })(Utils = A.Utils || (A.Utils = {})); -})(A || (exports.A = A = {})); +})(A || (A = {})); diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js index fed33c84d7e2b..296da27656543 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.js @@ -44,7 +44,7 @@ var A; })(B = A.B || (A.B = {})); })(A || (A = {})); (function (A) { - var B; + let B; (function (B) { })(B || (B = {})); })(A || (A = {})); @@ -57,25 +57,21 @@ var X; (function (Y) { var Z; (function (Z) { - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + length; + } Z.Line = Line; })(Z = Y.Z || (Y.Z = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); (function (X) { - var Y; + let Y; (function (Y) { - var Z; + let Z; (function (Z) { - var Line = /** @class */ (function () { - function Line() { - } - return Line; - }()); + class Line { + name; + } Z.Line = Line; })(Z || (Z = {})); })(Y = X.Y || (X.Y = {})); diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js index 4b6ee2b14e4bd..b82822308fad0 100644 --- a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.js @@ -33,9 +33,9 @@ module otherRoot { //// [part1.js] var Root; (function (Root) { - var A; + let A; (function (A) { - var Utils; + let Utils; (function (Utils) { function mirror(p) { return { x: p.y, y: p.x }; @@ -47,19 +47,20 @@ var Root; //// [part2.js] var otherRoot; (function (otherRoot) { - var A; + let A; (function (A) { // have to be fully qualified since in different root A.Origin = { x: 0, y: 0 }; - var Utils; + let Utils; (function (Utils) { - var Plane = /** @class */ (function () { - function Plane(tl, br) { + class Plane { + tl; + br; + constructor(tl, br) { this.tl = tl; this.br = br; } - return Plane; - }()); + } Utils.Plane = Plane; })(Utils = A.Utils || (A.Utils = {})); })(A = otherRoot.A || (otherRoot.A = {})); diff --git a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js index d221274edd87b..06deb00217ac6 100644 --- a/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js +++ b/tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.js @@ -42,7 +42,7 @@ var p = new A.Utils.Plane(o, { x: 1, y: 1 }); //// [part1.js] var A; (function (A) { - var Utils; + let Utils; (function (Utils) { function mirror(p) { return { x: p.y, y: p.x }; @@ -54,15 +54,16 @@ var A; var A; (function (A) { A.Origin = { x: 0, y: 0 }; - var Utils; + let Utils; (function (Utils) { - var Plane = /** @class */ (function () { - function Plane(tl, br) { + class Plane { + tl; + br; + constructor(tl, br) { this.tl = tl; this.br = br; } - return Plane; - }()); + } Utils.Plane = Plane; })(Utils = A.Utils || (A.Utils = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/TypeGuardWithArrayUnion.js b/tests/baselines/reference/TypeGuardWithArrayUnion.js index e52e11ff3fa71..93ef513ee1e45 100644 --- a/tests/baselines/reference/TypeGuardWithArrayUnion.js +++ b/tests/baselines/reference/TypeGuardWithArrayUnion.js @@ -13,11 +13,9 @@ function saySize(message: Message | Message[]) { //// [TypeGuardWithArrayUnion.js] -var Message = /** @class */ (function () { - function Message() { - } - return Message; -}()); +class Message { + value; +} function saySize(message) { if (message instanceof Array) { return message.length; // Should have type Message[] here diff --git a/tests/baselines/reference/TypeGuardWithArrayUnion.symbols b/tests/baselines/reference/TypeGuardWithArrayUnion.symbols index 1251771f71981..def746d136cd8 100644 --- a/tests/baselines/reference/TypeGuardWithArrayUnion.symbols +++ b/tests/baselines/reference/TypeGuardWithArrayUnion.symbols @@ -16,7 +16,7 @@ function saySize(message: Message | Message[]) { if (message instanceof Array) { >message : Symbol(message, Decl(TypeGuardWithArrayUnion.ts, 4, 17)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) return message.length; // Should have type Message[] here >message.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/abstractPropertyInitializer.js b/tests/baselines/reference/abstractPropertyInitializer.js index edb169729b932..20bc62f280f08 100644 --- a/tests/baselines/reference/abstractPropertyInitializer.js +++ b/tests/baselines/reference/abstractPropertyInitializer.js @@ -8,11 +8,8 @@ abstract class C { //// [abstractPropertyInitializer.js] "use strict"; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} //// [abstractPropertyInitializer.d.ts] diff --git a/tests/baselines/reference/accessorsAreNotContextuallyTyped.js b/tests/baselines/reference/accessorsAreNotContextuallyTyped.js index 4daab7e02060c..9ec976eb0a6f4 100644 --- a/tests/baselines/reference/accessorsAreNotContextuallyTyped.js +++ b/tests/baselines/reference/accessorsAreNotContextuallyTyped.js @@ -17,19 +17,12 @@ var r = c.x(''); // string //// [accessorsAreNotContextuallyTyped.js] // accessors are not contextually typed -var C = /** @class */ (function () { - function C() { +class C { + set x(v) { } - Object.defineProperty(C.prototype, "x", { - get: function () { - return function (x) { return ""; }; - }, - set: function (v) { - }, - enumerable: false, - configurable: true - }); - return C; -}()); + get x() { + return (x) => ""; + } +} var c; var r = c.x(''); // string diff --git a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js index c9f1290b0f57e..61235d8b9da43 100644 --- a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js @@ -43,12 +43,10 @@ var r20 = a + ((a: string) => { return a }); //// [additionOperatorWithAnyAndEveryType.js] function foo() { } -var C = /** @class */ (function () { - function C() { - } - C.foo = function () { }; - return C; -}()); +class C { + a; + static foo() { } +} var E; (function (E) { E[E["a"] = 0] = "a"; @@ -85,4 +83,4 @@ var r16 = a + M; var r17 = a + ''; var r18 = a + 123; var r19 = a + { a: '' }; -var r20 = a + (function (a) { return a; }); +var r20 = a + ((a) => { return a; }); diff --git a/tests/baselines/reference/additionOperatorWithConstrainedTypeParameter.js b/tests/baselines/reference/additionOperatorWithConstrainedTypeParameter.js index dbf1f3ddaa83e..6bd92fe270e43 100644 --- a/tests/baselines/reference/additionOperatorWithConstrainedTypeParameter.js +++ b/tests/baselines/reference/additionOperatorWithConstrainedTypeParameter.js @@ -21,8 +21,7 @@ function sum(n, v, k) { n += v[k]; // += should work the same way } function realSum(n, vs, k) { - for (var _i = 0, vs_1 = vs; _i < vs_1.length; _i++) { - var v = vs_1[_i]; + for (const v of vs) { n = n + v[k]; n += v[k]; } diff --git a/tests/baselines/reference/additionOperatorWithInvalidOperands.js b/tests/baselines/reference/additionOperatorWithInvalidOperands.js index a5f7e3baa5d4b..215ff3cb8f160 100644 --- a/tests/baselines/reference/additionOperatorWithInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithInvalidOperands.js @@ -44,12 +44,10 @@ var r20 = E.a + M; //// [additionOperatorWithInvalidOperands.js] function foo() { } -var C = /** @class */ (function () { - function C() { - } - C.foo = function () { }; - return C; -}()); +class C { + a; + static foo() { } +} var E; (function (E) { E[E["a"] = 0] = "a"; diff --git a/tests/baselines/reference/additionOperatorWithInvalidOperands.symbols b/tests/baselines/reference/additionOperatorWithInvalidOperands.symbols index 2fc6040b97438..3fe507f80d397 100644 --- a/tests/baselines/reference/additionOperatorWithInvalidOperands.symbols +++ b/tests/baselines/reference/additionOperatorWithInvalidOperands.symbols @@ -35,7 +35,7 @@ var c: Object; var d: Number; >d : Symbol(d, Decl(additionOperatorWithInvalidOperands.ts, 11, 3)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) // boolean + every type except any and string var r1 = a + a; diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js index 8388dbebb3955..5652457a92115 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js @@ -44,4 +44,4 @@ var r7 = null + d; var r8 = null + true; var r9 = null + { a: '' }; var r10 = null + foo(); -var r11 = null + (function () { }); +var r11 = null + (() => { }); diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.symbols b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.symbols index 4e0844055bb5e..6295fb92595ed 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.symbols +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.symbols @@ -19,7 +19,7 @@ var c: void; var d: Number; >d : Symbol(d, Decl(additionOperatorWithNullValueAndInvalidOperator.ts, 7, 3)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) // null + boolean/Object var r1 = null + a; diff --git a/tests/baselines/reference/additionOperatorWithTypeParameter.js b/tests/baselines/reference/additionOperatorWithTypeParameter.js index 7f321c748aeb0..53a18d33ef704 100644 --- a/tests/baselines/reference/additionOperatorWithTypeParameter.js +++ b/tests/baselines/reference/additionOperatorWithTypeParameter.js @@ -76,6 +76,6 @@ function foo(t, u) { var r16 = t + undefined; var r17 = t + t; var r18 = t + u; - var r19 = t + (function () { }); + var r19 = t + (() => { }); var r20 = t + []; } diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js index 755ddc7bc18e3..839a28773427f 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js @@ -44,4 +44,4 @@ var r7 = undefined + d; var r8 = undefined + true; var r9 = undefined + { a: '' }; var r10 = undefined + foo(); -var r11 = undefined + (function () { }); +var r11 = undefined + (() => { }); diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.symbols b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.symbols index 0ea20fccc4a65..7a283158bda62 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.symbols +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.symbols @@ -19,7 +19,7 @@ var c: void; var d: Number; >d : Symbol(d, Decl(additionOperatorWithUndefinedValueAndInvalidOperands.ts, 7, 3)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) // undefined + boolean/Object var r1 = undefined + a; diff --git a/tests/baselines/reference/allowUnescapedParagraphAndLineSeparatorsInStringLiteral.js b/tests/baselines/reference/allowUnescapedParagraphAndLineSeparatorsInStringLiteral.js index 9080fce8c91d5..c54c62dd3d2f0 100644 --- a/tests/baselines/reference/allowUnescapedParagraphAndLineSeparatorsInStringLiteral.js +++ b/tests/baselines/reference/allowUnescapedParagraphAndLineSeparatorsInStringLiteral.js @@ -33,14 +33,14 @@ var stringContainingUnescapedLineSeparator1 = "
STRING_CONTENT
"; var stringContainingUnescapedParagraphSeparator1 = "
STRING_CONTENT
"; var stringContainingUnescapedLineSeparator2 = '
STRING_CONTENT
'; var stringContainingUnescapedParagraphSeparator2 = '
STRING_CONTENT
'; -var stringContainingUnescapedLineSeparator3 = "\u2028STRING_CONTENT\u2028"; -var stringContainingUnescapedParagraphSeparator3 = "\u2029STRING_CONTENT\u2029"; +var stringContainingUnescapedLineSeparator3 = `
STRING_CONTENT
`; +var stringContainingUnescapedParagraphSeparator3 = `
STRING_CONTENT
`; // Array of unescaped line / paragraph separators var arr = [ "

STRING_CONTENT

", "


STRING_CONTENT


", "STRING_CONTENT
", "
STRING_CONTENT", - "", + `\
`, '
' ]; diff --git a/tests/baselines/reference/ambient.js b/tests/baselines/reference/ambient.js index 5e94b128f71b8..bccf8e4e79bf4 100644 --- a/tests/baselines/reference/ambient.js +++ b/tests/baselines/reference/ambient.js @@ -12,15 +12,8 @@ declare namespace ns { //// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = void 0; -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -exports.A = A; +export class A { + a; +} //// [b.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/ambientDeclarationsExternal.errors.txt b/tests/baselines/reference/ambientDeclarationsExternal.errors.txt new file mode 100644 index 0000000000000..d3960bc394980 --- /dev/null +++ b/tests/baselines/reference/ambientDeclarationsExternal.errors.txt @@ -0,0 +1,30 @@ +consumer.ts(2,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. +consumer.ts(6,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== consumer.ts (2 errors) ==== + /// + import imp1 = require('equ'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + + // Ambient external module members are always exported with or without export keyword when module lacks export assignment + import imp3 = require('equ2'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + var n = imp3.x; + var n: number; + +==== decls.ts (0 errors) ==== + // Ambient external module with export assignment + declare module 'equ' { + var x; + export = x; + } + + declare module 'equ2' { + var x: number; + } + + // Ambient external import declaration referencing ambient external module using top level module name \ No newline at end of file diff --git a/tests/baselines/reference/ambientDeclarationsExternal.js b/tests/baselines/reference/ambientDeclarationsExternal.js index 6a4569d3dfcef..97e478808a6d5 100644 --- a/tests/baselines/reference/ambientDeclarationsExternal.js +++ b/tests/baselines/reference/ambientDeclarationsExternal.js @@ -26,9 +26,6 @@ var n: number; //// [decls.js] // Ambient external import declaration referencing ambient external module using top level module name //// [consumer.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// Ambient external module members are always exported with or without export keyword when module lacks export assignment -var imp3 = require("equ2"); var n = imp3.x; var n; +export {}; diff --git a/tests/baselines/reference/ambientDeclarationsExternal.types b/tests/baselines/reference/ambientDeclarationsExternal.types index cb85354a6f2f1..2f56e0066a9e8 100644 --- a/tests/baselines/reference/ambientDeclarationsExternal.types +++ b/tests/baselines/reference/ambientDeclarationsExternal.types @@ -34,6 +34,7 @@ declare module 'equ' { var x; >x : any +> : ^^^ export = x; >x : any diff --git a/tests/baselines/reference/ambientDeclarationsPatterns.js b/tests/baselines/reference/ambientDeclarationsPatterns.js index 0de3327533fdb..102c87185334f 100644 --- a/tests/baselines/reference/ambientDeclarationsPatterns.js +++ b/tests/baselines/reference/ambientDeclarationsPatterns.js @@ -33,13 +33,11 @@ foo(fileText); //// [user.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// -var foobarbaz_1 = require("foobarbaz"); -(0, foobarbaz_1.foo)(foobarbaz_1.baz); -var foosball_1 = require("foosball"); -(0, foobarbaz_1.foo)(foosball_1.foos); +import { foo, baz } from "foobarbaz"; +foo(baz); +import { foos } from "foosball"; +foo(foos); // Works with relative file name -var file_text_1 = require("./file!text"); -(0, foobarbaz_1.foo)(file_text_1.default); +import fileText from "./file!text"; +foo(fileText); diff --git a/tests/baselines/reference/ambientDeclarationsPatterns_merging1.js b/tests/baselines/reference/ambientDeclarationsPatterns_merging1.js index 7ffe5313a13c1..909ebf6fff29f 100644 --- a/tests/baselines/reference/ambientDeclarationsPatterns_merging1.js +++ b/tests/baselines/reference/ambientDeclarationsPatterns_merging1.js @@ -18,8 +18,6 @@ import { everywhere, onlyInA } from "b.foo"; // Error //// [types.js] //// [testA.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [testB.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/ambientDeclarationsPatterns_merging2.js b/tests/baselines/reference/ambientDeclarationsPatterns_merging2.js index 97c32855f449e..7d7edc8a0fb9f 100644 --- a/tests/baselines/reference/ambientDeclarationsPatterns_merging2.js +++ b/tests/baselines/reference/ambientDeclarationsPatterns_merging2.js @@ -20,8 +20,6 @@ declare module "a.foo" { //// [types.js] //// [testA.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [testB.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/ambientDeclarationsPatterns_merging3.js b/tests/baselines/reference/ambientDeclarationsPatterns_merging3.js index 63645257d8e7c..3a2976a31e846 100644 --- a/tests/baselines/reference/ambientDeclarationsPatterns_merging3.js +++ b/tests/baselines/reference/ambientDeclarationsPatterns_merging3.js @@ -16,6 +16,5 @@ ohno.a // oh no //// [types.js] //// [test.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); ohno.a; // oh no +export {}; diff --git a/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js b/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js index 8066fd7de6b57..0896531629625 100644 --- a/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js +++ b/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath.js @@ -15,11 +15,8 @@ declare module debugger {} // still an error //// [ambientModuleDeclarationWithReservedIdentifierInDottedPath.js] -"use strict"; // https://github.com/microsoft/TypeScript/issues/7840 -Object.defineProperty(exports, "__esModule", { value: true }); -exports.tabId = void 0; -exports.tabId = chrome.debugger.tabId; +export const tabId = chrome.debugger.tabId; declare; module; debugger; diff --git a/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath2.js b/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath2.js index 1751a8d5c967e..4574fb3c0d0c9 100644 --- a/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath2.js +++ b/tests/baselines/reference/ambientModuleDeclarationWithReservedIdentifierInDottedPath2.js @@ -13,10 +13,7 @@ declare namespace debugger {} // still an error //// [ambientModuleDeclarationWithReservedIdentifierInDottedPath2.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.tabId = void 0; -exports.tabId = chrome.debugger.tabId; +export const tabId = chrome.debugger.tabId; declare; namespace; debugger; diff --git a/tests/baselines/reference/ambientShorthand.errors.txt b/tests/baselines/reference/ambientShorthand.errors.txt new file mode 100644 index 0000000000000..930c34c24f78c --- /dev/null +++ b/tests/baselines/reference/ambientShorthand.errors.txt @@ -0,0 +1,17 @@ +user.ts(4,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== user.ts (1 errors) ==== + /// + import foo, {bar} from "jquery"; + import * as baz from "fs"; + import boom = require("jquery"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + foo(bar, baz, boom); + +==== declarations.d.ts (0 errors) ==== + declare module "jquery" + // Semicolon is optional + declare module "fs"; + \ No newline at end of file diff --git a/tests/baselines/reference/ambientShorthand.js b/tests/baselines/reference/ambientShorthand.js index 80c42be439857..c3743d6fd8fba 100644 --- a/tests/baselines/reference/ambientShorthand.js +++ b/tests/baselines/reference/ambientShorthand.js @@ -14,10 +14,7 @@ foo(bar, baz, boom); //// [user.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// -var jquery_1 = require("jquery"); -var baz = require("fs"); -var boom = require("jquery"); -(0, jquery_1.default)(jquery_1.bar, baz, boom); +import foo, { bar } from "jquery"; +import * as baz from "fs"; +foo(bar, baz, boom); diff --git a/tests/baselines/reference/ambientShorthand.types b/tests/baselines/reference/ambientShorthand.types index f2bf95c3ba548..efd7bab2a8526 100644 --- a/tests/baselines/reference/ambientShorthand.types +++ b/tests/baselines/reference/ambientShorthand.types @@ -10,6 +10,7 @@ import foo, {bar} from "jquery"; import * as baz from "fs"; >baz : any +> : ^^^ import boom = require("jquery"); >boom : any @@ -17,16 +18,23 @@ import boom = require("jquery"); foo(bar, baz, boom); >foo(bar, baz, boom) : any +> : ^^^ >foo : any +> : ^^^ >bar : any +> : ^^^ >baz : any +> : ^^^ >boom : any +> : ^^^ === declarations.d.ts === declare module "jquery" >"jquery" : any +> : ^^^ // Semicolon is optional declare module "fs"; >"fs" : any +> : ^^^ diff --git a/tests/baselines/reference/ambientShorthand_duplicate.js b/tests/baselines/reference/ambientShorthand_duplicate.js index 99c490003275c..43f65f7ab603b 100644 --- a/tests/baselines/reference/ambientShorthand_duplicate.js +++ b/tests/baselines/reference/ambientShorthand_duplicate.js @@ -13,5 +13,4 @@ import foo from "foo"; //// [user.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/ambientShorthand_merging.js b/tests/baselines/reference/ambientShorthand_merging.js index b8a134c179606..f2f8043ae7af7 100644 --- a/tests/baselines/reference/ambientShorthand_merging.js +++ b/tests/baselines/reference/ambientShorthand_merging.js @@ -15,5 +15,4 @@ import foo, {bar} from "foo"; //// [user.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/ambientShorthand_reExport.js b/tests/baselines/reference/ambientShorthand_reExport.js index 169d78faa8be2..84793e8449218 100644 --- a/tests/baselines/reference/ambientShorthand_reExport.js +++ b/tests/baselines/reference/ambientShorthand_reExport.js @@ -17,33 +17,11 @@ x($); //// [reExportX.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -var jquery_1 = require("jquery"); -Object.defineProperty(exports, "x", { enumerable: true, get: function () { return jquery_1.x; } }); +export { x } from "jquery"; //// [reExportAll.js] -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("jquery"), exports); +export * from "jquery"; //// [reExportUser.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var reExportX_1 = require("./reExportX"); -var $ = require("./reExportAll"); +import { x } from "./reExportX"; +import * as $ from "./reExportAll"; // '$' is not callable, it is an object. -(0, reExportX_1.x)($); +x($); diff --git a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js index c6f5699f6d1ae..3ddffc105ff1d 100644 --- a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js +++ b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js @@ -36,13 +36,10 @@ define(["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.E1 = exports.C1 = void 0; - var C1 = /** @class */ (function () { - function C1() { - this.m1 = 42; - } - C1.s1 = true; - return C1; - }()); + class C1 { + m1 = 42; + static s1 = true; + } exports.C1 = C1; var E1; (function (E1) { diff --git a/tests/baselines/reference/argumentExpressionContextualTyping.js b/tests/baselines/reference/argumentExpressionContextualTyping.js index 4c73d0e458679..0ab90a276c6a1 100644 --- a/tests/baselines/reference/argumentExpressionContextualTyping.js +++ b/tests/baselines/reference/argumentExpressionContextualTyping.js @@ -21,22 +21,9 @@ baz(["string", 1, true, ...array]); // Error foo(o); // Error because x has an array type namely (string|number)[] //// [argumentExpressionContextualTyping.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // In a typed function call, argument expressions are contextually typed by their corresponding parameter types. -function foo(_a) { - var _b = _a.x, a = _b[0], b = _b[1], _c = _a.y, c = _c.c, d = _c.d, e = _c.e; -} -function bar(_a) { - var _b = _a.x, a = _b[0], _c = _b[1], b = _c === void 0 ? 10 : _c, _d = _a.y, c = _d.c, d = _d.d, _e = _d.e, e = _e === void 0 ? { f: 1 } : _e; -} +function foo({ x: [a, b], y: { c, d, e } }) { } +function bar({ x: [a, b = 10], y: { c, d, e = { f: 1 } } }) { } function baz(x) { } var o = { x: ["string", 1], y: { c: true, d: "world", e: 3 } }; var o1 = { x: ["string", 1], y: { c: true, d: "world", e: 3 } }; @@ -47,5 +34,5 @@ var tuple = ["string", 1, true]; baz(tuple); baz(["string", 1, true]); baz(array); // Error -baz(__spreadArray(["string", 1, true], array, true)); // Error +baz(["string", 1, true, ...array]); // Error foo(o); // Error because x has an array type namely (string|number)[] diff --git a/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.symbols b/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.symbols index b087cff2b360d..47213cb26e333 100644 --- a/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.symbols +++ b/tests/baselines/reference/arithmeticOperatorWithInvalidOperands.symbols @@ -27,7 +27,7 @@ var e: { a: number }; var f: Number; >f : Symbol(f, Decl(arithmeticOperatorWithInvalidOperands.ts, 9, 3)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) // All of the below should be an error unless otherwise noted // operator * diff --git a/tests/baselines/reference/arrayAssignmentPatternWithAny.js b/tests/baselines/reference/arrayAssignmentPatternWithAny.js index 5160c81de9b09..0476548d87bc6 100644 --- a/tests/baselines/reference/arrayAssignmentPatternWithAny.js +++ b/tests/baselines/reference/arrayAssignmentPatternWithAny.js @@ -8,4 +8,4 @@ var x: string; //// [arrayAssignmentPatternWithAny.js] var a; var x; -x = a[0]; +[x] = a; diff --git a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js index acba52443a9b4..b88916841bd55 100644 --- a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js +++ b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.js @@ -18,15 +18,6 @@ var spr2:[number, number, number] = [1, 2, 3, ...tup]; // Error //// [arrayLiteralExpressionContextualTyping.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // In a contextually typed array literal expression containing no spread elements, an element expression at index N is contextually typed by // the type of the property with the numeric name N in the contextual type, if any, or otherwise // the numeric index type of the contextual type, if any. @@ -37,6 +28,6 @@ var tup1 = [1, 2, 3, "string"]; var tup2 = [1, 2, 3, "string"]; // Error // In a contextually typed array literal expression containing one or more spread elements, // an element expression at index N is contextually typed by the numeric index type of the contextual type, if any. -var spr = __spreadArray([1, 2, 3], array, true); -var spr1 = __spreadArray([1, 2, 3], tup, true); -var spr2 = __spreadArray([1, 2, 3], tup, true); // Error +var spr = [1, 2, 3, ...array]; +var spr1 = [1, 2, 3, ...tup]; +var spr2 = [1, 2, 3, ...tup]; // Error diff --git a/tests/baselines/reference/arrayLiteralSpread.js b/tests/baselines/reference/arrayLiteralSpread.js index a0ea9ce127f74..5efdb6c45d19b 100644 --- a/tests/baselines/reference/arrayLiteralSpread.js +++ b/tests/baselines/reference/arrayLiteralSpread.js @@ -26,32 +26,23 @@ function f2() { //// [arrayLiteralSpread.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; function f0() { var a = [1, 2, 3]; - var a1 = __spreadArray([], a, true); - var a2 = __spreadArray([1], a, true); - var a3 = __spreadArray([1, 2], a, true); - var a4 = __spreadArray(__spreadArray([], a, true), [1], false); - var a5 = __spreadArray(__spreadArray([], a, true), [1, 2], false); - var a6 = __spreadArray(__spreadArray([1, 2], a, true), [1, 2], false); - var a7 = __spreadArray(__spreadArray(__spreadArray([1], a, true), [2], false), a, true); - var a8 = __spreadArray(__spreadArray(__spreadArray([], a, true), a, true), a, true); + var a1 = [...a]; + var a2 = [1, ...a]; + var a3 = [1, 2, ...a]; + var a4 = [...a, 1]; + var a5 = [...a, 1, 2]; + var a6 = [1, 2, ...a, 1, 2]; + var a7 = [1, ...a, 2, ...a]; + var a8 = [...a, ...a, ...a]; } function f1() { var a = [1, 2, 3]; - var b = __spreadArray(__spreadArray(["hello"], a, true), [true], false); + var b = ["hello", ...a, true]; var b; } function f2() { - var a = []; - var b = [5]; + var a = [...[...[...[...[...[]]]]]]; + var b = [...[...[...[...[...[5]]]]]]; } diff --git a/tests/baselines/reference/arrayLiteralSpreadES5iterable.js b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js index 3f16bdfbeebe4..bf3a64e62817b 100644 --- a/tests/baselines/reference/arrayLiteralSpreadES5iterable.js +++ b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js @@ -26,48 +26,23 @@ function f2() { //// [arrayLiteralSpreadES5iterable.js] -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; function f0() { var a = [1, 2, 3]; - var a1 = __spreadArray([], __read(a), false); - var a2 = __spreadArray([1], __read(a), false); - var a3 = __spreadArray([1, 2], __read(a), false); - var a4 = __spreadArray(__spreadArray([], __read(a), false), [1], false); - var a5 = __spreadArray(__spreadArray([], __read(a), false), [1, 2], false); - var a6 = __spreadArray(__spreadArray([1, 2], __read(a), false), [1, 2], false); - var a7 = __spreadArray(__spreadArray(__spreadArray([1], __read(a), false), [2], false), __read(a), false); - var a8 = __spreadArray(__spreadArray(__spreadArray([], __read(a), false), __read(a), false), __read(a), false); + var a1 = [...a]; + var a2 = [1, ...a]; + var a3 = [1, 2, ...a]; + var a4 = [...a, 1]; + var a5 = [...a, 1, 2]; + var a6 = [1, 2, ...a, 1, 2]; + var a7 = [1, ...a, 2, ...a]; + var a8 = [...a, ...a, ...a]; } function f1() { var a = [1, 2, 3]; - var b = __spreadArray(__spreadArray(["hello"], __read(a), false), [true], false); + var b = ["hello", ...a, true]; var b; } function f2() { - var a = []; - var b = [5]; + var a = [...[...[...[...[...[]]]]]]; + var b = [...[...[...[...[...[5]]]]]]; } diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 0f2dc1f7e2ebf..1df430b76c0fa 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -40,21 +40,6 @@ var context4: Base[] = [new Derived1(), new Derived1()]; //// [arrayLiterals.js] // Empty array literal with no contextual type has type Undefined[] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); var arr1 = [[], [1], ['']]; var arr2 = [[null], [1], ['']]; // Array literal with elements of only EveryType E has type E[] @@ -62,11 +47,9 @@ var stringArrArr = [[''], [""]]; var stringArr = ['', ""]; var numberArr = [0, 0.0, 0x00, 1e1]; var boolArr = [false, true, false, true]; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + p; +} var classArr = [new C(), new C()]; var classTypeArray = [C, C, C]; var classTypeArray; // Should OK, not be a parse error @@ -74,26 +57,16 @@ var classTypeArray; // Should OK, not be a parse error var context1 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; // Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] -var Base = /** @class */ (function () { - function Base() { - } - return Base; -}()); -var Derived1 = /** @class */ (function (_super) { - __extends(Derived1, _super); - function Derived1() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived1; -}(Base)); +class Base { + p; +} +class Derived1 extends Base { + m; +} ; -var Derived2 = /** @class */ (function (_super) { - __extends(Derived2, _super); - function Derived2() { - return _super !== null && _super.apply(this, arguments) || this; - } - return Derived2; -}(Base)); +class Derived2 extends Base { + n; +} ; var context3 = [new Derived1(), new Derived2()]; // Contextual type C with numeric index signature of type Base makes array literal of Derived1 and Derived2 have type Base[] diff --git a/tests/baselines/reference/arrayLiterals.symbols b/tests/baselines/reference/arrayLiterals.symbols index 840abbdb53233..be6f731544bf7 100644 --- a/tests/baselines/reference/arrayLiterals.symbols +++ b/tests/baselines/reference/arrayLiterals.symbols @@ -40,7 +40,7 @@ var classTypeArray = [C, C, C]; var classTypeArray: Array; // Should OK, not be a parse error >classTypeArray : Symbol(classTypeArray, Decl(arrayLiterals.ts, 19, 3), Decl(arrayLiterals.ts, 20, 3)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) >C : Symbol(C, Decl(arrayLiterals.ts, 14, 41)) // Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] diff --git a/tests/baselines/reference/arrayLiterals2ES5.js b/tests/baselines/reference/arrayLiterals2ES5.js index 23b9662bb0506..ecd528dfd1a1f 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.js +++ b/tests/baselines/reference/arrayLiterals2ES5.js @@ -64,23 +64,14 @@ var d9 = [[...temp1], ...["hello"]]; // Elisionopt SpreadElement // ElementList, Elisionopt AssignmentExpression // ElementList, Elisionopt SpreadElement -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // SpreadElement: // ... AssignmentExpression var a0 = [, , 2, 3, 4]; var a1 = ["hello", "world"]; -var a2 = __spreadArray(__spreadArray([, , ,], a0, true), ["hello"], false); -var a3 = __spreadArray([, ,], a0, true); -var a4 = [function () { return 1; },]; -var a5 = __spreadArray(__spreadArray([], a0, true), [,], false); +var a2 = [, , , ...a0, "hello"]; +var a3 = [, , ...a0]; +var a4 = [() => 1,]; +var a5 = [...a0, ,]; // Each element expression in a non-empty array literal is processed as follows: // - If the array literal contains no spread elements, and if the array literal is contextually typed (section 4.19) // by a type T and T has a property with the numeric name N, where N is the index of the element expression in the array literal, @@ -93,8 +84,8 @@ var b1 = [[1, 2, 3], ["hello", "string"]]; // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1), // the resulting type is a tuple type constructed from the types of the element expressions. -var _a = [1, 2], c0 = _a[0], c1 = _a[1]; // tuple type [number, number] -var _b = [1, 2, true], c2 = _b[0], c3 = _b[1]; // tuple type [number, number, boolean] +var [c0, c1] = [1, 2]; // tuple type [number, number] +var [c2, c3] = [1, 2, true]; // tuple type [number, number, boolean] // The resulting type an array literal expression is determined as follows: // - the resulting type is an array type with an element type that is the union of the types of the // non - spread element expressions and the numeric index signature types of the spread element expressions @@ -103,13 +94,13 @@ var temp1 = [1, 2, 3]; var temp2 = [[1, 2, 3], ["hello", "string"]]; var temp3 = [undefined, null, undefined]; var temp4 = []; -var d0 = __spreadArray([1, true], temp, true); // has type (string|number|boolean)[] -var d1 = __spreadArray([], temp, true); // has type string[] -var d2 = __spreadArray([], temp1, true); -var d3 = __spreadArray([], temp1, true); -var d4 = __spreadArray(__spreadArray([], temp, true), temp1, true); -var d5 = __spreadArray([], temp3, true); -var d6 = __spreadArray([], temp4, true); -var d7 = __spreadArray([], temp1, true); -var d8 = [__spreadArray([], temp1, true)]; -var d9 = __spreadArray([__spreadArray([], temp1, true)], ["hello"], false); +var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[] +var d1 = [...temp]; // has type string[] +var d2 = [...temp1]; +var d3 = [...temp1]; +var d4 = [...temp, ...temp1]; +var d5 = [...temp3]; +var d6 = [...temp4]; +var d7 = [...[...temp1]]; +var d8 = [[...temp1]]; +var d9 = [[...temp1], ...["hello"]]; diff --git a/tests/baselines/reference/arrayLiterals2ES5.symbols b/tests/baselines/reference/arrayLiterals2ES5.symbols index 236cc654c3099..822a9f20c5671 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.symbols +++ b/tests/baselines/reference/arrayLiterals2ES5.symbols @@ -82,14 +82,14 @@ var temp4 = []; interface myArray extends Array { } >myArray : Symbol(myArray, Decl(arrayLiterals2ES5.ts, 42, 15)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) interface myArray2 extends Array { } >myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES5.ts, 44, 43)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 7 more) var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[] >d0 : Symbol(d0, Decl(arrayLiterals2ES5.ts, 46, 3)) diff --git a/tests/baselines/reference/arrayLiterals3.js b/tests/baselines/reference/arrayLiterals3.js index 15601e737ad96..333172ea450bd 100644 --- a/tests/baselines/reference/arrayLiterals3.js +++ b/tests/baselines/reference/arrayLiterals3.js @@ -42,15 +42,6 @@ var c2: myArray = [...temp1, ...temp]; // Error cannot assign (number // - If the array literal contains no spread elements, and if the array literal is contextually typed (section 4.19) // by a type T and T has a property with the numeric name N, where N is the index of the element expression in the array literal, // the element expression is contextually typed by the type of that property. -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is contextually typed by a tuple-like type, // the resulting type is a tuple type constructed from the types of the element expressions. @@ -59,13 +50,13 @@ var a1 = ["string", 1, true]; // Error // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1), // the resulting type is a tuple type constructed from the types of the element expressions. -var _a = [1, 2, "string", true], b1 = _a[0], b2 = _a[1]; +var [b1, b2] = [1, 2, "string", true]; // The resulting type an array literal expression is determined as follows: // - the resulting type is an array type with an element type that is the union of the types of the // non - spread element expressions and the numeric index signature types of the spread element expressions var temp = ["s", "t", "r"]; var temp1 = [1, 2, 3]; var temp2 = [[1, 2, 3], ["hello", "string"]]; -var c0 = __spreadArray([], temp2, true); // Error -var c1 = __spreadArray([], temp1, true); // Error cannot assign number[] to [number, number, number] -var c2 = __spreadArray(__spreadArray([], temp1, true), temp, true); // Error cannot assign (number|string)[] to number[] +var c0 = [...temp2]; // Error +var c1 = [...temp1]; // Error cannot assign number[] to [number, number, number] +var c2 = [...temp1, ...temp]; // Error cannot assign (number|string)[] to number[] diff --git a/tests/baselines/reference/arrayLiterals3.symbols b/tests/baselines/reference/arrayLiterals3.symbols index 015ed97cd3b13..b98308b69650a 100644 --- a/tests/baselines/reference/arrayLiterals3.symbols +++ b/tests/baselines/reference/arrayLiterals3.symbols @@ -47,14 +47,14 @@ interface tup { } interface myArray extends Array { } >myArray : Symbol(myArray, Decl(arrayLiterals3.ts, 28, 1)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) interface myArray2 extends Array { } >myArray2 : Symbol(myArray2, Decl(arrayLiterals3.ts, 29, 43)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 7 more) var c0: tup = [...temp2]; // Error >c0 : Symbol(c0, Decl(arrayLiterals3.ts, 31, 3)) diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index 7a80cd10d9c18..aa2188fcfc265 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -98,110 +98,81 @@ var asserted2: any; //// [arrowFunctionContexts.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var _this = this; // Arrow function used in with statement with (window) { - var p = function () { return _this; }; + var p = () => this; } // Arrow function as argument to super call -var Base = /** @class */ (function () { - function Base(n) { - } - return Base; -}()); -var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { - var _this = _super.call(this, function () { return _this; }) || this; - return _this; +class Base { + constructor(n) { } +} +class Derived extends Base { + constructor() { + super(() => this); } - return Derived; -}(Base)); +} // Arrow function as function argument -window.setTimeout(function () { return null; }, 100); +window.setTimeout(() => null, 100); // Arrow function as value in array literal -var obj = function (n) { return ''; }; +var obj = (n) => ''; var obj; // OK -var arr = [function (n) { return ''; }]; +var arr = [(n) => '']; var arr; // Incorrect error here (bug 829597) // Arrow function as enum value var E; (function (E) { - var _this = this; - E[E["x"] = function () { return 4; }] = "x"; - E[E["y"] = (function () { return _this; }).length] = "y"; // error, can't use this in enum + E[E["x"] = () => 4] = "x"; + E[E["y"] = (() => this).length] = "y"; // error, can't use this in enum })(E || (E = {})); // Arrow function as module variable initializer var M; (function (M) { - M.a = function (s) { return ''; }; - var b = function (s) { return s; }; + M.a = (s) => ''; + var b = (s) => s; })(M || (M = {})); // Repeat above for module members that are functions? (necessary to redo all of them?) var M2; (function (M2) { - var _this = this; // Arrow function used in with statement with (window) { - var p = function () { return _this; }; + var p = () => this; } // Arrow function as argument to super call - var Base = /** @class */ (function () { - function Base(n) { - } - return Base; - }()); - var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { - var _this = _super.call(this, function () { return _this; }) || this; - return _this; + class Base { + constructor(n) { } + } + class Derived extends Base { + constructor() { + super(() => this); } - return Derived; - }(Base)); + } // Arrow function as function argument - window.setTimeout(function () { return null; }, 100); + window.setTimeout(() => null, 100); // Arrow function as value in array literal - var obj = function (n) { return ''; }; + var obj = (n) => ''; var obj; // OK - var arr = [function (n) { return ''; }]; + var arr = [(n) => '']; var arr; // Incorrect error here (bug 829597) // Arrow function as enum value - var E; + let E; (function (E) { - var _this = this; - E[E["x"] = function () { return 4; }] = "x"; - E[E["y"] = (function () { return _this; }).length] = "y"; + E[E["x"] = () => 4] = "x"; + E[E["y"] = (() => this).length] = "y"; })(E || (E = {})); // Arrow function as module variable initializer - var M; + let M; (function (M) { - M.a = function (s) { return ''; }; - var b = function (s) { return s; }; + M.a = (s) => ''; + var b = (s) => s; })(M || (M = {})); })(M2 || (M2 = {})); // (ParamList) => { ... } is a generic arrow function -var generic1 = function (n) { return [n]; }; +var generic1 = (n) => [n]; var generic1; // Incorrect error, Bug 829597 -var generic2 = function (n) { return [n]; }; +var generic2 = (n) => { return [n]; }; var generic2; // ((ParamList) => { ... } ) is a type assertion to an arrow function -var asserted1 = (function (n) { return [n]; }); +var asserted1 = ((n) => [n]); var asserted1; -var asserted2 = (function (n) { return n; }); +var asserted2 = ((n) => { return n; }); var asserted2; diff --git a/tests/baselines/reference/arrowFunctionExpressions.js b/tests/baselines/reference/arrowFunctionExpressions.js index f4be03dd189a6..cbb8a29bf058b 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.js +++ b/tests/baselines/reference/arrowFunctionExpressions.js @@ -103,88 +103,63 @@ function tryCatchFn() { //// [arrowFunctionExpressions.js] // ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } -var a = function (p) { return p.length; }; -var a = function (p) { return p.length; }; +var a = (p) => p.length; +var a = (p) => { return p.length; }; // Identifier => Block is equivalent to(Identifier) => Block -var b = function (j) { return 0; }; -var b = function (j) { return 0; }; +var b = j => { return 0; }; +var b = (j) => { return 0; }; // Identifier => AssignmentExpression is equivalent to(Identifier) => AssignmentExpression var c; -var d = function (n) { return c = n; }; -var d = function (n) { return c = n; }; +var d = n => c = n; +var d = (n) => c = n; var d; // Binding patterns in arrow functions -var p1 = function (_a) { - var a = _a[0]; -}; -var p2 = function (_a) { - var a = _a.slice(0); -}; -var p3 = function (_a) { - var a = _a[1]; -}; -var p4 = function (_a) { - var a = _a.slice(1); -}; -var p5 = function (_a) { - var _b = _a[0], a = _b === void 0 ? 1 : _b; -}; -var p6 = function (_a) { - var a = _a.a; -}; -var p7 = function (_a) { - var b = _a.a.b; -}; -var p8 = function (_a) { - var _b = _a.a, a = _b === void 0 ? 1 : _b; -}; -var p9 = function (_a) { - var _b = _a.a, _c = _b === void 0 ? { b: 1 } : _b, _d = _c.b, b = _d === void 0 ? 1 : _d; -}; -var p10 = function (_a) { - var _b = _a[0], value = _b.value, done = _b.done; -}; +var p1 = ([a]) => { }; +var p2 = ([...a]) => { }; +var p3 = ([, a]) => { }; +var p4 = ([, ...a]) => { }; +var p5 = ([a = 1]) => { }; +var p6 = ({ a }) => { }; +var p7 = ({ a: { b } }) => { }; +var p8 = ({ a = 1 }) => { }; +var p9 = ({ a: { b = 1 } = { b: 1 } }) => { }; +var p10 = ([{ value, done }]) => { }; // Arrow function used in class member initializer // Arrow function used in class member function -var MyClass = /** @class */ (function () { - function MyClass() { - var _this = this; - this.m = function (n) { return n + 1; }; - this.p = function (n) { return n && _this; }; +class MyClass { + m = (n) => n + 1; + p = (n) => n && this; + fn() { + var m = (n) => n + 1; + var p = (n) => n && this; } - MyClass.prototype.fn = function () { - var _this = this; - var m = function (n) { return n + 1; }; - var p = function (n) { return n && _this; }; - }; - return MyClass; -}()); +} // Arrow function used in arrow function -var arrrr = function () { return function (m) { return function () { return function (n) { return m + n; }; }; }; }; +var arrrr = () => (m) => () => (n) => m + n; var e = arrrr()(3)()(4); var e; // Arrow function used in arrow function used in function function someFn() { - var arr = function (n) { return function (p) { return p * n; }; }; + var arr = (n) => (p) => p * n; arr(3)(4).toExponential(); } // Arrow function used in function function someOtherFn() { - var arr = function (n) { return '' + n; }; + var arr = (n) => '' + n; arr(4).charAt(0); } // Arrow function used in nested function in function function outerFn() { function innerFn() { - var arrowFn = function () { }; + var arrowFn = () => { }; var p = arrowFn(); var p; } } // Arrow function used in nested function in arrow function -var f = function (n) { +var f = (n) => { function fn(x) { - return function () { return n + x; }; + return () => n + x; } return fn(4); }; @@ -192,9 +167,9 @@ var g = f('')(); var g; // Arrow function used in nested function in arrow function in nested function function someOuterFn() { - var arr = function (n) { + var arr = (n) => { function innerFn() { - return function () { return n.length; }; + return () => n.length; } return innerFn; }; @@ -204,14 +179,13 @@ var h = someOuterFn()('')()(); h.toExponential(); // Arrow function used in try/catch/finally in function function tryCatchFn() { - var _this = this; try { - var x = function () { return _this; }; + var x = () => this; } catch (e) { - var t = function () { return e + _this; }; + var t = () => e + this; } finally { - var m = function () { return _this + ''; }; + var m = () => this + ''; } } diff --git a/tests/baselines/reference/arrowFunctionExpressions.types b/tests/baselines/reference/arrowFunctionExpressions.types index cf5973fc84e6f..3158e45386ff0 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.types +++ b/tests/baselines/reference/arrowFunctionExpressions.types @@ -91,10 +91,10 @@ var p1 = ([a]) => { }; > : ^^^ var p2 = ([...a]) => { }; ->p2 : ([...a]: any[]) => void -> : ^ ^^^^^^^^^^^^^^^^ ->([...a]) => { } : ([...a]: any[]) => void -> : ^ ^^^^^^^^^^^^^^^^ +>p2 : ([...a]: Iterable) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>([...a]) => { } : ([...a]: Iterable) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >a : any[] > : ^^^^^ diff --git a/tests/baselines/reference/asOperator1.symbols b/tests/baselines/reference/asOperator1.symbols index 6323cdefdef0a..dd23ea33a1b71 100644 --- a/tests/baselines/reference/asOperator1.symbols +++ b/tests/baselines/reference/asOperator1.symbols @@ -15,7 +15,7 @@ var y = (null as string).length; var z = Date as any as string; >z : Symbol(z, Decl(asOperator1.ts, 3, 3)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) // Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string' var j = 32 as number|string; diff --git a/tests/baselines/reference/asOperator3.js b/tests/baselines/reference/asOperator3.js index 9eac43c07e479..bc1fed43548b9 100644 --- a/tests/baselines/reference/asOperator3.js +++ b/tests/baselines/reference/asOperator3.js @@ -13,15 +13,11 @@ var g = tag `Hello ${123} World` as string; var h = tag `Hello` as string; //// [asOperator3.js] -var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; -var a = "".concat(123 + 456); -var b = "leading ".concat(123 + 456); -var c = "".concat(123 + 456, " trailing"); -var d = "Hello ".concat(123, " World"); -var e = "Hello"; -var f = 1 + "".concat(1, " end of string"); -var g = tag(__makeTemplateObject(["Hello ", " World"], ["Hello ", " World"]), 123); -var h = tag(__makeTemplateObject(["Hello"], ["Hello"])); +var a = `${123 + 456}`; +var b = `leading ${123 + 456}`; +var c = `${123 + 456} trailing`; +var d = `Hello ${123} World`; +var e = `Hello`; +var f = 1 + `${1} end of string`; +var g = tag `Hello ${123} World`; +var h = tag `Hello`; diff --git a/tests/baselines/reference/asOperator4.js b/tests/baselines/reference/asOperator4.js index 6d8b39830440b..9a1b08235cb5b 100644 --- a/tests/baselines/reference/asOperator4.js +++ b/tests/baselines/reference/asOperator4.js @@ -19,7 +19,7 @@ function foo() { } //// [bar.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var foo_1 = require("./foo"); +const foo_1 = require("./foo"); // These should emit identically foo_1.foo; foo_1.foo; diff --git a/tests/baselines/reference/asOperatorASI.js b/tests/baselines/reference/asOperatorASI.js index 1de18b75954e1..0ef77ba3cf5ce 100644 --- a/tests/baselines/reference/asOperatorASI.js +++ b/tests/baselines/reference/asOperatorASI.js @@ -14,18 +14,11 @@ as(Foo); // should emit //// [asOperatorASI.js] -var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; -var Foo = /** @class */ (function () { - function Foo() { - } - return Foo; -}()); +class Foo { +} // Example 1 var x = 10; -as(__makeTemplateObject(["Hello world"], ["Hello world"])); // should not error +as `Hello world`; // should not error // Example 2 var y = 20; as(Foo); // should emit diff --git a/tests/baselines/reference/asOperatorContextualType.js b/tests/baselines/reference/asOperatorContextualType.js index 0d55b4dbd3fb6..e4198d64229b6 100644 --- a/tests/baselines/reference/asOperatorContextualType.js +++ b/tests/baselines/reference/asOperatorContextualType.js @@ -6,4 +6,4 @@ var x = (v => v) as (x: number) => string; //// [asOperatorContextualType.js] // should error -var x = (function (v) { return v; }); +var x = (v => v); diff --git a/tests/baselines/reference/asiPreventsParsingAsNamespace04.js b/tests/baselines/reference/asiPreventsParsingAsNamespace04.js index 027b839404df2..588b439e536a4 100644 --- a/tests/baselines/reference/asiPreventsParsingAsNamespace04.js +++ b/tests/baselines/reference/asiPreventsParsingAsNamespace04.js @@ -5,5 +5,5 @@ let module = 10; module in {} //// [asiPreventsParsingAsNamespace04.js] -var module = 10; +let module = 10; module in {}; diff --git a/tests/baselines/reference/asiPreventsParsingAsNamespace05.js b/tests/baselines/reference/asiPreventsParsingAsNamespace05.js index 0abf89d14d1c7..a8901cdac3199 100644 --- a/tests/baselines/reference/asiPreventsParsingAsNamespace05.js +++ b/tests/baselines/reference/asiPreventsParsingAsNamespace05.js @@ -12,7 +12,7 @@ a.b.c } //// [asiPreventsParsingAsNamespace05.js] -var namespace = 10; +let namespace = 10; var a; (function (a) { var b; diff --git a/tests/baselines/reference/assertionTypePredicates1.js b/tests/baselines/reference/assertionTypePredicates1.js index dd591b729358c..a64aca0bfc35d 100644 --- a/tests/baselines/reference/assertionTypePredicates1.js +++ b/tests/baselines/reference/assertionTypePredicates1.js @@ -262,22 +262,7 @@ function testFunctionThisParameter2( //// [assertionTypePredicates1.js] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var assert = function (value) { }; +const assert = value => { }; function f01(x) { if (!!true) { assert(typeof x === "string"); @@ -357,32 +342,30 @@ function f10(x) { x; // Unreachable } } -var Test = /** @class */ (function () { - function Test() { - } - Test.prototype.assert = function (value) { +class Test { + assert(value) { if (value) return; throw new Error(); - }; - Test.prototype.isTest2 = function () { + } + isTest2() { return this instanceof Test2; - }; - Test.prototype.assertIsTest2 = function () { + } + assertIsTest2() { if (this instanceof Test2) return; throw new Error(); - }; - Test.prototype.assertThis = function () { + } + assertThis() { if (!this) return; throw new Error(); - }; - Test.prototype.bar = function () { + } + bar() { this.assertThis(); this; - }; - Test.prototype.foo = function (x) { + } + foo(x) { this.assert(typeof x === "string"); x.length; if (this.isTest2()) { @@ -390,40 +373,27 @@ var Test = /** @class */ (function () { } this.assertIsTest2(); this.z; - }; - Test.prototype.baz = function (x) { + } + baz(x) { this.assert(false); x; // Unreachable - }; - return Test; -}()); -var Test2 = /** @class */ (function (_super) { - __extends(Test2, _super); - function Test2() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.z = 0; - return _this; } - return Test2; -}(Test)); -var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { - return _super !== null && _super.apply(this, arguments) || this; - } - Derived.prototype.foo = function (x) { - _super.prototype.assert.call(this, typeof x === "string"); +} +class Test2 extends Test { + z = 0; +} +class Derived extends Test { + foo(x) { + super.assert(typeof x === "string"); x.length; - }; - Derived.prototype.baz = function (x) { - _super.prototype.assert.call(this, false); + } + baz(x) { + super.assert(false); x; // Unreachable - }; - return Derived; -}(Test)); + } +} function f11(items) { - for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { - var item = items_1[_i]; + for (let item of items) { if (item.isTest2()) { item.z; } @@ -432,53 +402,41 @@ function f11(items) { } } function f20(x) { - var assert = function (value) { }; + const assert = (value) => { }; assert(typeof x === "string"); // Error - var a = [assert]; + const a = [assert]; a[0](typeof x === "string"); // Error - var t1 = new Test(); + const t1 = new Test(); t1.assert(typeof x === "string"); // Error - var t2 = new Test(); + const t2 = new Test(); t2.assert(typeof x === "string"); } function example1(things) { - for (var _i = 0, things_1 = things; _i < things_1.length; _i++) { - var thing = things_1[_i]; + for (let thing of things) { thing.isGood(); thing.good; } } -var TestPropertyDeclaration1 = /** @class */ (function () { - function TestPropertyDeclaration1() { - this.assert = function (value) { }; - } - TestPropertyDeclaration1.prototype.other = function (x) { +class TestPropertyDeclaration1 { + assert = (value) => { }; + other(x) { this.assert(x); // error x; - }; - return TestPropertyDeclaration1; -}()); -var TestPropertyDeclaration2 = /** @class */ (function () { - function TestPropertyDeclaration2() { - this.assert = function (value) { }; } - TestPropertyDeclaration2.prototype.other = function (x) { +} +class TestPropertyDeclaration2 { + assert = (value) => { }; + other(x) { this.assert(x); // ok x; - }; - return TestPropertyDeclaration2; -}()); -var ChildInheritedPropertyDeclaration = /** @class */ (function (_super) { - __extends(ChildInheritedPropertyDeclaration, _super); - function ChildInheritedPropertyDeclaration() { - return _super !== null && _super.apply(this, arguments) || this; } - ChildInheritedPropertyDeclaration.prototype.other = function (x) { +} +class ChildInheritedPropertyDeclaration extends ParentInheritedPropertyDeclaration { + other(x) { this.assert(x); // ok x; - }; - return ChildInheritedPropertyDeclaration; -}(ParentInheritedPropertyDeclaration)); + } +} function testPropertySignature(x, y) { x.assert(y); // ok x; diff --git a/tests/baselines/reference/assertionTypePredicates1.symbols b/tests/baselines/reference/assertionTypePredicates1.symbols index 23b6f944f93ef..a5d3f58c68416 100644 --- a/tests/baselines/reference/assertionTypePredicates1.symbols +++ b/tests/baselines/reference/assertionTypePredicates1.symbols @@ -54,7 +54,7 @@ function f01(x: unknown) { assert(x instanceof Error); >assert : Symbol(assert, Decl(assertionTypePredicates1.ts, 3, 5)) >x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) x.message; >x.message : Symbol(Error.message, Decl(lib.es5.d.ts, --, --)) @@ -68,9 +68,9 @@ function f01(x: unknown) { >x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) x.toLocaleString; ->x.toLocaleString : Symbol(toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>x.toLocaleString : Symbol(toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(assertionTypePredicates1.ts, 9, 13)) ->toLocaleString : Symbol(toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>toLocaleString : Symbol(toLocaleString, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) } if (!!true) { assert(isArrayOfStrings(x)); @@ -272,7 +272,7 @@ class Test { >value : Symbol(value, Decl(assertionTypePredicates1.ts, 95, 11)) throw new Error(); ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) } isTest2(): this is Test2 { >isTest2 : Symbol(Test.isTest2, Decl(assertionTypePredicates1.ts, 98, 5)) @@ -291,7 +291,7 @@ class Test { >Test2 : Symbol(Test2, Decl(assertionTypePredicates1.ts, 127, 1)) throw new Error(); ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) } assertThis(): asserts this { >assertThis : Symbol(Test.assertThis, Decl(assertionTypePredicates1.ts, 105, 5)) @@ -300,7 +300,7 @@ class Test { >this : Symbol(Test, Decl(assertionTypePredicates1.ts, 92, 1)) throw new Error(); ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) } bar() { >bar : Symbol(Test.bar, Decl(assertionTypePredicates1.ts, 109, 5)) diff --git a/tests/baselines/reference/assertionTypePredicates1.types b/tests/baselines/reference/assertionTypePredicates1.types index fe938414d516e..b0ccb48306159 100644 --- a/tests/baselines/reference/assertionTypePredicates1.types +++ b/tests/baselines/reference/assertionTypePredicates1.types @@ -138,12 +138,12 @@ function f01(x: unknown) { > : ^^^^^^^^ x.toLocaleString; ->x.toLocaleString : ((locales?: string | string[], options?: Intl.NumberFormatOptions) => string) | (() => string) -> : ^^ ^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^^ ^ +>x.toLocaleString : { (locales?: string | string[], options?: Intl.NumberFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string; } | (() => string) +> : ^^^ ^^^ ^^ ^^^ ^^^ ^^^ ^^^ ^^ ^^^ ^^^ ^^^^^^^^^^^^^ ^ >x : number | boolean > : ^^^^^^^^^^^^^^^^ ->toLocaleString : ((locales?: string | string[], options?: Intl.NumberFormatOptions) => string) | (() => string) -> : ^^ ^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^^ ^ +>toLocaleString : { (locales?: string | string[], options?: Intl.NumberFormatOptions): string; (locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string; } | (() => string) +> : ^^^ ^^^ ^^ ^^^ ^^^ ^^^ ^^^ ^^ ^^^ ^^^ ^^^^^^^^^^^^^ ^ } if (!!true) { >!!true : true diff --git a/tests/baselines/reference/assertionTypePredicates2.js b/tests/baselines/reference/assertionTypePredicates2.js index ada62f93812d4..5d370c8f5d9d2 100644 --- a/tests/baselines/reference/assertionTypePredicates2.js +++ b/tests/baselines/reference/assertionTypePredicates2.js @@ -26,12 +26,9 @@ export const main = () => { //// [assertionTypePredicates2.js] -"use strict"; /** * @typedef {{ x: number }} A */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.main = void 0; /** * @typedef { A & { y: number } } B */ @@ -39,14 +36,13 @@ exports.main = void 0; * @param {A} a * @returns { asserts a is B } */ -var foo = function (a) { +const foo = (a) => { if ( /** @type { B } */(a).y !== 0) throw TypeError(); return undefined; }; -var main = function () { +export const main = () => { /** @type { A } */ - var a = { x: 1 }; + const a = { x: 1 }; foo(a); }; -exports.main = main; diff --git a/tests/baselines/reference/assertionsAndNonReturningFunctions.symbols b/tests/baselines/reference/assertionsAndNonReturningFunctions.symbols index a3142da90cc93..0260e94a75848 100644 --- a/tests/baselines/reference/assertionsAndNonReturningFunctions.symbols +++ b/tests/baselines/reference/assertionsAndNonReturningFunctions.symbols @@ -10,7 +10,7 @@ const assert = check => { if (!check) throw new Error(); >check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 3, 14)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) } /** @type {(x: unknown) => asserts x is string } */ @@ -20,7 +20,7 @@ function assertIsString(x) { if (!(typeof x === "string")) throw new Error(); >x : Symbol(x, Decl(assertionsAndNonReturningFunctions.js, 8, 24)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) } /** @@ -33,7 +33,7 @@ function assert2(check) { if (!check) throw new Error(); >check : Symbol(check, Decl(assertionsAndNonReturningFunctions.js, 16, 17)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) } /** @@ -43,7 +43,7 @@ function fail() { >fail : Symbol(fail, Decl(assertionsAndNonReturningFunctions.js, 18, 1)) throw new Error(); ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) } /** diff --git a/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js b/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js index 52f6be2d86a20..1c86cba51bbac 100644 --- a/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js +++ b/tests/baselines/reference/assignmentGenericLookupTypeNarrowing.js @@ -16,10 +16,10 @@ function bar(key: K) { //// [assignmentGenericLookupTypeNarrowing.js] // Repro from #26130 -var mappedObject = { foo: { x: "hello" } }; +let mappedObject = { foo: { x: "hello" } }; function bar(key) { - var element = foo(mappedObject[key]); + const element = foo(mappedObject[key]); if (element == null) return; - var x = element.x; + const x = element.x; } diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 81506efa54a4f..e41946066e6dc 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -73,32 +73,14 @@ foo() = value; (foo()) = value; //// [assignmentLHSIsValue.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); // expected error for all the LHS of assignments var value; // this -var C = /** @class */ (function () { - function C() { - this = value; - } - C.prototype.foo = function () { this = value; }; - C.sfoo = function () { this = value; }; - return C; -}()); +class C { + constructor() { this = value; } + foo() { this = value; } + static sfoo() { this = value; } +} function foo() { this = value; } this = value; // identifiers: module, class, enum, function @@ -125,23 +107,17 @@ false = value; } value; // array literals -'' = value[0], '' = value[1]; +['', ''] = value; // super -var Derived = /** @class */ (function (_super) { - __extends(Derived, _super); - function Derived() { - var _this = _super.call(this) || this; - _super.prototype. = value; - return _this; - } - Derived.prototype.foo = function () { _super.prototype. = value; }; - Derived.sfoo = function () { _super. = value; }; - return Derived; -}(C)); +class Derived extends C { + constructor() { super(); super. = value; } + foo() { super. = value; } + static sfoo() { super. = value; } +} // function expression function bar() { } value; -(function () { }); +() => { }; value; // function calls foo() = value; diff --git a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js index 23f7e7ccf2d6c..5a86d8fead6a1 100644 --- a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js +++ b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.js @@ -92,7 +92,7 @@ M = { y: 3 }; // Error (M) = { y: 3 }; // Error var M2; (function (M2) { - var M3; + let M3; (function (M3) { })(M3 = M2.M3 || (M2.M3 = {})); M3 = { x: 3 }; // Error @@ -104,8 +104,8 @@ M2.M3 = { x: '' }; // Error (M2).M3 = { x: '' }; // Error (M2.M3) = { x: '' }; // Error function fn() { } -fn = function () { return 3; }; // Bug 823548: Should be error (fn is not a reference) -(fn) = function () { return 3; }; // Should be error +fn = () => 3; // Bug 823548: Should be error (fn is not a reference) +(fn) = () => 3; // Should be error function fn2(x, y) { x = 3; (x) = 3; // OK @@ -128,10 +128,7 @@ var E; })(E || (E = {})); E = undefined; // Error (E) = undefined; // Error -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} C = undefined; // Error (C) = undefined; // Error diff --git a/tests/baselines/reference/assignmentTypeNarrowing.js b/tests/baselines/reference/assignmentTypeNarrowing.js index 9d67dd0c50c3b..85457ff356b16 100644 --- a/tests/baselines/reference/assignmentTypeNarrowing.js +++ b/tests/baselines/reference/assignmentTypeNarrowing.js @@ -38,26 +38,24 @@ arr.push({ x: "ok" }); //// [assignmentTypeNarrowing.js] -var _a, _b, _c; -var x; +let x; x = ""; x; // string -x = [true][0]; +[x] = [true]; x; // boolean -_a = [1][0], x = _a === void 0 ? "" : _a; +[x = ""] = [1]; x; // string | number -(x = { x: true }.x); +({ x } = { x: true }); x; // boolean -(x = { y: 1 }.y); +({ y: x } = { y: 1 }); x; // number -(_b = { x: true }.x, x = _b === void 0 ? "" : _b); +({ x = "" } = { x: true }); x; // string | boolean -(_c = { y: 1 }.y, x = _c === void 0 ? /a/ : _c); +({ y: x = /a/ } = { y: 1 }); x; // number | RegExp -var a; -for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { - x = a_1[_i]; +let a; +for (x of a) { x; // string } -var arr = [{ x: "ok" }]; // weak type +const arr = [{ x: "ok" }]; // weak type arr.push({ x: "ok" }); diff --git a/tests/baselines/reference/assignmentTypeNarrowing.symbols b/tests/baselines/reference/assignmentTypeNarrowing.symbols index ba97395916459..bd5fb47438f1a 100644 --- a/tests/baselines/reference/assignmentTypeNarrowing.symbols +++ b/tests/baselines/reference/assignmentTypeNarrowing.symbols @@ -3,7 +3,7 @@ === assignmentTypeNarrowing.ts === let x: string | number | boolean | RegExp; >x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) ->RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.regexp.d.ts, --, --) ... and 3 more) x = ""; >x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3)) diff --git a/tests/baselines/reference/assignments.js b/tests/baselines/reference/assignments.js index 0351bb7d702c1..8c8c99995ca2e 100644 --- a/tests/baselines/reference/assignments.js +++ b/tests/baselines/reference/assignments.js @@ -43,11 +43,8 @@ I = null; // Error // Assign to a parameter // Assign to an interface M = null; // Error -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { +} C = null; // Error var E; (function (E) { diff --git a/tests/baselines/reference/binaryIntegerLiteralError.js b/tests/baselines/reference/binaryIntegerLiteralError.js index b46f6a1216748..dacb4a2a29b83 100644 --- a/tests/baselines/reference/binaryIntegerLiteralError.js +++ b/tests/baselines/reference/binaryIntegerLiteralError.js @@ -14,12 +14,12 @@ var obj1 = { //// [binaryIntegerLiteralError.js] // error -var bin1 = 6; +var bin1 = 0B110; 2110; -var bin1 = 6; +var bin1 = 0b110; 23410; var obj1 = { - 26: "hi", + 0b11010: "hi", 26: "Hello", "26": "world", }; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js index e9366ce705d47..a3cd244fecaa7 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.js @@ -70,20 +70,18 @@ var ANY; var ANY1; var ANY2 = ["", ""]; var obj; -var obj1 = { x: "", y: function () { } }; +var obj1 = { x: "", y: () => { } }; function foo() { var a; return a; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { +class A { + a; + static foo() { var a; return a; - }; - return A; -}()); + } +} var M; (function (M) { })(M || (M = {})); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js index e8ee07455d579..0a5b173661908 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js @@ -44,12 +44,10 @@ var ResultIsNumber8 = ~~BOOLEAN; // ~ operator on boolean type var BOOLEAN; function foo() { return true; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return false; }; - return A; -}()); +class A { + a; + static foo() { return false; } +} var M; (function (M) { })(M || (M = {})); diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js index 2373b8140dc62..5116a12560b31 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js @@ -51,12 +51,10 @@ var ResultIsNumber13 = ~~~(NUMBER + NUMBER); var NUMBER; var NUMBER1 = [1, 2]; function foo() { return 1; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return 1; }; - return A; -}()); +class A { + a; + static foo() { return 1; } +} var M; (function (M) { })(M || (M = {})); @@ -67,7 +65,7 @@ var ResultIsNumber2 = ~NUMBER1; // number type literal var ResultIsNumber3 = ~1; var ResultIsNumber4 = ~{ x: 1, y: 2 }; -var ResultIsNumber5 = ~{ x: 1, y: function (n) { return n; } }; +var ResultIsNumber5 = ~{ x: 1, y: (n) => { return n; } }; // number type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js index 9e39e5a83b024..09ddbeee4dbb4 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js @@ -50,12 +50,10 @@ var ResultIsNumber14 = ~~~(STRING + STRING); var STRING; var STRING1 = ["", "abc"]; function foo() { return "abc"; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return ""; }; - return A; -}()); +class A { + a; + static foo() { return ""; } +} var M; (function (M) { })(M || (M = {})); @@ -66,7 +64,7 @@ var ResultIsNumber2 = ~STRING1; // string type literal var ResultIsNumber3 = ~""; var ResultIsNumber4 = ~{ x: "", y: "" }; -var ResultIsNumber5 = ~{ x: "", y: function (s) { return s; } }; +var ResultIsNumber5 = ~{ x: "", y: (s) => { return s; } }; // string type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/callChain.2.js b/tests/baselines/reference/callChain.2.js index 1e5985f585401..f296c86d13af4 100644 --- a/tests/baselines/reference/callChain.2.js +++ b/tests/baselines/reference/callChain.2.js @@ -12,7 +12,6 @@ o3.b?.().c; //// [callChain.2.js] -var _a; -o1 === null || o1 === void 0 ? void 0 : o1(); -o2 === null || o2 === void 0 ? void 0 : o2.b(); -(_a = o3.b) === null || _a === void 0 ? void 0 : _a.call(o3).c; +o1?.(); +o2?.b(); +o3.b?.().c; diff --git a/tests/baselines/reference/callChain.3.js b/tests/baselines/reference/callChain.3.js index 38f02912a2dfe..ec343cd44ab4a 100644 --- a/tests/baselines/reference/callChain.3.js +++ b/tests/baselines/reference/callChain.3.js @@ -14,11 +14,10 @@ t1 = a!.m!({x: 12}); //// [callChain.3.js] "use strict"; -var _a, _b, _c, _d, _e; -var n1 = (_a = a === null || a === void 0 ? void 0 : a.m) === null || _a === void 0 ? void 0 : _a.call(a, { x: 12 }); // should be an error (`undefined` is not assignable to `number`) -var n2 = (_b = a === null || a === void 0 ? void 0 : a.m) === null || _b === void 0 ? void 0 : _b.call(a, { x: absorb() }); // likewise -var n3 = (_c = a === null || a === void 0 ? void 0 : a.m) === null || _c === void 0 ? void 0 : _c.call(a, { x: 12 }); // should be ok -var n4 = (_d = a === null || a === void 0 ? void 0 : a.m) === null || _d === void 0 ? void 0 : _d.call(a, { x: absorb() }); // likewise +const n1 = a?.m?.({ x: 12 }); // should be an error (`undefined` is not assignable to `number`) +const n2 = a?.m?.({ x: absorb() }); // likewise +const n3 = a?.m?.({ x: 12 }); // should be ok +const n4 = a?.m?.({ x: absorb() }); // likewise // Also a test showing `!` vs `?` for good measure -var t1 = (_e = a === null || a === void 0 ? void 0 : a.m) === null || _e === void 0 ? void 0 : _e.call(a, { x: 12 }); +let t1 = a?.m?.({ x: 12 }); t1 = a.m({ x: 12 }); diff --git a/tests/baselines/reference/callChain.js b/tests/baselines/reference/callChain.js index 1fca98bc97818..0f07a9dddce63 100644 --- a/tests/baselines/reference/callChain.js +++ b/tests/baselines/reference/callChain.js @@ -45,42 +45,32 @@ o2?.b()!.toString!; //// [callChain.js] "use strict"; -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; -o1 === null || o1 === void 0 ? void 0 : o1(); -o1 === null || o1 === void 0 ? void 0 : o1(1); -o1 === null || o1 === void 0 ? void 0 : o1.apply(void 0, [1, 2]); -o1 === null || o1 === void 0 ? void 0 : o1.apply(void 0, __spreadArray(__spreadArray([1], [2, 3], false), [4], false)); -o2 === null || o2 === void 0 ? void 0 : o2.b(); -o2 === null || o2 === void 0 ? void 0 : o2.b(1); -o2 === null || o2 === void 0 ? void 0 : o2.b.apply(o2, [1, 2]); -o2 === null || o2 === void 0 ? void 0 : o2.b.apply(o2, __spreadArray(__spreadArray([1], [2, 3], false), [4], false)); -o2 === null || o2 === void 0 ? void 0 : o2["b"](); -o2 === null || o2 === void 0 ? void 0 : o2["b"](1); -o2 === null || o2 === void 0 ? void 0 : o2["b"].apply(o2, [1, 2]); -o2 === null || o2 === void 0 ? void 0 : o2["b"].apply(o2, __spreadArray(__spreadArray([1], [2, 3], false), [4], false)); -(_a = o3.b) === null || _a === void 0 ? void 0 : _a.call(o3).c; -(_b = o3.b) === null || _b === void 0 ? void 0 : _b.call(o3, 1).c; -(_c = o3.b) === null || _c === void 0 ? void 0 : _c.call.apply(_c, __spreadArray([o3], [1, 2], false)).c; -(_d = o3.b) === null || _d === void 0 ? void 0 : _d.call.apply(_d, __spreadArray(__spreadArray([o3, 1], [2, 3], false), [4], false)).c; -(_e = o3.b) === null || _e === void 0 ? void 0 : _e.call(o3)["c"]; -(_f = o3.b) === null || _f === void 0 ? void 0 : _f.call(o3, 1)["c"]; -(_g = o3.b) === null || _g === void 0 ? void 0 : _g.call.apply(_g, __spreadArray([o3], [1, 2], false))["c"]; -(_h = o3.b) === null || _h === void 0 ? void 0 : _h.call.apply(_h, __spreadArray(__spreadArray([o3, 1], [2, 3], false), [4], false))["c"]; -(_j = o3["b"]) === null || _j === void 0 ? void 0 : _j.call(o3).c; -(_k = o3["b"]) === null || _k === void 0 ? void 0 : _k.call(o3, 1).c; -(_l = o3["b"]) === null || _l === void 0 ? void 0 : _l.call.apply(_l, __spreadArray([o3], [1, 2], false)).c; -(_m = o3["b"]) === null || _m === void 0 ? void 0 : _m.call.apply(_m, __spreadArray(__spreadArray([o3, 1], [2, 3], false), [4], false)).c; -var v = o4 === null || o4 === void 0 ? void 0 : o4(incr); -(_o = o5()) === null || _o === void 0 ? void 0 : _o(); +o1?.(); +o1?.(1); +o1?.(...[1, 2]); +o1?.(1, ...[2, 3], 4); +o2?.b(); +o2?.b(1); +o2?.b(...[1, 2]); +o2?.b(1, ...[2, 3], 4); +o2?.["b"](); +o2?.["b"](1); +o2?.["b"](...[1, 2]); +o2?.["b"](1, ...[2, 3], 4); +o3.b?.().c; +o3.b?.(1).c; +o3.b?.(...[1, 2]).c; +o3.b?.(1, ...[2, 3], 4).c; +o3.b?.()["c"]; +o3.b?.(1)["c"]; +o3.b?.(...[1, 2])["c"]; +o3.b?.(1, ...[2, 3], 4)["c"]; +o3["b"]?.().c; +o3["b"]?.(1).c; +o3["b"]?.(...[1, 2]).c; +o3["b"]?.(1, ...[2, 3], 4).c; +const v = o4?.(incr); +o5()?.(); // GH#36031 -o2 === null || o2 === void 0 ? void 0 : o2.b().toString; -o2 === null || o2 === void 0 ? void 0 : o2.b().toString; +o2?.b().toString; +o2?.b().toString; diff --git a/tests/baselines/reference/callChainInference.js b/tests/baselines/reference/callChainInference.js index 38e535d5ec98f..dfaaef1e52027 100644 --- a/tests/baselines/reference/callChainInference.js +++ b/tests/baselines/reference/callChainInference.js @@ -22,6 +22,6 @@ value?.foo("a"); "use strict"; // Repro from #42404 if (value) { - value === null || value === void 0 ? void 0 : value.foo("a"); + value?.foo("a"); } -value === null || value === void 0 ? void 0 : value.foo("a"); +value?.foo("a"); diff --git a/tests/baselines/reference/callOverload.js b/tests/baselines/reference/callOverload.js index a5cb85289d81b..0a492ce9c6c53 100644 --- a/tests/baselines/reference/callOverload.js +++ b/tests/baselines/reference/callOverload.js @@ -14,19 +14,10 @@ withRest(); withRest(...n); //// [callOverload.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; var n; fn(1); // no error fn(1, 2, 3, 4); takeTwo(1, 2, 3, 4); -withRest.apply(void 0, __spreadArray(['a'], n, false)); // no error +withRest('a', ...n); // no error withRest(); -withRest.apply(void 0, n); +withRest(...n); diff --git a/tests/baselines/reference/callOverload.symbols b/tests/baselines/reference/callOverload.symbols index 5988ca6b13b8d..a960fcb5c4a4b 100644 --- a/tests/baselines/reference/callOverload.symbols +++ b/tests/baselines/reference/callOverload.symbols @@ -14,7 +14,7 @@ declare function withRest(a: any, ...args: Array): void; >withRest : Symbol(withRest, Decl(callOverload.ts, 1, 47)) >a : Symbol(a, Decl(callOverload.ts, 2, 26)) >args : Symbol(args, Decl(callOverload.ts, 2, 33)) ->Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more) var n: number[]; >n : Symbol(n, Decl(callOverload.ts, 3, 3)) diff --git a/tests/baselines/reference/callWithMissingVoid.js b/tests/baselines/reference/callWithMissingVoid.js index 72a0bca07b59b..51a8f709709a2 100644 --- a/tests/baselines/reference/callWithMissingVoid.js +++ b/tests/baselines/reference/callWithMissingVoid.js @@ -89,14 +89,11 @@ call((x: number | void, y: number | void) => 42, 4, 2) // ok //// [callWithMissingVoid.js] "use strict"; // From #4260 -var X = /** @class */ (function () { - function X() { - } - X.prototype.f = function (t) { +class X { + f(t) { return { a: t }; - }; - return X; -}()); + } +} x.f(); // no error because f expects void xUnion.f(42); // no error because f accepts number xUnion.f(); // no error because f accepts void @@ -104,16 +101,15 @@ xAny.f(); // error, any still expects an argument xUnknown.f(); // error, unknown still expects an argument xNever.f(); // error, never still expects an argument // Promise has previously been updated to work without arguments, but to show this fixes the issue too. -var MyPromise = /** @class */ (function () { - function MyPromise(executor) { +class MyPromise { + constructor(executor) { } - return MyPromise; -}()); -new MyPromise(function (resolve) { return resolve(); }); // no error -new MyPromise(function (resolve) { return resolve(); }); // no error -new MyPromise(function (resolve) { return resolve(); }); // error, `any` arguments cannot be omitted -new MyPromise(function (resolve) { return resolve(); }); // error, `unknown` arguments cannot be omitted -new MyPromise(function (resolve) { return resolve(); }); // error, `never` arguments cannot be omitted +} +new MyPromise(resolve => resolve()); // no error +new MyPromise(resolve => resolve()); // no error +new MyPromise(resolve => resolve()); // error, `any` arguments cannot be omitted +new MyPromise(resolve => resolve()); // error, `unknown` arguments cannot be omitted +new MyPromise(resolve => resolve()); // error, `never` arguments cannot be omitted // Multiple parameters function a(x, y, z) { } @@ -132,11 +128,11 @@ c(3, void 0, void 0); // ok c(3, void 0); // ok c(3); // ok c(); // ok -call(function (x, y) { return x + y; }); // error -call(function (x, y) { return x + y; }, 4, 2); // ok -call(function (x, y) { return x; }, 4, void 0); // ok -call(function (x, y) { return x; }, 4); // ok -call(function (x, y) { return 42; }); // ok -call(function (x, y) { return 42; }); // ok -call(function (x, y) { return 42; }, 4); // ok -call(function (x, y) { return 42; }, 4, 2); // ok +call((x, y) => x + y); // error +call((x, y) => x + y, 4, 2); // ok +call((x, y) => x, 4, void 0); // ok +call((x, y) => x, 4); // ok +call((x, y) => 42); // ok +call((x, y) => 42); // ok +call((x, y) => 42, 4); // ok +call((x, y) => 42, 4, 2); // ok diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index 6bf603161d25c..decc82fdeeb7b 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -61,86 +61,46 @@ class D extends C { //// [callWithSpread.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; -var _a, _b, _c, _d, _e, _f, _g; -function foo(x, y) { - var z = []; - for (var _i = 2; _i < arguments.length; _i++) { - z[_i - 2] = arguments[_i]; - } +function foo(x, y, ...z) { } var a; var z; var obj; var xa; foo(1, 2, "abc"); -foo.apply(void 0, __spreadArray([1, 2], a, false)); -foo.apply(void 0, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); +foo(1, 2, ...a); +foo(1, 2, ...a, "abc"); obj.foo(1, 2, "abc"); -obj.foo.apply(obj, __spreadArray([1, 2], a, false)); -obj.foo.apply(obj, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); -obj.foo.apply(obj, __spreadArray([1, 2], a, false)).foo(1, 2, "abc"); -(_a = obj.foo.apply(obj, __spreadArray([1, 2], a, false))).foo.apply(_a, __spreadArray([1, 2], a, false)); -(_b = obj.foo.apply(obj, __spreadArray([1, 2], a, false))).foo.apply(_b, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); +obj.foo(1, 2, ...a); +obj.foo(1, 2, ...a, "abc"); +obj.foo(1, 2, ...a).foo(1, 2, "abc"); +obj.foo(1, 2, ...a).foo(1, 2, ...a); +obj.foo(1, 2, ...a).foo(1, 2, ...a, "abc"); (obj.foo)(1, 2, "abc"); -obj.foo.apply(obj, __spreadArray([1, 2], a, false)); -obj.foo.apply(obj, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); -(obj.foo.apply(obj, __spreadArray([1, 2], a, false)).foo)(1, 2, "abc"); -(_c = obj.foo.apply(obj, __spreadArray([1, 2], a, false))).foo.apply(_c, __spreadArray([1, 2], a, false)); -(_d = obj.foo.apply(obj, __spreadArray([1, 2], a, false))).foo.apply(_d, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); +(obj.foo)(1, 2, ...a); +(obj.foo)(1, 2, ...a, "abc"); +((obj.foo)(1, 2, ...a).foo)(1, 2, "abc"); +((obj.foo)(1, 2, ...a).foo)(1, 2, ...a); +((obj.foo)(1, 2, ...a).foo)(1, 2, ...a, "abc"); xa[1].foo(1, 2, "abc"); -(_e = xa[1]).foo.apply(_e, __spreadArray([1, 2], a, false)); -(_f = xa[1]).foo.apply(_f, __spreadArray(__spreadArray([1, 2], a, false), ["abc"], false)); -(_g = xa[1]).foo.apply(_g, [1, 2, "abc"]); -var C = /** @class */ (function () { - function C(x, y) { - var z = []; - for (var _i = 2; _i < arguments.length; _i++) { - z[_i - 2] = arguments[_i]; - } +xa[1].foo(1, 2, ...a); +xa[1].foo(1, 2, ...a, "abc"); +xa[1].foo(...[1, 2, "abc"]); +class C { + constructor(x, y, ...z) { this.foo(x, y); - this.foo.apply(this, __spreadArray([x, y], z, false)); + this.foo(x, y, ...z); + } + foo(x, y, ...z) { } - C.prototype.foo = function (x, y) { - var z = []; - for (var _i = 2; _i < arguments.length; _i++) { - z[_i - 2] = arguments[_i]; - } - }; - return C; -}()); -var D = /** @class */ (function (_super) { - __extends(D, _super); - function D() { - var _this = _super.call(this, 1, 2) || this; - return _super.apply(this, __spreadArray([1, 2], a, false)) || this; +} +class D extends C { + constructor() { + super(1, 2); + super(1, 2, ...a); + } + foo() { + super.foo(1, 2); + super.foo(1, 2, ...a); } - D.prototype.foo = function () { - _super.prototype.foo.call(this, 1, 2); - _super.prototype.foo.apply(this, __spreadArray([1, 2], a, false)); - }; - return D; -}(C)); +} diff --git a/tests/baselines/reference/callWithSpread.symbols b/tests/baselines/reference/callWithSpread.symbols index 72135145be436..06690c86433b0 100644 --- a/tests/baselines/reference/callWithSpread.symbols +++ b/tests/baselines/reference/callWithSpread.symbols @@ -148,7 +148,7 @@ xa[1].foo(1, 2, ...a, "abc"); >a : Symbol(a, Decl(callWithSpread.ts, 7, 3)) (xa[1].foo)(...[1, 2, "abc"]); ->Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) >xa[1].foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) >xa : Symbol(xa, Decl(callWithSpread.ts, 10, 3)) >foo : Symbol(X.foo, Decl(callWithSpread.ts, 0, 13)) diff --git a/tests/baselines/reference/callWithSpread2.js b/tests/baselines/reference/callWithSpread2.js index ca7a2346c1fed..dc74992a43c76 100644 --- a/tests/baselines/reference/callWithSpread2.js +++ b/tests/baselines/reference/callWithSpread2.js @@ -40,33 +40,24 @@ prefix2("g", ...ns); //// [callWithSpread2.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // good -all.apply(void 0, ns); -weird.apply(void 0, ns); -weird.apply(void 0, mixed); -weird.apply(void 0, tuple); -prefix.apply(void 0, __spreadArray(["a"], ns, false)); -rest.apply(void 0, __spreadArray(["d"], ns, false)); +all(...ns); +weird(...ns); +weird(...mixed); +weird(...tuple); +prefix("a", ...ns); +rest("d", ...ns); // extra arguments -normal.apply(void 0, __spreadArray(["g"], ns, false)); -thunk.apply(void 0, ns); +normal("g", ...ns); +thunk(...ns); // bad -all.apply(void 0, mixed); -all.apply(void 0, tuple); -prefix.apply(void 0, __spreadArray(["b"], mixed, false)); -prefix.apply(void 0, __spreadArray(["c"], tuple, false)); -rest.apply(void 0, __spreadArray(["e"], mixed, false)); -rest.apply(void 0, __spreadArray(["f"], tuple, false)); -prefix.apply(void 0, ns); // required parameters are required -prefix.apply(void 0, mixed); -prefix.apply(void 0, tuple); -prefix2.apply(void 0, __spreadArray(["g"], ns, false)); +all(...mixed); +all(...tuple); +prefix("b", ...mixed); +prefix("c", ...tuple); +rest("e", ...mixed); +rest("f", ...tuple); +prefix(...ns); // required parameters are required +prefix(...mixed); +prefix(...tuple); +prefix2("g", ...ns); diff --git a/tests/baselines/reference/callWithSpread3.js b/tests/baselines/reference/callWithSpread3.js index 5d725cf67926b..38eba460de814 100644 --- a/tests/baselines/reference/callWithSpread3.js +++ b/tests/baselines/reference/callWithSpread3.js @@ -39,34 +39,25 @@ fs5(...s2, "foo", ...s2); //// [callWithSpread3.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; // error -fs2.apply(void 0, __spreadArray(['a'], s2, false)); // error on ...s2 -fs2.apply(void 0, __spreadArray(['a', 'b', 'c'], s2, false)); // error on 'c' and ...s2 -fs2.apply(void 0, __spreadArray(__spreadArray(['a', 'b'], s2, false), ['c'], false)); // error on ...s2 and 'c' -fs2.apply(void 0, __spreadArray(__spreadArray(['a', 'b', 'c'], s2, false), ['d'], false)); // error on 'c', ...s2 and 'd' -fs2.apply(void 0, __spreadArray(__spreadArray([], s2, false), ['a'], false)); // error on 'a' -fs2.apply(void 0, s3); // error on ...s3 -fs2_.apply(void 0, s_); // error on ...s_ -fs2_.apply(void 0, s2n_); // error on ...s2n_ -fs2_.apply(void 0, __spreadArray(__spreadArray([], s_, false), s_, false)); // error on ...s_ -fs2_.apply(void 0, __spreadArray(__spreadArray(__spreadArray([], s_, false), s_, false), s_, false)); // error on ...s_ +fs2('a', ...s2); // error on ...s2 +fs2('a', 'b', 'c', ...s2); // error on 'c' and ...s2 +fs2('a', 'b', ...s2, 'c'); // error on ...s2 and 'c' +fs2('a', 'b', 'c', ...s2, 'd'); // error on 'c', ...s2 and 'd' +fs2(...s2, 'a'); // error on 'a' +fs2(...s3); // error on ...s3 +fs2_(...s_); // error on ...s_ +fs2_(...s2n_); // error on ...s2n_ +fs2_(...s_, ...s_); // error on ...s_ +fs2_(...s_, ...s_, ...s_); // error on ...s_ // fs2n_(...s2, ...s_); // FIXME: should be a type error -fs2n_.apply(void 0, s2_); // error on ...s2_ +fs2n_(...s2_); // error on ...s2_ // ok -fs2_.apply(void 0, s2_); -fs2_.apply(void 0, __spreadArray(__spreadArray([], s2_, false), s_, false)); -fs2_.apply(void 0, __spreadArray(__spreadArray([], s2_, false), s2_, false)); -fs2_.apply(void 0, __spreadArray(__spreadArray([], s_, false), s2_, false)); -fs2n_.apply(void 0, s2n_); -fs2n_.apply(void 0, s2); +fs2_(...s2_); +fs2_(...s2_, ...s_); +fs2_(...s2_, ...s2_); +fs2_(...s_, ...s2_); +fs2n_(...s2n_); +fs2n_(...s2); // fs2n_(...s2, ...n_); // FIXME: should compile -fs5.apply(void 0, __spreadArray(__spreadArray(__spreadArray([], s2, false), ["foo"], false), s2, false)); +fs5(...s2, "foo", ...s2); diff --git a/tests/baselines/reference/callWithSpread5.js b/tests/baselines/reference/callWithSpread5.js index 5938fe6e25d3f..9b29d0b577f0f 100644 --- a/tests/baselines/reference/callWithSpread5.js +++ b/tests/baselines/reference/callWithSpread5.js @@ -11,14 +11,5 @@ fn(...nntnnnt, x) //// [callWithSpread5.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; -fn.apply(void 0, __spreadArray(__spreadArray([], nnnu, false), [x], false)); -fn.apply(void 0, __spreadArray(__spreadArray([], nntnnnt, false), [x], false)); +fn(...nnnu, x); +fn(...nntnnnt, x); diff --git a/tests/baselines/reference/callbackOnConstructor.js b/tests/baselines/reference/callbackOnConstructor.js index ff7779e0476fd..a146a32dac878 100644 --- a/tests/baselines/reference/callbackOnConstructor.js +++ b/tests/baselines/reference/callbackOnConstructor.js @@ -17,23 +17,17 @@ var ooscope2 = s => s.length > 0 //// [callbackOnConstructor.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Preferences = void 0; -var Preferences = /** @class */ (function () { +export class Preferences { + assignability = "no"; /** * @callback ValueGetter_2 * @param {string} name * @returns {boolean|number|string|undefined} */ - function Preferences() { - this.assignability = "no"; - } - return Preferences; -}()); -exports.Preferences = Preferences; + constructor() { } +} /** @type {ValueGetter_2} */ -var ooscope2 = function (s) { return s.length > 0; }; +var ooscope2 = s => s.length > 0; //// [callbackOnConstructor.d.ts] diff --git a/tests/baselines/reference/callbackTagVariadicType.js b/tests/baselines/reference/callbackTagVariadicType.js index da31a9e954549..82569d07704e7 100644 --- a/tests/baselines/reference/callbackTagVariadicType.js +++ b/tests/baselines/reference/callbackTagVariadicType.js @@ -13,18 +13,14 @@ var res = x('a', 'b') //// [callbackTagVariadicType.js] -"use strict"; /** * @callback Foo * @param {...string} args * @returns {number} */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; /** @type {Foo} */ -var x = function () { return 1; }; -exports.x = x; -var res = (0, exports.x)('a', 'b'); +export const x = () => 1; +var res = x('a', 'b'); //// [callbackTagVariadicType.d.ts] diff --git a/tests/baselines/reference/canFollowGetSetKeyword.errors.txt b/tests/baselines/reference/canFollowGetSetKeyword.errors.txt index 6994b68f4970b..bb06bf25ecab6 100644 --- a/tests/baselines/reference/canFollowGetSetKeyword.errors.txt +++ b/tests/baselines/reference/canFollowGetSetKeyword.errors.txt @@ -1,11 +1,9 @@ -error TS2318: Cannot find global type 'IterableIterator'. canFollowGetSetKeyword.ts(10,5): error TS18004: No value exists in scope for the shorthand property 'get'. Either declare one or provide an initializer. canFollowGetSetKeyword.ts(11,5): error TS1005: ',' expected. -canFollowGetSetKeyword.ts(14,5): error TS18004: No value exists in scope for the shorthand property 'set'. Either declare one or provide an initializer. +canFollowGetSetKeyword.ts(14,5): error TS2552: Cannot find name 'set'. Did you mean 'Set'? canFollowGetSetKeyword.ts(15,5): error TS1005: ',' expected. -!!! error TS2318: Cannot find global type 'IterableIterator'. ==== canFollowGetSetKeyword.ts (4 errors) ==== class A { get @@ -26,7 +24,8 @@ canFollowGetSetKeyword.ts(15,5): error TS1005: ',' expected. const d = { set ~~~ -!!! error TS18004: No value exists in scope for the shorthand property 'set'. Either declare one or provide an initializer. +!!! error TS2552: Cannot find name 'set'. Did you mean 'Set'? +!!! related TS2728 lib.es2015.collection.d.ts:--:--: 'Set' is declared here. *x() {} ~ !!! error TS1005: ',' expected. diff --git a/tests/baselines/reference/canFollowGetSetKeyword.js b/tests/baselines/reference/canFollowGetSetKeyword.js index 261125fc938b0..7f6b67b4ba9e6 100644 --- a/tests/baselines/reference/canFollowGetSetKeyword.js +++ b/tests/baselines/reference/canFollowGetSetKeyword.js @@ -19,58 +19,19 @@ const d = { }; //// [canFollowGetSetKeyword.js] -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } +class A { + get; + *x() { } +} +class B { + set; + *x() { } +} +const c = { + get, + *x() { } }; -var A = /** @class */ (function () { - function A() { - } - A.prototype.x = function () { return __generator(this, function (_a) { - return [2 /*return*/]; - }); }; - return A; -}()); -var B = /** @class */ (function () { - function B() { - } - B.prototype.x = function () { return __generator(this, function (_a) { - return [2 /*return*/]; - }); }; - return B; -}()); -var c = { - get: get, - x: function () { return __generator(this, function (_a) { - return [2 /*return*/]; - }); } -}; -var d = { - set: set, - x: function () { return __generator(this, function (_a) { - return [2 /*return*/]; - }); } +const d = { + set, + *x() { } }; diff --git a/tests/baselines/reference/chained.js b/tests/baselines/reference/chained.js index d9aca8740213d..5394370cc5720 100644 --- a/tests/baselines/reference/chained.js +++ b/tests/baselines/reference/chained.js @@ -20,21 +20,15 @@ const d: D = {}; //// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { + a; +} +export {}; //// [b.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [c.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [d.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); new D(); -var d = {}; +const d = {}; +export {}; diff --git a/tests/baselines/reference/chained2.js b/tests/baselines/reference/chained2.js index 892f42286a257..b1174b1d77c44 100644 --- a/tests/baselines/reference/chained2.js +++ b/tests/baselines/reference/chained2.js @@ -22,27 +22,18 @@ const b: types.B = {}; //// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); +class A { + a; +} +export {}; //// [b.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [c.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; -var types = require("./b"); -exports.default = types; +import * as types from './b'; +export { types as default }; //// [d.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var c_1 = require("./c"); -new c_1.default.A(); -new c_1.default.B(); -var a = {}; -var b = {}; +import types from './c'; +new types.A(); +new types.B(); +const a = {}; +const b = {}; diff --git a/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt b/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt index 32d4e79828823..4d79e8b2be24c 100644 --- a/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt +++ b/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt @@ -1,8 +1,10 @@ +validator.ts(3,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. validator.ts(19,1): error TS2322: Type 'string' is not assignable to type 'number'. validator.ts(20,1): error TS2322: Type 'string' is not assignable to type 'number'. validator.ts(21,1): error TS2322: Type 'number' is not assignable to type 'string'. +validator.ts(23,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. validator.ts(39,1): error TS2322: Type 'number' is not assignable to type 'string'. @@ -10,10 +12,12 @@ validator.ts(40,1): error TS2322: Type 'string' is not assignable to type 'numbe validator.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'. -==== validator.ts (10 errors) ==== +==== validator.ts (12 errors) ==== import "./"; import m1 = require("./mod1"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. m1.thing; m1.readonlyProp; @@ -44,6 +48,8 @@ validator.ts(41,1): error TS2322: Type 'number' is not assignable to type 'strin !!! error TS2322: Type 'number' is not assignable to type 'string'. import m2 = require("./mod2"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. m2.thing; m2.readonlyProp; diff --git a/tests/baselines/reference/checkExportsObjectAssignProperty.symbols b/tests/baselines/reference/checkExportsObjectAssignProperty.symbols index 684b7bae7edfa..01eaeca18bed8 100644 --- a/tests/baselines/reference/checkExportsObjectAssignProperty.symbols +++ b/tests/baselines/reference/checkExportsObjectAssignProperty.symbols @@ -194,7 +194,7 @@ Object.defineProperty(exports, "setonlyAccessor", { this.rwAccessors = Number(str) >rwAccessors : Symbol(rwAccessors, Decl(mod1.js, 6, 14)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) >str : Symbol(str, Decl(mod1.js, 6, 8)) } }); @@ -260,29 +260,8 @@ Object.defineProperty(module.exports, "setonlyAccessor", { this.rwAccessors = Number(str) >rwAccessors : Symbol(rwAccessors, Decl(mod2.js, 6, 14)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) >str : Symbol(str, Decl(mod2.js, 6, 8)) } }); -=== index.js === -/** - * @type {number} - */ -const q = require("./mod1").thing; ->q : Symbol(q, Decl(index.js, 3, 5)) ->require("./mod1").thing : Symbol(thing, Decl(mod1.js, 0, 0)) ->require : Symbol(require) ->"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) ->thing : Symbol(thing, Decl(mod1.js, 0, 0)) - -/** - * @type {string} - */ -const u = require("./mod2").thing; ->u : Symbol(u, Decl(index.js, 8, 5)) ->require("./mod2").thing : Symbol(thing, Decl(mod2.js, 0, 0)) ->require : Symbol(require) ->"./mod2" : Symbol("mod2", Decl(mod2.js, 0, 0)) ->thing : Symbol(thing, Decl(mod2.js, 0, 0)) - diff --git a/tests/baselines/reference/checkExportsObjectAssignProperty.types b/tests/baselines/reference/checkExportsObjectAssignProperty.types index 36a76a895f16d..413c61031e8ae 100644 --- a/tests/baselines/reference/checkExportsObjectAssignProperty.types +++ b/tests/baselines/reference/checkExportsObjectAssignProperty.types @@ -575,38 +575,3 @@ Object.defineProperty(module.exports, "setonlyAccessor", { } }); -=== index.js === -/** - * @type {number} - */ -const q = require("./mod1").thing; ->q : number -> : ^^^^^^ ->require("./mod1").thing : number -> : ^^^^^^ ->require("./mod1") : typeof import("mod1") -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->require : any -> : ^^^ ->"./mod1" : "./mod1" -> : ^^^^^^^^ ->thing : number -> : ^^^^^^ - -/** - * @type {string} - */ -const u = require("./mod2").thing; ->u : string -> : ^^^^^^ ->require("./mod2").thing : string -> : ^^^^^^ ->require("./mod2") : typeof import("mod2") -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->require : any -> : ^^^ ->"./mod2" : "./mod2" -> : ^^^^^^^^ ->thing : string -> : ^^^^^^ - diff --git a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt index 805191bcca68f..87fe977042349 100644 --- a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt +++ b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt @@ -1,3 +1,4 @@ +validator.ts(3,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. validator.ts(19,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. validator.ts(20,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. validator.ts(21,1): error TS2322: Type 'string' is not assignable to type 'number'. @@ -5,10 +6,12 @@ validator.ts(22,1): error TS2322: Type 'string' is not assignable to type 'numbe validator.ts(23,1): error TS2322: Type 'number' is not assignable to type 'string'. -==== validator.ts (5 errors) ==== +==== validator.ts (6 errors) ==== import "./"; import Person = require("./mod1"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. const m1 = new Person("Name") diff --git a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.symbols b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.symbols index a4bd591843df3..fb838ea2f1839 100644 --- a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.symbols +++ b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.symbols @@ -167,7 +167,7 @@ Object.defineProperty(Person.prototype, "setonlyAccessor", { >this.rwAccessors : Symbol(Person.rwAccessors, Decl(mod1.js, 11, 93)) >this : Symbol(Person, Decl(mod1.js, 0, 0)) >rwAccessors : Symbol(rwAccessors, Decl(mod1.js, 16, 14)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) >str : Symbol(str, Decl(mod1.js, 16, 8)) } }); diff --git a/tests/baselines/reference/checkJsdocSatisfiesTag15.js b/tests/baselines/reference/checkJsdocSatisfiesTag15.js index 9bf48fb0c473b..57005fd7befbf 100644 --- a/tests/baselines/reference/checkJsdocSatisfiesTag15.js +++ b/tests/baselines/reference/checkJsdocSatisfiesTag15.js @@ -46,50 +46,40 @@ export function fn7(uuid) {} //// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fn6 = exports.fn5 = exports.fn4 = exports.fn3 = exports.fn2 = exports.v2 = exports.v1 = exports.fn1 = void 0; -exports.fn7 = fn7; /** @satisfies {(uuid: string) => void} */ -var fn1 = function (uuid) { }; -exports.fn1 = fn1; +export const fn1 = uuid => { }; /** @typedef {Parameters} Foo */ /** @type Foo */ -exports.v1 = ['abc']; +export const v1 = ['abc']; /** @type Foo */ -exports.v2 = [123]; // error +export const v2 = [123]; // error /** @satisfies {(a: string, ...args: never) => void} */ -var fn2 = function (a, b) { }; -exports.fn2 = fn2; +export const fn2 = (a, b) => { }; /** * @satisfies {(a: string, ...args: never) => void} * @param {string} a */ -var fn3 = function (a, b) { }; -exports.fn3 = fn3; +export const fn3 = (a, b) => { }; /** * @satisfies {(a: string, ...args: never) => void} * @param {string} a * @param {number} b */ -var fn4 = function (a, b) { }; -exports.fn4 = fn4; +export const fn4 = (a, b) => { }; /** * @satisfies {(a: string, ...args: number[]) => void} * @param {string} a * @param {string} b */ -var fn5 = function (a, b) { }; -exports.fn5 = fn5; +export const fn5 = (a, b) => { }; /** * @satisfies {(a: string, ...args: number[]) => void} * @param {string} a * @param {string | number} b */ -var fn6 = function (a, b) { }; -exports.fn6 = fn6; +export const fn6 = (a, b) => { }; /** @satisfies {(uuid: string) => void} */ -function fn7(uuid) { } +export function fn7(uuid) { } //// [a.d.ts] diff --git a/tests/baselines/reference/checkJsdocTypeTag1.js b/tests/baselines/reference/checkJsdocTypeTag1.js index e605dfc187b34..a154f9d89a479 100644 --- a/tests/baselines/reference/checkJsdocTypeTag1.js +++ b/tests/baselines/reference/checkJsdocTypeTag1.js @@ -56,16 +56,16 @@ anyT = "hello"; var anyT1 = 2; anyT1 = "hi"; /** @type {Function} */ -var x = function (a) { return a + 1; }; +const x = (a) => a + 1; x(1); /** @type {function} */ -var y = function (a) { return a + 1; }; +const y = (a) => a + 1; y(1); /** @type {function (number)} */ -var x1 = function (a) { return a + 1; }; +const x1 = (a) => a + 1; x1(0); /** @type {function (number): number} */ -var x2 = function (a) { return a + 1; }; +const x2 = (a) => a + 1; x2(0); /** * @type {object} diff --git a/tests/baselines/reference/checkJsdocTypeTag2.js b/tests/baselines/reference/checkJsdocTypeTag2.js index 1e7db9aa49c82..ee542d60a97e7 100644 --- a/tests/baselines/reference/checkJsdocTypeTag2.js +++ b/tests/baselines/reference/checkJsdocTypeTag2.js @@ -34,16 +34,16 @@ var S = true; /** @type {number} */ var n = "hello"; /** @type {function (number)} */ -var x1 = function (a) { return a + 1; }; +const x1 = (a) => a + 1; x1("string"); /** @type {function (number): number} */ -var x2 = function (a) { return a + 1; }; +const x2 = (a) => a + 1; /** @type {string} */ var a; a = x2(0); /** @type {function (number): number} */ -var x3 = function (a) { return a.concat("hi"); }; +const x3 = (a) => a.concat("hi"); x3(0); /** @type {function (number): string} */ -var x4 = function (a) { return a + 1; }; +const x4 = (a) => a + 1; x4(0); diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js index 1c5c61fcbf5f2..015c24d006fe3 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js @@ -27,26 +27,24 @@ obj.bar1 = "42"; obj.arrowFunc(0); //// [0.js] -var _a; // @ts-check var lol = "hello Lol"; -var obj = (_a = { - /** @type {string|undefined} */ - foo: undefined, - /** @type {string|undefined} */ - bar: "42", - /** @type {function(number): number} */ - method1: function (n1) { - return n1 + 42; - }, - /** @type {string} */ - lol: lol +const obj = { + /** @type {string|undefined} */ + foo: undefined, + /** @type {string|undefined} */ + bar: "42", + /** @type {function(number): number} */ + method1(n1) { + return n1 + 42; }, + /** @type {string} */ + lol, /** @type {number} */ - _a['b' + 'ar1'] = 42, + ['b' + 'ar1']: 42, /** @type {function(number): number} */ - _a.arrowFunc = function (num) { return num + 42; }, - _a); + arrowFunc: (num) => num + 42 +}; obj.foo = 'string'; obj.lol; obj.bar = undefined; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js index 62fe33e8b2675..a2333e6b998b2 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js @@ -27,22 +27,19 @@ var s1 = obj.method2("0"); //// [0.js] // @ts-check var lol; -var obj = { +const obj = { /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ - method1: function (n1) { + method1(n1) { return "42"; }, /** @type {function(number): number} */ - method2: function (n1) { return "lol"; }, + method2: (n1) => "lol", /** @type {function(number): number} */ - arrowFunc: function (num) { - if (num === void 0) { num = "0"; } - return num + 42; - }, + arrowFunc: (num = "0") => num + 42, /** @type {string} */ - lol: lol + lol }; lol = "string"; /** @type {string} */ diff --git a/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js b/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js index 5289265970499..76a2b24725d0b 100644 --- a/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js +++ b/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.js @@ -22,4 +22,4 @@ var exports = {}; */ exports.SomeName; /** @type {exports.SomeName} */ -var myString = 'str'; +const myString = 'str'; diff --git a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js index e39ef89f279b1..21f87617be4c4 100644 --- a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js +++ b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.js @@ -24,39 +24,14 @@ const testErr = //// [checkJsxChildrenCanBeTupleType.js] -"use strict"; /// -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var react_1 = __importDefault(require("react")); -var ResizablePanel = /** @class */ (function (_super) { - __extends(ResizablePanel, _super); - function ResizablePanel() { - return _super !== null && _super.apply(this, arguments) || this; - } - return ResizablePanel; -}(react_1.default.Component)); -var test = react_1.default.createElement(ResizablePanel, null, - react_1.default.createElement("div", null), - react_1.default.createElement("div", null)); -var testErr = react_1.default.createElement(ResizablePanel, null, - react_1.default.createElement("div", null), - react_1.default.createElement("div", null), - react_1.default.createElement("div", null)); +import React from 'react'; +class ResizablePanel extends React.Component { +} +const test = React.createElement(ResizablePanel, null, + React.createElement("div", null), + React.createElement("div", null)); +const testErr = React.createElement(ResizablePanel, null, + React.createElement("div", null), + React.createElement("div", null), + React.createElement("div", null)); diff --git a/tests/baselines/reference/checkJsxChildrenProperty1.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty1.errors.txt new file mode 100644 index 0000000000000..e025c0ee25410 --- /dev/null +++ b/tests/baselines/reference/checkJsxChildrenProperty1.errors.txt @@ -0,0 +1,28 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + interface Prop { + a: number, + b: string, + children: string | JSX.Element + } + + function Comp(p: Prop) { + return
{p.b}
; + } + + // OK + let k = ; + let k1 = + + hi hi hi! + ; + let k2 = + +
hi hi hi!
+
; \ No newline at end of file diff --git a/tests/baselines/reference/checkJsxChildrenProperty1.js b/tests/baselines/reference/checkJsxChildrenProperty1.js index 90e72ea120cf6..7cd52bbb184d0 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty1.js +++ b/tests/baselines/reference/checkJsxChildrenProperty1.js @@ -25,17 +25,15 @@ let k2 =
; //// [file.jsx] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); function Comp(p) { return
{p.b}
; } // OK -var k = ; -var k1 = +let k = ; +let k1 = hi hi hi! ; -var k2 = +let k2 =
hi hi hi!
; +export {}; diff --git a/tests/baselines/reference/checkJsxChildrenProperty10.js b/tests/baselines/reference/checkJsxChildrenProperty10.js index a63bd97c28072..4f7b27bce6fa1 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty10.js +++ b/tests/baselines/reference/checkJsxChildrenProperty10.js @@ -25,16 +25,14 @@ let k3 =
{1} {"That is a number"}
; let k4 = ; //// [file.jsx] -var Button = /** @class */ (function () { - function Button() { - } - Button.prototype.render = function () { +class Button { + props; + render() { return (
My Button
); - }; - return Button; -}()); + } +} // OK -var k1 =

Hello

world

; -var k2 =

Hello

{function (user) { return

{user.name}

; }}
; -var k3 =
{1} {"That is a number"}
; -var k4 = ; +let k1 =

Hello

world

; +let k2 =

Hello

{(user) =>

{user.name}

}
; +let k3 =
{1} {"That is a number"}
; +let k4 = ; diff --git a/tests/baselines/reference/checkJsxChildrenProperty11.js b/tests/baselines/reference/checkJsxChildrenProperty11.js index 9ba605e32c7aa..d79f8a4e17a51 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty11.js +++ b/tests/baselines/reference/checkJsxChildrenProperty11.js @@ -25,16 +25,14 @@ let k3 =
{1} {"That is a number"}
; let k4 = ; //// [file.jsx] -var Button = /** @class */ (function () { - function Button() { - } - Button.prototype.render = function () { +class Button { + props; + render() { return (
My Button
); - }; - return Button; -}()); + } +} // OK -var k1 =

Hello

world

; -var k2 =

Hello

{function (user) { return

{user.name}

; }}
; -var k3 =
{1} {"That is a number"}
; -var k4 = ; +let k1 =

Hello

world

; +let k2 =

Hello

{(user) =>

{user.name}

}
; +let k3 =
{1} {"That is a number"}
; +let k4 = ; diff --git a/tests/baselines/reference/checkJsxChildrenProperty12.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty12.errors.txt new file mode 100644 index 0000000000000..e8d395e680942 --- /dev/null +++ b/tests/baselines/reference/checkJsxChildrenProperty12.errors.txt @@ -0,0 +1,38 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + interface ButtonProp { + a: number, + b: string, + children: Button; + } + + class Button extends React.Component { + render() { + let condition: boolean; + if (condition) { + return + } + else { + return ( +
Hello World
+
); + } + } + } + + interface InnerButtonProp { + a: number + } + + class InnerButton extends React.Component { + render() { + return (); + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/checkJsxChildrenProperty12.js b/tests/baselines/reference/checkJsxChildrenProperty12.js index 5288eddbe8b90..1caf4bc05b253 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty12.js +++ b/tests/baselines/reference/checkJsxChildrenProperty12.js @@ -35,31 +35,9 @@ class InnerButton extends React.Component { //// [file.jsx] -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var Button = /** @class */ (function (_super) { - __extends(Button, _super); - function Button() { - return _super !== null && _super.apply(this, arguments) || this; - } - Button.prototype.render = function () { - var condition; +class Button extends React.Component { + render() { + let condition; if (condition) { return ; } @@ -68,16 +46,11 @@ var Button = /** @class */ (function (_super) {
Hello World
); } - }; - return Button; -}(React.Component)); -var InnerButton = /** @class */ (function (_super) { - __extends(InnerButton, _super); - function InnerButton() { - return _super !== null && _super.apply(this, arguments) || this; } - InnerButton.prototype.render = function () { +} +class InnerButton extends React.Component { + render() { return (); - }; - return InnerButton; -}(React.Component)); + } +} +export {}; diff --git a/tests/baselines/reference/checkJsxChildrenProperty13.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty13.errors.txt index 3f1b4539a58d9..10dceefda1115 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty13.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty13.errors.txt @@ -1,8 +1,11 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. file.tsx(12,30): error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten. -==== file.tsx (1 errors) ==== +==== file.tsx (2 errors) ==== import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. interface ButtonProp { a: number, diff --git a/tests/baselines/reference/checkJsxChildrenProperty13.js b/tests/baselines/reference/checkJsxChildrenProperty13.js index 304266b096d0c..8d80e1e9e3a8c 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty13.js +++ b/tests/baselines/reference/checkJsxChildrenProperty13.js @@ -30,44 +30,17 @@ class InnerButton extends React.Component { //// [file.jsx] -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var Button = /** @class */ (function (_super) { - __extends(Button, _super); - function Button() { - return _super !== null && _super.apply(this, arguments) || this; - } - Button.prototype.render = function () { +class Button extends React.Component { + render() { // Error children are specified twice return (
Hello World
); - }; - return Button; -}(React.Component)); -var InnerButton = /** @class */ (function (_super) { - __extends(InnerButton, _super); - function InnerButton() { - return _super !== null && _super.apply(this, arguments) || this; } - InnerButton.prototype.render = function () { +} +class InnerButton extends React.Component { + render() { return (); - }; - return InnerButton; -}(React.Component)); + } +} +export {}; diff --git a/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt index 0fefce4922a9f..466948bc6f7d4 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty14.errors.txt @@ -1,8 +1,11 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. file.tsx(42,11): error TS2746: This JSX tag's 'children' prop expects a single child of type 'Element', but multiple children were provided. -==== file.tsx (1 errors) ==== +==== file.tsx (2 errors) ==== import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. interface Prop { a: number, diff --git a/tests/baselines/reference/checkJsxChildrenProperty14.js b/tests/baselines/reference/checkJsxChildrenProperty14.js index ea803d1134c64..31a0e0d108fdf 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty14.js +++ b/tests/baselines/reference/checkJsxChildrenProperty14.js @@ -45,34 +45,11 @@ let k4 = <>; - }; - return Button; -}(React.Component)); + } +} exports.Button = Button; //// [app.jsx] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.App = void 0; -var React = require("react"); +const React = require("react"); // Should see var button_1 = require('./button') here -var button_1 = require("./button"); -var App = /** @class */ (function (_super) { - __extends(App, _super); - function App() { - return _super !== null && _super.apply(this, arguments) || this; - } - App.prototype.render = function () { +const button_1 = require("./button"); +class App extends React.Component { + render() { return ; - }; - return App; -}(React.Component)); + } +} exports.App = App; diff --git a/tests/baselines/reference/tsxExternalModuleEmit2.js b/tests/baselines/reference/tsxExternalModuleEmit2.js index 02277011f9ac0..46bc209bd95e7 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit2.js +++ b/tests/baselines/reference/tsxExternalModuleEmit2.js @@ -18,20 +18,9 @@ declare var Foo, React; //// [app.js] "use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; Object.defineProperty(exports, "__esModule", { value: true }); -var mod_1 = require("mod"); +const mod_1 = require("mod"); // Should see mod_1['default'] in emit here React.createElement(Foo, { handler: mod_1.default }); // Should see mod_1['default'] in emit here -React.createElement(Foo, __assign({}, mod_1.default)); +React.createElement(Foo, { ...mod_1.default }); diff --git a/tests/baselines/reference/tsxGenericArrowFunctionParsing.js b/tests/baselines/reference/tsxGenericArrowFunctionParsing.js index 54048f1cc25af..8bf0220d6679a 100644 --- a/tests/baselines/reference/tsxGenericArrowFunctionParsing.js +++ b/tests/baselines/reference/tsxGenericArrowFunctionParsing.js @@ -38,10 +38,10 @@ var T, T1, T2; var x1 = () => ; x1.isElement; // This is a generic function -var x2 = function () { }; +var x2 = () => { }; x2(); // This is a generic function -var x3 = function () { }; +var x3 = () => { }; x3(); // This is an element var x4 = () => ; @@ -50,5 +50,5 @@ x4.isElement; var x5 = () => ; x5.isElement; // This is a generic function -var x6 = function () { }; +var x6 = () => { }; x6(); diff --git a/tests/baselines/reference/tsxGenericAttributesType1.errors.txt b/tests/baselines/reference/tsxGenericAttributesType1.errors.txt new file mode 100644 index 0000000000000..41d0ae127d2ad --- /dev/null +++ b/tests/baselines/reference/tsxGenericAttributesType1.errors.txt @@ -0,0 +1,19 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + const decorator = function (Component: React.StatelessComponent): React.StatelessComponent { + return (props) => + }; + + const decorator2 = function (Component: React.StatelessComponent): React.StatelessComponent { + return (props) => + }; + + const decorator3 = function (Component: React.StatelessComponent): React.StatelessComponent { + return (props) => + }; \ No newline at end of file diff --git a/tests/baselines/reference/tsxGenericAttributesType1.js b/tests/baselines/reference/tsxGenericAttributesType1.js index c6b87260c1b14..70f21229a2215 100644 --- a/tests/baselines/reference/tsxGenericAttributesType1.js +++ b/tests/baselines/reference/tsxGenericAttributesType1.js @@ -16,15 +16,13 @@ const decorator3 = function ( }; //// [file.jsx] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var decorator = function (Component) { - return function (props) { return ; }; +const decorator = function (Component) { + return (props) => ; }; -var decorator2 = function (Component) { - return function (props) { return ; }; +const decorator2 = function (Component) { + return (props) => ; }; -var decorator3 = function (Component) { - return function (props) { return ; }; +const decorator3 = function (Component) { + return (props) => ; }; +export {}; diff --git a/tests/baselines/reference/tsxGenericAttributesType2.errors.txt b/tests/baselines/reference/tsxGenericAttributesType2.errors.txt new file mode 100644 index 0000000000000..f16995f04c671 --- /dev/null +++ b/tests/baselines/reference/tsxGenericAttributesType2.errors.txt @@ -0,0 +1,11 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + const decorator4 = function (Component: React.StatelessComponent): React.StatelessComponent { + return (props) => + }; \ No newline at end of file diff --git a/tests/baselines/reference/tsxGenericAttributesType2.js b/tests/baselines/reference/tsxGenericAttributesType2.js index 9378020d24573..9e960c405d922 100644 --- a/tests/baselines/reference/tsxGenericAttributesType2.js +++ b/tests/baselines/reference/tsxGenericAttributesType2.js @@ -8,9 +8,7 @@ const decorator4 = function (Component: React.Stateless }; //// [file.jsx] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var decorator4 = function (Component) { - return function (props) { return ; }; +const decorator4 = function (Component) { + return (props) => ; }; +export {}; diff --git a/tests/baselines/reference/tsxGenericAttributesType3.errors.txt b/tests/baselines/reference/tsxGenericAttributesType3.errors.txt new file mode 100644 index 0000000000000..45137feaade4d --- /dev/null +++ b/tests/baselines/reference/tsxGenericAttributesType3.errors.txt @@ -0,0 +1,18 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + class B1 extends React.Component { + render() { + return
hi
; + } + } + class B extends React.Component { + render() { + return ; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/tsxGenericAttributesType3.js b/tests/baselines/reference/tsxGenericAttributesType3.js index f2232eba8209d..fe46ef1f41116 100644 --- a/tests/baselines/reference/tsxGenericAttributesType3.js +++ b/tests/baselines/reference/tsxGenericAttributesType3.js @@ -15,41 +15,14 @@ class B extends React.Component { } //// [file.jsx] -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var B1 = /** @class */ (function (_super) { - __extends(B1, _super); - function B1() { - return _super !== null && _super.apply(this, arguments) || this; - } - B1.prototype.render = function () { +class B1 extends React.Component { + render() { return
hi
; - }; - return B1; -}(React.Component)); -var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; } - B.prototype.render = function () { +} +class B extends React.Component { + render() { return ; - }; - return B; -}(React.Component)); + } +} +export {}; diff --git a/tests/baselines/reference/tsxGenericAttributesType4.errors.txt b/tests/baselines/reference/tsxGenericAttributesType4.errors.txt new file mode 100644 index 0000000000000..94fa87b930657 --- /dev/null +++ b/tests/baselines/reference/tsxGenericAttributesType4.errors.txt @@ -0,0 +1,18 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + class B1 extends React.Component { + render() { + return
hi
; + } + } + class B extends React.Component { + render() { + return ; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/tsxGenericAttributesType4.js b/tests/baselines/reference/tsxGenericAttributesType4.js index bf51d7bfcda65..ab34542f66b8a 100644 --- a/tests/baselines/reference/tsxGenericAttributesType4.js +++ b/tests/baselines/reference/tsxGenericAttributesType4.js @@ -15,41 +15,14 @@ class B extends React.Component { } //// [file.jsx] -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var B1 = /** @class */ (function (_super) { - __extends(B1, _super); - function B1() { - return _super !== null && _super.apply(this, arguments) || this; - } - B1.prototype.render = function () { +class B1 extends React.Component { + render() { return
hi
; - }; - return B1; -}(React.Component)); -var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; } - B.prototype.render = function () { +} +class B extends React.Component { + render() { return ; - }; - return B; -}(React.Component)); + } +} +export {}; diff --git a/tests/baselines/reference/tsxGenericAttributesType5.errors.txt b/tests/baselines/reference/tsxGenericAttributesType5.errors.txt new file mode 100644 index 0000000000000..889f32cfdff94 --- /dev/null +++ b/tests/baselines/reference/tsxGenericAttributesType5.errors.txt @@ -0,0 +1,22 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. +file.tsx(9,5): error TS2612: Property 'props' will overwrite the base property in 'Component'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration. + + +==== file.tsx (2 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + class B1 extends React.Component { + render() { + return
hi
; + } + } + class B extends React.Component { + props: U; + ~~~~~ +!!! error TS2612: Property 'props' will overwrite the base property in 'Component'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration. + render() { + return ; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/tsxGenericAttributesType5.js b/tests/baselines/reference/tsxGenericAttributesType5.js index 67e6d8e05088a..8a7cc27d9df01 100644 --- a/tests/baselines/reference/tsxGenericAttributesType5.js +++ b/tests/baselines/reference/tsxGenericAttributesType5.js @@ -16,41 +16,15 @@ class B extends React.Component { } //// [file.jsx] -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var B1 = /** @class */ (function (_super) { - __extends(B1, _super); - function B1() { - return _super !== null && _super.apply(this, arguments) || this; - } - B1.prototype.render = function () { +class B1 extends React.Component { + render() { return
hi
; - }; - return B1; -}(React.Component)); -var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; } - B.prototype.render = function () { +} +class B extends React.Component { + props; + render() { return ; - }; - return B; -}(React.Component)); + } +} +export {}; diff --git a/tests/baselines/reference/tsxGenericAttributesType6.errors.txt b/tests/baselines/reference/tsxGenericAttributesType6.errors.txt new file mode 100644 index 0000000000000..a1136d571bc87 --- /dev/null +++ b/tests/baselines/reference/tsxGenericAttributesType6.errors.txt @@ -0,0 +1,22 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. +file.tsx(9,5): error TS2612: Property 'props' will overwrite the base property in 'Component'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration. + + +==== file.tsx (2 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + class B1 extends React.Component { + render() { + return
hi
; + } + } + class B extends React.Component { + props: U; + ~~~~~ +!!! error TS2612: Property 'props' will overwrite the base property in 'Component'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration. + render() { + return ; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/tsxGenericAttributesType6.js b/tests/baselines/reference/tsxGenericAttributesType6.js index 4d9a909b87c7e..4c4f2afcf8da4 100644 --- a/tests/baselines/reference/tsxGenericAttributesType6.js +++ b/tests/baselines/reference/tsxGenericAttributesType6.js @@ -16,41 +16,15 @@ class B extends React.Component { } //// [file.jsx] -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var B1 = /** @class */ (function (_super) { - __extends(B1, _super); - function B1() { - return _super !== null && _super.apply(this, arguments) || this; - } - B1.prototype.render = function () { +class B1 extends React.Component { + render() { return
hi
; - }; - return B1; -}(React.Component)); -var B = /** @class */ (function (_super) { - __extends(B, _super); - function B() { - return _super !== null && _super.apply(this, arguments) || this; } - B.prototype.render = function () { +} +class B extends React.Component { + props; + render() { return ; - }; - return B; -}(React.Component)); + } +} +export {}; diff --git a/tests/baselines/reference/tsxGenericAttributesType7.errors.txt b/tests/baselines/reference/tsxGenericAttributesType7.errors.txt new file mode 100644 index 0000000000000..f8f0b53ce9df9 --- /dev/null +++ b/tests/baselines/reference/tsxGenericAttributesType7.errors.txt @@ -0,0 +1,16 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + declare function Component(props: T) : JSX.Element; + const decorator = function (props: U) { + return ; + } + + const decorator1 = function (props: U) { + return ; + } \ No newline at end of file diff --git a/tests/baselines/reference/tsxGenericAttributesType7.js b/tests/baselines/reference/tsxGenericAttributesType7.js index fdc394fbce913..9aa59f164be58 100644 --- a/tests/baselines/reference/tsxGenericAttributesType7.js +++ b/tests/baselines/reference/tsxGenericAttributesType7.js @@ -13,12 +13,10 @@ const decorator1 = function (props: U) { } //// [file.jsx] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var decorator = function (props) { +const decorator = function (props) { return ; }; -var decorator1 = function (props) { +const decorator1 = function (props) { return ; }; +export {}; diff --git a/tests/baselines/reference/tsxGenericAttributesType8.errors.txt b/tests/baselines/reference/tsxGenericAttributesType8.errors.txt new file mode 100644 index 0000000000000..1d5cb899ff075 --- /dev/null +++ b/tests/baselines/reference/tsxGenericAttributesType8.errors.txt @@ -0,0 +1,16 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + declare function Component(props: T) : JSX.Element; + const decorator = function (props: U) { + return ; + } + + const decorator1 = function (props: U) { + return ; + } \ No newline at end of file diff --git a/tests/baselines/reference/tsxGenericAttributesType8.js b/tests/baselines/reference/tsxGenericAttributesType8.js index 54f511b01d0dd..396a3157369b9 100644 --- a/tests/baselines/reference/tsxGenericAttributesType8.js +++ b/tests/baselines/reference/tsxGenericAttributesType8.js @@ -13,12 +13,10 @@ const decorator1 = function (props: U) { } //// [file.jsx] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var decorator = function (props) { +const decorator = function (props) { return ; }; -var decorator1 = function (props) { +const decorator1 = function (props) { return ; }; +export {}; diff --git a/tests/baselines/reference/tsxGenericAttributesType9.errors.txt b/tests/baselines/reference/tsxGenericAttributesType9.errors.txt new file mode 100644 index 0000000000000..4c95f90836542 --- /dev/null +++ b/tests/baselines/reference/tsxGenericAttributesType9.errors.txt @@ -0,0 +1,19 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + export function makeP

(Ctor: React.ComponentClass

) { + return class extends React.PureComponent { + public render(): JSX.Element { + return ( + + ); + } + }; + } + + \ No newline at end of file diff --git a/tests/baselines/reference/tsxGenericAttributesType9.js b/tests/baselines/reference/tsxGenericAttributesType9.js index 5d94e6f103b5d..20aa50071b123 100644 --- a/tests/baselines/reference/tsxGenericAttributesType9.js +++ b/tests/baselines/reference/tsxGenericAttributesType9.js @@ -16,34 +16,10 @@ export function makeP

(Ctor: React.ComponentClass

) { //// [file.jsx] -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.makeP = makeP; -var React = require("react"); -function makeP(Ctor) { - return /** @class */ (function (_super) { - __extends(class_1, _super); - function class_1() { - return _super !== null && _super.apply(this, arguments) || this; - } - class_1.prototype.render = function () { +export function makeP(Ctor) { + return class extends React.PureComponent { + render() { return (); - }; - return class_1; - }(React.PureComponent)); + } + }; } diff --git a/tests/baselines/reference/tsxInArrowFunction.js b/tests/baselines/reference/tsxInArrowFunction.js index d642ed63b0120..8b82af280b974 100644 --- a/tests/baselines/reference/tsxInArrowFunction.js +++ b/tests/baselines/reference/tsxInArrowFunction.js @@ -26,10 +26,10 @@ declare namespace JSX { //// [tsxInArrowFunction.jsx] // didn't work -

{function () { return
; }}
; +
{() =>
}
; // didn't work -
{function (x) { return
; }}
; +
{x =>
}
; // worked -
{function () { return (
); }}
; +
{() => (
)}
; // worked (!) -
{function () { return
; }}
; +
{() =>
}
; diff --git a/tests/baselines/reference/tsxLibraryManagedAttributes.js b/tests/baselines/reference/tsxLibraryManagedAttributes.js index 454cb063cfbb5..69b40fc6dfabe 100644 --- a/tests/baselines/reference/tsxLibraryManagedAttributes.js +++ b/tests/baselines/reference/tsxLibraryManagedAttributes.js @@ -129,117 +129,72 @@ const aa = ; //// [tsxLibraryManagedAttributes.jsx] "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var Component = /** @class */ (function (_super) { - __extends(Component, _super); - function Component() { - return _super !== null && _super.apply(this, arguments) || this; - } - Component.propTypes = { +class Component extends ReactComponent { + static propTypes = { foo: PropTypes.number, bar: PropTypes.node, baz: PropTypes.string.isRequired, }; - Component.defaultProps = { + static defaultProps = { foo: 42, }; - return Component; -}(ReactComponent)); -var a = ; -var b = ; // Error, missing required prop bar -var c = ; -var d = ; // Error, baz not a valid prop -var e = ; // bar is nullable/undefinable since it's not marked `isRequired` -var f = ; // Error, baz is _not_ nullable/undefinable since it's marked `isRequired` -var JustPropTypes = /** @class */ (function (_super) { - __extends(JustPropTypes, _super); - function JustPropTypes() { - return _super !== null && _super.apply(this, arguments) || this; - } - JustPropTypes.propTypes = { +} +const a = ; +const b = ; // Error, missing required prop bar +const c = ; +const d = ; // Error, baz not a valid prop +const e = ; // bar is nullable/undefinable since it's not marked `isRequired` +const f = ; // Error, baz is _not_ nullable/undefinable since it's marked `isRequired` +class JustPropTypes extends ReactComponent { + static propTypes = { foo: PropTypes.number, bar: PropTypes.node.isRequired, }; - return JustPropTypes; -}(ReactComponent)); -var g = ; -var h = ; // error, wrong type -var i = ; -var j = ; // error, bar is required -var JustDefaultProps = /** @class */ (function (_super) { - __extends(JustDefaultProps, _super); - function JustDefaultProps() { - return _super !== null && _super.apply(this, arguments) || this; - } - JustDefaultProps.defaultProps = { +} +const g = ; +const h = ; // error, wrong type +const i = ; +const j = ; // error, bar is required +class JustDefaultProps extends ReactComponent { + static defaultProps = { foo: 42, }; - return JustDefaultProps; -}(ReactComponent)); -var k = ; -var l = ; // error, no prop named bar -var m = ; // error, wrong type -var BothWithSpecifiedGeneric = /** @class */ (function (_super) { - __extends(BothWithSpecifiedGeneric, _super); - function BothWithSpecifiedGeneric() { - return _super !== null && _super.apply(this, arguments) || this; - } - BothWithSpecifiedGeneric.propTypes = { +} +const k = ; +const l = ; // error, no prop named bar +const m = ; // error, wrong type +class BothWithSpecifiedGeneric extends ReactComponent { + static propTypes = { foo: PropTypes.string, bar: PropTypes.node, baz: PropTypes.number.isRequired, }; - BothWithSpecifiedGeneric.defaultProps = { + static defaultProps = { foo: "yo", }; - return BothWithSpecifiedGeneric; -}(ReactComponent)); -var n = ; -var o = ; // Error, missing required prop bar -var p = ; -var q = ; // Error, baz not a valid prop -var r = ; // bar is nullable/undefinable since it's not marked `isRequired` -var s = ; // Error, baz is _not_ nullable/undefinable since it's marked `isRequired` -var JustPropTypesWithSpecifiedGeneric = /** @class */ (function (_super) { - __extends(JustPropTypesWithSpecifiedGeneric, _super); - function JustPropTypesWithSpecifiedGeneric() { - return _super !== null && _super.apply(this, arguments) || this; - } - JustPropTypesWithSpecifiedGeneric.propTypes = { +} +const n = ; +const o = ; // Error, missing required prop bar +const p = ; +const q = ; // Error, baz not a valid prop +const r = ; // bar is nullable/undefinable since it's not marked `isRequired` +const s = ; // Error, baz is _not_ nullable/undefinable since it's marked `isRequired` +class JustPropTypesWithSpecifiedGeneric extends ReactComponent { + static propTypes = { foo: PropTypes.string, bar: PropTypes.node.isRequired, }; - return JustPropTypesWithSpecifiedGeneric; -}(ReactComponent)); -var t = ; -var u = ; // error, wrong type -var v = ; // generic overrides propTypes required-ness, null isn't valid -var w = ; // error, bar is required -var JustDefaultPropsWithSpecifiedGeneric = /** @class */ (function (_super) { - __extends(JustDefaultPropsWithSpecifiedGeneric, _super); - function JustDefaultPropsWithSpecifiedGeneric() { - return _super !== null && _super.apply(this, arguments) || this; - } - JustDefaultPropsWithSpecifiedGeneric.defaultProps = { +} +const t = ; +const u = ; // error, wrong type +const v = ; // generic overrides propTypes required-ness, null isn't valid +const w = ; // error, bar is required +class JustDefaultPropsWithSpecifiedGeneric extends ReactComponent { + static defaultProps = { foo: "no", }; - return JustDefaultPropsWithSpecifiedGeneric; -}(ReactComponent)); -var x = ; -var y = ; // error, no prop named bar -var z = ; // error, wrong type -var aa = ; +} +const x = ; +const y = ; // error, no prop named bar +const z = ; // error, wrong type +const aa = ; diff --git a/tests/baselines/reference/tsxNamespacedAttributeName1.js b/tests/baselines/reference/tsxNamespacedAttributeName1.js index 24c7e0a2fe425..7b993f1740880 100644 --- a/tests/baselines/reference/tsxNamespacedAttributeName1.js +++ b/tests/baselines/reference/tsxNamespacedAttributeName1.js @@ -6,5 +6,5 @@ const b = ; //// [a.jsx] -var a = ; -var b = ; +const a = ; +const b = ; diff --git a/tests/baselines/reference/tsxNamespacedAttributeName2.js b/tests/baselines/reference/tsxNamespacedAttributeName2.js index d33fde2c34e90..59a885bbbfcc5 100644 --- a/tests/baselines/reference/tsxNamespacedAttributeName2.js +++ b/tests/baselines/reference/tsxNamespacedAttributeName2.js @@ -8,5 +8,5 @@ const b = ; //// [a.js] -var a = React.createElement("svg:path", { "a:b": 1 }); -var b = React.createElement("svg:path", { "a:b": 1 }); +const a = React.createElement("svg:path", { "a:b": 1 }); +const b = React.createElement("svg:path", { "a:b": 1 }); diff --git a/tests/baselines/reference/tsxNamespacedTagName1.js b/tests/baselines/reference/tsxNamespacedTagName1.js index 33995b2526972..548c9da331893 100644 --- a/tests/baselines/reference/tsxNamespacedTagName1.js +++ b/tests/baselines/reference/tsxNamespacedTagName1.js @@ -8,7 +8,7 @@ const d = ; //// [a.jsx] -var a = ; -var b = ; -var c = ; -var d = ; +const a = ; +const b = ; +const c = ; +const d = ; diff --git a/tests/baselines/reference/tsxNamespacedTagName2.js b/tests/baselines/reference/tsxNamespacedTagName2.js index dfe4f35a2c37a..03dde53f6578d 100644 --- a/tests/baselines/reference/tsxNamespacedTagName2.js +++ b/tests/baselines/reference/tsxNamespacedTagName2.js @@ -10,7 +10,7 @@ const d = ; //// [a.js] -var a = React.createElement("svg:path", null); -var b = React.createElement("svg:path", null); -var c = React.createElement("A:foo", null); -var d = React.createElement("a:foo", null); +const a = React.createElement("svg:path", null); +const b = React.createElement("svg:path", null); +const c = React.createElement("A:foo", null); +const d = React.createElement("a:foo", null); diff --git a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter1.errors.txt b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter1.errors.txt new file mode 100644 index 0000000000000..6789d532f8d05 --- /dev/null +++ b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter1.errors.txt @@ -0,0 +1,18 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + interface Prop { + a: number, + b: string + } + + declare class MyComp

extends React.Component { + internalProp: P; + } + + let x = \ No newline at end of file diff --git a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter1.js b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter1.js index 130b9c8410481..ba3c022edb37e 100644 --- a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter1.js +++ b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter1.js @@ -15,7 +15,5 @@ declare class MyComp

extends React.Component { let x = //// [file.jsx] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var x = ; +let x = ; +export {}; diff --git a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter2.errors.txt b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter2.errors.txt new file mode 100644 index 0000000000000..16a98db556411 --- /dev/null +++ b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter2.errors.txt @@ -0,0 +1,19 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + +==== file.tsx (1 errors) ==== + import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + + interface Prop { + a: number, + b: string + } + + declare class MyComp

extends React.Component { + internalProp: P; + } + + let x = + let x1 = \ No newline at end of file diff --git a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter2.js b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter2.js index ec7a124d701ff..93b41c9104530 100644 --- a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter2.js +++ b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter2.js @@ -16,8 +16,6 @@ let x = let x1 = //// [file.jsx] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); -var x = ; -var x1 = ; +let x = ; +let x1 = ; +export {}; diff --git a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt index 6b64e564ce6d1..de94dbaec4f30 100644 --- a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt +++ b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt @@ -1,9 +1,12 @@ +file.tsx(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. file.tsx(13,11): error TS2739: Type '{}' is missing the following properties from type 'Prop': a, b file.tsx(19,18): error TS2322: Type 'string' is not assignable to type 'number'. -==== file.tsx (2 errors) ==== +==== file.tsx (3 errors) ==== import React = require('react'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. interface Prop { a: number, diff --git a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.js b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.js index ddcae6321975b..7462a019a95a2 100644 --- a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.js +++ b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.js @@ -22,12 +22,10 @@ let x = let x2 = //// [file.jsx] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var React = require("react"); // Error -var x1 = ; +let x1 = ; // OK -var x = ; +let x = ; // Error -var x2 = ; +let x2 = ; +export {}; diff --git a/tests/baselines/reference/tsxReactEmit1.js b/tests/baselines/reference/tsxReactEmit1.js index aca1c1cd075a3..7c166c86a6dd8 100644 --- a/tests/baselines/reference/tsxReactEmit1.js +++ b/tests/baselines/reference/tsxReactEmit1.js @@ -44,15 +44,6 @@ var whitespace3 =

//// [file.js] -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; var p; var selfClosed1 = React.createElement("div", null); var selfClosed2 = React.createElement("div", { x: "1" }); @@ -66,20 +57,16 @@ var openClosed2 = React.createElement("div", { n: 'm' }, "foo"); var openClosed3 = React.createElement("div", { n: 'm' }, p); var openClosed4 = React.createElement("div", { n: 'm' }, p < p); var openClosed5 = React.createElement("div", { n: 'm', b: true }, p > p); -var SomeClass = /** @class */ (function () { - function SomeClass() { +class SomeClass { + f() { + var rewrites1 = React.createElement("div", null, () => this); + var rewrites2 = React.createElement("div", null, [p, ...p, p]); + var rewrites3 = React.createElement("div", null, { p }); + var rewrites4 = React.createElement("div", { a: () => this }); + var rewrites5 = React.createElement("div", { a: [p, ...p, p] }); + var rewrites6 = React.createElement("div", { a: { p } }); } - SomeClass.prototype.f = function () { - var _this = this; - var rewrites1 = React.createElement("div", null, function () { return _this; }); - var rewrites2 = React.createElement("div", null, __spreadArray(__spreadArray([p], p, true), [p], false)); - var rewrites3 = React.createElement("div", null, { p: p }); - var rewrites4 = React.createElement("div", { a: function () { return _this; } }); - var rewrites5 = React.createElement("div", { a: __spreadArray(__spreadArray([p], p, true), [p], false) }); - var rewrites6 = React.createElement("div", { a: { p: p } }); - }; - return SomeClass; -}()); +} var whitespace1 = React.createElement("div", null, " "); var whitespace2 = React.createElement("div", null, " ", diff --git a/tests/baselines/reference/tsxReactEmit2.js b/tests/baselines/reference/tsxReactEmit2.js index 0c4b927ae7351..413f53909fedd 100644 --- a/tests/baselines/reference/tsxReactEmit2.js +++ b/tests/baselines/reference/tsxReactEmit2.js @@ -18,20 +18,9 @@ var spreads5 =
{p2}
; //// [file.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; var p1, p2, p3; -var spreads1 = React.createElement("div", __assign({}, p1), p2); -var spreads2 = React.createElement("div", __assign({}, p1), p2); -var spreads3 = React.createElement("div", __assign({ x: p3 }, p1), p2); -var spreads4 = React.createElement("div", __assign({}, p1, { x: p3 }), p2); -var spreads5 = React.createElement("div", __assign({ x: p2 }, p1, { y: p3 }), p2); +var spreads1 = React.createElement("div", { ...p1 }, p2); +var spreads2 = React.createElement("div", { ...p1 }, p2); +var spreads3 = React.createElement("div", { x: p3, ...p1 }, p2); +var spreads4 = React.createElement("div", { ...p1, x: p3 }, p2); +var spreads5 = React.createElement("div", { x: p2, ...p1, y: p3 }, p2); diff --git a/tests/baselines/reference/tsxReactEmit4.js b/tests/baselines/reference/tsxReactEmit4.js index b94afbfbf9678..2e8de36a8471e 100644 --- a/tests/baselines/reference/tsxReactEmit4.js +++ b/tests/baselines/reference/tsxReactEmit4.js @@ -20,18 +20,7 @@ var openClosed1 =
var spread1 =
; //// [file.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; var p; var openClosed1 = React.createElement("div", null, blah); // Should emit React.__spread({}, p, {x: 0}) -var spread1 = React.createElement("div", __assign({}, p, { x: 0 })); +var spread1 = React.createElement("div", { ...p, x: 0 }); diff --git a/tests/baselines/reference/tsxReactEmit5.js b/tests/baselines/reference/tsxReactEmit5.js index fd22392ace5db..2c55163cb2424 100644 --- a/tests/baselines/reference/tsxReactEmit5.js +++ b/tests/baselines/reference/tsxReactEmit5.js @@ -22,20 +22,9 @@ var spread1 =
; //// [file.js] //// [react-consumer.js] "use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; Object.defineProperty(exports, "__esModule", { value: true }); -var test_1 = require("./test"); +const test_1 = require("./test"); // Should emit test_1.React.createElement // and React.__spread var foo; -var spread1 = test_1.React.createElement("div", __assign({ x: '' }, foo, { y: '' })); +var spread1 = test_1.React.createElement("div", { x: '', ...foo, y: '' }); diff --git a/tests/baselines/reference/tsxReactEmit6.js b/tests/baselines/reference/tsxReactEmit6.js index 0f0b9a8793da4..3f59e97fb22ab 100644 --- a/tests/baselines/reference/tsxReactEmit6.js +++ b/tests/baselines/reference/tsxReactEmit6.js @@ -27,17 +27,6 @@ namespace M { //// [file.js] //// [react-consumer.js] -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; var M; (function (M) { })(M || (M = {})); @@ -45,7 +34,7 @@ var M; // Should emit M.React.createElement // and M.React.__spread var foo; - var spread1 = M.React.createElement("div", __assign({ x: '' }, foo, { y: '' })); + var spread1 = M.React.createElement("div", { x: '', ...foo, y: '' }); // Quotes var x = M.React.createElement("div", null, "This \"quote\" thing"); })(M || (M = {})); diff --git a/tests/baselines/reference/twoAccessorsWithSameName2.js b/tests/baselines/reference/twoAccessorsWithSameName2.js index 700402467bc0b..b34f969b8a690 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName2.js +++ b/tests/baselines/reference/twoAccessorsWithSameName2.js @@ -19,36 +19,17 @@ class E { } //// [twoAccessorsWithSameName2.js] -var C = /** @class */ (function () { - function C() { - } - Object.defineProperty(C, "x", { - get: function () { return 1; }, - enumerable: false, - configurable: true - }); - return C; -}()); -var D = /** @class */ (function () { - function D() { - } - Object.defineProperty(D, "x", { - set: function (v) { }, - enumerable: false, - configurable: true - }); - return D; -}()); -var E = /** @class */ (function () { - function E() { +class C { + static get x() { return 1; } + static get x() { return 1; } // error +} +class D { + static set x(v) { } + static set x(v) { } // error +} +class E { + static get x() { + return 1; } - Object.defineProperty(E, "x", { - get: function () { - return 1; - }, - set: function (v) { }, - enumerable: false, - configurable: true - }); - return E; -}()); + static set x(v) { } +} diff --git a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.symbols b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.symbols index 541f727708288..bea05b8235b36 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.symbols +++ b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.symbols @@ -4,7 +4,7 @@ interface A { >A : Symbol(A, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 0, 0), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 2, 1)) >T : Symbol(T, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 0, 12), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 4, 12)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) x: T; >x : Symbol(A.x, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 0, 29)) @@ -14,7 +14,7 @@ interface A { interface A { // error >A : Symbol(A, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 0, 0), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 2, 1)) >T : Symbol(T, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 0, 12), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 4, 12)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) y: T; >y : Symbol(A.y, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 4, 31)) @@ -28,7 +28,7 @@ module M { >B : Symbol(B, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 8, 10), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 11, 5)) >T : Symbol(T, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 9, 16), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 13, 16)) >A : Symbol(A, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 0, 0), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 2, 1)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) x: T; >x : Symbol(B.x, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 9, 36)) @@ -52,7 +52,7 @@ module M2 { interface A { >A : Symbol(A, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 18, 11)) >T : Symbol(T, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 19, 16)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) x: T; >x : Symbol(A.x, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 19, 33)) @@ -66,7 +66,7 @@ module M2 { interface A { // ok, different declaration space from other M2.A >A : Symbol(A, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 24, 11)) >T : Symbol(T, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 25, 16)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) y: T; >y : Symbol(A.y, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 25, 35)) @@ -80,7 +80,7 @@ module M3 { export interface A { >A : Symbol(A, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 30, 11), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 36, 11)) >T : Symbol(T, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 31, 23), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 37, 23)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) x: T; >x : Symbol(A.x, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 31, 40)) @@ -94,7 +94,7 @@ module M3 { export interface A { // error >A : Symbol(A, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 30, 11), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 36, 11)) >T : Symbol(T, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 31, 23), Decl(twoGenericInterfacesWithDifferentConstraints.ts, 37, 23)) ->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.number.d.ts, --, --)) y: T; >y : Symbol(A.y, Decl(twoGenericInterfacesWithDifferentConstraints.ts, 37, 42)) diff --git a/tests/baselines/reference/twoInterfacesDifferentRootModule2.js b/tests/baselines/reference/twoInterfacesDifferentRootModule2.js index 2e301952041e9..379ce9665a9ae 100644 --- a/tests/baselines/reference/twoInterfacesDifferentRootModule2.js +++ b/tests/baselines/reference/twoInterfacesDifferentRootModule2.js @@ -43,7 +43,7 @@ module M { // two interfaces with different root modules should not merge var M; (function (M) { - var M2; + let M2; (function (M2) { var a; var r1 = a.foo; // error diff --git a/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols b/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols index 091548a46b282..e8da0d753958d 100644 --- a/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols +++ b/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols @@ -21,8 +21,8 @@ interface A { foo(x: Date): Date; >foo : Symbol(A.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 2, 13), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 3, 27), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 7, 13)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 8, 8)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) } interface B { @@ -47,12 +47,12 @@ interface B { >foo : Symbol(B.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 8)) >T : Symbol(T, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 12), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) foo(x: Date): string; >foo : Symbol(B.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 18, 8)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) } var b: B; @@ -102,7 +102,7 @@ interface C { var c: C; >c : Symbol(c, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 34, 3)) >C : Symbol(C, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 22, 20), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 28, 1)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) var r2 = c.foo(1, 2); // number >r2 : Symbol(r2, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 35, 3)) @@ -152,7 +152,7 @@ interface D { var d: D; >d : Symbol(d, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 48, 3)) >D : Symbol(D, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 35, 21), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 42, 1)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) var r3 = d.foo(1, 1); // boolean, last definition wins >r3 : Symbol(r3, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 49, 3)) diff --git a/tests/baselines/reference/typeAndNamespaceExportMerge.js b/tests/baselines/reference/typeAndNamespaceExportMerge.js index fcf77459c49af..ae063d6c01ee2 100644 --- a/tests/baselines/reference/typeAndNamespaceExportMerge.js +++ b/tests/baselines/reference/typeAndNamespaceExportMerge.js @@ -17,19 +17,12 @@ const x: Drink = Drink.TEA; //// [constants.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TEA = exports.COFFEE = void 0; -exports.COFFEE = 0; -exports.TEA = 1; +export const COFFEE = 0; +export const TEA = 1; //// [drink.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Drink = void 0; -exports.Drink = require("./constants"); +import * as Drink_1 from "./constants"; +export { Drink_1 as Drink }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var drink_1 = require("./drink"); +import { Drink } from "./drink"; // 'Drink' only refers to a type, but is being used as a value here -var x = drink_1.Drink.TEA; +const x = Drink.TEA; diff --git a/tests/baselines/reference/typeArgumentInference.js b/tests/baselines/reference/typeArgumentInference.js index f6ac7609ae38f..355c4ceaa9519 100644 --- a/tests/baselines/reference/typeArgumentInference.js +++ b/tests/baselines/reference/typeArgumentInference.js @@ -119,38 +119,38 @@ someGenerics1(3, 4); someGenerics1(3, 4); // Generic call with argument of function type whose parameter is of type parameter type function someGenerics2a(n) { } -someGenerics2a(function (n) { return n; }); -someGenerics2a(function (n) { return n; }); -someGenerics2a(function (n) { return n.substr(0); }); +someGenerics2a((n) => n); +someGenerics2a((n) => n); +someGenerics2a((n) => n.substr(0)); function someGenerics2b(n) { } -someGenerics2b(function (n, x) { return n; }); -someGenerics2b(function (n, t) { return n; }); -someGenerics2b(function (n, t) { return n.substr(t * t); }); +someGenerics2b((n, x) => n); +someGenerics2b((n, t) => n); +someGenerics2b((n, t) => n.substr(t * t)); // Generic call with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter function someGenerics3(producer) { } -someGenerics3(function () { return ''; }); -someGenerics3(function () { return undefined; }); -someGenerics3(function () { return 3; }); +someGenerics3(() => ''); +someGenerics3(() => undefined); +someGenerics3(() => 3); // 2 parameter generic call with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(n, f) { } -someGenerics4(4, function () { return null; }); -someGenerics4('', function () { return 3; }); +someGenerics4(4, () => null); +someGenerics4('', () => 3); someGenerics4(null, null); // 2 parameter generic call with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(n, f) { } -someGenerics5(4, function () { return null; }); -someGenerics5('', function () { return 3; }); +someGenerics5(4, () => null); +someGenerics5('', () => 3); someGenerics5(null, null); // Generic call with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(a, b, c) { } -someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); -someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); -someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); +someGenerics6(n => n, n => n, n => n); +someGenerics6(n => n, n => n, n => n); +someGenerics6((n) => n, (n) => n, (n) => n); // Generic call with multiple arguments of function types that each have parameters of different generic type function someGenerics7(a, b, c) { } -someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); -someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); -someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); +someGenerics7(n => n, n => n, n => n); +someGenerics7(n => n, n => n, n => n); +someGenerics7((n) => n, (n) => n, (n) => n); // Generic call with argument of generic function type function someGenerics8(n) { return n; } var x = someGenerics8(someGenerics7); diff --git a/tests/baselines/reference/typeArgumentInference.symbols b/tests/baselines/reference/typeArgumentInference.symbols index 02caabaedfa9d..77b43d66f514d 100644 --- a/tests/baselines/reference/typeArgumentInference.symbols +++ b/tests/baselines/reference/typeArgumentInference.symbols @@ -114,7 +114,7 @@ someGenerics3(() => ''); someGenerics3(() => undefined); >someGenerics3 : Symbol(someGenerics3, Decl(typeArgumentInference.ts, 26, 58)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) >undefined : Symbol(undefined) someGenerics3(() => 3); @@ -319,7 +319,7 @@ interface A92 { z?: Date; >z : Symbol(A92.z, Decl(typeArgumentInference.ts, 78, 14)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) } var a9e = someGenerics9(undefined, { x: 6, z: new Date() }, { x: 6, y: '' }); >a9e : Symbol(a9e, Decl(typeArgumentInference.ts, 81, 3), Decl(typeArgumentInference.ts, 82, 3)) @@ -327,7 +327,7 @@ var a9e = someGenerics9(undefined, { x: 6, z: new Date() }, { x: 6, y: '' }); >undefined : Symbol(undefined) >x : Symbol(x, Decl(typeArgumentInference.ts, 81, 36)) >z : Symbol(z, Decl(typeArgumentInference.ts, 81, 42)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) >x : Symbol(x, Decl(typeArgumentInference.ts, 81, 61)) >y : Symbol(y, Decl(typeArgumentInference.ts, 81, 67)) @@ -341,7 +341,7 @@ var a9f = someGenerics9(undefined, { x: 6, z: new Date() }, { x: 6, y: '' } >undefined : Symbol(undefined) >x : Symbol(x, Decl(typeArgumentInference.ts, 83, 41)) >z : Symbol(z, Decl(typeArgumentInference.ts, 83, 47)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) >x : Symbol(x, Decl(typeArgumentInference.ts, 83, 66)) >y : Symbol(y, Decl(typeArgumentInference.ts, 83, 72)) diff --git a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.js b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.js index 477d8780dfc3d..04c83fe485388 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.js +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.js @@ -154,36 +154,36 @@ new someGenerics1(3, 4); new someGenerics1(3, 4); // Error new someGenerics1(3, 4); var someGenerics2a; -new someGenerics2a(function (n) { return n; }); -new someGenerics2a(function (n) { return n; }); -new someGenerics2a(function (n) { return n.substr(0); }); +new someGenerics2a((n) => n); +new someGenerics2a((n) => n); +new someGenerics2a((n) => n.substr(0)); var someGenerics2b; -new someGenerics2b(function (n, x) { return n; }); -new someGenerics2b(function (n, t) { return n; }); -new someGenerics2b(function (n, t) { return n.substr(t * t); }); +new someGenerics2b((n, x) => n); +new someGenerics2b((n, t) => n); +new someGenerics2b((n, t) => n.substr(t * t)); var someGenerics3; -new someGenerics3(function () { return ''; }); -new someGenerics3(function () { return undefined; }); -new someGenerics3(function () { return 3; }); +new someGenerics3(() => ''); +new someGenerics3(() => undefined); +new someGenerics3(() => 3); var someGenerics4; -new someGenerics4(4, function () { return null; }); -new someGenerics4('', function () { return 3; }); -new someGenerics4('', function (x) { return ''; }); // Error +new someGenerics4(4, () => null); +new someGenerics4('', () => 3); +new someGenerics4('', (x) => ''); // Error new someGenerics4(null, null); var someGenerics5; -new someGenerics5(4, function () { return null; }); -new someGenerics5('', function () { return 3; }); -new someGenerics5('', function (x) { return ''; }); // Error +new someGenerics5(4, () => null); +new someGenerics5('', () => 3); +new someGenerics5('', (x) => ''); // Error new someGenerics5(null, null); var someGenerics6; -new someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); -new someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); -new someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Error -new someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); +new someGenerics6(n => n, n => n, n => n); +new someGenerics6(n => n, n => n, n => n); +new someGenerics6((n) => n, (n) => n, (n) => n); // Error +new someGenerics6((n) => n, (n) => n, (n) => n); var someGenerics7; -new someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); -new someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); -new someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); +new someGenerics7(n => n, n => n, n => n); +new someGenerics7(n => n, n => n, n => n); +new someGenerics7((n) => n, (n) => n, (n) => n); var someGenerics8; var x = new someGenerics8(someGenerics7); new x(null, null, null); diff --git a/tests/baselines/reference/typeArgumentInferenceErrors.js b/tests/baselines/reference/typeArgumentInferenceErrors.js index 569b690faae3c..58ab5e5409152 100644 --- a/tests/baselines/reference/typeArgumentInferenceErrors.js +++ b/tests/baselines/reference/typeArgumentInferenceErrors.js @@ -24,10 +24,10 @@ function someGenerics1(n, m) { } someGenerics1(3, 4); // Error // 2 parameter generic call with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(n, f) { } -someGenerics4('', function (x) { return ''; }); // Error +someGenerics4('', (x) => ''); // Error // 2 parameter generic call with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(n, f) { } -someGenerics5('', function (x) { return ''; }); // Error +someGenerics5('', (x) => ''); // Error // Generic call with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(a, b, c) { } -someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Error +someGenerics6((n) => n, (n) => n, (n) => n); // Error diff --git a/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols b/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols index 9df639cc7bf72..fee438a1db98a 100644 --- a/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols +++ b/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols @@ -4,7 +4,7 @@ function fn(a: A, b: B, c: C) { >fn : Symbol(fn, Decl(typeArgumentInferenceTransitiveConstraints.ts, 0, 0)) >A : Symbol(A, Decl(typeArgumentInferenceTransitiveConstraints.ts, 0, 12)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) >B : Symbol(B, Decl(typeArgumentInferenceTransitiveConstraints.ts, 0, 27)) >A : Symbol(A, Decl(typeArgumentInferenceTransitiveConstraints.ts, 0, 12)) >C : Symbol(C, Decl(typeArgumentInferenceTransitiveConstraints.ts, 0, 40)) @@ -25,11 +25,11 @@ function fn(a: A, b: B, c: C) { var d = fn(new Date(), new Date(), new Date()); >d : Symbol(d, Decl(typeArgumentInferenceTransitiveConstraints.ts, 4, 3), Decl(typeArgumentInferenceTransitiveConstraints.ts, 5, 3)) >fn : Symbol(fn, Decl(typeArgumentInferenceTransitiveConstraints.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) var d: Date[]; // Should be OK (d should be Date[]) >d : Symbol(d, Decl(typeArgumentInferenceTransitiveConstraints.ts, 4, 3), Decl(typeArgumentInferenceTransitiveConstraints.ts, 5, 3)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) diff --git a/tests/baselines/reference/typeArgumentInferenceWithClassExpression1.js b/tests/baselines/reference/typeArgumentInferenceWithClassExpression1.js index a412707c7e0ac..4138260d075dd 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithClassExpression1.js +++ b/tests/baselines/reference/typeArgumentInferenceWithClassExpression1.js @@ -8,19 +8,11 @@ function foo(x = class { static prop: T }): T { foo(class { static prop = "hello" }).length; //// [typeArgumentInferenceWithClassExpression1.js] -var _a; -function foo(x) { - if (x === void 0) { x = /** @class */ (function () { - function class_1() { - } - return class_1; - }()); } +function foo(x = class { + static prop; +}) { return undefined; } -foo((_a = /** @class */ (function () { - function class_2() { - } - return class_2; - }()), - _a.prop = "hello", - _a)).length; +foo(class { + static prop = "hello"; +}).length; diff --git a/tests/baselines/reference/typeArgumentInferenceWithClassExpression2.js b/tests/baselines/reference/typeArgumentInferenceWithClassExpression2.js index 5960a18ff4524..61d9af35bcd10 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithClassExpression2.js +++ b/tests/baselines/reference/typeArgumentInferenceWithClassExpression2.js @@ -9,20 +9,12 @@ function foo(x = class { prop: T }): T { foo(class { static prop = "hello" }).length; //// [typeArgumentInferenceWithClassExpression2.js] -var _a; -function foo(x) { - if (x === void 0) { x = /** @class */ (function () { - function class_1() { - } - return class_1; - }()); } +function foo(x = class { + prop; +}) { return undefined; } // Should not infer string because it is a static property -foo((_a = /** @class */ (function () { - function class_2() { - } - return class_2; - }()), - _a.prop = "hello", - _a)).length; +foo(class { + static prop = "hello"; +}).length; diff --git a/tests/baselines/reference/typeArgumentInferenceWithClassExpression3.js b/tests/baselines/reference/typeArgumentInferenceWithClassExpression3.js index 851a6a75f4075..e0a48ebb92ffe 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithClassExpression3.js +++ b/tests/baselines/reference/typeArgumentInferenceWithClassExpression3.js @@ -8,17 +8,11 @@ function foo(x = class { prop: T }): T { foo(class { prop = "hello" }).length; //// [typeArgumentInferenceWithClassExpression3.js] -function foo(x) { - if (x === void 0) { x = /** @class */ (function () { - function class_1() { - } - return class_1; - }()); } +function foo(x = class { + prop; +}) { return undefined; } -foo(/** @class */ (function () { - function class_2() { - this.prop = "hello"; - } - return class_2; -}())).length; +foo(class { + prop = "hello"; +}).length; diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.js b/tests/baselines/reference/typeArgumentInferenceWithConstraints.js index ff174dc83fe8a..731450b7a8b90 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.js +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.js @@ -126,41 +126,41 @@ someGenerics1(3, 4); // Error someGenerics1(3, 4); // Generic call with argument of function type whose parameter is of type parameter type function someGenerics2a(n) { } -someGenerics2a(function (n) { return n; }); -someGenerics2a(function (n) { return n; }); -someGenerics2a(function (n) { return n.substr(0); }); +someGenerics2a((n) => n); +someGenerics2a((n) => n); +someGenerics2a((n) => n.substr(0)); function someGenerics2b(n) { } -someGenerics2b(function (n, x) { return n; }); -someGenerics2b(function (n, t) { return n; }); -someGenerics2b(function (n, t) { return n.substr(t * t); }); +someGenerics2b((n, x) => n); +someGenerics2b((n, t) => n); +someGenerics2b((n, t) => n.substr(t * t)); // Generic call with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter function someGenerics3(producer) { } -someGenerics3(function () { return ''; }); // Error -someGenerics3(function () { return undefined; }); -someGenerics3(function () { return 3; }); // Error +someGenerics3(() => ''); // Error +someGenerics3(() => undefined); +someGenerics3(() => 3); // Error // 2 parameter generic call with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(n, f) { } -someGenerics4(4, function () { return null; }); // Valid -someGenerics4('', function () { return 3; }); -someGenerics4('', function (x) { return ''; }); // Error +someGenerics4(4, () => null); // Valid +someGenerics4('', () => 3); +someGenerics4('', (x) => ''); // Error someGenerics4(null, null); // 2 parameter generic call with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(n, f) { } -someGenerics5(4, function () { return null; }); // Valid -someGenerics5('', function () { return 3; }); -someGenerics5('', function (x) { return ''; }); // Error +someGenerics5(4, () => null); // Valid +someGenerics5('', () => 3); +someGenerics5('', (x) => ''); // Error someGenerics5(null, null); // Error // Generic call with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(a, b, c) { } -someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Valid -someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); -someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Error -someGenerics6(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); +someGenerics6(n => n, n => n, n => n); // Valid +someGenerics6(n => n, n => n, n => n); +someGenerics6((n) => n, (n) => n, (n) => n); // Error +someGenerics6((n) => n, (n) => n, (n) => n); // Generic call with multiple arguments of function types that each have parameters of different generic type function someGenerics7(a, b, c) { } -someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Valid, types of n are respectively -someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); -someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); +someGenerics7(n => n, n => n, n => n); // Valid, types of n are respectively +someGenerics7(n => n, n => n, n => n); +someGenerics7((n) => n, (n) => n, (n) => n); // Generic call with argument of generic function type function someGenerics8(n) { return n; } var x = someGenerics8(someGenerics7); // Error diff --git a/tests/baselines/reference/typeArgumentInferenceWithObjectLiteral.js b/tests/baselines/reference/typeArgumentInferenceWithObjectLiteral.js index 5c42beabf1c55..9becc03c769bc 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithObjectLiteral.js +++ b/tests/baselines/reference/typeArgumentInferenceWithObjectLiteral.js @@ -43,12 +43,12 @@ function foo(x) { } var s; // Calls below should infer string for T and then assign that type to the value parameter foo({ - read: function () { return s; }, - write: function (value) { return s = value; } + read: () => s, + write: value => s = value }); foo({ - write: function (value) { return s = value; }, - read: function () { return s; } + write: value => s = value, + read: () => s }); var E1; (function (E1) { @@ -59,9 +59,9 @@ var E2; E2[E2["X"] = 0] = "X"; })(E2 || (E2 = {})); var v1; -var v1 = f1({ w: function (x) { return x; }, r: function () { return 0; } }, 0); -var v1 = f1({ w: function (x) { return x; }, r: function () { return 0; } }, E1.X); -var v1 = f1({ w: function (x) { return x; }, r: function () { return E1.X; } }, 0); +var v1 = f1({ w: x => x, r: () => 0 }, 0); +var v1 = f1({ w: x => x, r: () => 0 }, E1.X); +var v1 = f1({ w: x => x, r: () => E1.X }, 0); var v2; -var v2 = f1({ w: function (x) { return x; }, r: function () { return E1.X; } }, E1.X); -var v3 = f1({ w: function (x) { return x; }, r: function () { return E1.X; } }, E2.X); // Error +var v2 = f1({ w: x => x, r: () => E1.X }, E1.X); +var v3 = f1({ w: x => x, r: () => E1.X }, E2.X); // Error diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js index f20f4bd13b4e3..c0b1cb5862169 100644 --- a/tests/baselines/reference/typeAssertions.js +++ b/tests/baselines/reference/typeAssertions.js @@ -54,21 +54,6 @@ if((numOrStr === undefined) as numOrStr is string) { // Error //// [typeAssertions.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); // Function call whose argument is a 1 arg generic function call with explicit type arguments function fn1(t) { } function fn2(t) { } @@ -78,23 +63,15 @@ var s; // Type assertion of non - unary expression var a = "" + 4; var s = "" + 4; -var SomeBase = /** @class */ (function () { - function SomeBase() { - } - return SomeBase; -}()); -var SomeDerived = /** @class */ (function (_super) { - __extends(SomeDerived, _super); - function SomeDerived() { - return _super !== null && _super.apply(this, arguments) || this; - } - return SomeDerived; -}(SomeBase)); -var SomeOther = /** @class */ (function () { - function SomeOther() { - } - return SomeOther; -}()); +class SomeBase { + p; +} +class SomeDerived extends SomeBase { + x; +} +class SomeOther { + q; +} // Type assertion should check for assignability in either direction var someBase = new SomeBase(); var someDerived = new SomeDerived(); diff --git a/tests/baselines/reference/typeGuardEnums.js b/tests/baselines/reference/typeGuardEnums.js index 2b3f1345492f1..3f6048c310a07 100644 --- a/tests/baselines/reference/typeGuardEnums.js +++ b/tests/baselines/reference/typeGuardEnums.js @@ -28,7 +28,7 @@ var E; var V; (function (V) { })(V || (V = {})); -var x; +let x; if (typeof x === "number") { x; // number|E|V } diff --git a/tests/baselines/reference/typeGuardFunction.js b/tests/baselines/reference/typeGuardFunction.js index e549dd922728d..ea982e8ed5860 100644 --- a/tests/baselines/reference/typeGuardFunction.js +++ b/tests/baselines/reference/typeGuardFunction.js @@ -85,38 +85,15 @@ let union2: C | B; let union3: boolean | B = isA(union2) || union2; //// [typeGuardFunction.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -var B = /** @class */ (function () { - function B() { - } - return B; -}()); -var C = /** @class */ (function (_super) { - __extends(C, _super); - function C() { - return _super !== null && _super.apply(this, arguments) || this; - } - return C; -}(A)); +class A { + propA; +} +class B { + propB; +} +class C extends A { + propC; +} var a; var b; // Basic @@ -138,16 +115,13 @@ if (isC_multipleParams(a, 0)) { } // Methods var obj; -var D = /** @class */ (function () { - function D() { - } - D.prototype.method1 = function (p1) { +class D { + method1(p1) { return true; - }; - return D; -}()); + } +} // Arrow function -var f1 = function (p1) { return false; }; +let f1 = (p1) => false; // Function expressions f2(function (p1) { return true; @@ -155,5 +129,5 @@ f2(function (p1) { acceptingBoolean(isA(a)); acceptingTypeGuardFunction(isA); // Binary expressions -var union2; -var union3 = isA(union2) || union2; +let union2; +let union3 = isA(union2) || union2; diff --git a/tests/baselines/reference/typeGuardFunctionErrors.js b/tests/baselines/reference/typeGuardFunctionErrors.js index fe6896e44a832..992be544aeb97 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.js +++ b/tests/baselines/reference/typeGuardFunctionErrors.js @@ -170,38 +170,15 @@ declare function newError3(x: number): x is NeedsFoo; // should error //// [typeGuardFunctionErrors.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -var B = /** @class */ (function () { - function B() { - } - return B; -}()); -var C = /** @class */ (function (_super) { - __extends(C, _super); - function C() { - return _super !== null && _super.apply(this, arguments) || this; - } - return C; -}(A)); +class A { + propA; +} +class B { + propB; +} +class C extends A { + propC; +} function hasANonBooleanReturnStatement(x) { return ''; } @@ -229,8 +206,8 @@ function hasNonMatchingParameterType2(x) { function hasNonMathcingGenericType(a) { return true; } -var a; -var b; +let a; +let b; // Passed argument is not the same as the one being guarded. if (isB(b)) { a.propB; @@ -270,47 +247,31 @@ A; } ; // Non-compatiable type predicate positions for signature declarations -var D = /** @class */ (function () { - function D(p1) { +class D { + constructor(p1): p1 is C { return true; } - Object.defineProperty(D.prototype, "m1", { - get: function (p1) { - return true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(D.prototype, "m2", { - set: function (p1) { - return true; - }, - enumerable: false, - configurable: true - }); - return D; -}()); + get m1(p1) { + return true; + } + set m2(p1): p1 is C { + return true; + } +} is; C; // Reference to rest parameter -function b4() { - var a = []; - for (var _i = 0; _i < arguments.length; _i++) { - a[_i] = arguments[_i]; - } +function b4(...a) { return true; } // Reference to binding pattern -function b5(_a, p2, p3) { - var a = _a.a, b = _a.b, p1 = _a.p1; +function b5({ a, b, p1 }, p2, p3) { return true; } -function b6(_a, p2, p3) { - var a = _a[0], b = _a[1], p1 = _a[2]; +function b6([a, b, p1], p2, p3) { return true; } -function b7(_a, p2, p3) { - var a = _a.a, b = _a.b, p1 = _a.c.p1; +function b7({ a, b, c: { p1 } }, p2, p3) { return true; } // Should not crash the compiler diff --git a/tests/baselines/reference/typeGuardFunctionGenerics.js b/tests/baselines/reference/typeGuardFunctionGenerics.js index a8c77a80783a3..19b20df935ec2 100644 --- a/tests/baselines/reference/typeGuardFunctionGenerics.js +++ b/tests/baselines/reference/typeGuardFunctionGenerics.js @@ -35,45 +35,22 @@ if (funD(isC, a)) { let test3: B = funE(isB, 1); //// [typeGuardFunctionGenerics.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -var B = /** @class */ (function () { - function B() { - } - return B; -}()); -var C = /** @class */ (function (_super) { - __extends(C, _super); - function C() { - return _super !== null && _super.apply(this, arguments) || this; - } - return C; -}(A)); -var a; -var test1 = funA(isB); +class A { + propA; +} +class B { + propB; +} +class C extends A { + propC; +} +let a; +let test1 = funA(isB); if (funB(retC, a)) { a.propC; } -var test2 = funC(isB); +let test2 = funC(isB); if (funD(isC, a)) { a.propC; } -var test3 = funE(isB, 1); +let test3 = funE(isB, 1); diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.js b/tests/baselines/reference/typeGuardFunctionOfFormThis.js index f0cb81eff5abb..b9a158fdcb8dc 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.js @@ -144,58 +144,30 @@ interface MimicGuardInterface { //// [typeGuardFunctionOfFormThis.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var RoyalGuard = /** @class */ (function () { - function RoyalGuard() { - } - RoyalGuard.prototype.isLeader = function () { +class RoyalGuard { + isLeader() { return this instanceof LeadGuard; - }; - RoyalGuard.prototype.isFollower = function () { + } + isFollower() { return this instanceof FollowerGuard; - }; - return RoyalGuard; -}()); -var LeadGuard = /** @class */ (function (_super) { - __extends(LeadGuard, _super); - function LeadGuard() { - return _super !== null && _super.apply(this, arguments) || this; } - LeadGuard.prototype.lead = function () { }; +} +class LeadGuard extends RoyalGuard { + lead() { } ; - return LeadGuard; -}(RoyalGuard)); -var FollowerGuard = /** @class */ (function (_super) { - __extends(FollowerGuard, _super); - function FollowerGuard() { - return _super !== null && _super.apply(this, arguments) || this; - } - FollowerGuard.prototype.follow = function () { }; +} +class FollowerGuard extends RoyalGuard { + follow() { } ; - return FollowerGuard; -}(RoyalGuard)); -var a = new FollowerGuard(); +} +let a = new FollowerGuard(); if (a.isLeader()) { a.lead(); } else if (a.isFollower()) { a.follow(); } -var b; +let b; if (b.isLeader()) { b.lead(); } @@ -214,49 +186,35 @@ else if (b.isFollower()) { // else if (((a)["isFollower"]())) { // a.follow(); // } -var holder2 = { a: a }; +var holder2 = { a }; if (holder2.a.isLeader()) { holder2.a; } else { holder2.a; } -var ArrowGuard = /** @class */ (function () { - function ArrowGuard() { - var _this = this; - this.isElite = function () { - return _this instanceof ArrowElite; - }; - this.isMedic = function () { - return _this instanceof ArrowMedic; - }; - } - return ArrowGuard; -}()); -var ArrowElite = /** @class */ (function (_super) { - __extends(ArrowElite, _super); - function ArrowElite() { - return _super !== null && _super.apply(this, arguments) || this; - } - ArrowElite.prototype.defend = function () { }; - return ArrowElite; -}(ArrowGuard)); -var ArrowMedic = /** @class */ (function (_super) { - __extends(ArrowMedic, _super); - function ArrowMedic() { - return _super !== null && _super.apply(this, arguments) || this; - } - ArrowMedic.prototype.heal = function () { }; - return ArrowMedic; -}(ArrowGuard)); -var guard = new ArrowGuard(); +class ArrowGuard { + isElite = () => { + return this instanceof ArrowElite; + }; + isMedic = () => { + return this instanceof ArrowMedic; + }; +} +class ArrowElite extends ArrowGuard { + defend() { } +} +class ArrowMedic extends ArrowGuard { + heal() { } +} +let guard = new ArrowGuard(); if (guard.isElite()) { guard.defend(); } else if (guard.isMedic()) { guard.heal(); } -var crate; +let crate; if (crate.isSundries()) { crate.contents.broken = true; } @@ -266,32 +224,19 @@ else if (crate.isSupplies()) { // Matching guards should be assignable a.isFollower = b.isFollower; a.isLeader = b.isLeader; -var MimicGuard = /** @class */ (function () { - function MimicGuard() { - } - MimicGuard.prototype.isLeader = function () { return this instanceof MimicLeader; }; +class MimicGuard { + isLeader() { return this instanceof MimicLeader; } ; - MimicGuard.prototype.isFollower = function () { return this instanceof MimicFollower; }; + isFollower() { return this instanceof MimicFollower; } ; - return MimicGuard; -}()); -var MimicLeader = /** @class */ (function (_super) { - __extends(MimicLeader, _super); - function MimicLeader() { - return _super !== null && _super.apply(this, arguments) || this; - } - MimicLeader.prototype.lead = function () { }; - return MimicLeader; -}(MimicGuard)); -var MimicFollower = /** @class */ (function (_super) { - __extends(MimicFollower, _super); - function MimicFollower() { - return _super !== null && _super.apply(this, arguments) || this; - } - MimicFollower.prototype.follow = function () { }; - return MimicFollower; -}(MimicGuard)); -var mimic = new MimicGuard(); +} +class MimicLeader extends MimicGuard { + lead() { } +} +class MimicFollower extends MimicGuard { + follow() { } +} +let mimic = new MimicGuard(); a.isLeader = mimic.isLeader; a.isFollower = mimic.isFollower; if (mimic.isFollower()) { diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js index 3de4086386995..123d71bee8d5d 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js @@ -62,52 +62,24 @@ else { } //// [typeGuardFunctionOfFormThisErrors.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var RoyalGuard = /** @class */ (function () { - function RoyalGuard() { - } - RoyalGuard.prototype.isLeader = function () { +class RoyalGuard { + isLeader() { return this instanceof LeadGuard; - }; - RoyalGuard.prototype.isFollower = function () { + } + isFollower() { return this instanceof FollowerGuard; - }; - return RoyalGuard; -}()); -var LeadGuard = /** @class */ (function (_super) { - __extends(LeadGuard, _super); - function LeadGuard() { - return _super !== null && _super.apply(this, arguments) || this; } - LeadGuard.prototype.lead = function () { }; +} +class LeadGuard extends RoyalGuard { + lead() { } ; - return LeadGuard; -}(RoyalGuard)); -var FollowerGuard = /** @class */ (function (_super) { - __extends(FollowerGuard, _super); - function FollowerGuard() { - return _super !== null && _super.apply(this, arguments) || this; - } - FollowerGuard.prototype.follow = function () { }; +} +class FollowerGuard extends RoyalGuard { + follow() { } ; - return FollowerGuard; -}(RoyalGuard)); -var a = new FollowerGuard(); -var b = new LeadGuard(); +} +let a = new FollowerGuard(); +let b = new LeadGuard(); // Mismatched guards shouldn't be assignable b.isFollower = b.isLeader; b.isLeader = b.isFollower; @@ -116,14 +88,14 @@ a.isLeader = a.isFollower; function invalidGuard(c) { return false; } -var c; +let c; if (invalidGuard(c)) { c; } else { c; } -var holder = { invalidGuard: invalidGuard }; +let holder = { invalidGuard }; if (holder.invalidGuard(c)) { c; holder; @@ -132,7 +104,7 @@ else { c; holder; } -var detached = a.isFollower; +let detached = a.isFollower; if (detached()) { a.follow(); } diff --git a/tests/baselines/reference/typeGuardInClass.js b/tests/baselines/reference/typeGuardInClass.js index 7b15566b7c7f2..a3ec3ffbc1124 100644 --- a/tests/baselines/reference/typeGuardInClass.js +++ b/tests/baselines/reference/typeGuardInClass.js @@ -20,20 +20,18 @@ else { //// [typeGuardInClass.js] -var x; +let x; if (typeof x === "string") { - var n = /** @class */ (function () { - function class_1() { - var y = x; + let n = class { + constructor() { + let y = x; } - return class_1; - }()); + }; } else { - var m = /** @class */ (function () { - function class_2() { - var y = x; + let m = class { + constructor() { + let y = x; } - return class_2; - }()); + }; } diff --git a/tests/baselines/reference/typeGuardIntersectionTypes.js b/tests/baselines/reference/typeGuardIntersectionTypes.js index e75701a240155..856a03394622d 100644 --- a/tests/baselines/reference/typeGuardIntersectionTypes.js +++ b/tests/baselines/reference/typeGuardIntersectionTypes.js @@ -145,27 +145,27 @@ function identifyBeast(beast) { // All winged beasts with legs if (hasWings(beast)) { if (beast.legs === 4) { - log("pegasus - 4 legs, wings"); + log(`pegasus - 4 legs, wings`); } else if (beast.legs === 2) { - log("bird - 2 legs, wings"); + log(`bird - 2 legs, wings`); } else { - log("unknown - ".concat(beast.legs, " legs, wings")); + log(`unknown - ${beast.legs} legs, wings`); } } // All non-winged beasts with legs else { - log("manbearpig - ".concat(beast.legs, " legs, no wings")); + log(`manbearpig - ${beast.legs} legs, no wings`); } } // All beasts without legs else { if (hasWings(beast)) { - log("quetzalcoatl - no legs, wings"); + log(`quetzalcoatl - no legs, wings`); } else { - log("snake - no legs, no wings"); + log(`snake - no legs, no wings`); } } } diff --git a/tests/baselines/reference/typeGuardNarrowsPrimitiveIntersection.js b/tests/baselines/reference/typeGuardNarrowsPrimitiveIntersection.js index 40407133f8e31..2117b561c5592 100644 --- a/tests/baselines/reference/typeGuardNarrowsPrimitiveIntersection.js +++ b/tests/baselines/reference/typeGuardNarrowsPrimitiveIntersection.js @@ -25,7 +25,7 @@ if (isNonBlank2(value)) { //// [typeGuardNarrowsPrimitiveIntersection.js] -var value; +let value; if (isNonBlank(value)) { doThis(value); } diff --git a/tests/baselines/reference/typeGuardNarrowsToLiteralType.js b/tests/baselines/reference/typeGuardNarrowsToLiteralType.js index c0d151cb72b31..6e0644c53670e 100644 --- a/tests/baselines/reference/typeGuardNarrowsToLiteralType.js +++ b/tests/baselines/reference/typeGuardNarrowsToLiteralType.js @@ -14,7 +14,7 @@ if (isFoo(value)) { //// [typeGuardNarrowsToLiteralType.js] -var value; +let value; if (isFoo(value)) { doThis(value); } diff --git a/tests/baselines/reference/typeGuardNarrowsToLiteralTypeUnion.js b/tests/baselines/reference/typeGuardNarrowsToLiteralTypeUnion.js index b097c594a4373..5125c2f178ad7 100644 --- a/tests/baselines/reference/typeGuardNarrowsToLiteralTypeUnion.js +++ b/tests/baselines/reference/typeGuardNarrowsToLiteralTypeUnion.js @@ -14,7 +14,7 @@ if (isFoo(value)) { //// [typeGuardNarrowsToLiteralTypeUnion.js] -var value; +let value; if (isFoo(value)) { doThis(value); } diff --git a/tests/baselines/reference/typeGuardNesting.js b/tests/baselines/reference/typeGuardNesting.js index 4e5390dd8a59e..aefc626d781fc 100644 --- a/tests/baselines/reference/typeGuardNesting.js +++ b/tests/baselines/reference/typeGuardNesting.js @@ -18,16 +18,16 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole //// [typeGuardNesting.js] -var strOrBool; +let strOrBool; if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') { - var label = (typeof strOrBool === 'string') ? strOrBool : "string"; - var bool = (typeof strOrBool === 'boolean') ? strOrBool : false; - var label2 = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; - var bool2 = (typeof strOrBool !== 'string') ? strOrBool : false; + let label = (typeof strOrBool === 'string') ? strOrBool : "string"; + let bool = (typeof strOrBool === 'boolean') ? strOrBool : false; + let label2 = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; + let bool2 = (typeof strOrBool !== 'string') ? strOrBool : false; } if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boolean') { - var label = (typeof strOrBool === 'string') ? strOrBool : "string"; - var bool = (typeof strOrBool === 'boolean') ? strOrBool : false; - var label2 = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; - var bool2 = (typeof strOrBool !== 'string') ? strOrBool : false; + let label = (typeof strOrBool === 'string') ? strOrBool : "string"; + let bool = (typeof strOrBool === 'boolean') ? strOrBool : false; + let label2 = (typeof strOrBool !== 'boolean') ? strOrBool : "string"; + let bool2 = (typeof strOrBool !== 'string') ? strOrBool : false; } diff --git a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.js b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.js index 454112ee1fcaf..95b8bd3fc5b3e 100644 --- a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.js +++ b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.js @@ -55,11 +55,9 @@ var num; var strOrNum; var strOrNumOrBool; var numOrBool; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + p; +} var c; var cOrBool; var strOrNumOrBoolOrC; diff --git a/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.js b/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.js index b26363e639720..213d861c19d92 100644 --- a/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.js +++ b/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.js @@ -55,11 +55,9 @@ var num; var strOrNum; var strOrNumOrBool; var numOrBool; -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + p; +} var c; var cOrBool; var strOrNumOrBoolOrC; diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.js b/tests/baselines/reference/typeGuardOfFormInstanceOf.js index 583aa15bcc8a9..02af821a45a84 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.js +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.js @@ -75,43 +75,18 @@ else { // - when true, narrows the type of x to the type of the 'prototype' property in C provided // it is a subtype of the type of x, or // - when false, has no effect on the type of x. -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var C1 = /** @class */ (function () { - function C1() { - } - return C1; -}()); -var C2 = /** @class */ (function () { - function C2() { - } - return C2; -}()); -var D1 = /** @class */ (function (_super) { - __extends(D1, _super); - function D1() { - return _super !== null && _super.apply(this, arguments) || this; - } - return D1; -}(C1)); -var C3 = /** @class */ (function () { - function C3() { - } - return C3; -}()); +class C1 { + p1; +} +class C2 { + p2; +} +class D1 extends C1 { + p3; +} +class C3 { + p4; +} var str; var num; var strOrNum; diff --git a/tests/baselines/reference/typeGuardOfFormIsType.js b/tests/baselines/reference/typeGuardOfFormIsType.js index cfc7e73b5a9e6..1622f981a4e91 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.js +++ b/tests/baselines/reference/typeGuardOfFormIsType.js @@ -39,38 +39,15 @@ str = isD1(c2Ord1) && c2Ord1.p1; // D1 var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1 //// [typeGuardOfFormIsType.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var C1 = /** @class */ (function () { - function C1() { - } - return C1; -}()); -var C2 = /** @class */ (function () { - function C2() { - } - return C2; -}()); -var D1 = /** @class */ (function (_super) { - __extends(D1, _super); - function D1() { - return _super !== null && _super.apply(this, arguments) || this; - } - return D1; -}(C1)); +class C1 { + p1; +} +class C2 { + p2; +} +class D1 extends C1 { + p3; +} var str; var num; var strOrNum; diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.js b/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.js index 42200ddee3225..4caf442e24345 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.js @@ -89,11 +89,9 @@ else { //// [typeGuardOfFormTypeOfBoolean.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + p; +} ; var str; var bool; @@ -135,10 +133,10 @@ else { c = boolOrC; // C } if (typeof strOrNum === "boolean") { - var z1 = strOrNum; // {} + let z1 = strOrNum; // {} } else { - var z2 = strOrNum; // string | number + let z2 = strOrNum; // string | number } // A type guard of the form typeof x !== s, where s is a string literal, // - when true, narrows the type of x by typeof x === s when false, or @@ -168,8 +166,8 @@ else { bool = boolOrC; // boolean } if (typeof strOrNum !== "boolean") { - var z1 = strOrNum; // string | number + let z1 = strOrNum; // string | number } else { - var z2 = strOrNum; // {} + let z2 = strOrNum; // {} } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.js b/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.js index 9bf218444e1a3..36a6f58362639 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.js @@ -38,11 +38,9 @@ else { } //// [typeGuardOfFormTypeOfEqualEqualHasNoEffect.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + p; +} ; var strOrNum; var strOrBool; diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfFunction.js b/tests/baselines/reference/typeGuardOfFormTypeOfFunction.js index 0c75bf893c134..118aa2a516cf3 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfFunction.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfFunction.js @@ -145,16 +145,15 @@ function f12(x) { } // Repro from #18238 function f100(obj, keys) { - for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { - var k = keys_1[_i]; - var item = obj[k]; + for (const k of keys) { + const item = obj[k]; if (typeof item == 'function') item.call(obj); } } // Repro from #49316 function configureStore(reducer) { - var rootReducer; + let rootReducer; if (typeof reducer === 'function') { rootReducer = reducer; } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.js b/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.js index e1bf25b928639..a7aef7f7deb99 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.js @@ -38,11 +38,9 @@ else { } //// [typeGuardOfFormTypeOfNotEqualHasNoEffect.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + p; +} ; var strOrNum; var strOrBool; diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNumber.js b/tests/baselines/reference/typeGuardOfFormTypeOfNumber.js index 1794f2781e380..ddd1889df8ec5 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfNumber.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfNumber.js @@ -88,11 +88,9 @@ else { //// [typeGuardOfFormTypeOfNumber.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + p; +} ; var str; var bool; @@ -134,10 +132,10 @@ else { c = numOrC; // C } if (typeof strOrBool === "number") { - var y1 = strOrBool; // {} + let y1 = strOrBool; // {} } else { - var y2 = strOrBool; // string | boolean + let y2 = strOrBool; // string | boolean } // A type guard of the form typeof x !== s, where s is a string literal, // - when true, narrows the type of x by typeof x === s when false, or @@ -167,8 +165,8 @@ else { num = numOrC; // number } if (typeof strOrBool !== "number") { - var y1 = strOrBool; // string | boolean + let y1 = strOrBool; // string | boolean } else { - var y2 = strOrBool; // {} + let y2 = strOrBool; // {} } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfOther.js b/tests/baselines/reference/typeGuardOfFormTypeOfOther.js index 4fdaa2261ea69..2288547fe5ca4 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfOther.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfOther.js @@ -84,11 +84,9 @@ else { //// [typeGuardOfFormTypeOfOther.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + p; +} ; var str; var bool; @@ -131,10 +129,10 @@ else { var r5 = strOrC; // error: no narrowing to string } if (typeof strOrNumOrBool === "Object") { - var q1 = strOrNumOrBool; // {} + let q1 = strOrNumOrBool; // {} } else { - var q2 = strOrNumOrBool; // string | number | boolean + let q2 = strOrNumOrBool; // string | number | boolean } // A type guard of the form typeof x !== s, where s is a string literal, // - when true, narrows the type of x by typeof x === s when false, or @@ -158,8 +156,8 @@ else { c = boolOrC; // C } if (typeof strOrNumOrBool !== "Object") { - var q1 = strOrNumOrBool; // string | number | boolean + let q1 = strOrNumOrBool; // string | number | boolean } else { - var q2 = strOrNumOrBool; // {} + let q2 = strOrNumOrBool; // {} } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.js b/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.js index 6ad1b306a926d..e91a23b6650f7 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfPrimitiveSubtype.js @@ -25,23 +25,23 @@ if (typeof b === "boolean") { //// [typeGuardOfFormTypeOfPrimitiveSubtype.js] -var a; -var b; +let a; +let b; if (typeof a === "number") { - var c = a; + let c = a; } if (typeof a === "string") { - var c = a; + let c = a; } if (typeof a === "boolean") { - var c = a; + let c = a; } if (typeof b === "number") { - var c = b; + let c = b; } if (typeof b === "string") { - var c = b; + let c = b; } if (typeof b === "boolean") { - var c = b; + let c = b; } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfString.js b/tests/baselines/reference/typeGuardOfFormTypeOfString.js index 18212c46e5283..9c532908eb7ce 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfString.js +++ b/tests/baselines/reference/typeGuardOfFormTypeOfString.js @@ -88,11 +88,9 @@ else { //// [typeGuardOfFormTypeOfString.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + p; +} ; var str; var bool; @@ -134,10 +132,10 @@ else { c = strOrC; // C } if (typeof numOrBool === "string") { - var x1 = numOrBool; // {} + let x1 = numOrBool; // {} } else { - var x2 = numOrBool; // number | boolean + let x2 = numOrBool; // number | boolean } // A type guard of the form typeof x !== s, where s is a string literal, // - when true, narrows the type of x by typeof x === s when false, or @@ -167,8 +165,8 @@ else { str = strOrC; // string } if (typeof numOrBool !== "string") { - var x1 = numOrBool; // number | boolean + let x1 = numOrBool; // number | boolean } else { - var x2 = numOrBool; // {} + let x2 = numOrBool; // {} } diff --git a/tests/baselines/reference/typeGuardOfFromPropNameInUnionType.js b/tests/baselines/reference/typeGuardOfFromPropNameInUnionType.js index d5beaccfa5386..9bf7b5e50484c 100644 --- a/tests/baselines/reference/typeGuardOfFromPropNameInUnionType.js +++ b/tests/baselines/reference/typeGuardOfFromPropNameInUnionType.js @@ -109,26 +109,18 @@ function f(i: Indexed) { //// [typeGuardOfFromPropNameInUnionType.js] -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -var B = /** @class */ (function () { - function B() { - } - return B; -}()); -var C = /** @class */ (function () { - function C() { - } - return C; -}()); -var D = /** @class */ (function () { - function D() { - } - return D; -}()); +class A { + a; +} +class B { + b; +} +class C { + b; +} +class D { + a; +} function namedClasses(x) { if ("a" in x) { x.a = "1"; @@ -139,100 +131,88 @@ function namedClasses(x) { } function multipleClasses(x) { if ("a" in x) { - var y = x.a; + let y = x.a; } else { - var z = x.b; + let z = x.b; } } function anonymousClasses(x) { if ("a" in x) { - var y = x.a; + let y = x.a; } else { - var z = x.b; + let z = x.b; } } -var AWithOptionalProp = /** @class */ (function () { - function AWithOptionalProp() { - } - return AWithOptionalProp; -}()); -var BWithOptionalProp = /** @class */ (function () { - function BWithOptionalProp() { - } - return BWithOptionalProp; -}()); +class AWithOptionalProp { + a; +} +class BWithOptionalProp { + b; +} function positiveTestClassesWithOptionalProperties(x) { if ("a" in x) { x.a = "1"; } else { - var y = x instanceof AWithOptionalProp + const y = x instanceof AWithOptionalProp ? x.a : x.b; } } function inParenthesizedExpression(x) { if ("a" in (x)) { - var y = x.a; + let y = x.a; } else { - var z = x.b; + let z = x.b; } } -var ClassWithUnionProp = /** @class */ (function () { - function ClassWithUnionProp() { - } - return ClassWithUnionProp; -}()); +class ClassWithUnionProp { + prop; +} function inProperty(x) { if ("a" in x.prop) { - var y = x.prop.a; + let y = x.prop.a; } else { - var z = x.prop.b; + let z = x.prop.b; } } -var NestedClassWithProp = /** @class */ (function () { - function NestedClassWithProp() { - } - return NestedClassWithProp; -}()); +class NestedClassWithProp { + outer; +} function innestedProperty(x) { if ("a" in x.outer.prop) { - var y = x.outer.prop.a; + let y = x.outer.prop.a; } else { - var z = x.outer.prop.b; + let z = x.outer.prop.b; } } -var InMemberOfClass = /** @class */ (function () { - function InMemberOfClass() { - } - InMemberOfClass.prototype.inThis = function () { +class InMemberOfClass { + prop; + inThis() { if ("a" in this.prop) { - var y = this.prop.a; + let y = this.prop.a; } else { - var z = this.prop.b; + let z = this.prop.b; } - }; - return InMemberOfClass; -}()); -// added for completeness -var SelfAssert = /** @class */ (function () { - function SelfAssert() { } - SelfAssert.prototype.inThis = function () { +} +// added for completeness +class SelfAssert { + a; + inThis() { if ("a" in this) { - var y = this.a; + let y = this.a; } else { } - }; - return SelfAssert; -}()); + } +} function f(i) { if ("a" in i) { return i.a; diff --git a/tests/baselines/reference/typeGuardOfFromPropNameInUnionType.symbols b/tests/baselines/reference/typeGuardOfFromPropNameInUnionType.symbols index 184265455b807..e0c5608985054 100644 --- a/tests/baselines/reference/typeGuardOfFromPropNameInUnionType.symbols +++ b/tests/baselines/reference/typeGuardOfFromPropNameInUnionType.symbols @@ -17,7 +17,7 @@ class C { b: Object; } class D { a: Date; } >D : Symbol(D, Decl(typeGuardOfFromPropNameInUnionType.ts, 2, 22)) >a : Symbol(D.a, Decl(typeGuardOfFromPropNameInUnionType.ts, 3, 9)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) function namedClasses(x: A | B) { >namedClasses : Symbol(namedClasses, Decl(typeGuardOfFromPropNameInUnionType.ts, 3, 20)) @@ -54,7 +54,7 @@ function multipleClasses(x: A | B | C | D) { let y: string | Date = x.a; >y : Symbol(y, Decl(typeGuardOfFromPropNameInUnionType.ts, 15, 11)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) >x.a : Symbol(a, Decl(typeGuardOfFromPropNameInUnionType.ts, 0, 9), Decl(typeGuardOfFromPropNameInUnionType.ts, 3, 9)) >x : Symbol(x, Decl(typeGuardOfFromPropNameInUnionType.ts, 13, 25)) >a : Symbol(a, Decl(typeGuardOfFromPropNameInUnionType.ts, 0, 9), Decl(typeGuardOfFromPropNameInUnionType.ts, 3, 9)) diff --git a/tests/baselines/reference/typeGuardTautologicalConsistiency.js b/tests/baselines/reference/typeGuardTautologicalConsistiency.js index 9cdcedb0ca8cf..627b3f0fd4f28 100644 --- a/tests/baselines/reference/typeGuardTautologicalConsistiency.js +++ b/tests/baselines/reference/typeGuardTautologicalConsistiency.js @@ -15,7 +15,7 @@ if (typeof stringOrNumber === "number" && typeof stringOrNumber !== "number") { //// [typeGuardTautologicalConsistiency.js] -var stringOrNumber; +let stringOrNumber; if (typeof stringOrNumber === "number") { if (typeof stringOrNumber !== "number") { stringOrNumber; diff --git a/tests/baselines/reference/typeGuardsAsAssertions.js b/tests/baselines/reference/typeGuardsAsAssertions.js index 53b3172853152..38f2199deb465 100644 --- a/tests/baselines/reference/typeGuardsAsAssertions.js +++ b/tests/baselines/reference/typeGuardsAsAssertions.js @@ -129,22 +129,17 @@ function f7() { //// [typeGuardsAsAssertions.js] -"use strict"; // Repro from #8513 -Object.defineProperty(exports, "__esModule", { value: true }); -exports.none = void 0; -exports.isSome = isSome; -exports.fn = fn; -var cond; -exports.none = { none: '' }; -function isSome(value) { +let cond; +export const none = { none: '' }; +export function isSome(value) { return 'some' in value; } function someFrom(some) { - return { some: some }; + return { some }; } -function fn(makeSome) { - var result = exports.none; +export function fn(makeSome) { + let result = none; result; // None while (cond) { result; // Some | None @@ -153,7 +148,7 @@ function fn(makeSome) { } } function foo1() { - var x = 0; + let x = 0; x; // number while (cond) { x; // number, then string | number @@ -163,7 +158,7 @@ function foo1() { x; } function foo2() { - var x = 0; + let x = 0; x; // number while (cond) { x; // number, then string | number @@ -179,7 +174,7 @@ function foo2() { } // Type guards as assertions function f1() { - var x = undefined; + let x = undefined; x; // undefined if (x) { x; // string | number (guard as assertion) @@ -187,7 +182,7 @@ function f1() { x; // string | number | undefined } function f2() { - var x = undefined; + let x = undefined; x; // undefined if (typeof x === "string") { x; // string (guard as assertion) @@ -195,7 +190,7 @@ function f2() { x; // string | undefined } function f3() { - var x = undefined; + let x = undefined; x; // undefined if (!x) { return; @@ -203,7 +198,7 @@ function f3() { x; // string | number (guard as assertion) } function f4() { - var x = undefined; + let x = undefined; x; // undefined if (typeof x === "boolean") { x; // nothing (boolean not in declared type) @@ -220,7 +215,7 @@ function f5(x) { x; // string | number } function f6() { - var x; + let x; x.slice(); x = ""; x.slice(); @@ -236,6 +231,6 @@ function f6() { x.slice(); } function f7() { - var x; + let x; x.slice(); } diff --git a/tests/baselines/reference/typeGuardsDefeat.js b/tests/baselines/reference/typeGuardsDefeat.js index 12ed0b8e032bd..a84565994adef 100644 --- a/tests/baselines/reference/typeGuardsDefeat.js +++ b/tests/baselines/reference/typeGuardsDefeat.js @@ -71,7 +71,7 @@ function foo3(x) { return x.length; // string } else { - var f = function () { return x * x; }; + var f = () => x * x; } x = "hello"; f(); diff --git a/tests/baselines/reference/typeGuardsInClassMethods.js b/tests/baselines/reference/typeGuardsInClassMethods.js index ac00c2e9f81b9..4b881122185e1 100644 --- a/tests/baselines/reference/typeGuardsInClassMethods.js +++ b/tests/baselines/reference/typeGuardsInClassMethods.js @@ -76,8 +76,8 @@ class C1 { // variables in global var num; var var1; -var C1 = /** @class */ (function () { - function C1(param) { +class C1 { + constructor(param) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration @@ -87,7 +87,7 @@ var C1 = /** @class */ (function () { num = typeof param === "string" && param.length; // string } // Inside function declaration - C1.prototype.p1 = function (param) { + p1(param) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration @@ -95,9 +95,9 @@ var C1 = /** @class */ (function () { num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string - }; + } // Inside function declaration - C1.prototype.p2 = function (param) { + p2(param) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration @@ -105,9 +105,9 @@ var C1 = /** @class */ (function () { num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string - }; + } // Inside function declaration - C1.s1 = function (param) { + static s1(param) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration @@ -115,9 +115,9 @@ var C1 = /** @class */ (function () { num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string - }; + } // Inside function declaration - C1.s2 = function (param) { + static s2(param) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration @@ -125,6 +125,5 @@ var C1 = /** @class */ (function () { num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string - }; - return C1; -}()); + } +} diff --git a/tests/baselines/reference/typeGuardsInDoStatement.js b/tests/baselines/reference/typeGuardsInDoStatement.js index 8ea64454e5708..b9266e4ef6794 100644 --- a/tests/baselines/reference/typeGuardsInDoStatement.js +++ b/tests/baselines/reference/typeGuardsInDoStatement.js @@ -31,7 +31,7 @@ function c(x: string | number) { //// [typeGuardsInDoStatement.js] -var cond; +let cond; function a(x) { x = true; do { diff --git a/tests/baselines/reference/typeGuardsInForStatement.js b/tests/baselines/reference/typeGuardsInForStatement.js index 8a496b85128c7..119e3fefe0fd0 100644 --- a/tests/baselines/reference/typeGuardsInForStatement.js +++ b/tests/baselines/reference/typeGuardsInForStatement.js @@ -25,7 +25,7 @@ function c(x: string | number) { //// [typeGuardsInForStatement.js] -var cond; +let cond; function a(x) { for (x = undefined; typeof x !== "number"; x = undefined) { x; // string diff --git a/tests/baselines/reference/typeGuardsInFunction.js b/tests/baselines/reference/typeGuardsInFunction.js index 4dd32ff2f8eb1..81ceefc2ab92a 100644 --- a/tests/baselines/reference/typeGuardsInFunction.js +++ b/tests/baselines/reference/typeGuardsInFunction.js @@ -144,7 +144,7 @@ function f3(param) { // variables in function declaration var var2; // variables in function expressions - var r = (function (param1) { + var r = ((param1) => { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables from outer function declaration diff --git a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.js b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.js index 58c9657570dad..79cefbaa138f1 100644 --- a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.js +++ b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.js @@ -106,7 +106,7 @@ function foo2(x) { function foo3(x) { return typeof x === "string" ? x - : (function () { + : (() => { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean @@ -116,7 +116,7 @@ function foo3(x) { function foo4(x) { return typeof x === "string" ? x - : (function (a) { + : ((a) => { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean @@ -135,7 +135,7 @@ function foo5(x) { var m; (function (m) { var x; - var m2; + let m2; (function (m2) { var b = x; // new scope - number | boolean | string var y; @@ -152,9 +152,9 @@ var m; var m1; (function (m1) { var x; - var m2; + let m2; (function (m2) { - var m3; + let m3; (function (m3) { var b = x; // new scope - number | boolean | string var y; diff --git a/tests/baselines/reference/typeGuardsInModule.js b/tests/baselines/reference/typeGuardsInModule.js index a15f200eba5a0..794dbec66c1d6 100644 --- a/tests/baselines/reference/typeGuardsInModule.js +++ b/tests/baselines/reference/typeGuardsInModule.js @@ -120,7 +120,7 @@ var m1; var m2; (function (m2) { var var2; - var m3; + let m3; (function (m3) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string diff --git a/tests/baselines/reference/typeGuardsInWhileStatement.js b/tests/baselines/reference/typeGuardsInWhileStatement.js index 5f2fa01dcade7..22f7974e24312 100644 --- a/tests/baselines/reference/typeGuardsInWhileStatement.js +++ b/tests/baselines/reference/typeGuardsInWhileStatement.js @@ -28,7 +28,7 @@ function c(x: string | number) { //// [typeGuardsInWhileStatement.js] -var cond; +let cond; function a(x) { while (typeof x === "string") { x; // string diff --git a/tests/baselines/reference/typeGuardsNestedAssignments.js b/tests/baselines/reference/typeGuardsNestedAssignments.js index e195cde18833c..2c776577e76a6 100644 --- a/tests/baselines/reference/typeGuardsNestedAssignments.js +++ b/tests/baselines/reference/typeGuardsNestedAssignments.js @@ -48,40 +48,38 @@ while ((match = re.exec("xxx")) != null) { } //// [typeGuardsNestedAssignments.js] -var Foo = /** @class */ (function () { - function Foo() { - } - return Foo; -}()); +class Foo { + x; +} function f1() { - var foo; + let foo; if ((foo = getFooOrNull()) !== null) { foo; // Foo } } function f2() { - var foo1; - var foo2; + let foo1; + let foo2; if ((foo1 = getFooOrNull(), foo2 = foo1) !== null) { foo1; // Foo | null foo2; // Foo } } function f3() { - var obj; + let obj; if ((obj = getFooOrNull()) instanceof Foo) { obj; } } function f4() { - var x; + let x; if (typeof (x = getStringOrNumberOrNull()) === "number") { x; } } // Repro from #8851 -var re = /./g; -var match; +const re = /./g; +let match; while ((match = re.exec("xxx")) != null) { - var length_1 = match[1].length + match[2].length; + const length = match[1].length + match[2].length; } diff --git a/tests/baselines/reference/typeGuardsNestedAssignments.symbols b/tests/baselines/reference/typeGuardsNestedAssignments.symbols index 49ccb47beb265..66c85802f552a 100644 --- a/tests/baselines/reference/typeGuardsNestedAssignments.symbols +++ b/tests/baselines/reference/typeGuardsNestedAssignments.symbols @@ -95,7 +95,7 @@ const re = /./g let match: RegExpExecArray | null >match : Symbol(match, Decl(typeGuardsNestedAssignments.ts, 40, 3)) ->RegExpExecArray : Symbol(RegExpExecArray, Decl(lib.es5.d.ts, --, --)) +>RegExpExecArray : Symbol(RegExpExecArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.regexp.d.ts, --, --), Decl(lib.es2022.regexp.d.ts, --, --)) while ((match = re.exec("xxx")) != null) { >match : Symbol(match, Decl(typeGuardsNestedAssignments.ts, 40, 3)) diff --git a/tests/baselines/reference/typeGuardsOnClassProperty.js b/tests/baselines/reference/typeGuardsOnClassProperty.js index 288751038eabb..f647443c47182 100644 --- a/tests/baselines/reference/typeGuardsOnClassProperty.js +++ b/tests/baselines/reference/typeGuardsOnClassProperty.js @@ -35,18 +35,16 @@ if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { } // have no effect on members of objects such as properties. // Note that the class's property must be copied to a local variable for // the type guard to have an effect -var D = /** @class */ (function () { - function D() { - } - D.prototype.getData = function () { +class D { + data; + getData() { var data = this.data; return typeof data === "string" ? data : data.join(" "); - }; - D.prototype.getData1 = function () { + } + getData1() { return typeof this.data === "string" ? this.data : this.data.join(" "); - }; - return D; -}()); + } +} var o = { prop1: "string", prop2: true diff --git a/tests/baselines/reference/typeGuardsOnClassProperty.symbols b/tests/baselines/reference/typeGuardsOnClassProperty.symbols index bd3efc4e60da4..5c6abd9d8215e 100644 --- a/tests/baselines/reference/typeGuardsOnClassProperty.symbols +++ b/tests/baselines/reference/typeGuardsOnClassProperty.symbols @@ -82,7 +82,7 @@ var prop1 = o.prop1; if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { } >prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 26, 3)) ->prop1.toLocaleLowerCase : Symbol(String.toLocaleLowerCase, Decl(lib.es5.d.ts, --, --)) +>prop1.toLocaleLowerCase : Symbol(String.toLocaleLowerCase, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.string.d.ts, --, --)) >prop1 : Symbol(prop1, Decl(typeGuardsOnClassProperty.ts, 26, 3)) ->toLocaleLowerCase : Symbol(String.toLocaleLowerCase, Decl(lib.es5.d.ts, --, --)) +>toLocaleLowerCase : Symbol(String.toLocaleLowerCase, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.string.d.ts, --, --)) diff --git a/tests/baselines/reference/typeGuardsOnClassProperty.types b/tests/baselines/reference/typeGuardsOnClassProperty.types index dbdf7dcca523d..f4de73566e7a8 100644 --- a/tests/baselines/reference/typeGuardsOnClassProperty.types +++ b/tests/baselines/reference/typeGuardsOnClassProperty.types @@ -175,10 +175,10 @@ if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { } > : ^^^^^^^^ >prop1.toLocaleLowerCase() : string > : ^^^^^^ ->prop1.toLocaleLowerCase : (locales?: string | string[]) => string -> : ^ ^^^ ^^^^^ +>prop1.toLocaleLowerCase : { (locales?: string | string[]): string; (locales?: Intl.LocalesArgument): string; } +> : ^^^ ^^^ ^^^ ^^^ ^^^ ^^^ ^^^ >prop1 : string > : ^^^^^^ ->toLocaleLowerCase : (locales?: string | string[]) => string -> : ^ ^^^ ^^^^^ +>toLocaleLowerCase : { (locales?: string | string[]): string; (locales?: Intl.LocalesArgument): string; } +> : ^^^ ^^^ ^^^ ^^^ ^^^ ^^^ ^^^ diff --git a/tests/baselines/reference/typeGuardsTypeParameters.js b/tests/baselines/reference/typeGuardsTypeParameters.js index cde3d832ff343..67155475760f4 100644 --- a/tests/baselines/reference/typeGuardsTypeParameters.js +++ b/tests/baselines/reference/typeGuardsTypeParameters.js @@ -38,30 +38,28 @@ function fun(item: { [P in keyof T]: T[P] }) { //// [typeGuardsTypeParameters.js] // Type guards involving type parameters produce intersection types -var C = /** @class */ (function () { - function C() { - } - return C; -}()); +class C { + prop; +} function f1(x) { if (x instanceof C) { - var v1 = x; - var v2 = x; + let v1 = x; + let v2 = x; x.prop; } } function f2(x) { if (typeof x === "string") { - var v1 = x; - var v2 = x; + let v1 = x; + let v2 = x; x.length; } } // Repro from #13872 function fun(item) { - var strings = []; - for (var key in item) { - var value = item[key]; + const strings = []; + for (const key in item) { + const value = item[key]; if (typeof value === "string") { strings.push(value); } diff --git a/tests/baselines/reference/typeGuardsWithInstanceOf.js b/tests/baselines/reference/typeGuardsWithInstanceOf.js index 611449d11b0c2..7b2528e7bbb43 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOf.js +++ b/tests/baselines/reference/typeGuardsWithInstanceOf.js @@ -51,16 +51,13 @@ if (!(result instanceof RegExp)) { } else if (!result.global) { } -var C = /** @class */ (function () { - function C() { - } - C.prototype.validate = function () { +class C { + validate() { return {}; - }; - return C; -}()); + } +} function foo() { - var v = null; + let v = null; if (v instanceof C) { v; // Validator & Partial & C } diff --git a/tests/baselines/reference/typeGuardsWithInstanceOf.symbols b/tests/baselines/reference/typeGuardsWithInstanceOf.symbols index 8515d2d80f3c9..6bd01dc0d6b6f 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOf.symbols +++ b/tests/baselines/reference/typeGuardsWithInstanceOf.symbols @@ -15,7 +15,7 @@ var result2!: I; if (!(result instanceof RegExp)) { >result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3)) ->RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.regexp.d.ts, --, --) ... and 3 more) result = result2; >result : Symbol(result, Decl(typeGuardsWithInstanceOf.ts, 1, 3)) diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.symbols b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.symbols index c2aa82dad9f5d..8148295240af3 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.symbols +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.symbols @@ -496,7 +496,7 @@ var obj18: any; if (obj18 instanceof Function) { // can't narrow type from 'any' to 'Function' >obj18 : Symbol(obj18, Decl(typeGuardsWithInstanceOfByConstructorSignature.ts, 196, 3)) ->Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) obj18.foo1; >obj18 : Symbol(obj18, Decl(typeGuardsWithInstanceOfByConstructorSignature.ts, 196, 3)) diff --git a/tests/baselines/reference/typeOfThisInAccessor.js b/tests/baselines/reference/typeOfThisInAccessor.js index 6c97dac657009..74c8f0e0de886 100644 --- a/tests/baselines/reference/typeOfThisInAccessor.js +++ b/tests/baselines/reference/typeOfThisInAccessor.js @@ -34,48 +34,27 @@ var x = { } //// [typeOfThisInAccessor.js] -var C = /** @class */ (function () { - function C() { +class C { + get x() { + var r = this; // C + return 1; + } + static get y() { + var r2 = this; // typeof C + return 1; + } +} +class D { + a; + get x() { + var r = this; // D + return 1; } - Object.defineProperty(C.prototype, "x", { - get: function () { - var r = this; // C - return 1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(C, "y", { - get: function () { - var r2 = this; // typeof C - return 1; - }, - enumerable: false, - configurable: true - }); - return C; -}()); -var D = /** @class */ (function () { - function D() { + static get y() { + var r2 = this; // typeof D + return 1; } - Object.defineProperty(D.prototype, "x", { - get: function () { - var r = this; // D - return 1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(D, "y", { - get: function () { - var r2 = this; // typeof D - return 1; - }, - enumerable: false, - configurable: true - }); - return D; -}()); +} var x = { get a() { var r3 = this; // any diff --git a/tests/baselines/reference/typeOfThisInConstructorParamList.js b/tests/baselines/reference/typeOfThisInConstructorParamList.js index f47f886ebbfa1..200edf46368e0 100644 --- a/tests/baselines/reference/typeOfThisInConstructorParamList.js +++ b/tests/baselines/reference/typeOfThisInConstructorParamList.js @@ -10,10 +10,7 @@ class ErrClass { //// [typeOfThisInConstructorParamList.js] //type of 'this' in constructor param list is the class instance type (error) -var ErrClass = /** @class */ (function () { +class ErrClass { // Should be an error - function ErrClass(f) { - if (f === void 0) { f = this; } - } - return ErrClass; -}()); + constructor(f = this) { } +} diff --git a/tests/baselines/reference/typeOfThisInFunctionExpression.js b/tests/baselines/reference/typeOfThisInFunctionExpression.js index f150662397694..953908b8068f3 100644 --- a/tests/baselines/reference/typeOfThisInFunctionExpression.js +++ b/tests/baselines/reference/typeOfThisInFunctionExpression.js @@ -61,19 +61,16 @@ var t2 = function f() { var x = this; var x; }; -var C = /** @class */ (function () { - function C() { - this.x = function () { - var q; - var q = this; - }; - this.y = function ff() { - var q; - var q = this; - }; - } - return C; -}()); +class C { + x = function () { + var q; + var q = this; + }; + y = function ff() { + var q; + var q = this; + }; +} var M; (function (M) { function fn() { diff --git a/tests/baselines/reference/typeOfThisInInstanceMember.js b/tests/baselines/reference/typeOfThisInInstanceMember.js index 4056077c13096..d71db5510cd9b 100644 --- a/tests/baselines/reference/typeOfThisInInstanceMember.js +++ b/tests/baselines/reference/typeOfThisInInstanceMember.js @@ -34,27 +34,22 @@ rs.forEach(x => { }); //// [typeOfThisInInstanceMember.js] -var C = /** @class */ (function () { - function C(x) { - this.x = this; +class C { + x = this; + foo() { + return this; + } + constructor(x) { var t = this; t.x; t.y; t.z; var r = t.foo(); } - C.prototype.foo = function () { + get y() { return this; - }; - Object.defineProperty(C.prototype, "y", { - get: function () { - return this; - }, - enumerable: false, - configurable: true - }); - return C; -}()); + } +} var c; // all ok var r = c.x; @@ -62,7 +57,7 @@ var ra = c.x.x.x; var r2 = c.y; var r3 = c.foo(); var rs = [r, r2, r3]; -rs.forEach(function (x) { +rs.forEach(x => { x.foo; x.x; x.y; diff --git a/tests/baselines/reference/typeOfThisInInstanceMember2.js b/tests/baselines/reference/typeOfThisInInstanceMember2.js index d94dcebad4889..bd3c89885baf6 100644 --- a/tests/baselines/reference/typeOfThisInInstanceMember2.js +++ b/tests/baselines/reference/typeOfThisInInstanceMember2.js @@ -38,27 +38,23 @@ rs.forEach(x => { }); //// [typeOfThisInInstanceMember2.js] -var C = /** @class */ (function () { - function C(x) { - this.x = this; +class C { + x = this; + foo() { + return this; + } + constructor(x) { var t = this; t.x; t.y; t.z; var r = t.foo(); } - C.prototype.foo = function () { + get y() { return this; - }; - Object.defineProperty(C.prototype, "y", { - get: function () { - return this; - }, - enumerable: false, - configurable: true - }); - return C; -}()); + } + z; +} var c; // all ok var r = c.x; @@ -67,7 +63,7 @@ var r2 = c.y; var r3 = c.foo(); var r4 = c.z; var rs = [r, r2, r3]; -rs.forEach(function (x) { +rs.forEach(x => { x.foo; x.x; x.y; diff --git a/tests/baselines/reference/typeOfThisInMemberFunctions.js b/tests/baselines/reference/typeOfThisInMemberFunctions.js index e8560bf43dd1f..68fb0838b9272 100644 --- a/tests/baselines/reference/typeOfThisInMemberFunctions.js +++ b/tests/baselines/reference/typeOfThisInMemberFunctions.js @@ -34,36 +34,29 @@ class E { } //// [typeOfThisInMemberFunctions.js] -var C = /** @class */ (function () { - function C() { - } - C.prototype.foo = function () { +class C { + foo() { var r = this; - }; - C.bar = function () { + } + static bar() { var r2 = this; - }; - return C; -}()); -var D = /** @class */ (function () { - function D() { } - D.prototype.foo = function () { +} +class D { + x; + foo() { var r = this; - }; - D.bar = function () { + } + static bar() { var r2 = this; - }; - return D; -}()); -var E = /** @class */ (function () { - function E() { } - E.prototype.foo = function () { +} +class E { + x; + foo() { var r = this; - }; - E.bar = function () { + } + static bar() { var r2 = this; - }; - return E; -}()); + } +} diff --git a/tests/baselines/reference/typeOfThisInMemberFunctions.symbols b/tests/baselines/reference/typeOfThisInMemberFunctions.symbols index 27c4361926d17..32416a0d685e8 100644 --- a/tests/baselines/reference/typeOfThisInMemberFunctions.symbols +++ b/tests/baselines/reference/typeOfThisInMemberFunctions.symbols @@ -49,7 +49,7 @@ class D { class E { >E : Symbol(E, Decl(typeOfThisInMemberFunctions.ts, 19, 1)) >T : Symbol(T, Decl(typeOfThisInMemberFunctions.ts, 21, 8)) ->Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 1 more) x: T; >x : Symbol(E.x, Decl(typeOfThisInMemberFunctions.ts, 21, 25)) diff --git a/tests/baselines/reference/typeOfThisInStaticMembers.js b/tests/baselines/reference/typeOfThisInStaticMembers.js index 8d46c106152a0..11d710b631859 100644 --- a/tests/baselines/reference/typeOfThisInStaticMembers.js +++ b/tests/baselines/reference/typeOfThisInStaticMembers.js @@ -37,31 +37,30 @@ var r7 = new t2(''); //// [typeOfThisInStaticMembers.js] -var C = /** @class */ (function () { - function C(x) { - } - C.bar = function () { +class C { + constructor(x) { } + static foo; + static bar() { // type of this is the constructor function type var t = this; return this; - }; - return C; -}()); + } +} var t = C.bar(); // all ok var r2 = t.foo + 1; var r3 = t.bar(); var r4 = new t(1); -var C2 = /** @class */ (function () { - function C2(x) { - } - C2.bar = function () { +class C2 { + static test; + constructor(x) { } + static foo; + static bar() { // type of this is the constructor function type var t = this; return this; - }; - return C2; -}()); + } +} var t2 = C2.bar(); // all ok var r5 = t2.foo + 1; diff --git a/tests/baselines/reference/typeOfThisInStaticMembers2.js b/tests/baselines/reference/typeOfThisInStaticMembers2.js index afd23768a74f1..8cc532d09646a 100644 --- a/tests/baselines/reference/typeOfThisInStaticMembers2.js +++ b/tests/baselines/reference/typeOfThisInStaticMembers2.js @@ -10,19 +10,9 @@ class C2 { } //// [typeOfThisInStaticMembers2.js] -var C = /** @class */ (function () { - function C() { - } - var _a; - _a = C; - C.foo = _a; // ok - return C; -}()); -var C2 = /** @class */ (function () { - function C2() { - } - var _b; - _b = C2; - C2.foo = _b; // ok - return C2; -}()); +class C { + static foo = this; // ok +} +class C2 { + static foo = this; // ok +} diff --git a/tests/baselines/reference/typeOfThisInStaticMembers6.js b/tests/baselines/reference/typeOfThisInStaticMembers6.js index f1070269a1c20..e09287eb7f40e 100644 --- a/tests/baselines/reference/typeOfThisInStaticMembers6.js +++ b/tests/baselines/reference/typeOfThisInStaticMembers6.js @@ -11,32 +11,9 @@ class D extends C { //// [typeOfThisInStaticMembers6.js] -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var C = /** @class */ (function () { - function C() { - } - C.f = 1; - return C; -}()); -var D = /** @class */ (function (_super) { - __extends(D, _super); - function D() { - return _super !== null && _super.apply(this, arguments) || this; - } - D.c = _this = _super.call(this) || this; - return D; -}(C)); +class C { + static f = 1; +} +class D extends C { + static c = super(); +} diff --git a/tests/baselines/reference/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.js b/tests/baselines/reference/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.js index ff90c1ef58af6..92d7b5ddee747 100644 --- a/tests/baselines/reference/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.js +++ b/tests/baselines/reference/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.js @@ -34,29 +34,24 @@ class SomeClass2 { } //// [typeOfThisInstanceMemberNarrowedWithLoopAntecedent.js] -var SomeClass = /** @class */ (function () { - function SomeClass() { - } - SomeClass.prototype.method = function () { +class SomeClass { + state; + method() { while (0) { } this.state.data; if (this.state.type === "stringVariant") { - var s = this.state.data; + const s = this.state.data; } - }; - return SomeClass; -}()); -var SomeClass2 = /** @class */ (function () { - function SomeClass2() { } - SomeClass2.prototype.method = function () { - var _a; - var c = false; +} +class SomeClass2 { + state; + method() { + const c = false; while (c) { } if (this.state.type === "numberVariant") { this.state.data; } - var n = (_a = this.state) === null || _a === void 0 ? void 0 : _a.data; // This should be an error - }; - return SomeClass2; -}()); + let n = this.state?.data; // This should be an error + } +} diff --git a/tests/baselines/reference/typeOnlyMerge1.js b/tests/baselines/reference/typeOnlyMerge1.js index aa259cb0b28e3..08c99d8655bc9 100644 --- a/tests/baselines/reference/typeOnlyMerge1.js +++ b/tests/baselines/reference/typeOnlyMerge1.js @@ -15,16 +15,10 @@ A; //// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [b.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = void 0; -var A = 0; -exports.A = A; +const A = 0; +export { A }; //// [c.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var b_1 = require("./b"); -b_1.A; +import { A } from "./b"; +A; diff --git a/tests/baselines/reference/typeOnlyMerge2.js b/tests/baselines/reference/typeOnlyMerge2.js index f28fd67141d41..3014dd1b3e340 100644 --- a/tests/baselines/reference/typeOnlyMerge2.js +++ b/tests/baselines/reference/typeOnlyMerge2.js @@ -20,18 +20,12 @@ A; //// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = void 0; -var A = {}; -exports.A = A; +const A = {}; +export { A }; //// [b.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [c.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [d.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); A; +export {}; diff --git a/tests/baselines/reference/typeOnlyMerge3.js b/tests/baselines/reference/typeOnlyMerge3.js index 44e0443fe5ff9..e4af379d850c7 100644 --- a/tests/baselines/reference/typeOnlyMerge3.js +++ b/tests/baselines/reference/typeOnlyMerge3.js @@ -19,21 +19,16 @@ A(); //// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); function A() { } +export {}; //// [b.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = void 0; var A; (function (A) { A.displayName = "A"; -})(A || (exports.A = A = {})); +})(A || (A = {})); +export { A }; //// [c.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var b_1 = require("./b"); +import { A } from "./b"; A; A.displayName; A(); diff --git a/tests/baselines/reference/typeQuery.js b/tests/baselines/reference/typeQuery.js index 30360afafe3cc..28fb713fc1c58 100644 --- a/tests/baselines/reference/typeQuery.js +++ b/tests/baselines/reference/typeQuery.js @@ -9,16 +9,8 @@ let AConstructor: typeof A; //// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = void 0; -var A = /** @class */ (function () { - function A() { - } - return A; -}()); -exports.A = A; +export class A { +} //// [b.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var AConstructor; +let AConstructor; +export {}; diff --git a/tests/baselines/reference/typeReferenceRelatedFiles.js b/tests/baselines/reference/typeReferenceRelatedFiles.js index e2b6323d919b7..0cb0c25c1902b 100644 --- a/tests/baselines/reference/typeReferenceRelatedFiles.js +++ b/tests/baselines/reference/typeReferenceRelatedFiles.js @@ -20,10 +20,7 @@ export function f() { //// [main.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = f; -function f() { +export function f() { return {}; } diff --git a/tests/baselines/reference/typeSatisfaction.js b/tests/baselines/reference/typeSatisfaction.js index d3f9f88676d20..d3ff08907def2 100644 --- a/tests/baselines/reference/typeSatisfaction.js +++ b/tests/baselines/reference/typeSatisfaction.js @@ -28,11 +28,11 @@ let t8 = { a: 'test', b: 'test' } satisfies A; //// [typeSatisfaction.js] -var t1 = { a: 1 }; // Ok -var t2 = { a: 1, b: 1 }; // Error -var t3 = {}; // Error -var t4 = { a: "a" }; // Ok -var t5 = (function (m) { return m.substring(0); }); // Ok -var t6 = [1, 2]; -var t7 = { a: 'test' }; -var t8 = { a: 'test', b: 'test' }; +const t1 = { a: 1 }; // Ok +const t2 = { a: 1, b: 1 }; // Error +const t3 = {}; // Error +const t4 = { a: "a" }; // Ok +const t5 = (m => m.substring(0)); // Ok +const t6 = [1, 2]; +let t7 = { a: 'test' }; +let t8 = { a: 'test', b: 'test' }; diff --git a/tests/baselines/reference/typeSatisfaction_contextualTyping1.js b/tests/baselines/reference/typeSatisfaction_contextualTyping1.js index fe358de7fbf23..c6b0c4f67f959 100644 --- a/tests/baselines/reference/typeSatisfaction_contextualTyping1.js +++ b/tests/baselines/reference/typeSatisfaction_contextualTyping1.js @@ -10,7 +10,7 @@ const p = { //// [typeSatisfaction_contextualTyping1.js] -var p = { - isEven: function (n) { return n % 2 === 0; }, - isOdd: function (n) { return n % 2 === 1; } +const p = { + isEven: n => n % 2 === 0, + isOdd: n => n % 2 === 1 }; diff --git a/tests/baselines/reference/typeSatisfaction_contextualTyping2.js b/tests/baselines/reference/typeSatisfaction_contextualTyping2.js index c7a2c0bc5b5de..3b3d67f45cbfe 100644 --- a/tests/baselines/reference/typeSatisfaction_contextualTyping2.js +++ b/tests/baselines/reference/typeSatisfaction_contextualTyping2.js @@ -12,9 +12,9 @@ let obj: { f(s: string): void } & Record = { //// [typeSatisfaction_contextualTyping2.js] "use strict"; -var obj = { - f: function (s) { }, // "incorrect" implicit any on 's' - g: function (s) { } +let obj = { + f(s) { }, // "incorrect" implicit any on 's' + g(s) { } }; // This needs to not crash (outer node is not expression) -({ f: function (x) { } }); +({ f(x) { } }); diff --git a/tests/baselines/reference/typeSatisfaction_contextualTyping3.symbols b/tests/baselines/reference/typeSatisfaction_contextualTyping3.symbols index 0f32eab596046..2cf03bf217abf 100644 --- a/tests/baselines/reference/typeSatisfaction_contextualTyping3.symbols +++ b/tests/baselines/reference/typeSatisfaction_contextualTyping3.symbols @@ -29,7 +29,7 @@ const obj2 = { } satisfies { [key: string]: Function; >key : Symbol(key, Decl(typeSatisfaction_contextualTyping3.ts, 11, 4)) ->Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) }; diff --git a/tests/baselines/reference/typeSatisfaction_ensureInterfaceImpl.js b/tests/baselines/reference/typeSatisfaction_ensureInterfaceImpl.js index 03501ae87f23f..028aa3404e671 100644 --- a/tests/baselines/reference/typeSatisfaction_ensureInterfaceImpl.js +++ b/tests/baselines/reference/typeSatisfaction_ensureInterfaceImpl.js @@ -15,10 +15,10 @@ const car = { //// [typeSatisfaction_ensureInterfaceImpl.js] -var car = { - start: function () { }, - move: function (d) { +const car = { + start() { }, + move(d) { // d should be number }, - stop: function () { } + stop() { } }; diff --git a/tests/baselines/reference/typeSatisfaction_optionalMemberConformance.js b/tests/baselines/reference/typeSatisfaction_optionalMemberConformance.js index 06962b865d28f..8e7ff9ee27e85 100644 --- a/tests/baselines/reference/typeSatisfaction_optionalMemberConformance.js +++ b/tests/baselines/reference/typeSatisfaction_optionalMemberConformance.js @@ -12,8 +12,8 @@ let p = a.y; //// [typeSatisfaction_optionalMemberConformance.js] // Undesirable behavior today with type annotation -var a = { x: 10 }; +const a = { x: 10 }; // Should OK console.log(a.x.toFixed()); // Should error -var p = a.y; +let p = a.y; diff --git a/tests/baselines/reference/typeSatisfaction_propNameConstraining.js b/tests/baselines/reference/typeSatisfaction_propNameConstraining.js index 9592adafeb50d..ebd773f7346b8 100644 --- a/tests/baselines/reference/typeSatisfaction_propNameConstraining.js +++ b/tests/baselines/reference/typeSatisfaction_propNameConstraining.js @@ -17,13 +17,13 @@ let d = p.d; //// [typeSatisfaction_propNameConstraining.js] -var p = { +const p = { a: 0, b: "hello", x: 8 // Should error, 'x' isn't in 'Keys' }; // Should be OK -- retain info that a is number and b is string -var a = p.a.toFixed(); -var b = p.b.substring(1); +let a = p.a.toFixed(); +let b = p.b.substring(1); // Should error even though 'd' is in 'Keys' -var d = p.d; +let d = p.d; diff --git a/tests/baselines/reference/typeSatisfaction_propertyNameFulfillment.js b/tests/baselines/reference/typeSatisfaction_propertyNameFulfillment.js index df049d140c155..f2736c0d09c85 100644 --- a/tests/baselines/reference/typeSatisfaction_propertyNameFulfillment.js +++ b/tests/baselines/reference/typeSatisfaction_propertyNameFulfillment.js @@ -17,13 +17,13 @@ let d = p.d; //// [typeSatisfaction_propertyNameFulfillment.js] -var p = { +const p = { a: 0, b: "hello", x: 8 // Should error, 'x' isn't in 'Keys' }; // Should be OK -- retain info that a is number and b is string -var a = p.a.toFixed(); -var b = p.b.substring(1); +let a = p.a.toFixed(); +let b = p.b.substring(1); // Should error even though 'd' is in 'Keys' -var d = p.d; +let d = p.d; diff --git a/tests/baselines/reference/typeSatisfaction_propertyValueConformance1(nopropertyaccessfromindexsignature=false).js b/tests/baselines/reference/typeSatisfaction_propertyValueConformance1(nopropertyaccessfromindexsignature=false).js index 98a3de9fdb0e7..7785a21797dde 100644 --- a/tests/baselines/reference/typeSatisfaction_propertyValueConformance1(nopropertyaccessfromindexsignature=false).js +++ b/tests/baselines/reference/typeSatisfaction_propertyValueConformance1(nopropertyaccessfromindexsignature=false).js @@ -27,7 +27,7 @@ const x2 = { //// [typeSatisfaction_propertyValueConformance1.js] -var x = { +const x = { m: true }; // Should be OK @@ -36,9 +36,9 @@ checkTruths(x); checkM(x); // Should fail under --noPropertyAccessFromIndexSignature console.log(x.z); -var m = x.m; +const m = x.m; // Should be able to detect a failure here -var x2 = { +const x2 = { m: true, s: "false" }; diff --git a/tests/baselines/reference/typeSatisfaction_propertyValueConformance1(nopropertyaccessfromindexsignature=true).js b/tests/baselines/reference/typeSatisfaction_propertyValueConformance1(nopropertyaccessfromindexsignature=true).js index 98a3de9fdb0e7..7785a21797dde 100644 --- a/tests/baselines/reference/typeSatisfaction_propertyValueConformance1(nopropertyaccessfromindexsignature=true).js +++ b/tests/baselines/reference/typeSatisfaction_propertyValueConformance1(nopropertyaccessfromindexsignature=true).js @@ -27,7 +27,7 @@ const x2 = { //// [typeSatisfaction_propertyValueConformance1.js] -var x = { +const x = { m: true }; // Should be OK @@ -36,9 +36,9 @@ checkTruths(x); checkM(x); // Should fail under --noPropertyAccessFromIndexSignature console.log(x.z); -var m = x.m; +const m = x.m; // Should be able to detect a failure here -var x2 = { +const x2 = { m: true, s: "false" }; diff --git a/tests/baselines/reference/typeSatisfaction_propertyValueConformance2(nouncheckedindexedaccess=false).js b/tests/baselines/reference/typeSatisfaction_propertyValueConformance2(nouncheckedindexedaccess=false).js index f41a9b6a4a240..8b64e712b7cd6 100644 --- a/tests/baselines/reference/typeSatisfaction_propertyValueConformance2(nouncheckedindexedaccess=false).js +++ b/tests/baselines/reference/typeSatisfaction_propertyValueConformance2(nouncheckedindexedaccess=false).js @@ -27,7 +27,7 @@ const x2 = { //// [typeSatisfaction_propertyValueConformance2.js] -var x = { +const x = { m: true }; // Should be OK @@ -36,9 +36,9 @@ checkTruths(x); checkM(x); console.log(x.z); // Should be OK under --noUncheckedIndexedAccess -var m = x.m; +const m = x.m; // Should be able to detect a failure here -var x2 = { +const x2 = { m: true, s: "false" }; diff --git a/tests/baselines/reference/typeSatisfaction_propertyValueConformance2(nouncheckedindexedaccess=true).js b/tests/baselines/reference/typeSatisfaction_propertyValueConformance2(nouncheckedindexedaccess=true).js index f41a9b6a4a240..8b64e712b7cd6 100644 --- a/tests/baselines/reference/typeSatisfaction_propertyValueConformance2(nouncheckedindexedaccess=true).js +++ b/tests/baselines/reference/typeSatisfaction_propertyValueConformance2(nouncheckedindexedaccess=true).js @@ -27,7 +27,7 @@ const x2 = { //// [typeSatisfaction_propertyValueConformance2.js] -var x = { +const x = { m: true }; // Should be OK @@ -36,9 +36,9 @@ checkTruths(x); checkM(x); console.log(x.z); // Should be OK under --noUncheckedIndexedAccess -var m = x.m; +const m = x.m; // Should be able to detect a failure here -var x2 = { +const x2 = { m: true, s: "false" }; diff --git a/tests/baselines/reference/typeSatisfaction_propertyValueConformance3.js b/tests/baselines/reference/typeSatisfaction_propertyValueConformance3.js index c474d13bbfe11..dd12f410a19db 100644 --- a/tests/baselines/reference/typeSatisfaction_propertyValueConformance3.js +++ b/tests/baselines/reference/typeSatisfaction_propertyValueConformance3.js @@ -12,11 +12,8 @@ export const Palette = { //// [typeSatisfaction_propertyValueConformance3.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Palette = void 0; // All of these should be Colors, but I only use some of them here. -exports.Palette = { +export const Palette = { white: { r: 255, g: 255, b: 255 }, black: { r: 0, g: 0, d: 0 }, // <- oops! 'd' in place of 'b' blue: { r: 0, g: 0, b: 255 }, diff --git a/tests/baselines/reference/typeSatisfaction_vacuousIntersectionOfContextualTypes.js b/tests/baselines/reference/typeSatisfaction_vacuousIntersectionOfContextualTypes.js index d5207403940c2..1239fee8d81c1 100644 --- a/tests/baselines/reference/typeSatisfaction_vacuousIntersectionOfContextualTypes.js +++ b/tests/baselines/reference/typeSatisfaction_vacuousIntersectionOfContextualTypes.js @@ -6,5 +6,5 @@ const b: { xyz: "baz" } = { xyz: "foo" } satisfies { xyz: "foo" | "bar" }; //// [typeSatisfaction_vacuousIntersectionOfContextualTypes.js] -var a = "foo"; -var b = { xyz: "foo" }; +const a = "foo"; +const b = { xyz: "foo" }; diff --git a/tests/baselines/reference/typeTagNoErasure.js b/tests/baselines/reference/typeTagNoErasure.js index fb3fdef2207c4..763434c2e9187 100644 --- a/tests/baselines/reference/typeTagNoErasure.js +++ b/tests/baselines/reference/typeTagNoErasure.js @@ -13,7 +13,7 @@ test('hi') // error, T=number //// [typeTagNoErasure.js] /** @template T @typedef {(data: T1) => T1} Test */ /** @type {Test} */ -var test = function (dibbity) { return dibbity; }; +const test = dibbity => dibbity; test(1); // ok, T=1 test('hi'); // error, T=number diff --git a/tests/baselines/reference/typedefOnSemicolonClassElement.js b/tests/baselines/reference/typedefOnSemicolonClassElement.js index b968a72470a37..23b6ace979c3e 100644 --- a/tests/baselines/reference/typedefOnSemicolonClassElement.js +++ b/tests/baselines/reference/typedefOnSemicolonClassElement.js @@ -10,19 +10,12 @@ export class Preferences { //// [typedefOnSemicolonClassElement.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Preferences = void 0; -var Preferences = /** @class */ (function () { - function Preferences() { - /** @type {A} */ - this.a = 'ok'; - } +export class Preferences { /** @typedef {string} A */ ; - return Preferences; -}()); -exports.Preferences = Preferences; + /** @type {A} */ + a = 'ok'; +} //// [typedefOnSemicolonClassElement.d.ts] diff --git a/tests/baselines/reference/typedefOnStatements.js b/tests/baselines/reference/typedefOnStatements.js index 4d7c6f671bba1..10720cb5f2c04 100644 --- a/tests/baselines/reference/typedefOnStatements.js +++ b/tests/baselines/reference/typedefOnStatements.js @@ -105,13 +105,12 @@ while (false) { for (;; false) { } /** @typedef {{ i: string }} I */ -for (var i in []) { +for (let i in []) { } /** @typedef {{ j: string }} J */ break; /** @typedef {{ k: string }} K */ -for (var _i = 0, _a = []; _i < _a.length; _i++) { - var k = _a[_i]; +for (let k of []) { } /** @typedef {{ l: string }} L */ continue; diff --git a/tests/baselines/reference/typedefOnStatements.symbols b/tests/baselines/reference/typedefOnStatements.symbols index 11e9ad73f10d7..0b182c5f4a272 100644 --- a/tests/baselines/reference/typedefOnStatements.symbols +++ b/tests/baselines/reference/typedefOnStatements.symbols @@ -49,7 +49,7 @@ fork: while (false) { /** @typedef {{ p: string }} P */ throw new Error('Unreachable') ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) /** @typedef {{ q: string }} Q */ try { diff --git a/tests/baselines/reference/typeofImportTypeOnlyExport.js b/tests/baselines/reference/typeofImportTypeOnlyExport.js index 65562b62328c0..fd3323c41f22c 100644 --- a/tests/baselines/reference/typeofImportTypeOnlyExport.js +++ b/tests/baselines/reference/typeofImportTypeOnlyExport.js @@ -19,27 +19,15 @@ export const classMap = directive(ClassMapDirective); //// [lit.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.classMap = exports.directive = void 0; -var ClassMapDirective = /** @class */ (function () { - function ClassMapDirective() { - } - return ClassMapDirective; -}()); -var directive = function (class_) { - return function () { return ({ - directive: class_, - }); }; -}; -exports.directive = directive; -exports.classMap = (0, exports.directive)(ClassMapDirective); +class ClassMapDirective { +} +export const directive = (class_) => () => ({ + directive: class_, +}); +export const classMap = directive(ClassMapDirective); //// [button.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.c = void 0; -var lit_js_1 = require("./lit.js"); -exports.c = (0, lit_js_1.classMap)(); +import { classMap } from './lit.js'; +export const c = classMap(); //// [lit.d.ts] diff --git a/tests/baselines/reference/typeofOperatorWithAnyOtherType.js b/tests/baselines/reference/typeofOperatorWithAnyOtherType.js index 0bd919c00cf9c..88c15d4ba7e66 100644 --- a/tests/baselines/reference/typeofOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/typeofOperatorWithAnyOtherType.js @@ -82,20 +82,18 @@ var ANY; var ANY1; var ANY2 = ["", ""]; var obj; -var obj1 = { x: "a", y: function () { } }; +var obj1 = { x: "a", y: () => { } }; function foo() { var a; return a; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { +class A { + a; + static foo() { var a; return a; - }; - return A; -}()); + } +} var M; (function (M) { })(M || (M = {})); diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.js b/tests/baselines/reference/typeofOperatorWithBooleanType.js index 9fb53bcf1a571..9b2fa41005b81 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.js +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.js @@ -56,12 +56,10 @@ z: typeof M.n; // typeof operator on boolean type var BOOLEAN; function foo() { return true; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return false; }; - return A; -}()); +class A { + a; + static foo() { return false; } +} var M; (function (M) { })(M || (M = {})); diff --git a/tests/baselines/reference/typeofOperatorWithNumberType.js b/tests/baselines/reference/typeofOperatorWithNumberType.js index cc9ca6556caf9..bef1866fe71eb 100644 --- a/tests/baselines/reference/typeofOperatorWithNumberType.js +++ b/tests/baselines/reference/typeofOperatorWithNumberType.js @@ -64,12 +64,10 @@ z: typeof M.n; var NUMBER; var NUMBER1 = [1, 2]; function foo() { return 1; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return 1; }; - return A; -}()); +class A { + a; + static foo() { return 1; } +} var M; (function (M) { })(M || (M = {})); @@ -80,7 +78,7 @@ var ResultIsString2 = typeof NUMBER1; // number type literal var ResultIsString3 = typeof 1; var ResultIsString4 = typeof { x: 1, y: 2 }; -var ResultIsString5 = typeof { x: 1, y: function (n) { return n; } }; +var ResultIsString5 = typeof { x: 1, y: (n) => { return n; } }; // number type expressions var ResultIsString6 = typeof objA.a; var ResultIsString7 = typeof M.n; diff --git a/tests/baselines/reference/typeofOperatorWithStringType.js b/tests/baselines/reference/typeofOperatorWithStringType.js index cb056afe1a513..484c5ec90756d 100644 --- a/tests/baselines/reference/typeofOperatorWithStringType.js +++ b/tests/baselines/reference/typeofOperatorWithStringType.js @@ -64,12 +64,10 @@ z: typeof M.n; var STRING; var STRING1 = ["", "abc"]; function foo() { return "abc"; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return ""; }; - return A; -}()); +class A { + a; + static foo() { return ""; } +} var M; (function (M) { })(M || (M = {})); @@ -80,7 +78,7 @@ var ResultIsString2 = typeof STRING1; // string type literal var ResultIsString3 = typeof ""; var ResultIsString4 = typeof { x: "", y: "" }; -var ResultIsString5 = typeof { x: "", y: function (s) { return s; } }; +var ResultIsString5 = typeof { x: "", y: (s) => { return s; } }; // string type expressions var ResultIsString6 = typeof objA.a; var ResultIsString7 = typeof M.n; diff --git a/tests/baselines/reference/typesOnlyExternalModuleStillHasInstance.js b/tests/baselines/reference/typesOnlyExternalModuleStillHasInstance.js index 8be5e7caa926b..52fd2b6639212 100644 --- a/tests/baselines/reference/typesOnlyExternalModuleStillHasInstance.js +++ b/tests/baselines/reference/typesOnlyExternalModuleStillHasInstance.js @@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [foo_1.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var foo0 = require("./foo_0"); +const foo0 = require("./foo_0"); // Per 11.2.3, foo_0 should still be "instantiated", albeit with no members var x = {}; var y = foo0; diff --git a/tests/baselines/reference/umd-augmentation-1.js b/tests/baselines/reference/umd-augmentation-1.js index 6137a45b0f418..1f4f1971f0e13 100644 --- a/tests/baselines/reference/umd-augmentation-1.js +++ b/tests/baselines/reference/umd-augmentation-1.js @@ -42,9 +42,9 @@ var t = p.x; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /// -var m = require("math2d"); -var v = new m.Vector(3, 2); -var magnitude = m.getLength(v); -var p = v.translate(5, 5); +const m = require("math2d"); +let v = new m.Vector(3, 2); +let magnitude = m.getLength(v); +let p = v.translate(5, 5); p = v.reverse(); var t = p.x; diff --git a/tests/baselines/reference/umd-augmentation-2.js b/tests/baselines/reference/umd-augmentation-2.js index 334da47215499..044d56aeae7cd 100644 --- a/tests/baselines/reference/umd-augmentation-2.js +++ b/tests/baselines/reference/umd-augmentation-2.js @@ -41,8 +41,8 @@ var t = p.x; //// [a.js] /// /// -var v = new Math2d.Vector(3, 2); -var magnitude = Math2d.getLength(v); -var p = v.translate(5, 5); +let v = new Math2d.Vector(3, 2); +let magnitude = Math2d.getLength(v); +let p = v.translate(5, 5); p = v.reverse(); var t = p.x; diff --git a/tests/baselines/reference/umd-augmentation-3.js b/tests/baselines/reference/umd-augmentation-3.js index 9350a0c1d14cb..d75e2ddee3db4 100644 --- a/tests/baselines/reference/umd-augmentation-3.js +++ b/tests/baselines/reference/umd-augmentation-3.js @@ -48,9 +48,9 @@ var t = p.x; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /// -var m = require("math2d"); -var v = new m.Vector(3, 2); -var magnitude = m.getLength(v); -var p = v.translate(5, 5); +const m = require("math2d"); +let v = new m.Vector(3, 2); +let magnitude = m.getLength(v); +let p = v.translate(5, 5); p = v.reverse(); var t = p.x; diff --git a/tests/baselines/reference/umd-augmentation-4.js b/tests/baselines/reference/umd-augmentation-4.js index 1479bbf2d5496..fa57ee3b663c1 100644 --- a/tests/baselines/reference/umd-augmentation-4.js +++ b/tests/baselines/reference/umd-augmentation-4.js @@ -47,8 +47,8 @@ var t = p.x; //// [a.js] /// /// -var v = new Math2d.Vector(3, 2); -var magnitude = Math2d.getLength(v); -var p = v.translate(5, 5); +let v = new Math2d.Vector(3, 2); +let magnitude = Math2d.getLength(v); +let p = v.translate(5, 5); p = v.reverse(); var t = p.x; diff --git a/tests/baselines/reference/umd1.js b/tests/baselines/reference/umd1.js index 5344bfd4a7034..03bd9b46cc4bb 100644 --- a/tests/baselines/reference/umd1.js +++ b/tests/baselines/reference/umd1.js @@ -16,5 +16,5 @@ let y: number = x.n; //// [a.js] /// Foo.fn(); -var x; -var y = x.n; +let x; +let y = x.n; diff --git a/tests/baselines/reference/umd2.js b/tests/baselines/reference/umd2.js index 3b01eb8321ee0..9bf4e659a1606 100644 --- a/tests/baselines/reference/umd2.js +++ b/tests/baselines/reference/umd2.js @@ -13,5 +13,5 @@ let y: number = x.n; //// [a.js] Foo.fn(); -var x; -var y = x.n; +let x; +let y = x.n; diff --git a/tests/baselines/reference/umd3.js b/tests/baselines/reference/umd3.js index 54aa4598b2035..927ea391c6b75 100644 --- a/tests/baselines/reference/umd3.js +++ b/tests/baselines/reference/umd3.js @@ -16,7 +16,7 @@ let y: number = x.n; //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var Foo = require("./foo"); +const Foo = require("./foo"); Foo.fn(); -var x; -var y = x.n; +let x; +let y = x.n; diff --git a/tests/baselines/reference/umd4.js b/tests/baselines/reference/umd4.js index 00aec9578bb65..32d4f9360ad31 100644 --- a/tests/baselines/reference/umd4.js +++ b/tests/baselines/reference/umd4.js @@ -16,7 +16,7 @@ let y: number = x.n; //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var Bar = require("./foo"); +const Bar = require("./foo"); Bar.fn(); -var x; -var y = x.n; +let x; +let y = x.n; diff --git a/tests/baselines/reference/umd5.js b/tests/baselines/reference/umd5.js index e31a5c9de4886..0ee9c2d4209b8 100644 --- a/tests/baselines/reference/umd5.js +++ b/tests/baselines/reference/umd5.js @@ -18,9 +18,9 @@ let z = Foo; //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var Bar = require("./foo"); +const Bar = require("./foo"); Bar.fn(); -var x; -var y = x.n; +let x; +let y = x.n; // should error -var z = Foo; +let z = Foo; diff --git a/tests/baselines/reference/umd6.js b/tests/baselines/reference/umd6.js index e894edb7437b7..b640e56208656 100644 --- a/tests/baselines/reference/umd6.js +++ b/tests/baselines/reference/umd6.js @@ -14,4 +14,4 @@ let y: number = Foo.fn(); //// [a.js] /// -var y = Foo.fn(); +let y = Foo.fn(); diff --git a/tests/baselines/reference/umd7.js b/tests/baselines/reference/umd7.js index 0aea243fe74cf..bfaff9b142bff 100644 --- a/tests/baselines/reference/umd7.js +++ b/tests/baselines/reference/umd7.js @@ -12,4 +12,4 @@ let y: number = Foo(); //// [a.js] /// -var y = Foo(); +let y = Foo(); diff --git a/tests/baselines/reference/umd8.js b/tests/baselines/reference/umd8.js index a6a501057b99c..ffdca76671cb0 100644 --- a/tests/baselines/reference/umd8.js +++ b/tests/baselines/reference/umd8.js @@ -23,7 +23,7 @@ let x: any = Foo; // Not OK in value position //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var y; // OK in type position +let y; // OK in type position y.foo(); -var z; // OK in ns position -var x = Foo; // Not OK in value position +let z; // OK in ns position +let x = Foo; // Not OK in value position diff --git a/tests/baselines/reference/valuesMergingAcrossModules.js b/tests/baselines/reference/valuesMergingAcrossModules.js index 2f536cb52d330..4dbfa9c86dd80 100644 --- a/tests/baselines/reference/valuesMergingAcrossModules.js +++ b/tests/baselines/reference/valuesMergingAcrossModules.js @@ -20,22 +20,16 @@ A.displayName; //// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = A; function A() { } +export { A }; //// [b.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = void 0; -var a_1 = require("./a"); -Object.defineProperty(exports, "A", { enumerable: true, get: function () { return a_1.A; } }); +import { A } from "./a"; +export { A }; //// [c.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); var A; (function (A) { A.displayName = "A"; })(A || (A = {})); A(); A.displayName; +export {}; diff --git a/tests/baselines/reference/verbatimModuleSyntaxNoElisionESM.js b/tests/baselines/reference/verbatimModuleSyntaxNoElisionESM.js index f38feb4540da2..2ad3f3559b89a 100644 --- a/tests/baselines/reference/verbatimModuleSyntaxNoElisionESM.js +++ b/tests/baselines/reference/verbatimModuleSyntaxNoElisionESM.js @@ -35,13 +35,9 @@ export default C; // error //// [a.js] -export var a = 0; -var AClass = /** @class */ (function () { - function AClass() { - } - return AClass; -}()); -export { AClass }; +export const a = 0; +export class AClass { +} //// [b.js] import { a, A, AClass } from "./a"; import {} from "./a"; @@ -53,12 +49,8 @@ import { AClass } from "./b"; //// [main4.js] export default 1; // ok //// [main5.js] -var C = /** @class */ (function () { - function C() { - } - return C; -}()); // ok -export default C; +export default class C { +} // ok //// [main6.js] export default I; // error //// [main7.js] diff --git a/tests/baselines/reference/voidOperatorWithAnyOtherType.js b/tests/baselines/reference/voidOperatorWithAnyOtherType.js index e3e2783cfc035..00394a373b111 100644 --- a/tests/baselines/reference/voidOperatorWithAnyOtherType.js +++ b/tests/baselines/reference/voidOperatorWithAnyOtherType.js @@ -73,15 +73,13 @@ function foo() { var a; return a; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { +class A { + a; + static foo() { var a; return a; - }; - return A; -}()); + } +} var M; (function (M) { })(M || (M = {})); diff --git a/tests/baselines/reference/voidOperatorWithBooleanType.js b/tests/baselines/reference/voidOperatorWithBooleanType.js index 225a8dc862a4f..694838bae57e2 100644 --- a/tests/baselines/reference/voidOperatorWithBooleanType.js +++ b/tests/baselines/reference/voidOperatorWithBooleanType.js @@ -44,12 +44,10 @@ void M.n; // void operator on boolean type var BOOLEAN; function foo() { return true; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return false; }; - return A; -}()); +class A { + a; + static foo() { return false; } +} var M; (function (M) { })(M || (M = {})); diff --git a/tests/baselines/reference/voidOperatorWithNumberType.js b/tests/baselines/reference/voidOperatorWithNumberType.js index 30d9992fdaf16..745321db5ba61 100644 --- a/tests/baselines/reference/voidOperatorWithNumberType.js +++ b/tests/baselines/reference/voidOperatorWithNumberType.js @@ -52,12 +52,10 @@ void objA.a, M.n; var NUMBER; var NUMBER1 = [1, 2]; function foo() { return 1; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return 1; }; - return A; -}()); +class A { + a; + static foo() { return 1; } +} var M; (function (M) { })(M || (M = {})); @@ -68,7 +66,7 @@ var ResultIsAny2 = void NUMBER1; // number type literal var ResultIsAny3 = void 1; var ResultIsAny4 = void { x: 1, y: 2 }; -var ResultIsAny5 = void { x: 1, y: function (n) { return n; } }; +var ResultIsAny5 = void { x: 1, y: (n) => { return n; } }; // number type expressions var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; diff --git a/tests/baselines/reference/voidOperatorWithStringType.js b/tests/baselines/reference/voidOperatorWithStringType.js index 826f71a9404bf..dfc8b2a4f53ed 100644 --- a/tests/baselines/reference/voidOperatorWithStringType.js +++ b/tests/baselines/reference/voidOperatorWithStringType.js @@ -51,12 +51,10 @@ void objA.a,M.n; var STRING; var STRING1 = ["", "abc"]; function foo() { return "abc"; } -var A = /** @class */ (function () { - function A() { - } - A.foo = function () { return ""; }; - return A; -}()); +class A { + a; + static foo() { return ""; } +} var M; (function (M) { })(M || (M = {})); @@ -67,7 +65,7 @@ var ResultIsAny2 = void STRING1; // string type literal var ResultIsAny3 = void ""; var ResultIsAny4 = void { x: "", y: "" }; -var ResultIsAny5 = void { x: "", y: function (s) { return s; } }; +var ResultIsAny5 = void { x: "", y: (s) => { return s; } }; // string type expressions var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; diff --git a/tests/baselines/reference/voidParamAssignmentCompatibility.js b/tests/baselines/reference/voidParamAssignmentCompatibility.js index 21b4f3c9f7b60..2b2abb492367d 100644 --- a/tests/baselines/reference/voidParamAssignmentCompatibility.js +++ b/tests/baselines/reference/voidParamAssignmentCompatibility.js @@ -14,5 +14,5 @@ gg = o.method; //// [voidParamAssignmentCompatibility.js] "use strict"; -var gg = g; +let gg = g; gg = o.method;