Files
zhangrengao 4dbd6a47f7 fix code check issue
Signed-off-by: zhangrengao <zhangrengao1@huawei.com>
Change-Id: Ie8f71fc157d4b8fc2cb61edc267bf0218bb0fff1
2022-03-23 16:22:13 +08:00

13245 lines
474 KiB
Diff
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
From 93dbec5e710a8cb28ca8b7f0c70b9ade4a8fc911 Mon Sep 17 00:00:00 2001
Date: Sat, 15 Jan 2022 21:39:48 +0800
Subject: [PATCH] test patch
---
.../ambient/ambientDeclarations.ts | 1 +
.../ambientDeclarationsPatterns.ts | 11 +
.../declarations.d.ts | 18 +
.../ambient/ambientInsideNonAmbient.ts | 2 +
.../ambientInsideNonAmbientExternalModule.ts | 4 +-
.../ambientShorthand_merging.ts | 6 +
.../declarations1.d.ts | 2 +
.../declarations2.d.ts | 4 +
.../ambientShorthand_reExport.ts | 5 +
.../declarations.d.ts | 2 +
.../ambientShorthand_reExport/jquery.d.ts | 2 +
.../ambientShorthand_reExport/reExportAll.ts | 2 +
.../ambientShorthand_reExport/reExportX.ts | 2 +
.../async/es5/asyncMethodWithSuper_es5.ts | 1 +
.../asyncOrYieldAsBindingIdentifier1.ts | 49 ++
.../classAbstractAsIdentifier.ts | 2 +-
.../classBody/classWithEmptyBody.ts | 4 +-
.../classDeclarations/classInsideBlock.ts | 1 +
.../classWithPredefinedTypesAsNames.ts | 4 +-
.../classWithSemicolonClassElement1.ts | 3 +-
.../classWithSemicolonClassElement2.ts | 3 +-
.../classExpressions/classExpression2.ts | 4 +-
.../classStaticBlock/classStaticBlock1.ts | 11 +
.../classStaticBlock/classStaticBlock10.ts | 30 ++
.../classStaticBlock/classStaticBlock11.ts | 15 +
.../classStaticBlock/classStaticBlock12.ts | 10 +
.../classStaticBlock/classStaticBlock13.ts | 14 +
.../classStaticBlock/classStaticBlock14.ts | 15 +
.../classStaticBlock/classStaticBlock15.ts | 18 +
.../classStaticBlock/classStaticBlock16.ts | 26 +
.../classStaticBlock/classStaticBlock17.ts | 33 ++
.../classStaticBlock/classStaticBlock18.ts | 15 +
.../classStaticBlock/classStaticBlock19.ts | 6 +
.../classStaticBlock/classStaticBlock2.ts | 20 +
.../classStaticBlock/classStaticBlock20.ts | 13 +
.../classStaticBlock/classStaticBlock21.ts | 7 +
.../classStaticBlock/classStaticBlock22.ts | 72 +++
.../classStaticBlock/classStaticBlock23.ts | 21 +
.../classStaticBlock/classStaticBlock24.ts | 8 +
.../classStaticBlock/classStaticBlock25.ts | 23 +
.../classStaticBlock/classStaticBlock26.ts | 30 ++
.../classStaticBlock/classStaticBlock27.ts | 17 +
.../classStaticBlock/classStaticBlock3.ts | 19 +
.../classStaticBlock/classStaticBlock4.ts | 16 +
.../classStaticBlock/classStaticBlock5.ts | 19 +
.../classStaticBlock/classStaticBlock6.ts | 62 +++
.../classStaticBlock/classStaticBlock7.ts | 43 ++
.../classStaticBlock/classStaticBlock8.ts | 48 ++
.../classStaticBlock/classStaticBlock9.ts | 8 +
.../classStaticBlockUseBeforeDef1.ts | 15 +
.../classStaticBlockUseBeforeDef2.ts | 10 +
.../classConstructorAccessibility4.ts | 4 +-
...structorImplementationWithDefaultValues.ts | 6 +-
.../declarationEmitReadonly.ts | 3 +-
.../quotedConstructors.ts | 4 +
...idesIndexersWithAssignmentCompatibility.ts | 4 +-
.../superInStaticMembers1.ts | 492 ++++++++++++++++++
.../thisAndSuperInStaticMembers1.ts | 42 ++
.../thisAndSuperInStaticMembers2.ts | 42 ++
.../thisAndSuperInStaticMembers3.ts | 26 +
.../thisAndSuperInStaticMembers4.ts | 26 +
.../typeOfThisInStaticMembers.ts | 3 +-
.../typeOfThisInStaticMembers10.ts | 51 ++
.../typeOfThisInStaticMembers11.ts | 51 ++
.../typeOfThisInStaticMembers12.ts | 10 +
.../typeOfThisInStaticMembers13.ts | 10 +
.../typeOfThisInStaticMembers3.ts | 12 +
.../typeOfThisInStaticMembers4.ts | 12 +
.../typeOfThisInStaticMembers5.ts | 9 +
.../typeOfThisInStaticMembers6.ts | 7 +
.../typeOfThisInStaticMembers7.ts | 12 +
.../typeOfThisInStaticMembers8.ts | 19 +
.../typeOfThisInStaticMembers9.ts | 22 +
.../privateNameComputedPropertyName3.ts | 2 +
.../privateNames/privateNameFieldAccess.ts | 1 +
.../privateNames/privateNameHashCharName.ts | 11 +
.../privateNames/privateNameInInExpression.ts | 119 +++++
.../privateNameInInExpressionTransform.ts | 47 ++
.../privateNameInInExpressionUnused.ts | 13 +
.../privateNamesIncompatibleModifiersJs.ts | 65 +++
.../classes/mixinClassesAnnotated.ts | 3 +
.../classes/mixinClassesAnonymous.ts | 2 +
.../classes/mixinClassesMembers.ts | 5 +
.../abstractProperty.ts | 3 +
.../abstractPropertyInitializer.ts | 5 +
.../instanceMemberInitialization.ts | 7 +-
...instanceMemberWithComputedPropertyName2.ts | 1 +
.../staticFactory1.ts | 3 +-
.../staticAndNonStaticPropertiesSameName.ts | 3 +-
.../staticPropertyAndFunctionWithSameName.ts | 4 +-
...icPropertyNameConflictsInAmbientContext.ts | 10 +
.../controlFlow/assertionTypePredicates2.ts | 27 +
.../controlFlow/controlFlowAliasing.ts | 285 ++++++++++
.../controlFlowAliasingCatchVariables.ts | 28 +
.../controlFlow/controlFlowElementAccess2.ts | 2 +-
.../controlFlow/controlFlowForInStatement2.ts | 25 +
.../controlFlow/controlFlowInOperator.ts | 26 +
.../controlFlowInstanceofExtendsFunction.ts | 4 +-
.../controlFlowSuperPropertyAccess.ts | 1 +
.../controlFlow/controlFlowTypeofObject.ts | 71 +++
.../dependentDestructuredVariables.ts | 161 ++++++
.../typeGuardsNestedAssignments.ts | 3 +-
.../controlFlow/typeGuardsTypeParameters.ts | 1 +
.../declarationEmitWorkWithInlineComments.ts | 5 +-
.../declarationEmitThisPredicates01.ts | 3 +-
...tionEmitThisPredicatesWithPrivateName01.ts | 3 +-
.../typeReferenceRelatedFiles/fs.d.ts | 5 +
.../typeReferenceRelatedFiles/main.ts | 2 +
.../typeReferenceRelatedFiles/package.json | 4 +
.../typeReferenceRelatedFiles.ts | 18 +
.../decoratorOnClassConstructorParameter5.ts | 15 +
.../class/decoratedBlockScopedClass1.ts | 16 +
.../class/decoratedBlockScopedClass2.ts | 19 +
.../class/decoratedBlockScopedClass3.ts | 27 +
.../class/method/decoratorOnClassMethod14.ts | 14 +
.../class/method/decoratorOnClassMethod15.ts | 12 +
.../class/method/decoratorOnClassMethod16.ts | 12 +
.../class/method/decoratorOnClassMethod17.ts | 11 +
.../class/method/decoratorOnClassMethod18.ts | 11 +
.../decoratorMetadataWithTypeOnlyImport2.ts | 17 +
...ter.asyncGenerators.classMethods.es2015.ts | 11 +
.../conformance/es2018/es2018IntlAPIs.ts | 7 +
.../conformance/es2020/es2020IntlAPIs.ts | 45 ++
...tionWithPropertyAccessInHeritageClause1.ts | 4 +-
.../superCallBeforeThisAccessing1.ts | 1 +
.../superCallBeforeThisAccessing2.ts | 1 +
.../superCallBeforeThisAccessing5.ts | 1 +
.../superCallBeforeThisAccessing8.ts | 1 +
.../es6/spread/arraySpreadImportHelpers.ts | 16 +
...mplateStringWithCommentsInArrowFunction.ts | 14 +
.../expressions/asOperator/asOperatorASI.ts | 1 +
.../comparisonOperatorWithIdenticalObjects.ts | 6 +-
.../comparisonOperatorWithIntersectionType.ts | 5 +
...nshipObjectsOnInstantiatedCallSignature.ts | 4 +-
...jectsOnInstantiatedConstructorSignature.ts | 4 +-
...peratorWithSubtypeObjectOnCallSignature.ts | 3 +-
...WithSubtypeObjectOnConstructorSignature.ts | 3 +-
...eratorWithSubtypeObjectOnIndexSignature.ts | 3 +-
...ubtypeObjectOnInstantiatedCallSignature.ts | 3 +-
...bjectOnInstantiatedConstructorSignature.ts | 3 +-
...isonOperatorWithSubtypeObjectOnProperty.ts | 6 +-
...anceofOperatorWithInvalidStaticToString.ts | 3 +
.../instanceofOperatorWithLHSIsObject.ts | 1 +
...ommaOperatorWithSecondOperandObjectType.ts | 1 +
.../conditionalOperatorWithIdenticalBCT.ts | 3 +
.../superCallParameterContextualTyping1.ts | 2 +
.../superCallParameterContextualTyping3.ts | 3 +-
.../functionCalls/callWithSpread.ts | 1 +
.../functions/arrowFunctionExpressions.ts | 1 +
.../newOperator/newOperatorConformance.ts | 1 +
.../expressions/superCalls/superCalls.ts | 2 +
.../thisKeyword/typeOfThisGeneral.ts | 178 +++++++
.../typeGuards/TypeGuardWithArrayUnion.ts | 1 +
.../typeGuards/typeGuardFunction.ts | 6 +-
.../typeGuards/typeGuardFunctionGenerics.ts | 4 +-
.../typeGuardOfFormExpr1AndExpr2.ts | 3 +-
.../typeGuards/typeGuardOfFormExpr1OrExpr2.ts | 3 +-
.../typeGuards/typeGuardOfFormInstanceOf.ts | 45 +-
.../typeGuards/typeGuardOfFormIsType.ts | 5 +-
.../typeGuardOfFormTypeOfBoolean.ts | 1 +
.../typeGuards/typeGuardOfFormTypeOfNumber.ts | 1 +
.../typeGuards/typeGuardOfFormTypeOfString.ts | 1 +
.../typeGuardOfFromPropNameInUnionType.ts | 9 +
.../typeGuards/typeGuardsInClassAccessors.ts | 1 +
.../typeGuards/typeGuardsInClassMethods.ts | 1 +
.../typeGuards/typeGuardsInProperties.ts | 3 +-
.../typeGuards/typeGuardsOnClassProperty.ts | 3 +-
.../bitwiseNotOperatorWithNumberType.ts | 3 +-
.../bitwiseNotOperatorWithStringType.ts | 3 +-
.../externalModules/exportNonVisibleType.ts | 1 +
.../moduleResolutionWithoutExtension1.ts | 12 +
.../moduleResolutionWithoutExtension2.ts | 6 +
.../moduleResolutionWithoutExtension3.ts | 12 +
.../moduleResolutionWithoutExtension4.ts | 12 +
.../moduleResolutionWithoutExtension5.ts | 6 +
.../moduleResolutionWithoutExtension6.ts | 8 +
.../moduleResolutionWithoutExtension7.ts | 6 +
.../moduleResolutionWithoutExtension8.ts | 6 +
.../typeOnly/exportSpecifiers.ts | 21 +
.../typeOnly/importDefaultNamedType/a.ts | 2 +
.../importDefaultNamedType.ts | 5 +
.../typeOnly/importSpecifiers1.ts | 46 ++
.../typeOnly/preserveValueImports.ts | 28 +
.../typeOnly/preserveValueImports_errors.ts | 47 ++
...erveValueImports_importsNotUsedAsValues.ts | 14 +
.../preserveValueImports_mixedImports.ts | 13 +
.../typeOnly/preserveValueImports_module.ts | 4 +
.../importAssertion/importAssertion1.ts | 37 ++
.../importAssertion/importAssertion2.ts | 17 +
.../importAssertion/importAssertion3.ts | 15 +
.../importAssertion/importAssertion4.ts | 1 +
.../importAssertion/importAssertion5.ts | 1 +
.../mergedInterfacesWithMultipleBases3.ts | 6 +-
.../interfaceExtendsObjectIntersection.ts | 12 +
.../interfaceWithPropertyOfEveryType.ts | 3 +-
...duleAndAmbientWithSameNameAndCommonRoot.ts | 1 -
...onAmbientClassWithSameNameAndCommonRoot.ts | 1 +
...ionAndNonExportedFunctionThatShareAName.ts | 4 +-
...ortedAndNonExportedClassesOfTheSameName.ts | 4 +
...rgeEachWithExportedModulesOfTheSameName.ts | 2 +
.../codeGeneration/exportCodeGen.ts | 2 +
.../codeGeneration/nameCollision.ts | 1 +
.../jsdoc/constructorTagOnClassConstructor.ts | 4 +-
...bclassWithExplicitNoArgumentConstructor.ts | 3 +-
.../declarations/jsDeclarationsThisTypes.ts | 4 +-
.../jsdoc/enumTagImported/enumTagImported.ts | 23 +
tests/cases/conformance/jsdoc/extendsTag1.ts | 1 +
.../jsdocAugments_qualifiedName.ts | 10 +
.../jsdoc/jsdocAugments_withTypeParameter.ts | 1 +
.../jsdocImplements_namespacedInterface.ts | 2 +
.../jsdoc/jsdocTemplateTagDefault.ts | 71 +++
.../jsdoc/jsdocTemplateTagNameResolution.ts | 16 +
.../jsdoc/jsdocTypeReferenceUseBeforeDef.ts | 1 +
.../conformance/jsdoc/jsdocVariadicType.ts | 12 +
tests/cases/conformance/jsdoc/seeTag3.ts | 7 +
tests/cases/conformance/jsdoc/thisTag2.ts | 11 +
.../conformance/jsx/jsxParsingError4.tsx | 18 +
.../jsx/jsxUnclosedParserRecovery.ts | 140 +++++
.../jsx/tsxReactEmitSpreadAttribute.ts | 32 ++
.../declarationNotFoundPackageBundlesTypes.ts | 23 +
.../scopedPackages/index.d.ts | 3 +
.../scopedPackages/scopedPackages.ts | 12 +
.../moduleResolution/scopedPackages/z.d.ts | 2 +
.../scopedPackagesClassic/index.d.ts | 2 +
.../scopedPackagesClassic.ts | 9 +
.../untypedModuleImport_allowJs.ts | 12 +
.../declarations.d.ts | 4 +
.../untypedModuleImport_vsAmbient.ts | 12 +
.../allowJs/nodeAllowJsPackageSelfName.ts | 24 +
.../node/allowJs/nodeModulesAllowJs1.ts | 324 ++++++++++++
.../allowJs/nodeModulesAllowJsCjsFromJs.ts | 8 +
...ModulesAllowJsConditionalPackageExports.ts | 126 +++++
.../nodeModulesAllowJsDynamicImport.ts | 27 +
.../nodeModulesAllowJsExportAssignment.ts | 32 ++
...deModulesAllowJsGeneratedNameCollisions.ts | 29 ++
.../nodeModulesAllowJsImportAssignment.ts | 34 ++
...eModulesAllowJsImportHelpersCollisions1.ts | 34 ++
...eModulesAllowJsImportHelpersCollisions2.ts | 30 ++
...eModulesAllowJsImportHelpersCollisions3.ts | 32 ++
.../allowJs/nodeModulesAllowJsImportMeta.ts | 23 +
.../nodeModulesAllowJsPackageExports.ts | 92 ++++
.../nodeModulesAllowJsPackageImports.ts | 41 ++
...nodeModulesAllowJsPackagePatternExports.ts | 69 +++
...lesAllowJsPackagePatternExportsTrailers.ts | 69 +++
...nodeModulesAllowJsSynchronousCallErrors.ts | 37 ++
.../nodeModulesAllowJsTopLevelAwait.ts | 25 +
...lesExportsSpecifierGenerationConditions.ts | 33 ++
tests/cases/conformance/node/nodeModules1.ts | 321 ++++++++++++
...odeModulesCjsFormatFileAlwaysHasDefault.ts | 19 +
.../nodeModulesConditionalPackageExports.ts | 124 +++++
...tionEmitDynamicImportWithPackageExports.ts | 71 +++
...odulesDeclarationEmitWithPackageExports.ts | 93 ++++
.../node/nodeModulesDynamicImport.ts | 24 +
.../node/nodeModulesExportAssignments.ts | 20 +
...ModulesExportsBlocksSpecifierResolution.ts | 27 +
...lesExportsSpecifierGenerationConditions.ts | 34 ++
...ulesExportsSpecifierGenerationDirectory.ts | 29 ++
...odulesExportsSpecifierGenerationPattern.ts | 29 ++
.../node/nodeModulesForbidenSyntax.ts | 67 +++
.../nodeModulesGeneratedNameCollisions.ts | 26 +
.../node/nodeModulesImportAssertions.ts | 13 +
.../node/nodeModulesImportAssignments.ts | 31 ++
.../nodeModulesImportHelpersCollisions.ts | 31 ++
.../nodeModulesImportHelpersCollisions2.ts | 27 +
.../nodeModulesImportHelpersCollisions3.ts | 25 +
.../conformance/node/nodeModulesImportMeta.ts | 20 +
.../nodeModulesImportResolutionIntoExport.ts | 24 +
.../nodeModulesImportResolutionNoCycle.ts | 24 +
.../node/nodeModulesPackageExports.ts | 90 ++++
.../node/nodeModulesPackageImports.ts | 38 ++
.../node/nodeModulesPackagePatternExports.ts | 67 +++
...odeModulesPackagePatternExportsTrailers.ts | 67 +++
.../node/nodeModulesResolveJsonModule.ts | 29 ++
.../node/nodeModulesSynchronousCallErrors.ts | 34 ++
.../node/nodeModulesTopLevelAwait.ts | 22 +
.../nodeModulesTypesVersionPackageExports.ts | 53 ++
.../conformance/node/nodePackageSelfName.ts | 21 +
.../node/nodePackageSelfNameScoped.ts | 21 +
.../cases/conformance/override/override10.ts | 3 +-
.../cases/conformance/override/override12.ts | 1 +
.../cases/conformance/override/override15.ts | 9 +
.../cases/conformance/override/override16.ts | 1 +
.../cases/conformance/override/override17.ts | 1 +
.../cases/conformance/override/override18.ts | 1 +
.../cases/conformance/override/override19.ts | 20 +
.../cases/conformance/override/override20.ts | 34 ++
.../conformance/override/override_js1.ts | 4 +-
.../conformance/override/override_js4.ts | 14 +
.../parserClassDeclaration16.ts | 3 +-
.../parserClassDeclaration17.ts | 1 +
.../parserClassDeclaration19.ts | 3 +-
.../parserClassDeclaration20.ts | 3 +-
.../parserClassDeclaration23.ts | 3 +-
.../parserClassDeclaration26.ts | 3 +-
.../parserClassDeclarationIndexSignature1.ts | 3 +-
.../parserConstructorDeclaration1.ts | 3 +-
.../parserConstructorDeclaration5.ts | 3 +-
.../parserAccessibilityAfterStatic11.ts | 1 +
.../parserAccessibilityAfterStatic14.ts | 1 +
.../parserAccessibilityAfterStatic2.ts | 1 +
.../parserAccessibilityAfterStatic3.ts | 1 +
.../parserAccessibilityAfterStatic4.ts | 1 +
.../parserAccessibilityAfterStatic5.ts | 1 +
.../Generics/parserGenericClass1.ts | 3 +-
.../Generics/parserGenericClass2.ts | 3 +-
.../Generics/parserGenericConstraint1.ts | 3 +-
.../parserIndexMemberDeclaration1.ts | 3 +-
.../parserIndexMemberDeclaration2.ts | 3 +-
.../parserIndexMemberDeclaration3.ts | 3 +-
.../parserIndexMemberDeclaration4.ts | 3 +-
.../parserIndexMemberDeclaration6.ts | 3 +-
.../parserMemberVariableDeclaration5.ts | 3 +-
.../ecmascript5/Protected/Protected3.ts | 3 +-
.../ecmascript5/Protected/Protected5.ts | 3 +-
.../ecmascript5/Protected/Protected9.ts | 3 +-
.../RegressionTests/parser509546.ts | 1 +
.../RegressionTests/parser509546_1.ts | 1 +
.../RegressionTests/parser509546_2.ts | 1 +
.../parser/ecmascript5/parserUnicode3.ts | 3 +-
.../Iterators/parserForOfStatement22.ts | 4 +
.../Iterators/parserForOfStatement23.ts | 6 +
.../Iterators/parserForOfStatement24.ts | 4 +
.../inferringClassMembersFromAssignments3.ts | 1 +
.../conformance/salsa/plainJSBinderErrors.ts | 44 ++
.../conformance/salsa/plainJSRedeclare.ts | 6 +
.../conformance/salsa/plainJSRedeclare2.ts | 7 +
.../conformance/salsa/plainJSRedeclare3.ts | 7 +
.../salsa/plainJSReservedStrict.ts | 7 +
.../conformance/salsa/spellingUncheckedJS.ts | 51 ++
.../salsa/typeFromJSInitializer2.ts | 18 +
.../salsa/typeFromJSInitializer3.ts | 18 +
.../salsa/typeFromJSInitializer4.ts | 29 ++
.../salsa/typeFromPropertyAssignment23.ts | 3 +
.../for-inStatementsAsyncIdentifier.ts | 4 +
.../returnStatements/returnStatements.ts | 1 +
.../throwInEnclosingStatements.ts | 1 +
.../types/any/anyAsGenericFunctionCall.ts | 4 +-
.../types/any/assignAnyToEveryType.ts | 4 +-
.../types/any/assignEveryTypeToAny.ts | 4 +-
.../conformance/types/conditional/variance.ts | 2 +
...tatedFunctionInferenceWithTypeParameter.ts | 3 +
.../types/import/importTypeAmbient.ts | 5 +-
.../types/import/importTypeGenericTypes.ts | 5 +-
.../types/import/importTypeLocal.ts | 5 +
.../intersectionOfUnionNarrowing.ts | 16 +
.../types/keyof/keyofAndIndexedAccess.ts | 20 +
.../types/literal/literalTypes2.ts | 3 +
.../types/localTypes/localTypes2.ts | 3 +
.../types/localTypes/localTypes3.ts | 3 +
.../mapped/mappedTypeAsClauseRelationships.ts | 27 +
.../types/mapped/mappedTypeProperties.ts | 42 ++
.../conformance/types/mapped/mappedTypes3.ts | 4 +-
.../types/mapped/mappedTypesAndObjects.ts | 2 +
.../members/classWithProtectedProperty.ts | 4 +-
.../types/members/indexSignatures1.ts | 325 ++++++++++++
.../objectTypeHidingMembersOfObject.ts | 4 +-
.../types/members/objectTypePropertyAccess.ts | 2 +
.../members/objectTypeWithNumericProperty.ts | 4 +-
...hStringNamedPropertyOfIllegalCharacters.ts | 2 +
.../typesWithSpecializedCallSignatures.ts | 5 +-
...typesWithSpecializedConstructSignatures.ts | 5 +-
.../namedTypes/classWithOptionalParameter.ts | 5 +-
.../types/namedTypes/optionalMethods.ts | 3 +
.../conformance/types/never/neverType.ts | 2 +
...ureWithoutReturnTypeAnnotationInference.ts | 6 +-
.../callSignaturesWithDuplicateParameters.ts | 4 +-
.../callSignaturesWithOptionalParameters.ts | 2 +
.../callSignaturesWithOptionalParameters2.ts | 4 +-
.../parametersWithNoAnnotationAreAny.ts | 4 +-
...reIsNotSubtypeOfNonSpecializedSignature.ts | 3 +
...atureIsSubtypeOfNonSpecializedSignature.ts | 3 +
...gLiteralTypesInImplementationSignatures.ts | 2 +
.../typeParameterAsTypeArgument.ts | 4 +-
...WithOverloadsThatDifferOnlyByReturnType.ts | 5 +-
.../indexSignatures/numericIndexingResults.ts | 4 +-
.../indexSignatures/stringIndexingResults.ts | 2 +
.../propertyNameWithoutTypeAnnotation.ts | 4 +-
.../propertyNamesOfReservedWords.ts | 4 +-
.../stringNamedPropertyAccess.ts | 4 +-
.../number/extendNumberInterface.ts | 2 +-
.../undefined/invalidUndefinedValues.ts | 4 +-
.../undefined/validUndefinedAssignments.ts | 4 +-
.../types/rest/objectRestParameter.ts | 1 +
.../typeLiterals/arrayOfFunctionTypes3.ts | 4 +-
.../functionLiteralForOverloads2.ts | 5 +-
.../typeQueries/typeQueryOnClass.ts | 5 +-
.../typeQueries/typeQueryWithReservedWords.ts | 1 +
.../typeQueries/typeofClass2.ts | 5 +-
.../typeQueries/typeofModuleWithoutExports.ts | 3 +-
.../specifyingTypes/typeQueries/typeofThis.ts | 146 ++++++
.../typeQueries/typeofThisWithImplicitThis.ts | 5 +
.../types/spread/spreadDuplicate.ts | 21 +
.../types/spread/spreadDuplicateExact.ts | 22 +
.../conformance/types/spread/spreadUnion4.ts | 4 +
.../types/thisType/fluentClasses.ts | 2 +
.../types/thisType/thisTypeAndConstraints.ts | 3 +
.../types/thisType/thisTypeInClasses.ts | 6 +
.../types/thisType/thisTypeInFunctions3.ts | 3 +
.../thisType/thisTypeInTaggedTemplateCall.ts | 10 +
.../types/tuple/readonlyArraysAndTuples2.ts | 2 +
.../circularTypeAliasForUnionWithClass.ts | 4 +
.../classDoesNotDependOnBaseTypes.ts | 4 +-
.../types/typeAliases/typeAliases.ts | 4 +-
...allGenericFunctionWithZeroTypeArguments.ts | 5 +-
.../functionConstraintSatisfaction.ts | 5 +-
.../functionConstraintSatisfaction3.ts | 5 +-
.../innerTypeParameterShadowingOuterOne2.ts | 4 +-
...rtyAccessOnTypeParameterWithConstraints.ts | 3 +-
...tyAccessOnTypeParameterWithConstraints2.ts | 7 +-
...tyAccessOnTypeParameterWithConstraints3.ts | 4 +-
...AccessOnTypeParameterWithoutConstraints.ts | 4 +-
.../typeParameterUsedAsConstraint.ts | 7 +
.../anyAssignabilityInInheritance.ts | 6 +-
.../anyAssignableToEveryType.ts | 1 +
.../anyAssignableToEveryType2.ts | 3 +
.../assignmentCompatWithObjectMembers.ts | 5 +-
.../assignmentCompatWithObjectMembers2.ts | 2 +
.../assignmentCompatWithObjectMembers3.ts | 2 +
...mentCompatWithObjectMembersNumericNames.ts | 2 +
...allSignatureAssignabilityInInheritance2.ts | 6 +-
...allSignatureAssignabilityInInheritance4.ts | 6 +-
...allSignatureAssignabilityInInheritance5.ts | 5 +-
...uctSignatureAssignabilityInInheritance2.ts | 6 +-
...uctSignatureAssignabilityInInheritance4.ts | 5 +-
...uctSignatureAssignabilityInInheritance5.ts | 5 +-
.../everyTypeAssignableToAny.ts | 2 +
.../nullAssignableToEveryType.ts | 2 +-
.../undefinedAssignableToEveryType.ts | 1 +
.../bestCommonTypeOfConditionalExpressions.ts | 5 +-
...bestCommonTypeOfConditionalExpressions2.ts | 4 +-
.../heterogeneousArrayLiterals.ts | 2 +
.../narrowingConstrainedTypeVariable.ts | 3 +
.../arrayLiteralsWithRecursiveGenerics.ts | 6 +-
.../recursiveTypeInGenericConstraint.ts | 5 +-
.../recursiveTypesUsedAsFunctionParameters.ts | 5 +-
.../nullIsSubtypeOfEverythingButUndefined.ts | 4 +
.../stringLiteralTypeIsSubtypeOfString.ts | 4 +-
.../subtypesAndSuperTypes/subtypesOfAny.ts | 5 +-
...subtypesOfTypeParameterWithConstraints2.ts | 5 +-
.../subtypingWithCallSignatures2.ts | 6 +
.../subtypingWithCallSignatures3.ts | 4 +
.../subtypingWithCallSignatures4.ts | 6 +-
.../subtypingWithConstructSignatures2.ts | 5 +
.../subtypingWithConstructSignatures3.ts | 4 +
.../subtypingWithConstructSignatures4.ts | 6 +-
.../subtypingWithConstructSignatures5.ts | 6 +-
.../subtypingWithObjectMembers4.ts | 6 +-
.../undefinedIsSubtypeOfEverything.ts | 25 +
.../objectTypesIdentity.ts | 6 +-
.../objectTypesIdentity2.ts | 5 +-
.../objectTypesIdentityWithCallSignatures.ts | 5 +-
.../objectTypesIdentityWithCallSignatures2.ts | 5 +-
...yWithCallSignaturesDifferingParamCounts.ts | 5 +-
...IdentityWithCallSignaturesWithOverloads.ts | 6 +-
...ectTypesIdentityWithConstructSignatures.ts | 6 +-
...ctTypesIdentityWithConstructSignatures2.ts | 4 +-
...ConstructSignaturesDifferingParamCounts.ts | 4 +-
...tTypesIdentityWithGenericCallSignatures.ts | 6 +-
...TypesIdentityWithGenericCallSignatures2.ts | 6 +-
...ricCallSignaturesDifferingByConstraints.ts | 6 +-
...icCallSignaturesDifferingByConstraints2.ts | 6 +-
...icCallSignaturesDifferingByConstraints3.ts | 9 +-
...ericCallSignaturesDifferingByReturnType.ts | 5 +-
...ricCallSignaturesDifferingByReturnType2.ts | 6 +-
...lSignaturesDifferingTypeParameterCounts.ts | 6 +-
...llSignaturesDifferingTypeParameterNames.ts | 5 +-
...WithGenericCallSignaturesOptionalParams.ts | 5 +-
...ithGenericCallSignaturesOptionalParams2.ts | 5 +-
...ithGenericCallSignaturesOptionalParams3.ts | 6 +-
...nstructSignaturesDifferingByConstraints.ts | 2 +
...structSignaturesDifferingByConstraints2.ts | 7 +-
...structSignaturesDifferingByConstraints3.ts | 7 +-
...onstructSignaturesDifferingByReturnType.ts | 4 +-
...nstructSignaturesDifferingByReturnType2.ts | 6 +-
...tSignaturesDifferingTypeParameterCounts.ts | 4 +-
...ctSignaturesDifferingTypeParameterNames.ts | 6 +-
...enericConstructSignaturesOptionalParams.ts | 5 +-
...nericConstructSignaturesOptionalParams2.ts | 5 +-
...nericConstructSignaturesOptionalParams3.ts | 4 +-
...objectTypesIdentityWithNumericIndexers1.ts | 3 +
...objectTypesIdentityWithNumericIndexers2.ts | 5 +
...objectTypesIdentityWithNumericIndexers3.ts | 3 +
.../objectTypesIdentityWithOptionality.ts | 6 +-
.../objectTypesIdentityWithPrivates.ts | 4 +-
.../objectTypesIdentityWithPrivates2.ts | 1 +
.../objectTypesIdentityWithPublics.ts | 5 +-
.../objectTypesIdentityWithStringIndexers.ts | 3 +
.../objectTypesIdentityWithStringIndexers2.ts | 5 +
.../typeParametersAreIdenticalToThemselves.ts | 4 +-
...allWithConstraintsTypeArgumentInference.ts | 3 +
.../genericCallWithFunctionTypedArguments4.ts | 4 +-
.../genericCallWithObjectTypeArgs2.ts | 4 +-
...ricCallWithObjectTypeArgsAndConstraints.ts | 10 +-
...icCallWithObjectTypeArgsAndConstraints2.ts | 1 +
...icClassWithObjectTypeArgsAndConstraints.ts | 7 +-
.../keyofInferenceLowerPriorityThanReturn.ts | 4 +
.../types/union/discriminatedUnionTypes3.ts | 19 +
497 files changed, 8097 insertions(+), 197 deletions(-)
create mode 100644 tests/cases/conformance/ambient/ambientDeclarationsPatterns/ambientDeclarationsPatterns.ts
create mode 100644 tests/cases/conformance/ambient/ambientDeclarationsPatterns/declarations.d.ts
create mode 100644 tests/cases/conformance/ambient/ambientShorthand_merging/ambientShorthand_merging.ts
create mode 100644 tests/cases/conformance/ambient/ambientShorthand_merging/declarations1.d.ts
create mode 100644 tests/cases/conformance/ambient/ambientShorthand_merging/declarations2.d.ts
create mode 100644 tests/cases/conformance/ambient/ambientShorthand_reExport/ambientShorthand_reExport.ts
create mode 100644 tests/cases/conformance/ambient/ambientShorthand_reExport/declarations.d.ts
create mode 100644 tests/cases/conformance/ambient/ambientShorthand_reExport/jquery.d.ts
create mode 100644 tests/cases/conformance/ambient/ambientShorthand_reExport/reExportAll.ts
create mode 100644 tests/cases/conformance/ambient/ambientShorthand_reExport/reExportX.ts
create mode 100644 tests/cases/conformance/async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock1.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock10.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock11.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock12.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock13.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock14.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock15.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock16.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock17.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock18.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock19.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock2.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock20.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock21.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock23.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock24.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock25.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock27.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock3.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock4.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock5.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock6.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock7.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock8.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlock9.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef1.ts
create mode 100644 tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef2.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/superInStaticMembers1.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers1.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers2.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers3.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers4.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers10.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers11.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers12.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers13.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers3.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers4.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers5.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers6.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers7.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers8.ts
create mode 100644 tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers9.ts
create mode 100644 tests/cases/conformance/classes/members/privateNames/privateNameHashCharName.ts
create mode 100644 tests/cases/conformance/classes/members/privateNames/privateNameInInExpression.ts
create mode 100644 tests/cases/conformance/classes/members/privateNames/privateNameInInExpressionTransform.ts
create mode 100644 tests/cases/conformance/classes/members/privateNames/privateNameInInExpressionUnused.ts
create mode 100644 tests/cases/conformance/classes/members/privateNames/privateNamesIncompatibleModifiersJs.ts
create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/abstractPropertyInitializer.ts
create mode 100644 tests/cases/conformance/controlFlow/assertionTypePredicates2.ts
create mode 100644 tests/cases/conformance/controlFlow/controlFlowAliasing.ts
create mode 100644 tests/cases/conformance/controlFlow/controlFlowAliasingCatchVariables.ts
create mode 100644 tests/cases/conformance/controlFlow/controlFlowForInStatement2.ts
create mode 100644 tests/cases/conformance/controlFlow/controlFlowInOperator.ts
create mode 100644 tests/cases/conformance/controlFlow/controlFlowTypeofObject.ts
create mode 100644 tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts
create mode 100644 tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/fs.d.ts
create mode 100644 tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/main.ts
create mode 100644 tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/package.json
create mode 100644 tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/typeReferenceRelatedFiles.ts
create mode 100644 tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter5.ts
create mode 100644 tests/cases/conformance/decorators/class/decoratedBlockScopedClass1.ts
create mode 100644 tests/cases/conformance/decorators/class/decoratedBlockScopedClass2.ts
create mode 100644 tests/cases/conformance/decorators/class/decoratedBlockScopedClass3.ts
create mode 100644 tests/cases/conformance/decorators/class/method/decoratorOnClassMethod14.ts
create mode 100644 tests/cases/conformance/decorators/class/method/decoratorOnClassMethod15.ts
create mode 100644 tests/cases/conformance/decorators/class/method/decoratorOnClassMethod16.ts
create mode 100644 tests/cases/conformance/decorators/class/method/decoratorOnClassMethod17.ts
create mode 100644 tests/cases/conformance/decorators/class/method/decoratorOnClassMethod18.ts
create mode 100644 tests/cases/conformance/decorators/decoratorMetadataWithTypeOnlyImport2.ts
create mode 100644 tests/cases/conformance/es2018/es2018IntlAPIs.ts
create mode 100644 tests/cases/conformance/es2020/es2020IntlAPIs.ts
create mode 100644 tests/cases/conformance/es6/spread/arraySpreadImportHelpers.ts
create mode 100644 tests/cases/conformance/es6/templates/templateStringWithCommentsInArrowFunction.ts
create mode 100644 tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts
create mode 100644 tests/cases/conformance/expressions/thisKeyword/typeOfThisGeneral.ts
create mode 100644 tests/cases/conformance/externalModules/moduleResolutionWithoutExtension1.ts
create mode 100644 tests/cases/conformance/externalModules/moduleResolutionWithoutExtension2.ts
create mode 100644 tests/cases/conformance/externalModules/moduleResolutionWithoutExtension3.ts
create mode 100644 tests/cases/conformance/externalModules/moduleResolutionWithoutExtension4.ts
create mode 100644 tests/cases/conformance/externalModules/moduleResolutionWithoutExtension5.ts
create mode 100644 tests/cases/conformance/externalModules/moduleResolutionWithoutExtension6.ts
create mode 100644 tests/cases/conformance/externalModules/moduleResolutionWithoutExtension7.ts
create mode 100644 tests/cases/conformance/externalModules/moduleResolutionWithoutExtension8.ts
create mode 100644 tests/cases/conformance/externalModules/typeOnly/exportSpecifiers.ts
create mode 100644 tests/cases/conformance/externalModules/typeOnly/importDefaultNamedType/a.ts
create mode 100644 tests/cases/conformance/externalModules/typeOnly/importDefaultNamedType/importDefaultNamedType.ts
create mode 100644 tests/cases/conformance/externalModules/typeOnly/importSpecifiers1.ts
create mode 100644 tests/cases/conformance/externalModules/typeOnly/preserveValueImports.ts
create mode 100644 tests/cases/conformance/externalModules/typeOnly/preserveValueImports_errors.ts
create mode 100644 tests/cases/conformance/externalModules/typeOnly/preserveValueImports_importsNotUsedAsValues.ts
create mode 100644 tests/cases/conformance/externalModules/typeOnly/preserveValueImports_mixedImports.ts
create mode 100644 tests/cases/conformance/externalModules/typeOnly/preserveValueImports_module.ts
create mode 100644 tests/cases/conformance/importAssertion/importAssertion1.ts
create mode 100644 tests/cases/conformance/importAssertion/importAssertion2.ts
create mode 100644 tests/cases/conformance/importAssertion/importAssertion3.ts
create mode 100644 tests/cases/conformance/importAssertion/importAssertion4.ts
create mode 100644 tests/cases/conformance/importAssertion/importAssertion5.ts
create mode 100644 tests/cases/conformance/jsdoc/enumTagImported/enumTagImported.ts
create mode 100644 tests/cases/conformance/jsdoc/jsdocAugments_qualifiedName/jsdocAugments_qualifiedName.ts
create mode 100644 tests/cases/conformance/jsdoc/jsdocTemplateTagDefault.ts
create mode 100644 tests/cases/conformance/jsdoc/jsdocTemplateTagNameResolution.ts
create mode 100644 tests/cases/conformance/jsdoc/jsdocVariadicType.ts
create mode 100644 tests/cases/conformance/jsdoc/seeTag3.ts
create mode 100644 tests/cases/conformance/jsdoc/thisTag2.ts
create mode 100644 tests/cases/conformance/jsx/jsxParsingError4.tsx
create mode 100644 tests/cases/conformance/jsx/jsxUnclosedParserRecovery.ts
create mode 100644 tests/cases/conformance/jsx/tsxReactEmitSpreadAttribute.ts
create mode 100644 tests/cases/conformance/moduleResolution/declarationNotFoundPackageBundlesTypes.ts
create mode 100644 tests/cases/conformance/moduleResolution/scopedPackages/index.d.ts
create mode 100644 tests/cases/conformance/moduleResolution/scopedPackages/scopedPackages.ts
create mode 100644 tests/cases/conformance/moduleResolution/scopedPackages/z.d.ts
create mode 100644 tests/cases/conformance/moduleResolution/scopedPackagesClassic/index.d.ts
create mode 100644 tests/cases/conformance/moduleResolution/scopedPackagesClassic/scopedPackagesClassic.ts
create mode 100644 tests/cases/conformance/moduleResolution/untypedModuleImport_allowJs/untypedModuleImport_allowJs.ts
create mode 100644 tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/declarations.d.ts
create mode 100644 tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/untypedModuleImport_vsAmbient.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts
create mode 100644 tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts
create mode 100644 tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts
create mode 100644 tests/cases/conformance/node/nodeModules1.ts
create mode 100644 tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts
create mode 100644 tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts
create mode 100644 tests/cases/conformance/node/nodeModulesDeclarationEmitDynamicImportWithPackageExports.ts
create mode 100644 tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts
create mode 100644 tests/cases/conformance/node/nodeModulesDynamicImport.ts
create mode 100644 tests/cases/conformance/node/nodeModulesExportAssignments.ts
create mode 100644 tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts
create mode 100644 tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts
create mode 100644 tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts
create mode 100644 tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts
create mode 100644 tests/cases/conformance/node/nodeModulesForbidenSyntax.ts
create mode 100644 tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts
create mode 100644 tests/cases/conformance/node/nodeModulesImportAssertions.ts
create mode 100644 tests/cases/conformance/node/nodeModulesImportAssignments.ts
create mode 100644 tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts
create mode 100644 tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts
create mode 100644 tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts
create mode 100644 tests/cases/conformance/node/nodeModulesImportMeta.ts
create mode 100644 tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts
create mode 100644 tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts
create mode 100644 tests/cases/conformance/node/nodeModulesPackageExports.ts
create mode 100644 tests/cases/conformance/node/nodeModulesPackageImports.ts
create mode 100644 tests/cases/conformance/node/nodeModulesPackagePatternExports.ts
create mode 100644 tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts
create mode 100644 tests/cases/conformance/node/nodeModulesResolveJsonModule.ts
create mode 100644 tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts
create mode 100644 tests/cases/conformance/node/nodeModulesTopLevelAwait.ts
create mode 100644 tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts
create mode 100644 tests/cases/conformance/node/nodePackageSelfName.ts
create mode 100644 tests/cases/conformance/node/nodePackageSelfNameScoped.ts
create mode 100644 tests/cases/conformance/override/override15.ts
create mode 100644 tests/cases/conformance/override/override19.ts
create mode 100644 tests/cases/conformance/override/override20.ts
create mode 100644 tests/cases/conformance/override/override_js4.ts
create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement22.ts
create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement23.ts
create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement24.ts
create mode 100644 tests/cases/conformance/salsa/plainJSBinderErrors.ts
create mode 100644 tests/cases/conformance/salsa/plainJSRedeclare.ts
create mode 100644 tests/cases/conformance/salsa/plainJSRedeclare2.ts
create mode 100644 tests/cases/conformance/salsa/plainJSRedeclare3.ts
create mode 100644 tests/cases/conformance/salsa/plainJSReservedStrict.ts
create mode 100644 tests/cases/conformance/salsa/spellingUncheckedJS.ts
create mode 100644 tests/cases/conformance/salsa/typeFromJSInitializer2.ts
create mode 100644 tests/cases/conformance/salsa/typeFromJSInitializer3.ts
create mode 100644 tests/cases/conformance/salsa/typeFromJSInitializer4.ts
create mode 100644 tests/cases/conformance/statements/for-inStatements/for-inStatementsAsyncIdentifier.ts
create mode 100644 tests/cases/conformance/types/intersection/intersectionOfUnionNarrowing.ts
create mode 100644 tests/cases/conformance/types/mapped/mappedTypeAsClauseRelationships.ts
create mode 100644 tests/cases/conformance/types/mapped/mappedTypeProperties.ts
create mode 100644 tests/cases/conformance/types/members/indexSignatures1.ts
create mode 100644 tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThis.ts
create mode 100644 tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThisWithImplicitThis.ts
create mode 100644 tests/cases/conformance/types/spread/spreadDuplicate.ts
create mode 100644 tests/cases/conformance/types/spread/spreadDuplicateExact.ts
create mode 100644 tests/cases/conformance/types/spread/spreadUnion4.ts
create mode 100644 tests/cases/conformance/types/thisType/thisTypeInTaggedTemplateCall.ts
create mode 100644 tests/cases/conformance/types/union/discriminatedUnionTypes3.ts
diff --git a/tests/cases/conformance/ambient/ambientDeclarations.ts b/tests/cases/conformance/ambient/ambientDeclarations.ts
index 379f5a5440..156ca565af 100644
--- a/tests/cases/conformance/ambient/ambientDeclarations.ts
+++ b/tests/cases/conformance/ambient/ambientDeclarations.ts
@@ -73,3 +73,4 @@ declare module 'external1' {
var q;
}
+let qq2 = new cls();
\ No newline at end of file
diff --git a/tests/cases/conformance/ambient/ambientDeclarationsPatterns/ambientDeclarationsPatterns.ts b/tests/cases/conformance/ambient/ambientDeclarationsPatterns/ambientDeclarationsPatterns.ts
new file mode 100644
index 0000000000..8b2be7e0b2
--- /dev/null
+++ b/tests/cases/conformance/ambient/ambientDeclarationsPatterns/ambientDeclarationsPatterns.ts
@@ -0,0 +1,11 @@
+// @Filename: user.ts
+///<reference path="declarations.d.ts" />
+import {foo, baz} from "foobarbaz";
+foo(baz);
+
+import {foos} from "foosball";
+foo(foos);
+
+// Works with relative file name
+import fileText from "./file!text";
+foo(fileText);
\ No newline at end of file
diff --git a/tests/cases/conformance/ambient/ambientDeclarationsPatterns/declarations.d.ts b/tests/cases/conformance/ambient/ambientDeclarationsPatterns/declarations.d.ts
new file mode 100644
index 0000000000..725593c54e
--- /dev/null
+++ b/tests/cases/conformance/ambient/ambientDeclarationsPatterns/declarations.d.ts
@@ -0,0 +1,18 @@
+// @Filename: declarations.d.ts
+declare module "foo*baz" {
+ export function foo(s: string): void;
+}
+// Augmentations still work
+declare module "foo*baz" {
+ export const baz: string;
+}
+
+// Longest prefix wins
+declare module "foos*" {
+ export const foos: string;
+}
+
+declare module "*!text" {
+ const x: string;
+ export default x;
+}
diff --git a/tests/cases/conformance/ambient/ambientInsideNonAmbient.ts b/tests/cases/conformance/ambient/ambientInsideNonAmbient.ts
index e2f24113c9..d07ac13995 100644
--- a/tests/cases/conformance/ambient/ambientInsideNonAmbient.ts
+++ b/tests/cases/conformance/ambient/ambientInsideNonAmbient.ts
@@ -4,6 +4,7 @@ module M {
export declare class C { }
export declare enum E { }
export declare module M { }
+ let qq1 = new C();
}
module M2 {
@@ -12,4 +13,5 @@ module M2 {
declare class C { }
declare enum E { }
declare module M { }
+ let qq1 = new C();
}
\ No newline at end of file
diff --git a/tests/cases/conformance/ambient/ambientInsideNonAmbientExternalModule.ts b/tests/cases/conformance/ambient/ambientInsideNonAmbientExternalModule.ts
index dbdc315c74..3e1e4bfa35 100644
--- a/tests/cases/conformance/ambient/ambientInsideNonAmbientExternalModule.ts
+++ b/tests/cases/conformance/ambient/ambientInsideNonAmbientExternalModule.ts
@@ -3,4 +3,6 @@ export declare var x;
export declare function f();
export declare class C { }
export declare enum E { }
-export declare module M { }
\ No newline at end of file
+export declare module M { }
+
+let qq1 = new C();
diff --git a/tests/cases/conformance/ambient/ambientShorthand_merging/ambientShorthand_merging.ts b/tests/cases/conformance/ambient/ambientShorthand_merging/ambientShorthand_merging.ts
new file mode 100644
index 0000000000..a52d4c04bf
--- /dev/null
+++ b/tests/cases/conformance/ambient/ambientShorthand_merging/ambientShorthand_merging.ts
@@ -0,0 +1,6 @@
+// @Filename: user.ts
+///<reference path="declarations1.d.ts" />
+///<reference path="declarations1.d.ts" />
+import foo, {bar} from "foo";
+foo;
+bar;
diff --git a/tests/cases/conformance/ambient/ambientShorthand_merging/declarations1.d.ts b/tests/cases/conformance/ambient/ambientShorthand_merging/declarations1.d.ts
new file mode 100644
index 0000000000..66bdaa0fc8
--- /dev/null
+++ b/tests/cases/conformance/ambient/ambientShorthand_merging/declarations1.d.ts
@@ -0,0 +1,2 @@
+// @Filename: declarations1.d.ts
+declare module "foo";
diff --git a/tests/cases/conformance/ambient/ambientShorthand_merging/declarations2.d.ts b/tests/cases/conformance/ambient/ambientShorthand_merging/declarations2.d.ts
new file mode 100644
index 0000000000..ff7233979a
--- /dev/null
+++ b/tests/cases/conformance/ambient/ambientShorthand_merging/declarations2.d.ts
@@ -0,0 +1,4 @@
+// @Filename: declarations2.d.ts
+declare module "foo" {
+ export const bar: number;
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/ambient/ambientShorthand_reExport/ambientShorthand_reExport.ts b/tests/cases/conformance/ambient/ambientShorthand_reExport/ambientShorthand_reExport.ts
new file mode 100644
index 0000000000..45ba9cd111
--- /dev/null
+++ b/tests/cases/conformance/ambient/ambientShorthand_reExport/ambientShorthand_reExport.ts
@@ -0,0 +1,5 @@
+// @Filename: reExportUser.ts
+import {x} from "./reExportX";
+import * as $ from "./reExportAll";
+// '$' is not callable, it is an object.
+x($);
diff --git a/tests/cases/conformance/ambient/ambientShorthand_reExport/declarations.d.ts b/tests/cases/conformance/ambient/ambientShorthand_reExport/declarations.d.ts
new file mode 100644
index 0000000000..58d1d8215b
--- /dev/null
+++ b/tests/cases/conformance/ambient/ambientShorthand_reExport/declarations.d.ts
@@ -0,0 +1,2 @@
+// @Filename: declarations.d.ts
+declare module "jquery";
\ No newline at end of file
diff --git a/tests/cases/conformance/ambient/ambientShorthand_reExport/jquery.d.ts b/tests/cases/conformance/ambient/ambientShorthand_reExport/jquery.d.ts
new file mode 100644
index 0000000000..58d1d8215b
--- /dev/null
+++ b/tests/cases/conformance/ambient/ambientShorthand_reExport/jquery.d.ts
@@ -0,0 +1,2 @@
+// @Filename: declarations.d.ts
+declare module "jquery";
\ No newline at end of file
diff --git a/tests/cases/conformance/ambient/ambientShorthand_reExport/reExportAll.ts b/tests/cases/conformance/ambient/ambientShorthand_reExport/reExportAll.ts
new file mode 100644
index 0000000000..ae6c5d4864
--- /dev/null
+++ b/tests/cases/conformance/ambient/ambientShorthand_reExport/reExportAll.ts
@@ -0,0 +1,2 @@
+// @Filename: reExportAll.ts
+export * from "jquery";
\ No newline at end of file
diff --git a/tests/cases/conformance/ambient/ambientShorthand_reExport/reExportX.ts b/tests/cases/conformance/ambient/ambientShorthand_reExport/reExportX.ts
new file mode 100644
index 0000000000..07420e1616
--- /dev/null
+++ b/tests/cases/conformance/ambient/ambientShorthand_reExport/reExportX.ts
@@ -0,0 +1,2 @@
+// @Filename: reExportX.ts
+export {x} from "jquery";
\ No newline at end of file
diff --git a/tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts b/tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts
index c89369d02b..9f7e496b8a 100644
--- a/tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts
+++ b/tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts
@@ -55,3 +55,4 @@ class B extends A {
({ f: super["x"] } = { f });
}
}
+let b1 = new B();
diff --git a/tests/cases/conformance/async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts b/tests/cases/conformance/async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts
new file mode 100644
index 0000000000..31c1c4055c
--- /dev/null
+++ b/tests/cases/conformance/async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts
@@ -0,0 +1,49 @@
+// @target: esnext
+
+function f_let () {
+ let await = 1
+}
+
+function f1_var () {
+ var await = 1
+}
+
+function f1_const () {
+ const await = 1
+}
+
+async function f2_let () {
+ let await = 1
+}
+
+async function f2_var () {
+ var await = 1
+}
+
+async function f2_const () {
+ const await = 1
+}
+
+function f3_let () {
+ let yield = 2
+}
+
+function f3_var () {
+ var yield = 2
+}
+
+function f3_const () {
+ const yield = 2
+}
+
+function * f4_let () {
+ let yield = 2;
+}
+
+function * f4_var () {
+ var yield = 2;
+}
+
+function * f4_const () {
+ const yield = 2;
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAsIdentifier.ts b/tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAsIdentifier.ts
index 4c251a03c3..1a1aeedd41 100644
--- a/tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAsIdentifier.ts
+++ b/tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAsIdentifier.ts
@@ -1,5 +1,5 @@
class abstract {
foo() { return 1; }
}
-
+let a = new abstract()
new abstract;
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classDeclarations/classBody/classWithEmptyBody.ts b/tests/cases/conformance/classes/classDeclarations/classBody/classWithEmptyBody.ts
index 1a2e456e0f..5437d3a67d 100644
--- a/tests/cases/conformance/classes/classDeclarations/classBody/classWithEmptyBody.ts
+++ b/tests/cases/conformance/classes/classDeclarations/classBody/classWithEmptyBody.ts
@@ -17,4 +17,6 @@ var d: D;
var o: {} = d;
d = 1;
d = { foo: '' }
-d = () => { }
\ No newline at end of file
+d = () => { }
+let cc = new C();
+let dd = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts b/tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts
index efc3ccff9a..3184fc17d5 100644
--- a/tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts
+++ b/tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts
@@ -1,3 +1,4 @@
function foo() {
class C { }
+ let a1 = new C()
}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts b/tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts
index 93daf743f8..1d496f4eaf 100644
--- a/tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts
+++ b/tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts
@@ -3,4 +3,6 @@
class any { }
class number { }
class boolean { }
-class string { }
\ No newline at end of file
+class string { }
+
+let aa = new any();
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts b/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts
index 6571258d9d..5f049c27e3 100644
--- a/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts
+++ b/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts
@@ -1,3 +1,4 @@
class C {
;
-}
\ No newline at end of file
+}
+let c9 = new C()
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts b/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts
index 716c8b58ae..511baa19f9 100644
--- a/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts
+++ b/tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts
@@ -1,4 +1,5 @@
class C {
;
;
-}
\ No newline at end of file
+}
+let a15 = new C()
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classExpressions/classExpression2.ts b/tests/cases/conformance/classes/classExpressions/classExpression2.ts
index 6365cd07eb..d39896a361 100644
--- a/tests/cases/conformance/classes/classExpressions/classExpression2.ts
+++ b/tests/cases/conformance/classes/classExpressions/classExpression2.ts
@@ -1,2 +1,4 @@
class D { }
-var v = class C extends D {};
\ No newline at end of file
+var v = class C extends D {};
+let dd = new D()
+let vv = new v()
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock1.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock1.ts
new file mode 100644
index 0000000000..dd9455ad8c
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock1.ts
@@ -0,0 +1,11 @@
+// @target: esnext, es2015, es5
+const a = 2;
+
+class C {
+ static {
+ const a = 1;
+
+ a;
+ }
+}
+let a1 = new C()
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock10.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock10.ts
new file mode 100644
index 0000000000..aa82e1db13
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock10.ts
@@ -0,0 +1,30 @@
+// @target: esnext, es2015, es5
+var a1 = 1;
+var a2 = 1;
+const b1 = 2;
+const b2 = 2;
+
+function f () {
+ var a1 = 11;
+ const b1 = 22;
+
+ class C1 {
+ static {
+ var a1 = 111;
+ var a2 = 111;
+ const b1 = 222;
+ const b2 = 222;
+ }
+ }
+ let c1 = new C1();
+}
+
+class C2 {
+ static {
+ var a1 = 111;
+ var a2 = 111;
+ const b1 = 222;
+ const b2 = 222;
+ }
+}
+let c2 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock11.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock11.ts
new file mode 100644
index 0000000000..00492ae619
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock11.ts
@@ -0,0 +1,15 @@
+// @target: esnext, es2015
+
+let getX;
+class C {
+ #x = 1
+ constructor(x: number) {
+ this.#x = x;
+ }
+
+ static {
+ // getX has privileged access to #x
+ getX = (obj: C) => obj.#x;
+ }
+}
+let cc = new C(1);
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock12.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock12.ts
new file mode 100644
index 0000000000..436c690665
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock12.ts
@@ -0,0 +1,10 @@
+// @useDefineForClassFields: false
+// @target: es2015
+
+class C {
+ static #x = 1;
+
+ static {
+ C.#x;
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock13.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock13.ts
new file mode 100644
index 0000000000..8120cc3575
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock13.ts
@@ -0,0 +1,14 @@
+// @target: esnext, es2015
+// @useDefineForClassFields: true
+
+class C {
+ static #x = 123;
+
+ static {
+ console.log(C.#x)
+ }
+
+ foo () {
+ return C.#x;
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock14.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock14.ts
new file mode 100644
index 0000000000..ff510c8436
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock14.ts
@@ -0,0 +1,15 @@
+// @useDefineForClassFields: false
+// @target: es2015
+
+class C {
+ static #_1 = 1;
+ static #_3 = 1;
+ static #_5 = 1;
+
+ static {}
+ static {}
+ static {}
+ static {}
+ static {}
+ static {}
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock15.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock15.ts
new file mode 100644
index 0000000000..ec2727660f
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock15.ts
@@ -0,0 +1,18 @@
+// @target: esnext, es2015
+// @useDefineForClassFields: true
+var _C__1;
+
+class C {
+ static #_1 = 1;
+ static #_3 = 3;
+ static #_5 = 5;
+
+ static {}
+ static {}
+ static {}
+ static {}
+ static {}
+ static {}
+}
+
+console.log(_C__1)
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock16.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock16.ts
new file mode 100644
index 0000000000..bc15e5f1ab
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock16.ts
@@ -0,0 +1,26 @@
+// @target: es2015
+
+let getX: (c: C) => number;
+class C {
+ #x = 1
+ constructor(x: number) {
+ this.#x = x;
+ }
+
+ static {
+ // getX has privileged access to #x
+ getX = (obj: C) => obj.#x;
+ getY = (obj: D) => obj.#y;
+ }
+}
+
+let getY: (c: D) => number;
+class D {
+ #y = 1
+
+ static {
+ // getY has privileged access to y
+ getX = (obj: C) => obj.#x;
+ getY = (obj: D) => obj.#y;
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock17.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock17.ts
new file mode 100644
index 0000000000..8d26cb4a08
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock17.ts
@@ -0,0 +1,33 @@
+// @target: es2015
+
+let friendA: { getX(o: A): number, setX(o: A, v: number): void };
+
+class A {
+ #x: number;
+
+ constructor (v: number) {
+ this.#x = v;
+ }
+
+ getX () {
+ return this.#x;
+ }
+
+ static {
+ friendA = {
+ getX(obj) { return obj.#x },
+ setX(obj, value) { obj.#x = value }
+ };
+ }
+};
+
+class B {
+ constructor(a: A) {
+ const x = friendA.getX(a); // ok
+ friendA.setX(a, x + 1); // ok
+ }
+};
+
+const a = new A(41);
+const b = new B(a);
+a.getX();
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock18.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock18.ts
new file mode 100644
index 0000000000..a36bd50917
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock18.ts
@@ -0,0 +1,15 @@
+// @target: esnext, es2015, es5
+
+function foo () {
+ return class {
+ static foo = 1;
+ static {
+ const c = class {
+ static bar = 2;
+ static {
+ // do
+ }
+ }
+ }
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock19.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock19.ts
new file mode 100644
index 0000000000..33bb993be6
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock19.ts
@@ -0,0 +1,6 @@
+class C {
+ @decorator
+ static {
+ // something
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock2.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock2.ts
new file mode 100644
index 0000000000..292d7181bb
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock2.ts
@@ -0,0 +1,20 @@
+// @target: esnext, es2015, es5
+
+const a = 1;
+const b = 2;
+
+class C {
+ static {
+ const a = 11;
+
+ a;
+ b;
+ }
+
+ static {
+ const a = 11;
+
+ a;
+ b;
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock20.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock20.ts
new file mode 100644
index 0000000000..72a9d09161
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock20.ts
@@ -0,0 +1,13 @@
+class C {
+ async static {
+ // something
+ }
+
+ public static {
+ // something
+ }
+
+ readonly private static {
+ // something
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock21.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock21.ts
new file mode 100644
index 0000000000..65422df9cd
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock21.ts
@@ -0,0 +1,7 @@
+class C {
+ /* jsdocs */
+ static {
+ // something
+ }
+}
+let cc = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts
new file mode 100644
index 0000000000..8d3be9861a
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts
@@ -0,0 +1,72 @@
+// @target: esnext
+
+let await: "any";
+class C {
+ static {
+ let await: any; // illegal, cannot declare a new binding for await
+ }
+ static {
+ let { await } = {} as any; // illegal, cannot declare a new binding for await
+ }
+ static {
+ let { await: other } = {} as any; // legal
+ }
+ static {
+ let await; // illegal, cannot declare a new binding for await
+ }
+ static {
+ function await() { }; // illegal
+ }
+ static {
+ class await { }; // illegal
+ }
+
+ static {
+ class D {
+ await = 1; // legal
+ x = await; // legal (initializers have an implicit function boundary)
+ };
+ }
+ static {
+ (function await() { }); // legal, 'await' in function expression name not bound inside of static block
+ }
+ static {
+ (class await { }); // legal, 'await' in class expression name not bound inside of static block
+ }
+ static {
+ (function () { return await; }); // legal, 'await' is inside of a new function boundary
+ }
+ static {
+ (() => await); // legal, 'await' is inside of a new function boundary
+ }
+
+ static {
+ class E {
+ constructor() { await; }
+ method() { await; }
+ get accessor() {
+ await;
+ return 1;
+ }
+ set accessor(v: any) {
+ await;
+ }
+ propLambda = () => { await; }
+ propFunc = function () { await; }
+ }
+ }
+ static {
+ class S {
+ static method() { await; }
+ static get accessor() {
+ await;
+ return 1;
+ }
+ static set accessor(v: any) {
+ await;
+ }
+ static propLambda = () => { await; }
+ static propFunc = function () { await; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock23.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock23.ts
new file mode 100644
index 0000000000..bb83b27dca
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock23.ts
@@ -0,0 +1,21 @@
+// @target: esnext
+
+const nums = [1, 2, 3].map(n => Promise.resolve(n))
+
+class C {
+ static {
+ for await (const nn of nums) {
+ console.log(nn)
+ }
+ }
+}
+
+async function foo () {
+ class C {
+ static {
+ for await (const nn of nums) {
+ console.log(nn)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock24.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock24.ts
new file mode 100644
index 0000000000..8132238772
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock24.ts
@@ -0,0 +1,8 @@
+// @module: commonjs, es2015, es2020, UMD, AMD, System, esnext
+
+export class C {
+ static x: number;
+ static {
+ C.x = 1;
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock25.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock25.ts
new file mode 100644
index 0000000000..56f99a6122
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock25.ts
@@ -0,0 +1,23 @@
+// @target: esnext
+// @declaration: true
+// @declarationMap: true
+// @sourceMap: true
+
+const a = 1;
+const b = 2;
+
+class C {
+ static {
+ const a = 11;
+
+ a;
+ b;
+ }
+
+ static {
+ const a = 11;
+
+ a;
+ b;
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts
new file mode 100644
index 0000000000..1081729acd
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts
@@ -0,0 +1,30 @@
+// @target: esnext
+
+class C {
+ static {
+ await; // illegal
+ }
+ static {
+ await (1); // illegal
+ }
+ static {
+ ({ [await]: 1 }); // illegal
+ }
+ static {
+ class D {
+ [await] = 1; // illegal (computed property names are evaluated outside of a class body
+ };
+ }
+ static {
+ ({ await }); // illegal short-hand property reference
+ }
+ static {
+ await: // illegal, 'await' cannot be used as a label
+ break await; // illegal, 'await' cannot be used as a label
+ }
+ static {
+ function f(await) { }
+ const ff = (await) => { }
+ const fff = await => { }
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock27.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock27.ts
new file mode 100644
index 0000000000..a0429bbb54
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock27.ts
@@ -0,0 +1,17 @@
+// https://github.com/microsoft/TypeScript/issues/44872
+
+void class Foo {
+ static prop = 1
+ static {
+ console.log(Foo.prop);
+ Foo.prop++;
+ }
+ static {
+ console.log(Foo.prop);
+ Foo.prop++;
+ }
+ static {
+ console.log(Foo.prop);
+ Foo.prop++;
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock3.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock3.ts
new file mode 100644
index 0000000000..84125fdbed
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock3.ts
@@ -0,0 +1,19 @@
+// @target: esnext
+
+const a = 1;
+
+class C {
+ static f1 = 1;
+
+ static {
+ console.log(C.f1, C.f2, C.f3)
+ }
+
+ static f2 = 2;
+
+ static {
+ console.log(C.f1, C.f2, C.f3)
+ }
+
+ static f3 = 3;
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock4.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock4.ts
new file mode 100644
index 0000000000..7a944a4969
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock4.ts
@@ -0,0 +1,16 @@
+// @target: esnext
+
+class C {
+ static s1 = 1;
+
+ static {
+ this.s1;
+ C.s1;
+
+ this.s2;
+ C.s2;
+ }
+
+ static s2 = 2;
+ static ss2 = this.s1;
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock5.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock5.ts
new file mode 100644
index 0000000000..2410b532ab
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock5.ts
@@ -0,0 +1,19 @@
+// @target: esnext, es2015, es5
+
+class B {
+ static a = 1;
+ static b = 2;
+}
+
+class C extends B {
+ static b = 3;
+ static c = super.a
+
+ static {
+ this.b;
+ super.b;
+ super.a;
+ }
+}
+
+let cc = new C();
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock6.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock6.ts
new file mode 100644
index 0000000000..cdd0cda2fe
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock6.ts
@@ -0,0 +1,62 @@
+class B {
+ static a = 1;
+}
+
+class C extends B {
+ static {
+ let await = 1;
+ let arguments = 1;
+ let eval = 1;
+ }
+
+ static {
+ await: if (true) {
+
+ }
+
+ arguments;
+ await;
+ super();
+ }
+}
+
+class CC {
+ constructor () {
+ class C extends B {
+ static {
+ class CC extends B {
+ constructor () {
+ super();
+ }
+ }
+ super();
+ }
+ }
+ }
+}
+
+async function foo () {
+ class C extends B {
+ static {
+ arguments;
+ await;
+
+ async function ff () {
+ arguments;
+ await;
+ }
+ }
+ }
+}
+
+function foo1 () {
+ class C extends B {
+ static {
+ arguments;
+
+ function ff () {
+ arguments;
+ }
+ }
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock7.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock7.ts
new file mode 100644
index 0000000000..727ada0342
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock7.ts
@@ -0,0 +1,43 @@
+class C {
+ static {
+ await 1;
+ yield 1;
+ return 1;
+ }
+}
+
+async function f1 () {
+ class C {
+ static {
+ await 1;
+
+ async function ff () {
+ await 1;
+ }
+ }
+ }
+}
+
+function * f2 () {
+ class C {
+ static {
+ yield 1;
+
+ function * ff () {
+ yield 1;
+ }
+ }
+ }
+}
+
+function f3 () {
+ class C {
+ static {
+ return 1;
+
+ function ff () {
+ return 1
+ }
+ }
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock8.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock8.ts
new file mode 100644
index 0000000000..d2e5220b83
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock8.ts
@@ -0,0 +1,48 @@
+function foo (v: number) {
+ label: while (v) {
+ class C {
+ static {
+ if (v === 1) {
+ break label;
+ }
+ if (v === 2) {
+ continue label;
+ }
+ if (v === 3) {
+ break
+ }
+ if (v === 4) {
+ continue
+ }
+ }
+ }
+
+ if (v === 5) {
+ break label;
+ }
+ if (v === 6) {
+ continue label;
+ }
+ if (v === 7) {
+ break;
+ }
+ if (v === 8) {
+ continue;
+ }
+ }
+
+ class C {
+ static {
+ outer: break outer; // valid
+ loop: while (v) {
+ if (v === 1) break loop; // valid
+ if (v === 2) continue loop; // valid
+ if (v === 3) break; // valid
+ if (v === 4) continue; // valid
+ }
+ switch (v) {
+ default: break; // valid
+ }
+ }
+ }
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock9.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock9.ts
new file mode 100644
index 0000000000..d99157b190
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock9.ts
@@ -0,0 +1,8 @@
+// @target: esnext, es2015, es5
+class A {
+ static bar = A.foo + 1
+ static {
+ A.foo + 2;
+ }
+ static foo = 1;
+}
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef1.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef1.ts
new file mode 100644
index 0000000000..11f8b7f554
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef1.ts
@@ -0,0 +1,15 @@
+// @target: esnext
+// @noEmit: true
+// @strict: true
+
+class C {
+ static x;
+ static {
+ this.x = 1;
+ }
+ static y = this.x;
+ static z;
+ static {
+ this.z = this.y;
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef2.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef2.ts
new file mode 100644
index 0000000000..89658a6ebe
--- /dev/null
+++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlockUseBeforeDef2.ts
@@ -0,0 +1,10 @@
+// @target: esnext
+// @noEmit: true
+// @strict: true
+
+class C {
+ static {
+ this.x = 1;
+ }
+ static x;
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts
index 3760f2176a..83c7d721b0 100644
--- a/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts
+++ b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts
@@ -14,6 +14,7 @@ class A {
}
}
}
+let aa = new A();
class D {
protected constructor() { }
@@ -28,4 +29,5 @@ class D {
class F extends D { // OK
}
}
-}
\ No newline at end of file
+}
+let dd = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues.ts b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues.ts
index bdbcd7f959..c75a4f196b 100644
--- a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues.ts
+++ b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues.ts
@@ -17,4 +17,8 @@ class E<T extends Date> {
constructor(x: T = null) {
var y = x;
}
-}
\ No newline at end of file
+}
+
+let cc = new C(null);
+let dd = new D(null);
+let ee = new E(null);
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmitReadonly.ts b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmitReadonly.ts
index 76b41eabba..ffd568ede1 100644
--- a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmitReadonly.ts
+++ b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmitReadonly.ts
@@ -2,4 +2,5 @@
class C {
constructor(readonly x: number) {}
-}
\ No newline at end of file
+}
+let c7 = new C(1)
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts b/tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts
index c03ce26cc2..e22bf5d126 100644
--- a/tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts
+++ b/tests/cases/conformance/classes/constructorDeclarations/quotedConstructors.ts
@@ -29,3 +29,7 @@ class F {
console.log(this);
}
}
+let c3 =new C()
+let c4 =new D()
+let c5 =new E()
+let c6 =new F()
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesIndexersWithAssignmentCompatibility.ts b/tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesIndexersWithAssignmentCompatibility.ts
index 20243d55be..7806d4f33e 100644
--- a/tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesIndexersWithAssignmentCompatibility.ts
+++ b/tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesIndexersWithAssignmentCompatibility.ts
@@ -14,4 +14,6 @@ class Base2 {
// ok, use assignment compatibility
class Derived2 extends Base2 {
[x: number]: any;
-}
\ No newline at end of file
+}
+let c1 = new Derived()
+let c2 = new Derived2()
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/superInStaticMembers1.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/superInStaticMembers1.ts
new file mode 100644
index 0000000000..fd281b1606
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/superInStaticMembers1.ts
@@ -0,0 +1,492 @@
+// @target: es5, es2015, es2021, esnext
+// @noTypesAndSymbols: true
+
+// @filename: external.ts
+export class Reflect {}
+export interface Foo {}
+export declare namespace Bar { type _ = unknown; }
+export const enum Baz {}
+export default class {};
+
+// @filename: locals.ts
+export {};
+declare class B { static w(): number; }
+class C extends B {
+ static _ = [
+ (() => {
+ var Reflect; // collision (es2015-es2021 only)
+ super.w();
+ })(),
+ (() => {
+ var { Reflect } = { Reflect: null }; // collision (es2015-es2021 only)
+ super.w();
+ })(),
+ (() => {
+ var [Reflect] = [null]; // collision (es2015-es2021 only)
+ super.w();
+ })(),
+ (() => {
+ class Reflect {} // collision (es2015-es2021 only)
+ super.w();
+ })(),
+ (() => {
+ function Reflect() {} // collision (es2015-es2021 only)
+ super.w();
+ })(),
+ (() => {
+ enum Reflect {} // collision (es2015-es2021 only)
+ super.w();
+ })(),
+ (() => {
+ const enum Reflect {} // collision (es2015-es2021 only)
+ super.w();
+ })(),
+ (() => {
+ type Reflect = unknown; // no collision
+ super.w();
+ })(),
+ (() => {
+ interface Reflect {}; // no collision
+ super.w();
+ })(),
+ (() => {
+ (class Reflect {}); // no collision
+ super.w();
+ })(),
+ (() => {
+ (function Reflect() {}); // no collision
+ super.w();
+ })(),
+ ];
+
+ static {
+ var { Reflect } = { Reflect: null }; // collision (es2015-es2021 only)
+ super.w();
+ }
+
+ static {
+ var [Reflect] = [null]; // collision (es2015-es2021 only)
+ super.w();
+ }
+
+ static {
+ var Reflect; // collision (es2015-es2021 only)
+ super.w();
+ }
+
+ static {
+ class Reflect {} // collision (es2015-es2021 only)
+ super.w();
+ }
+
+ static {
+ function Reflect() {} // collision (es2015-es2021 only)
+ super.w();
+ }
+
+ static {
+ enum Reflect {} // collision (es2015-es2021 only)
+ super.w();
+ }
+
+ static {
+ const enum Reflect {} // collision (es2015-es2021 only)
+ super.w();
+ }
+
+ static {
+ type Reflect = unknown; // no collision
+ super.w();
+ }
+
+ static {
+ interface Reflect {} // no collision
+ super.w();
+ }
+
+ static {
+ (class Reflect {}) // no collision
+ super.w();
+ }
+
+ static {
+ (function Reflect() {}) // no collision
+ super.w();
+ }
+}
+
+// @filename: varInContainingScopeStaticField1.ts
+export {};
+declare class B { static w(): number; }
+var Reflect = null; // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: varInContainingScopeStaticField2.ts
+export {};
+declare class B { static w(): number; }
+var { Reflect } = { Reflect: null }; // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: varInContainingScopeStaticField3.ts
+export {};
+declare class B { static w(): number; }
+var [Reflect] = [null]; // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: varInContainingScopeStaticBlock1.ts
+export {};
+declare class B { static w(): number; }
+var Reflect = null; // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: varInContainingScopeStaticBlock2.ts
+export {};
+declare class B { static w(): number; }
+var { Reflect } = { Reflect: null }; // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: varInContainingScopeStaticBlock3.ts
+export {};
+declare class B { static w(): number; }
+var [Reflect] = [null]; // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: classDeclInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+class Reflect {} // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: classDeclInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+class Reflect {} // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: funcDeclInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+function Reflect() {} // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: funcDeclInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+function Reflect() {} // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: valueNamespaceInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+namespace Reflect {} // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: valueNamespaceInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+namespace Reflect {} // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: enumInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+enum Reflect {} // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: enumInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+enum Reflect {} // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: constEnumInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+const enum Reflect {} // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: constEnumInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+const enum Reflect {} // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: namespaceImportInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+import * as Reflect from "./external"; // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: namespaceImportInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+import * as Reflect from "./external"; // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: namedImportInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+import { Reflect } from "./external"; // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: namedImportInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+import { Reflect } from "./external"; // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: namedImportOfInterfaceInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+import { Foo as Reflect } from "./external"; // collision (es2015-es2021 only, not a type-only import)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: namedImportOfInterfaceInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+import { Foo as Reflect } from "./external"; // collision (es2015-es2021 only, not a type-only import)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: namedImportOfUninstantiatedNamespaceInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+import { Bar as Reflect } from "./external"; // collision (es2015-es2021 only, not a type-only import)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: namedImportOfUninstantiatedNamespaceInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+import { Bar as Reflect } from "./external"; // collision (es2015-es2021 only, not a type-only import)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: namedImportOfConstEnumInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+import { Baz as Reflect } from "./external"; // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: namedImportOfConstEnumInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+import { Baz as Reflect } from "./external"; // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: typeOnlyNamedImportInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+import type { Reflect } from "./external"; // no collision
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: typeOnlyNamedImportInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+import type { Reflect } from "./external"; // no collision
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: defaultImportInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+import Reflect from "./external"; // collision (es2015-es2021 only)
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: defaultImportInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+import Reflect from "./external"; // collision (es2015-es2021 only)
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: typeOnlyDefaultImportInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+import type Reflect from "./external"; // no collision
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: typeOnlyDefaultImportInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+import type Reflect from "./external"; // no collision
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: typeInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+type Reflect = unknown; // no collision
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: typeInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+type Reflect = unknown; // no collision
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: interfaceInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+interface Reflect {}; // no collision
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: interfaceInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+interface Reflect {}; // no collision
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: uninstantiatedNamespaceInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+declare namespace Reflect { type _ = unknown; }; // no collision
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: uninstantiatedNamespaceInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+declare namespace Reflect { type _ = unknown; }; // no collision
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: classExprInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+(class Reflect {}); // no collision
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: classExprInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+(class Reflect {}); // no collision
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: inContainingClassExprStaticField.ts
+export {};
+declare class B { static w(): number; }
+(class Reflect { // collision (es2015-es2021 only)
+ static {
+ class C extends B {
+ static _ = super.w();
+ }
+ }
+});
+
+// @filename: inContainingClassExprStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+(class Reflect { // collision (es2015-es2021 only)
+ static {
+ class C extends B {
+ static { super.w(); }
+ }
+ }
+});
+
+// @filename: funcExprInContainingScopeStaticField.ts
+export {};
+declare class B { static w(): number; }
+(function Reflect() {}); // no collision
+class C extends B {
+ static _ = super.w();
+}
+
+// @filename: funcExprInContainingScopeStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+(function Reflect() {}); // no collision
+class C extends B {
+ static { super.w(); }
+}
+
+// @filename: inContainingFuncExprStaticField.ts
+export {};
+declare class B { static w(): number; }
+(function Reflect() { // collision (es2015-es2021 only)
+ class C extends B {
+ static _ = super.w();
+ }
+});
+
+// @filename: inContainingFuncExprStaticBlock.ts
+export {};
+declare class B { static w(): number; }
+(function Reflect() { // collision (es2015-es2021 only)
+ class C extends B {
+ static { super.w(); }
+ }
+});
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers1.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers1.ts
new file mode 100644
index 0000000000..e3bfff9aed
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers1.ts
@@ -0,0 +1,42 @@
+// @target: esnext, es2015
+// @useDefineForClassFields: true
+// @noTypesAndSymbols: true
+
+declare class B {
+ static a: any;
+ static f(): number;
+ a: number;
+ f(): number;
+}
+
+class C extends B {
+ static x: any = undefined!;
+ static y1 = this.x;
+ static y2 = this.x();
+ static y3 = this?.x();
+ static y4 = this[("x")]();
+ static y5 = this?.[("x")]();
+ static z1 = super.a;
+ static z2 = super["a"];
+ static z3 = super.f();
+ static z4 = super["f"]();
+ static z5 = super.a = 0;
+ static z6 = super.a += 1;
+ static z7 = (() => { super.a = 0; })();
+ static z8 = [super.a] = [0];
+ static z9 = [super.a = 0] = [0];
+ static z10 = [...super.a] = [0];
+ static z11 = { x: super.a } = { x: 0 };
+ static z12 = { x: super.a = 0 } = { x: 0 };
+ static z13 = { ...super.a } = { x: 0 };
+ static z14 = ++super.a;
+ static z15 = --super.a;
+ static z16 = ++super[("a")];
+ static z17 = super.a++;
+ static z18 = super.a``;
+
+ // these should be unaffected
+ x = 1;
+ y = this.x;
+ z = super.f();
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers2.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers2.ts
new file mode 100644
index 0000000000..7e751c3d67
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers2.ts
@@ -0,0 +1,42 @@
+// @target: esnext, es2015
+// @useDefineForClassFields: false
+// @noTypesAndSymbols: true
+
+declare class B {
+ static a: any;
+ static f(): number;
+ a: number;
+ f(): number;
+}
+
+class C extends B {
+ static x: any = undefined!;
+ static y1 = this.x;
+ static y2 = this.x();
+ static y3 = this?.x();
+ static y4 = this[("x")]();
+ static y5 = this?.[("x")]();
+ static z1 = super.a;
+ static z2 = super["a"];
+ static z3 = super.f();
+ static z4 = super["f"]();
+ static z5 = super.a = 0;
+ static z6 = super.a += 1;
+ static z7 = (() => { super.a = 0; })();
+ static z8 = [super.a] = [0];
+ static z9 = [super.a = 0] = [0];
+ static z10 = [...super.a] = [0];
+ static z11 = { x: super.a } = { x: 0 };
+ static z12 = { x: super.a = 0 } = { x: 0 };
+ static z13 = { ...super.a } = { x: 0 };
+ static z14 = ++super.a;
+ static z15 = --super.a;
+ static z16 = ++super[("a")];
+ static z17 = super.a++;
+ static z18 = super.a``;
+
+ // these should be unaffected
+ x = 1;
+ y = this.x;
+ z = super.f();
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers3.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers3.ts
new file mode 100644
index 0000000000..413c7c54bc
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers3.ts
@@ -0,0 +1,26 @@
+// @target: es5
+// @useDefineForClassFields: true
+// @noTypesAndSymbols: true
+
+declare class B {
+ static a: any;
+ static f(): number;
+ a: number;
+ f(): number;
+}
+
+class C extends B {
+ static x: any = undefined!;
+ static y1 = this.x;
+ static y2 = this.x();
+ static y3 = this?.x();
+ static y4 = this[("x")]();
+ static y5 = this?.[("x")]();
+ static z3 = super.f();
+ static z4 = super["f"]();
+
+ // these should be unaffected
+ x = 1;
+ y = this.x;
+ z = super.f();
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers4.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers4.ts
new file mode 100644
index 0000000000..aad82e41dc
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/thisAndSuperInStaticMembers4.ts
@@ -0,0 +1,26 @@
+// @target: es5
+// @useDefineForClassFields: false
+// @noTypesAndSymbols: true
+
+declare class B {
+ static a: any;
+ static f(): number;
+ a: number;
+ f(): number;
+}
+
+class C extends B {
+ static x: any = undefined!;
+ static y1 = this.x;
+ static y2 = this.x();
+ static y3 = this?.x();
+ static y4 = this[("x")]();
+ static y5 = this?.[("x")]();
+ static z3 = super.f();
+ static z4 = super["f"]();
+
+ // these should be unaffected
+ x = 1;
+ y = this.x;
+ z = super.f();
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers.ts
index dcba533725..f05e58dcb5 100644
--- a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers.ts
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers.ts
@@ -30,4 +30,5 @@ var t2 = C2.bar();
var r5 = t2.foo + 1;
var r6 = t2.bar();
var r7 = new t2('');
-
+let b2 = new C(1)
+let b3 = new C2('null')
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers10.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers10.ts
new file mode 100644
index 0000000000..bb458c87d2
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers10.ts
@@ -0,0 +1,51 @@
+// @target: esnext, es6, es5
+// @experimentalDecorators: true
+// @useDefineForClassFields: false
+
+declare const foo: any;
+
+@foo
+class C {
+ static a = 1;
+ static b = this.a + 1;
+}
+
+@foo
+class D extends C {
+ static c = 2;
+ static d = this.c + 1;
+ static e = super.a + this.c + 1;
+ static f = () => this.c + 1;
+ static ff = function () { this.c + 1 }
+ static foo () {
+ return this.c + 1;
+ }
+ static get fa () {
+ return this.c + 1;
+ }
+ static set fa (v: number) {
+ this.c = v + 1;
+ }
+}
+
+class CC {
+ static a = 1;
+ static b = this.a + 1;
+}
+
+class DD extends CC {
+ static c = 2;
+ static d = this.c + 1;
+ static e = super.a + this.c + 1;
+ static f = () => this.c + 1;
+ static ff = function () { this.c + 1 }
+ static foo () {
+ return this.c + 1;
+ }
+ static get fa () {
+ return this.c + 1;
+ }
+ static set fa (v: number) {
+ this.c = v + 1;
+ }
+}
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers11.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers11.ts
new file mode 100644
index 0000000000..6c4025bc47
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers11.ts
@@ -0,0 +1,51 @@
+// @target: esnext, es6, es5
+// @experimentalDecorators: true
+// @useDefineForClassFields: true
+
+declare const foo: any;
+
+@foo
+class C {
+ static a = 1;
+ static b = this.a + 1;
+}
+
+@foo
+class D extends C {
+ static c = 2;
+ static d = this.c + 1;
+ static e = super.a + this.c + 1;
+ static f = () => this.c + 1;
+ static ff = function () { this.c + 1 }
+ static foo () {
+ return this.c + 1;
+ }
+ static get fa () {
+ return this.c + 1;
+ }
+ static set fa (v: number) {
+ this.c = v + 1;
+ }
+}
+
+class CC {
+ static a = 1;
+ static b = this.a + 1;
+}
+
+class DD extends CC {
+ static c = 2;
+ static d = this.c + 1;
+ static e = super.a + this.c + 1;
+ static f = () => this.c + 1;
+ static ff = function () { this.c + 1 }
+ static foo () {
+ return this.c + 1;
+ }
+ static get fa () {
+ return this.c + 1;
+ }
+ static set fa (v: number) {
+ this.c = v + 1;
+ }
+}
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers12.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers12.ts
new file mode 100644
index 0000000000..041089512b
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers12.ts
@@ -0,0 +1,10 @@
+// @target: esnext, es6, es5
+// @useDefineForClassFields: false
+
+class C {
+ static readonly c: "foo" = "foo"
+ static bar = class Inner {
+ static [this.c] = 123;
+ [this.c] = 123;
+ }
+}
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers13.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers13.ts
new file mode 100644
index 0000000000..6c965e0e2d
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers13.ts
@@ -0,0 +1,10 @@
+// @target: esnext, es6, es5
+// @useDefineForClassFields: true
+
+class C {
+ static readonly c: "foo" = "foo"
+ static bar = class Inner {
+ static [this.c] = 123;
+ [this.c] = 123;
+ }
+}
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers3.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers3.ts
new file mode 100644
index 0000000000..27541ce361
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers3.ts
@@ -0,0 +1,12 @@
+// @target: esnext, es6, es5
+// @useDefineForClassFields: false
+class C {
+ static a = 1;
+ static b = this.a + 1;
+}
+
+class D extends C {
+ static c = 2;
+ static d = this.c + 1;
+ static e = super.a + this.c + 1;
+}
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers4.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers4.ts
new file mode 100644
index 0000000000..0d08423bb9
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers4.ts
@@ -0,0 +1,12 @@
+// @target: esnext, es6, es5
+// @useDefineForClassFields: true
+class C {
+ static a = 1;
+ static b = this.a + 1;
+}
+
+class D extends C {
+ static c = 2;
+ static d = this.c + 1;
+ static e = super.a + this.c + 1;
+}
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers5.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers5.ts
new file mode 100644
index 0000000000..db6e8a76c6
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers5.ts
@@ -0,0 +1,9 @@
+// @target: esnext, es6, es5
+
+class C {
+ static create = () => new this("yep")
+
+ constructor (private foo: string) {
+
+ }
+}
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers6.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers6.ts
new file mode 100644
index 0000000000..b27d0855a2
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers6.ts
@@ -0,0 +1,7 @@
+class C {
+ static f = 1
+}
+
+class D extends C {
+ static c = super();
+}
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers7.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers7.ts
new file mode 100644
index 0000000000..1a2d9cd2e2
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers7.ts
@@ -0,0 +1,12 @@
+// @target: esnext, es6, es5
+
+class C {
+ static a = 1;
+ static b = this.a + 1;
+}
+
+class D extends C {
+ static c = 2;
+ static d = this.c + 1;
+ static e = 1 + (super.a) + (this.c + 1) + 1;
+}
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers8.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers8.ts
new file mode 100644
index 0000000000..8b26476f14
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers8.ts
@@ -0,0 +1,19 @@
+// @target: esnext, es6, es5
+
+class C {
+ static f = 1;
+ static arrowFunctionBoundary = () => this.f + 1;
+ static functionExprBoundary = function () { return this.f + 2 };
+ static classExprBoundary = class { a = this.f + 3 };
+ static functionAndClassDeclBoundary = (() => {
+ function foo () {
+ return this.f + 4
+ }
+ class CC {
+ a = this.f + 5
+ method () {
+ return this.f + 6
+ }
+ }
+ })();
+}
diff --git a/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers9.ts b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers9.ts
new file mode 100644
index 0000000000..0a648d2fa0
--- /dev/null
+++ b/tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers9.ts
@@ -0,0 +1,22 @@
+// @target: esnext, es6, es5
+
+class C {
+ static f = 1
+}
+
+class D extends C {
+ static arrowFunctionBoundary = () => super.f + 1;
+ static functionExprBoundary = function () { return super.f + 2 };
+ static classExprBoundary = class { a = super.f + 3 };
+ static functionAndClassDeclBoundary = (() => {
+ function foo () {
+ return super.f + 4
+ }
+ class C {
+ a = super.f + 5
+ method () {
+ return super.f +6
+ }
+ }
+ })();
+}
diff --git a/tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName3.ts b/tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName3.ts
index 09573f98c9..f57d3afc8b 100644
--- a/tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName3.ts
+++ b/tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName3.ts
@@ -23,3 +23,5 @@ class Foo {
}
console.log(new Foo("NAME").getValue(100));
+
+let ff = new Foo(null)
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/members/privateNames/privateNameFieldAccess.ts b/tests/cases/conformance/classes/members/privateNames/privateNameFieldAccess.ts
index 4c02159bfa..af502334e7 100644
--- a/tests/cases/conformance/classes/members/privateNames/privateNameFieldAccess.ts
+++ b/tests/cases/conformance/classes/members/privateNames/privateNameFieldAccess.ts
@@ -6,3 +6,4 @@ class A {
console.log(this.#myField);
}
}
+let aa = new A();
diff --git a/tests/cases/conformance/classes/members/privateNames/privateNameHashCharName.ts b/tests/cases/conformance/classes/members/privateNames/privateNameHashCharName.ts
new file mode 100644
index 0000000000..4a076565bf
--- /dev/null
+++ b/tests/cases/conformance/classes/members/privateNames/privateNameHashCharName.ts
@@ -0,0 +1,11 @@
+// @target: es6
+
+#
+
+class C {
+ #
+
+ m() {
+ this.#
+ }
+}
diff --git a/tests/cases/conformance/classes/members/privateNames/privateNameInInExpression.ts b/tests/cases/conformance/classes/members/privateNames/privateNameInInExpression.ts
new file mode 100644
index 0000000000..e274378150
--- /dev/null
+++ b/tests/cases/conformance/classes/members/privateNames/privateNameInInExpression.ts
@@ -0,0 +1,119 @@
+// @strict: true
+// @target: esnext
+// @useDefineForClassFields: true
+
+class Foo {
+ #field = 1;
+ static #staticField = 2;
+ #method() {}
+ static #staticMethod() {}
+
+ goodRhs(v: any) {
+ const a = #field in v;
+
+ const b = #field in v.p1.p2;
+
+ const c = #field in (v as {});
+
+ const d = #field in (v as Foo);
+
+ const e = #field in (v as never);
+
+ for (let f in #field in v as any) { /**/ } // unlikely but valid
+ }
+ badRhs(v: any) {
+ const a = #field in (v as unknown); // Bad - RHS of in must be object type or any
+
+ const b = #fiel in v; // Bad - typo in privateID
+
+ const c = (#field) in v; // Bad - privateID is not an expression on its own
+
+ for (#field in v) { /**/ } // Bad - 'in' not allowed
+
+ for (let d in #field in v) { /**/ } // Bad - rhs of in should be a object/any
+ }
+ whitespace(v: any) {
+ const a = v && /*0*/#field/*1*/
+ /*2*/in/*3*/
+ /*4*/v/*5*/
+ }
+ flow(u: unknown, n: never, fb: Foo | Bar, fs: FooSub, b: Bar, fsb: FooSub | Bar, fsfb: Foo | FooSub | Bar) {
+
+ if (typeof u === 'object') {
+ if (#field in n) {
+ n; // good n is never
+ }
+
+ if (#field in u) {
+ u; // good u is Foo
+ } else {
+ u; // good u is object | null
+ }
+
+ if (u !== null) {
+ if (#field in u) {
+ u; // good u is Foo
+ } else {
+ u; // good u is object
+ }
+
+ if (#method in u) {
+ u; // good u is Foo
+ }
+
+ if (#staticField in u) {
+ u; // good u is typeof Foo
+ }
+
+ if (#staticMethod in u) {
+ u; // good u is typeof Foo
+ }
+ }
+ }
+
+ if (#field in fb) {
+ fb; // good fb is Foo
+ } else {
+ fb; // good fb is Bar
+ }
+
+ if (#field in fs) {
+ fs; // good fs is FooSub
+ } else {
+ fs; // good fs is never
+ }
+
+ if (#field in b) {
+ b; // good b is 'Bar & Foo'
+ } else {
+ b; // good b is Bar
+ }
+
+ if (#field in fsb) {
+ fsb; // good fsb is FooSub
+ } else {
+ fsb; // good fsb is Bar
+ }
+
+ if (#field in fsfb) {
+ fsfb; // good fsfb is 'Foo | FooSub'
+ } else {
+ fsfb; // good fsfb is Bar
+ }
+
+ class Nested {
+ m(v: any) {
+ if (#field in v) {
+ v; // good v is Foo
+ }
+ }
+ }
+ }
+}
+
+class FooSub extends Foo { subTypeOfFoo = true }
+class Bar { notFoo = true }
+
+function badSyntax(v: Foo) {
+ return #field in v; // Bad - outside of class
+}
diff --git a/tests/cases/conformance/classes/members/privateNames/privateNameInInExpressionTransform.ts b/tests/cases/conformance/classes/members/privateNames/privateNameInInExpressionTransform.ts
new file mode 100644
index 0000000000..f7be176373
--- /dev/null
+++ b/tests/cases/conformance/classes/members/privateNames/privateNameInInExpressionTransform.ts
@@ -0,0 +1,47 @@
+// @target: esnext, es2020
+
+class Foo {
+ #field = 1;
+ #method() {}
+ static #staticField= 2;
+ static #staticMethod() {}
+
+ check(v: any) {
+ #field in v; // expect Foo's 'field' WeakMap
+ #method in v; // expect Foo's 'instances' WeakSet
+ #staticField in v; // expect Foo's constructor
+ #staticMethod in v; // expect Foo's constructor
+ }
+ precedence(v: any) {
+ // '==' and '||' have lower precedence than 'in'
+ // 'in' naturally has same precedence as 'in'
+ // '<<' has higher precedence than 'in'
+
+ v == #field in v || v; // Good precedence: (v == (#field in v)) || v
+
+ v << #field in v << v; // Good precedence (SyntaxError): (v << #field) in (v << v)
+
+ v << #field in v == v; // Good precedence (SyntaxError): ((v << #field) in v) == v
+
+ v == #field in v in v; // Good precedence: v == ((#field in v) in v)
+
+ #field in v && #field in v; // Good precedence: (#field in v) && (#field in v)
+ }
+ invalidLHS(v: any) {
+ 'prop' in v = 10;
+ #field in v = 10;
+ }
+}
+
+class Bar {
+ #field = 1;
+ check(v: any) {
+ #field in v; // expect Bar's 'field' WeakMap
+ }
+}
+
+function syntaxError(v: Foo) {
+ return #field in v; // expect `return in v` so runtime will have a syntax error
+}
+
+export { }
diff --git a/tests/cases/conformance/classes/members/privateNames/privateNameInInExpressionUnused.ts b/tests/cases/conformance/classes/members/privateNames/privateNameInInExpressionUnused.ts
new file mode 100644
index 0000000000..4b214a2b9e
--- /dev/null
+++ b/tests/cases/conformance/classes/members/privateNames/privateNameInInExpressionUnused.ts
@@ -0,0 +1,13 @@
+// @strict: true
+// @noUnusedLocals: true
+// @target: esnext
+
+class Foo {
+ #unused: undefined; // expect unused error
+ #brand: undefined; // expect no error
+
+ isFoo(v: any): v is Foo {
+ // This should count as using/reading '#brand'
+ return #brand in v;
+ }
+}
diff --git a/tests/cases/conformance/classes/members/privateNames/privateNamesIncompatibleModifiersJs.ts b/tests/cases/conformance/classes/members/privateNames/privateNamesIncompatibleModifiersJs.ts
new file mode 100644
index 0000000000..5154b5e439
--- /dev/null
+++ b/tests/cases/conformance/classes/members/privateNames/privateNamesIncompatibleModifiersJs.ts
@@ -0,0 +1,65 @@
+// @allowJs: true
+// @checkJs: true
+// @strict: true
+// @target: es6
+// @outDir: ./out
+// @filename: privateNamesIncompatibleModifiersJs.js
+
+class A {
+ /**
+ * @public
+ */
+ #a = 1;
+
+ /**
+ * @private
+ */
+ #b = 1;
+
+ /**
+ * @protected
+ */
+ #c = 1;
+
+ /**
+ * @public
+ */
+ #aMethod() { return 1; }
+
+ /**
+ * @private
+ */
+ #bMethod() { return 1; }
+
+ /**
+ * @protected
+ */
+ #cMethod() { return 1; }
+
+ /**
+ * @public
+ */
+ get #aProp() { return 1; }
+ /**
+ * @public
+ */
+ set #aProp(value) { }
+
+ /**
+ * @private
+ */
+ get #bProp() { return 1; }
+ /**
+ * @private
+ */
+ set #bProp(value) { }
+
+ /**
+ * @protected
+ */
+ get #cProp() { return 1; }
+ /**
+ * @protected
+ */
+ set #cProp(value) { }
+}
diff --git a/tests/cases/conformance/classes/mixinClassesAnnotated.ts b/tests/cases/conformance/classes/mixinClassesAnnotated.ts
index 62f5e30c9a..8bca7d06d1 100644
--- a/tests/cases/conformance/classes/mixinClassesAnnotated.ts
+++ b/tests/cases/conformance/classes/mixinClassesAnnotated.ts
@@ -36,6 +36,7 @@ function Tagged<T extends Constructor<{}>>(superClass: T): Constructor<Tagged> &
this._tag = "hello";
}
}
+ let c = new C();
return C;
}
@@ -65,3 +66,5 @@ class Thing3 extends Thing2 {
this.print();
}
}
+let der = new Derived(1,1,1);
+let th3 = new Thing3('');
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/mixinClassesAnonymous.ts b/tests/cases/conformance/classes/mixinClassesAnonymous.ts
index 0e42288808..aa639e71e3 100644
--- a/tests/cases/conformance/classes/mixinClassesAnonymous.ts
+++ b/tests/cases/conformance/classes/mixinClassesAnonymous.ts
@@ -62,3 +62,5 @@ const Timestamped = <CT extends Constructor<object>>(Base: CT) => {
timestamp = new Date();
};
}
+let aa = new Derived(1,1,1);
+let bb = new Thing3('');
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/mixinClassesMembers.ts b/tests/cases/conformance/classes/mixinClassesMembers.ts
index 905518c88f..7deb2ac30b 100644
--- a/tests/cases/conformance/classes/mixinClassesMembers.ts
+++ b/tests/cases/conformance/classes/mixinClassesMembers.ts
@@ -97,3 +97,8 @@ class C3 extends Mixed3 {
}
f() { return super.f(); }
}
+let aa = new C1('');
+let bb = new M1();
+let cc = new M2();
+let dd = new C2();
+let ee = new C3();
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/abstractProperty.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/abstractProperty.ts
index 5f7266c0ea..7870b163db 100644
--- a/tests/cases/conformance/classes/propertyMemberDeclarations/abstractProperty.ts
+++ b/tests/cases/conformance/classes/propertyMemberDeclarations/abstractProperty.ts
@@ -14,3 +14,6 @@ class B extends A {
class C extends A {
protected get x() { return 'C.x' };
}
+
+let b = new B();
+let c = new C();
diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/abstractPropertyInitializer.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/abstractPropertyInitializer.ts
new file mode 100644
index 0000000000..42a0999748
--- /dev/null
+++ b/tests/cases/conformance/classes/propertyMemberDeclarations/abstractPropertyInitializer.ts
@@ -0,0 +1,5 @@
+// @strict: true
+// @declaration: true
+abstract class C {
+ abstract prop = 1
+}
diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberInitialization.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberInitialization.ts
index 04b44a6835..d7c518964d 100644
--- a/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberInitialization.ts
+++ b/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberInitialization.ts
@@ -4,8 +4,8 @@ class C {
var c = new C();
c.x = 3;
-var c2 = new C();
-var r = c.x === c2.x;
+// var c2 = new C();
+// var r = c.x === c2.x;
// #31792
@@ -14,4 +14,5 @@ var r = c.x === c2.x;
class MyMap<K, V> {
constructor(private readonly Map_: { new<K, V>(): any }) {}
private readonly store = new this.Map_<K, V>();
-}
\ No newline at end of file
+}
+let mm = new MyMap(null)
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName2.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName2.ts
index e597b6b9d9..ed03d54763 100644
--- a/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName2.ts
+++ b/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName2.ts
@@ -6,3 +6,4 @@ const x = 1;
class C {
[x]: string;
}
+let cc = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/staticFactory1.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/staticFactory1.ts
index 5d786cd4cf..0277ffa658 100644
--- a/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/staticFactory1.ts
+++ b/tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/staticFactory1.ts
@@ -10,4 +10,5 @@ class Derived extends Base {
}
var d = Derived.create();
-d.foo();
\ No newline at end of file
+d.foo();
+let b1 =new Derived()
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/staticAndNonStaticPropertiesSameName.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/staticAndNonStaticPropertiesSameName.ts
index 06a784c782..d3b03f9716 100644
--- a/tests/cases/conformance/classes/propertyMemberDeclarations/staticAndNonStaticPropertiesSameName.ts
+++ b/tests/cases/conformance/classes/propertyMemberDeclarations/staticAndNonStaticPropertiesSameName.ts
@@ -4,4 +4,5 @@ class C {
f() { }
static f() { }
-}
\ No newline at end of file
+}
+let a4 = new C()
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyAndFunctionWithSameName.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyAndFunctionWithSameName.ts
index 4566ce26f0..4a275f4eef 100644
--- a/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyAndFunctionWithSameName.ts
+++ b/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyAndFunctionWithSameName.ts
@@ -6,4 +6,6 @@ class C {
class D {
static f: number;
f() { }
-}
\ No newline at end of file
+}
+let a2 =new C()
+let a3 = new D()
\ No newline at end of file
diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflictsInAmbientContext.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflictsInAmbientContext.ts
index 198c923b0d..d937176b83 100644
--- a/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflictsInAmbientContext.ts
+++ b/tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflictsInAmbientContext.ts
@@ -54,3 +54,13 @@ declare class StaticArgumentsFn {
static arguments(): any; // ok
arguments(): any; // ok
}
+let a5 =new StaticName()
+let a6 =new StaticNameFn()
+let a7 =new StaticLength()
+let a8 =new StaticLengthFn()
+let a9 =new StaticPrototype()
+let a10 =new StaticPrototypeFn()
+let a11 =new StaticCaller()
+let a12 =new StaticCallerFn()
+let a13 =new StaticArguments()
+let a14 =new StaticArgumentsFn()
\ No newline at end of file
diff --git a/tests/cases/conformance/controlFlow/assertionTypePredicates2.ts b/tests/cases/conformance/controlFlow/assertionTypePredicates2.ts
new file mode 100644
index 0000000000..915c9ae94f
--- /dev/null
+++ b/tests/cases/conformance/controlFlow/assertionTypePredicates2.ts
@@ -0,0 +1,27 @@
+// @allowJs: true
+// @checkJs: true
+// @outDir: ./out
+// @filename: assertionTypePredicates2.js
+
+/**
+ * @typedef {{ x: number }} A
+ */
+
+/**
+ * @typedef { A & { y: number } } B
+ */
+
+/**
+ * @param {A} a
+ * @returns { asserts a is B }
+ */
+const foo = (a) => {
+ if (/** @type { B } */ (a).y !== 0) throw TypeError();
+ return undefined;
+};
+
+export const main = () => {
+ /** @type { A } */
+ const a = { x: 1 };
+ foo(a);
+};
diff --git a/tests/cases/conformance/controlFlow/controlFlowAliasing.ts b/tests/cases/conformance/controlFlow/controlFlowAliasing.ts
new file mode 100644
index 0000000000..03b7530921
--- /dev/null
+++ b/tests/cases/conformance/controlFlow/controlFlowAliasing.ts
@@ -0,0 +1,285 @@
+// @strict: true
+// @declaration: true
+
+// Narrowing by aliased conditional expressions
+
+function f10(x: string | number) {
+ const isString = typeof x === "string";
+ if (isString) {
+ let t: string = x;
+ }
+ else {
+ let t: number = x;
+ }
+}
+
+function f11(x: unknown) {
+ const isString = typeof x === "string";
+ if (isString) {
+ let t: string = x;
+ }
+}
+
+function f12(x: string | number | boolean) {
+ const isString = typeof x === "string";
+ const isNumber = typeof x === "number";
+ if (isString || isNumber) {
+ let t: string | number = x;
+ }
+ else {
+ let t: boolean = x;
+ }
+}
+
+function f13(x: string | number | boolean) {
+ const isString = typeof x === "string";
+ const isNumber = typeof x === "number";
+ const isStringOrNumber = isString || isNumber;
+ if (isStringOrNumber) {
+ let t: string | number = x;
+ }
+ else {
+ let t: boolean = x;
+ }
+}
+
+function f14(x: number | null | undefined): number | null {
+ const notUndefined = x !== undefined;
+ return notUndefined ? x : 0;
+}
+
+function f15(obj: { readonly x: string | number }) {
+ const isString = typeof obj.x === 'string';
+ if (isString) {
+ let s: string = obj.x;
+ }
+}
+
+function f16(obj: { readonly x: string | number }) {
+ const isString = typeof obj.x === 'string';
+ obj = { x: 42 };
+ if (isString) {
+ let s: string = obj.x; // Not narrowed because of is assigned in function body
+ }
+}
+
+function f17(obj: readonly [string | number]) {
+ const isString = typeof obj[0] === 'string';
+ if (isString) {
+ let s: string = obj[0];
+ }
+}
+
+function f18(obj: readonly [string | number]) {
+ const isString = typeof obj[0] === 'string';
+ obj = [42];
+ if (isString) {
+ let s: string = obj[0]; // Not narrowed because of is assigned in function body
+ }
+}
+
+function f20(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ const isFoo = obj.kind === 'foo';
+ if (isFoo) {
+ obj.foo;
+ }
+ else {
+ obj.bar;
+ }
+}
+
+function f21(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ const isFoo: boolean = obj.kind === 'foo';
+ if (isFoo) {
+ obj.foo; // Not narrowed because isFoo has type annotation
+ }
+ else {
+ obj.bar; // Not narrowed because isFoo has type annotation
+ }
+}
+
+function f22(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ let isFoo = obj.kind === 'foo';
+ if (isFoo) {
+ obj.foo; // Not narrowed because isFoo is mutable
+ }
+ else {
+ obj.bar; // Not narrowed because isFoo is mutable
+ }
+}
+
+function f23(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ const isFoo = obj.kind === 'foo';
+ obj = obj;
+ if (isFoo) {
+ obj.foo; // Not narrowed because obj is assigned in function body
+ }
+ else {
+ obj.bar; // Not narrowed because obj is assigned in function body
+ }
+}
+
+function f24(arg: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ const obj = arg;
+ const isFoo = obj.kind === 'foo';
+ if (isFoo) {
+ obj.foo;
+ }
+ else {
+ obj.bar;
+ }
+}
+
+function f25(arg: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ let obj = arg;
+ const isFoo = obj.kind === 'foo';
+ if (isFoo) {
+ obj.foo; // Not narrowed because obj is mutable
+ }
+ else {
+ obj.bar; // Not narrowed because obj is mutable
+ }
+}
+
+function f26(outer: { readonly obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number } }) {
+ const isFoo = outer.obj.kind === 'foo';
+ if (isFoo) {
+ outer.obj.foo;
+ }
+ else {
+ outer.obj.bar;
+ }
+}
+
+function f27(outer: { obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number } }) {
+ const isFoo = outer.obj.kind === 'foo';
+ if (isFoo) {
+ outer.obj.foo; // Not narrowed because obj is mutable
+ }
+ else {
+ outer.obj.bar; // Not narrowed because obj is mutable
+ }
+}
+
+function f28(obj?: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ const isFoo = obj && obj.kind === 'foo';
+ const isBar = obj && obj.kind === 'bar';
+ if (isFoo) {
+ obj.foo;
+ }
+ if (isBar) {
+ obj.bar;
+ }
+}
+
+// Narrowing by aliased discriminant property access
+
+function f30(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ const kind = obj.kind;
+ if (kind === 'foo') {
+ obj.foo;
+ }
+ else {
+ obj.bar;
+ }
+}
+
+function f31(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ const { kind } = obj;
+ if (kind === 'foo') {
+ obj.foo;
+ }
+ else {
+ obj.bar;
+ }
+}
+
+function f32(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ const { kind: k } = obj;
+ if (k === 'foo') {
+ obj.foo;
+ }
+ else {
+ obj.bar;
+ }
+}
+
+function f33(obj: { kind: 'foo', foo: string } | { kind: 'bar', bar: number }) {
+ const { kind } = obj;
+ switch (kind) {
+ case 'foo': obj.foo; break;
+ case 'bar': obj.bar; break;
+ }
+}
+
+
+class C10 {
+ constructor(readonly x: string | number) {
+ const thisX_isString = typeof this.x === 'string';
+ const xIsString = typeof x === 'string';
+ if (thisX_isString && xIsString) {
+ let s: string;
+ s = this.x;
+ s = x;
+ }
+ }
+}
+
+class C11 {
+ constructor(readonly x: string | number) {
+ const thisX_isString = typeof this.x === 'string';
+ const xIsString = typeof x === 'string';
+ if (thisX_isString && xIsString) {
+ // Some narrowings may be invalidated due to later assignments.
+ let s: string;
+ s = this.x;
+ s = x;
+ }
+ else {
+ this.x = 10;
+ x = 10;
+ }
+ }
+}
+
+// Mixing of aliased discriminants and conditionals
+
+function f40(obj: { kind: 'foo', foo?: string } | { kind: 'bar', bar?: number }) {
+ const { kind } = obj;
+ const isFoo = kind == 'foo';
+ if (isFoo && obj.foo) {
+ let t: string = obj.foo;
+ }
+}
+
+// Unsupported narrowing of destructured payload by destructured discriminant
+
+type Data = { kind: 'str', payload: string } | { kind: 'num', payload: number };
+
+function gg2(obj: Data) {
+ if (obj.kind === 'str') {
+ let t: string = obj.payload;
+ }
+ else {
+ let t: number = obj.payload;
+ }
+}
+
+function foo({ kind, payload }: Data) {
+ if (kind === 'str') {
+ let t: string = payload;
+ }
+ else {
+ let t: number = payload;
+ }
+}
+
+// Repro from #45830
+
+const obj = {
+ fn: () => true
+};
+
+if (a) { }
+
+const a = obj.fn();
diff --git a/tests/cases/conformance/controlFlow/controlFlowAliasingCatchVariables.ts b/tests/cases/conformance/controlFlow/controlFlowAliasingCatchVariables.ts
new file mode 100644
index 0000000000..a746fa1cd0
--- /dev/null
+++ b/tests/cases/conformance/controlFlow/controlFlowAliasingCatchVariables.ts
@@ -0,0 +1,28 @@
+// @useUnknownInCatchVariables: true,false
+
+try {}
+catch (e) {
+ const isString = typeof e === 'string';
+ if (isString) {
+ e.toUpperCase(); // e string
+ }
+
+ if (typeof e === 'string') {
+ e.toUpperCase(); // e string
+ }
+}
+
+try {}
+catch (e) {
+ const isString = typeof e === 'string';
+
+ e = 1;
+
+ if (isString) {
+ e.toUpperCase(); // e any/unknown
+ }
+
+ if (typeof e === 'string') {
+ e.toUpperCase(); // e string
+ }
+}
diff --git a/tests/cases/conformance/controlFlow/controlFlowElementAccess2.ts b/tests/cases/conformance/controlFlow/controlFlowElementAccess2.ts
index fa0592c973..17a2af7895 100644
--- a/tests/cases/conformance/controlFlow/controlFlowElementAccess2.ts
+++ b/tests/cases/conformance/controlFlow/controlFlowElementAccess2.ts
@@ -10,4 +10,4 @@ if (typeof config['works'] !== 'boolean') {
if (typeof config.works !== 'boolean') {
config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string }
config.works.prop = 'test'; // ok
-}
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/controlFlow/controlFlowForInStatement2.ts b/tests/cases/conformance/controlFlow/controlFlowForInStatement2.ts
new file mode 100644
index 0000000000..450e50cadc
--- /dev/null
+++ b/tests/cases/conformance/controlFlow/controlFlowForInStatement2.ts
@@ -0,0 +1,25 @@
+const keywordA = 'a';
+const keywordB = 'b';
+
+type A = { [keywordA]: number };
+type B = { [keywordB]: string };
+
+declare const c: A | B;
+
+if ('a' in c) {
+ c; // narrowed to `A`
+}
+
+if (keywordA in c) {
+ c; // also narrowed to `A`
+}
+
+let stringB: string = 'b';
+
+if ((stringB as 'b') in c) {
+ c; // narrowed to `B`
+}
+
+if ((stringB as ('a' | 'b')) in c) {
+ c; // not narrowed
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/controlFlow/controlFlowInOperator.ts b/tests/cases/conformance/controlFlow/controlFlowInOperator.ts
new file mode 100644
index 0000000000..5dc27c45e8
--- /dev/null
+++ b/tests/cases/conformance/controlFlow/controlFlowInOperator.ts
@@ -0,0 +1,26 @@
+const a = 'a';
+const b = 'b';
+const d = 'd';
+
+type A = { [a]: number; };
+type B = { [b]: string; };
+
+declare const c: A | B;
+
+if ('a' in c) {
+ c; // A
+ c['a']; // number;
+}
+
+if ('d' in c) {
+ c; // never
+}
+
+if (a in c) {
+ c; // A
+ c[a]; // number;
+}
+
+if (d in c) {
+ c; // never
+}
diff --git a/tests/cases/conformance/controlFlow/controlFlowInstanceofExtendsFunction.ts b/tests/cases/conformance/controlFlow/controlFlowInstanceofExtendsFunction.ts
index 4a1ff7ff86..8780db0c12 100644
--- a/tests/cases/conformance/controlFlow/controlFlowInstanceofExtendsFunction.ts
+++ b/tests/cases/conformance/controlFlow/controlFlowInstanceofExtendsFunction.ts
@@ -29,4 +29,6 @@ export const x: X | number = Math.random() > 0.5 ? new X() : 1
if (x instanceof X) {
x.why() // should compile
-}
\ No newline at end of file
+}
+let xx = new X();
+let yy = new Y();
\ No newline at end of file
diff --git a/tests/cases/conformance/controlFlow/controlFlowSuperPropertyAccess.ts b/tests/cases/conformance/controlFlow/controlFlowSuperPropertyAccess.ts
index b42af687c0..b3710bae0d 100644
--- a/tests/cases/conformance/controlFlow/controlFlowSuperPropertyAccess.ts
+++ b/tests/cases/conformance/controlFlow/controlFlowSuperPropertyAccess.ts
@@ -7,3 +7,4 @@ class C extends B {
super.m && super.m();
}
}
+let qq3 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/controlFlow/controlFlowTypeofObject.ts b/tests/cases/conformance/controlFlow/controlFlowTypeofObject.ts
new file mode 100644
index 0000000000..db134447ed
--- /dev/null
+++ b/tests/cases/conformance/controlFlow/controlFlowTypeofObject.ts
@@ -0,0 +1,71 @@
+// @strict: true
+// @declaration: true
+
+declare function obj(x: object): void;
+
+function f1(x: unknown) {
+ if (!x) {
+ return;
+ }
+ if (typeof x === 'object') {
+ obj(x);
+ }
+}
+
+function f2(x: unknown) {
+ if (x === null) {
+ return;
+ }
+ if (typeof x === 'object') {
+ obj(x);
+ }
+}
+
+function f3(x: unknown) {
+ if (x == null) {
+ return;
+ }
+ if (typeof x === 'object') {
+ obj(x);
+ }
+}
+
+function f4(x: unknown) {
+ if (x == undefined) {
+ return;
+ }
+ if (typeof x === 'object') {
+ obj(x);
+ }
+}
+
+function f5(x: unknown) {
+ if (!!true) {
+ if (!x) {
+ return;
+ }
+ }
+ else {
+ if (x === null) {
+ return;
+ }
+ }
+ if (typeof x === 'object') {
+ obj(x);
+ }
+}
+
+function f6(x: unknown) {
+ if (x === null) {
+ x;
+ }
+ else {
+ x;
+ if (typeof x === 'object') {
+ obj(x);
+ }
+ }
+ if (typeof x === 'object') {
+ obj(x); // Error
+ }
+}
diff --git a/tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts b/tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts
new file mode 100644
index 0000000000..55e95ddf09
--- /dev/null
+++ b/tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts
@@ -0,0 +1,161 @@
+// @strict: true
+// @declaration: true
+// @target: es2015
+
+type Action =
+ | { kind: 'A', payload: number }
+ | { kind: 'B', payload: string };
+
+function f10({ kind, payload }: Action) {
+ if (kind === 'A') {
+ payload.toFixed();
+ }
+ if (kind === 'B') {
+ payload.toUpperCase();
+ }
+}
+
+function f11(action: Action) {
+ const { kind, payload } = action;
+ if (kind === 'A') {
+ payload.toFixed();
+ }
+ if (kind === 'B') {
+ payload.toUpperCase();
+ }
+}
+
+function f12({ kind, payload }: Action) {
+ switch (kind) {
+ case 'A':
+ payload.toFixed();
+ break;
+ case 'B':
+ payload.toUpperCase();
+ break;
+ default:
+ payload; // never
+ }
+}
+
+type Action2 =
+ | { kind: 'A', payload: number | undefined }
+ | { kind: 'B', payload: string | undefined };
+
+function f20({ kind, payload }: Action2) {
+ if (payload) {
+ if (kind === 'A') {
+ payload.toFixed();
+ }
+ if (kind === 'B') {
+ payload.toUpperCase();
+ }
+ }
+}
+
+function f21(action: Action2) {
+ const { kind, payload } = action;
+ if (payload) {
+ if (kind === 'A') {
+ payload.toFixed();
+ }
+ if (kind === 'B') {
+ payload.toUpperCase();
+ }
+ }
+}
+
+function f22(action: Action2) {
+ if (action.payload) {
+ const { kind, payload } = action;
+ if (kind === 'A') {
+ payload.toFixed();
+ }
+ if (kind === 'B') {
+ payload.toUpperCase();
+ }
+ }
+}
+
+function f23({ kind, payload }: Action2) {
+ if (payload) {
+ switch (kind) {
+ case 'A':
+ payload.toFixed();
+ break;
+ case 'B':
+ payload.toUpperCase();
+ break;
+ default:
+ payload; // never
+ }
+ }
+}
+
+type Foo =
+ | { kind: 'A', isA: true }
+ | { kind: 'B', isA: false }
+ | { kind: 'C', isA: false };
+
+function f30({ kind, isA }: Foo) {
+ if (kind === 'A') {
+ isA; // true
+ }
+ if (kind === 'B') {
+ isA; // false
+ }
+ if (kind === 'C') {
+ isA; // false
+ }
+ if (isA) {
+ kind; // 'A'
+ }
+ else {
+ kind; // 'B' | 'C'
+ }
+}
+
+// Repro from #35283
+
+interface A<T> { variant: 'a', value: T }
+
+interface B<T> { variant: 'b', value: Array<T> }
+
+type AB<T> = A<T> | B<T>;
+
+declare function printValue<T>(t: T): void;
+
+declare function printValueList<T>(t: Array<T>): void;
+
+function unrefined1<T>(ab: AB<T>): void {
+ const { variant, value } = ab;
+ if (variant === 'a') {
+ printValue<T>(value);
+ }
+ else {
+ printValueList<T>(value);
+ }
+}
+
+// Repro from #38020
+
+type Action3 =
+ | {type: 'add', payload: { toAdd: number } }
+ | {type: 'remove', payload: { toRemove: number } };
+
+const reducerBroken = (state: number, { type, payload }: Action3) => {
+ switch (type) {
+ case 'add':
+ return state + payload.toAdd;
+ case 'remove':
+ return state - payload.toRemove;
+ }
+}
+
+// Repro from #46143
+
+declare var it: Iterator<number>;
+const { value, done } = it.next();
+if (!done) {
+ value; // number
+}
diff --git a/tests/cases/conformance/controlFlow/typeGuardsNestedAssignments.ts b/tests/cases/conformance/controlFlow/typeGuardsNestedAssignments.ts
index 41e3ffe572..1a42e77ae0 100644
--- a/tests/cases/conformance/controlFlow/typeGuardsNestedAssignments.ts
+++ b/tests/cases/conformance/controlFlow/typeGuardsNestedAssignments.ts
@@ -44,4 +44,5 @@ let match: RegExpExecArray | null
while ((match = re.exec("xxx")) != null) {
const length = match[1].length + match[2].length
-}
\ No newline at end of file
+}
+let qq4 = new Foo();
\ No newline at end of file
diff --git a/tests/cases/conformance/controlFlow/typeGuardsTypeParameters.ts b/tests/cases/conformance/controlFlow/typeGuardsTypeParameters.ts
index 169dbc7a7c..708fcceab8 100644
--- a/tests/cases/conformance/controlFlow/typeGuardsTypeParameters.ts
+++ b/tests/cases/conformance/controlFlow/typeGuardsTypeParameters.ts
@@ -33,3 +33,4 @@ function fun<T>(item: { [P in keyof T]: T[P] }) {
}
}
}
+let qq6 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/declarationEmit/declarationEmitWorkWithInlineComments.ts b/tests/cases/conformance/declarationEmit/declarationEmitWorkWithInlineComments.ts
index a5b3074a5c..20e4ef968e 100644
--- a/tests/cases/conformance/declarationEmit/declarationEmitWorkWithInlineComments.ts
+++ b/tests/cases/conformance/declarationEmit/declarationEmitWorkWithInlineComments.ts
@@ -34,4 +34,7 @@ export class Baz {
constructor(/* @internal */
public isInternal: string
) {}
-}
\ No newline at end of file
+}
+// let ff = new Foo('','','','','','','','','','')
+// let bar = new Bar('');
+// let baz = new Baz('');
\ No newline at end of file
diff --git a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts
index 69af9c5b07..1b88b5d2bb 100644
--- a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts
+++ b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts
@@ -8,4 +8,5 @@ export class C {
}
export class D extends C {
-}
\ No newline at end of file
+}
+let qq6 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts
index 461c7d1757..d22941e2f2 100644
--- a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts
+++ b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts
@@ -8,4 +8,5 @@ export class C {
}
class D extends C {
-}
\ No newline at end of file
+}
+let qq7 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/fs.d.ts b/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/fs.d.ts
new file mode 100644
index 0000000000..fe6e6774e2
--- /dev/null
+++ b/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/fs.d.ts
@@ -0,0 +1,5 @@
+// @filename: node_modules/@types/node/fs.d.ts
+declare module "fs" {
+ function FSWatcher()
+ // interface FSWatcher {}
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/main.ts b/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/main.ts
new file mode 100644
index 0000000000..38de3dcf37
--- /dev/null
+++ b/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/main.ts
@@ -0,0 +1,2 @@
+// @filename: main.ts
+/// <reference types="node" />
\ No newline at end of file
diff --git a/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/package.json b/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/package.json
new file mode 100644
index 0000000000..f93a231130
--- /dev/null
+++ b/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/package.json
@@ -0,0 +1,4 @@
+{
+ "name": "@types/node",
+ "version": "1.0.0"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/typeReferenceRelatedFiles.ts b/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/typeReferenceRelatedFiles.ts
new file mode 100644
index 0000000000..957e4b37af
--- /dev/null
+++ b/tests/cases/conformance/declarationEmit/typeReferenceRelatedFiles/typeReferenceRelatedFiles.ts
@@ -0,0 +1,18 @@
+// @declaration: true
+// @filename: node_modules/@types/node/index.d.ts
+/// <reference path="fs.d.ts" />
+
+// @filename: node_modules/@types/node/package.json
+// {
+// "name": "@types/node",
+// "version": "1.0.0"
+// }
+// @filename: main.ts
+// / <reference types="node" />
+import { FSWatcher } from "fs";
+
+FSWatcher();
+
+export function f() {
+ // return {} as FSWatcher;
+}
diff --git a/tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter5.ts b/tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter5.ts
new file mode 100644
index 0000000000..3679047895
--- /dev/null
+++ b/tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter5.ts
@@ -0,0 +1,15 @@
+// @target: es2018
+// @experimentalDecorators: true
+// @noEmitHelpers: true
+// @noTypesAndSymbols: true
+
+// https://github.com/microsoft/TypeScript/issues/44931
+interface IFoo { }
+declare const IFoo: any;
+class BulkEditPreviewProvider {
+ static readonly Schema = 'vscode-bulkeditpreview';
+ static emptyPreview = { scheme: BulkEditPreviewProvider.Schema };
+ constructor(
+ @IFoo private readonly _modeService: IFoo,
+ ) { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/decorators/class/decoratedBlockScopedClass1.ts b/tests/cases/conformance/decorators/class/decoratedBlockScopedClass1.ts
new file mode 100644
index 0000000000..521dd6a31c
--- /dev/null
+++ b/tests/cases/conformance/decorators/class/decoratedBlockScopedClass1.ts
@@ -0,0 +1,16 @@
+// @target: es5
+// @experimentaldecorators: true
+// @emitDecoratorMetadata: true
+// @filename: a.ts
+
+function decorator() {
+ return (target: new (...args: any[]) => any) => {}
+}
+
+@decorator()
+class Foo {
+ public static func(): Foo {
+ return new Foo();
+ }
+}
+Foo.func();
diff --git a/tests/cases/conformance/decorators/class/decoratedBlockScopedClass2.ts b/tests/cases/conformance/decorators/class/decoratedBlockScopedClass2.ts
new file mode 100644
index 0000000000..7d8de6894f
--- /dev/null
+++ b/tests/cases/conformance/decorators/class/decoratedBlockScopedClass2.ts
@@ -0,0 +1,19 @@
+// @target: es5
+// @experimentaldecorators: true
+// @emitDecoratorMetadata: true
+// @filename: a.ts
+
+function decorator() {
+ return (target: new (...args: any[]) => any) => {}
+}
+
+try {
+ @decorator()
+ class Foo {
+ public static func(): Foo {
+ return new Foo();
+ }
+ }
+ Foo.func();
+}
+catch (e) {}
diff --git a/tests/cases/conformance/decorators/class/decoratedBlockScopedClass3.ts b/tests/cases/conformance/decorators/class/decoratedBlockScopedClass3.ts
new file mode 100644
index 0000000000..48eebc559f
--- /dev/null
+++ b/tests/cases/conformance/decorators/class/decoratedBlockScopedClass3.ts
@@ -0,0 +1,27 @@
+// @target: es5
+// @experimentaldecorators: true
+// @emitDecoratorMetadata: true
+// @filename: a.ts
+
+function decorator() {
+ return (target: new (...args: any[]) => any) => {}
+}
+
+@decorator()
+class Foo {
+ public static func(): Foo {
+ return new Foo();
+ }
+}
+Foo.func();
+
+try {
+ @decorator()
+ class Foo {
+ public static func(): Foo {
+ return new Foo();
+ }
+ }
+ Foo.func();
+}
+catch (e) {}
diff --git a/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod14.ts b/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod14.ts
new file mode 100644
index 0000000000..18f3df79bc
--- /dev/null
+++ b/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod14.ts
@@ -0,0 +1,14 @@
+// @target: esnext
+// @experimentaldecorators: true
+// @emitdecoratormetadata: true
+declare var decorator: any;
+
+class Foo {
+ private prop = () => {
+ return 0;
+ }
+ @decorator
+ foo() {
+ return 0;
+ }
+}
diff --git a/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod15.ts b/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod15.ts
new file mode 100644
index 0000000000..70f86b1bbe
--- /dev/null
+++ b/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod15.ts
@@ -0,0 +1,12 @@
+// @target: esnext
+// @experimentaldecorators: true
+// @emitdecoratormetadata: true
+declare var decorator: any;
+
+class Foo {
+ private prop = 1
+ @decorator
+ foo() {
+ return 0;
+ }
+}
diff --git a/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod16.ts b/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod16.ts
new file mode 100644
index 0000000000..400d4fbe5a
--- /dev/null
+++ b/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod16.ts
@@ -0,0 +1,12 @@
+// @target: esnext
+// @experimentaldecorators: true
+// @emitdecoratormetadata: true
+declare var decorator: any;
+
+class Foo {
+ private prop
+ @decorator
+ foo() {
+ return 0;
+ }
+}
diff --git a/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod17.ts b/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod17.ts
new file mode 100644
index 0000000000..1aa25d7f32
--- /dev/null
+++ b/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod17.ts
@@ -0,0 +1,11 @@
+// @target: esnext
+// @experimentaldecorators: true
+// @emitdecoratormetadata: true
+declare var decorator: any;
+
+class Foo {
+ private prop @decorator
+ foo() {
+ return 0;
+ }
+}
diff --git a/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod18.ts b/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod18.ts
new file mode 100644
index 0000000000..9417c44c5b
--- /dev/null
+++ b/tests/cases/conformance/decorators/class/method/decoratorOnClassMethod18.ts
@@ -0,0 +1,11 @@
+// @target: esnext
+// @experimentaldecorators: true
+// @emitdecoratormetadata: true
+declare var decorator: any;
+
+class Foo {
+ p1
+
+ @decorator()
+ p2;
+}
diff --git a/tests/cases/conformance/decorators/decoratorMetadataWithTypeOnlyImport2.ts b/tests/cases/conformance/decorators/decoratorMetadataWithTypeOnlyImport2.ts
new file mode 100644
index 0000000000..c63fcf1a16
--- /dev/null
+++ b/tests/cases/conformance/decorators/decoratorMetadataWithTypeOnlyImport2.ts
@@ -0,0 +1,17 @@
+// @experimentalDecorators: true
+// @emitDecoratorMetadata: true
+
+
+// @filename: services.ts
+export namespace Services {
+ export class Service {}
+}
+
+// @filename: index.ts
+import type { Services } from './services';
+
+declare const decorator: any;
+export class Main {
+ @decorator()
+ field: Services.Service;
+}
diff --git a/tests/cases/conformance/emitter/es2015/asyncGenerators/emitter.asyncGenerators.classMethods.es2015.ts b/tests/cases/conformance/emitter/es2015/asyncGenerators/emitter.asyncGenerators.classMethods.es2015.ts
index fe1bc56dd1..20e20e00dc 100644
--- a/tests/cases/conformance/emitter/es2015/asyncGenerators/emitter.asyncGenerators.classMethods.es2015.ts
+++ b/tests/cases/conformance/emitter/es2015/asyncGenerators/emitter.asyncGenerators.classMethods.es2015.ts
@@ -58,3 +58,14 @@ class C9 extends B9 {
super.g();
}
}
+
+let c1 = new C1();
+let c2 = new C2();
+let c3 = new C3();
+let c4 = new C4();
+let c5 = new C5();
+let c6 = new C6();
+let c7 = new C7();
+let c8 = new C8();
+let c9 = new C9();
+
diff --git a/tests/cases/conformance/es2018/es2018IntlAPIs.ts b/tests/cases/conformance/es2018/es2018IntlAPIs.ts
new file mode 100644
index 0000000000..c1f6739202
--- /dev/null
+++ b/tests/cases/conformance/es2018/es2018IntlAPIs.ts
@@ -0,0 +1,7 @@
+// @target: es2018
+
+// Sample from
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/supportedLocalesOf
+const locales = ['ban', 'id-u-co-pinyin', 'de-ID'];
+const options = { localeMatcher: 'lookup' } as const;
+console.log(Intl.PluralRules.supportedLocalesOf(locales, options).join(', '));
\ No newline at end of file
diff --git a/tests/cases/conformance/es2020/es2020IntlAPIs.ts b/tests/cases/conformance/es2020/es2020IntlAPIs.ts
new file mode 100644
index 0000000000..464ecc01ec
--- /dev/null
+++ b/tests/cases/conformance/es2020/es2020IntlAPIs.ts
@@ -0,0 +1,45 @@
+// @target: es2020
+
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation
+const count = 26254.39;
+const date = new Date("2012-05-24");
+
+function log(locale: string) {
+ console.log(
+ `${new Intl.DateTimeFormat(locale).format(date)} ${new Intl.NumberFormat(locale).format(count)}`
+ );
+}
+
+log("en-US");
+// expected output: 5/24/2012 26,254.39
+
+log("de-DE");
+// expected output: 24.5.2012 26.254,39
+
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat
+const rtf1 = new Intl.RelativeTimeFormat('en', { style: 'narrow' });
+
+console.log(rtf1.format(3, 'quarter'));
+//expected output: "in 3 qtrs."
+
+console.log(rtf1.format(-1, 'day'));
+//expected output: "1 day ago"
+
+const rtf2 = new Intl.RelativeTimeFormat('es', { numeric: 'auto' });
+
+console.log(rtf2.format(2, 'day'));
+//expected output: "pasado mañana"
+
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames
+const regionNamesInEnglish = new Intl.DisplayNames(['en'], { type: 'region' });
+const regionNamesInTraditionalChinese = new Intl.DisplayNames(['zh-Hant'], { type: 'region' });
+
+console.log(regionNamesInEnglish.of('US'));
+// expected output: "United States"
+
+console.log(regionNamesInTraditionalChinese.of('US'));
+// expected output: "美國"
+
+const locales1 = ['ban', 'id-u-co-pinyin', 'de-ID'];
+const options1 = { localeMatcher: 'lookup' } as const;
+console.log(Intl.DisplayNames.supportedLocalesOf(locales1, options1).join(', '));
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithPropertyAccessInHeritageClause1.ts b/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithPropertyAccessInHeritageClause1.ts
index 5d18229ea0..de26b4fc10 100644
--- a/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithPropertyAccessInHeritageClause1.ts
+++ b/tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithPropertyAccessInHeritageClause1.ts
@@ -2,4 +2,6 @@ class B {}
function foo() {
return {B: B};
}
-class C extends (foo()).B {}
\ No newline at end of file
+class C extends (foo()).B {}
+let qt6 = new B();
+let qt7 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts
index e5d63f2e93..a872204ec7 100644
--- a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts
+++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing1.ts
@@ -13,3 +13,4 @@ class D extends Base {
var i = Factory.create(s);
}
}
+let qt2 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts
index 1b0a0d541e..826baf9d02 100644
--- a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts
+++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing2.ts
@@ -7,3 +7,4 @@ class D extends Base {
super(() => { this._t }); // no error. only check when this is directly accessing in constructor
}
}
+let qt5 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing5.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing5.ts
index 1782027758..10e7ca31aa 100644
--- a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing5.ts
+++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing5.ts
@@ -4,3 +4,4 @@
this._t; // No error
}
}
+let qt4 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing8.ts b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing8.ts
index 5742cdab84..3b55dbc70f 100644
--- a/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing8.ts
+++ b/tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing8.ts
@@ -10,3 +10,4 @@ class D extends Base {
}
}
}
+let qt3 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/spread/arraySpreadImportHelpers.ts b/tests/cases/conformance/es6/spread/arraySpreadImportHelpers.ts
new file mode 100644
index 0000000000..ebeb117ed0
--- /dev/null
+++ b/tests/cases/conformance/es6/spread/arraySpreadImportHelpers.ts
@@ -0,0 +1,16 @@
+// @target: es5
+// @importHelpers: true
+// @isolatedModules: true
+// @noTypesAndSymbols: true
+// @noEmit: true
+// @filename: main.ts
+
+export {};
+const k = [1, , 2];
+const o = [3, ...k, 4];
+
+// @filename: tslib.d.ts
+// this is a pre-TS4.4 versions of emit helper, which always forced array packing
+declare module "tslib" {
+ function __spreadArray(to: any[], from: any[]): any[];
+}
diff --git a/tests/cases/conformance/es6/templates/templateStringWithCommentsInArrowFunction.ts b/tests/cases/conformance/es6/templates/templateStringWithCommentsInArrowFunction.ts
new file mode 100644
index 0000000000..c344bea1fb
--- /dev/null
+++ b/tests/cases/conformance/es6/templates/templateStringWithCommentsInArrowFunction.ts
@@ -0,0 +1,14 @@
+// @removeComments: false
+
+const a = 1;
+const f1 = () =>
+ `${
+ // a
+ a
+ }a`;
+
+const f2 = () =>
+ `${
+ // a
+ a
+ }`;
diff --git a/tests/cases/conformance/expressions/asOperator/asOperatorASI.ts b/tests/cases/conformance/expressions/asOperator/asOperatorASI.ts
index a4dd44a15a..ea325aefaf 100644
--- a/tests/cases/conformance/expressions/asOperator/asOperatorASI.ts
+++ b/tests/cases/conformance/expressions/asOperator/asOperatorASI.ts
@@ -8,3 +8,4 @@ as `Hello world`; // should not error
// Example 2
var y = 20
as(Foo); // should emit
+let qw11 = new Foo();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalObjects.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalObjects.ts
index 05b8e135cb..285f41f742 100644
--- a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalObjects.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalObjects.ts
@@ -191,4 +191,8 @@ var r8b3 = b2 !== a2;
var r8b4 = b3 !== a3;
var r8b5 = b4 !== a4;
var r8b6 = b5 !== a5;
-var r8b7 = b6 !== a6;
\ No newline at end of file
+var r8b7 = b6 !== a6;
+let qr1 = new A1();
+let qr2 = new B1();
+let qr3 = new A2();
+let qr4 = new B2();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts
new file mode 100644
index 0000000000..68900e5f91
--- /dev/null
+++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts
@@ -0,0 +1,5 @@
+declare let a: { a: 1 }
+a > 1;
+
+declare let b: { a: 1 } & { b: number }
+b > 1;
diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts
index 5670cf8ef1..441748fb1a 100644
--- a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts
@@ -146,4 +146,6 @@ var r8b2 = b2 !== a2;
var r8b3 = b3 !== a3;
var r8b4 = b4 !== a4;
var r8b5 = b5 !== a5;
-var r8b6 = b6 !== a6;
\ No newline at end of file
+var r8b6 = b6 !== a6;
+let qe5 = new Derived();
+let qe6 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts
index 8f3d914934..3f0d1adb65 100644
--- a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts
@@ -146,4 +146,6 @@ var r8b2 = b2 !== a2;
var r8b3 = b3 !== a3;
var r8b4 = b4 !== a4;
var r8b5 = b5 !== a5;
-var r8b6 = b6 !== a6;
\ No newline at end of file
+var r8b6 = b6 !== a6;
+let qe7 = new Derived();
+let qe8 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnCallSignature.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnCallSignature.ts
index 6b6ae79015..e60a012739 100644
--- a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnCallSignature.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnCallSignature.ts
@@ -256,4 +256,5 @@ var r8b8 = b8 !== a8;
var r8b9 = b9 !== a9;
var r8b10 = b10 !== a10;
var r8b11 = b11 !== a11;
-//var r8b12 = b12 !== a12;
\ No newline at end of file
+//var r8b12 = b12 !== a12;
+let qw12 = new Derived();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts
index 363192f49f..e42a1cc1c1 100644
--- a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts
@@ -218,4 +218,5 @@ var r8b6 = b6 !== a6;
var r8b7 = b7 !== a7;
var r8b8 = b8 !== a8;
var r8b9 = b9 !== a9;
-//var r8b10 = b10 !== a10;
\ No newline at end of file
+//var r8b10 = b10 !== a10;
+let qe9 = new Derived();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnIndexSignature.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnIndexSignature.ts
index 8246c6dd18..9154c7f806 100644
--- a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnIndexSignature.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnIndexSignature.ts
@@ -104,4 +104,5 @@ var r8a1 = a4 !== b4;
var r8b1 = b1 !== a1;
var r8b1 = b2 !== a2;
var r8b1 = b3 !== a3;
-var r8b1 = b4 !== a4;
\ No newline at end of file
+var r8b1 = b4 !== a4;
+let qr5 = new Derived();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts
index da3d4131c6..59f9a78a38 100644
--- a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts
@@ -161,4 +161,5 @@ var r8b3 = b3 !== a3;
var r8b4 = b4 !== a4;
var r8b5 = b5 !== a5;
var r8b6 = b6 !== a6;
-//var r8b7 = b7 !== a7;
\ No newline at end of file
+//var r8b7 = b7 !== a7;
+let qw14 = new Derived();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts
index 5a2356eadb..05f49336bf 100644
--- a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts
@@ -161,4 +161,5 @@ var r8b3 = b3 !== a3;
var r8b4 = b4 !== a4;
var r8b5 = b5 !== a5;
var r8b6 = b6 !== a6;
-//var r8b7 = b7 !== a7;
\ No newline at end of file
+//var r8b7 = b7 !== a7;
+let qw13 = new Derived();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnProperty.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnProperty.ts
index 6401feb11c..fb2cd09f76 100644
--- a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnProperty.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithSubtypeObjectOnProperty.ts
@@ -75,4 +75,8 @@ var rg4 = b2 === a2;
var rh1 = a1 !== b1;
var rh2 = a2 !== b2;
var rh3 = b1 !== a1;
-var rh4 = b2 !== a2;
\ No newline at end of file
+var rh4 = b2 !== a2;
+let qe1 = new Derived();
+let qe2 = new A1();
+let qe3 = new B1();
+let qe4 = new B2();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidStaticToString.ts b/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidStaticToString.ts
index b99f8d7114..1399026e80 100644
--- a/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidStaticToString.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidStaticToString.ts
@@ -19,3 +19,6 @@ declare class NormalToString {
function baz(normal: NormalToString) {
return normal instanceof NormalToString;
}
+let qr7 = new StaticToString();
+let qr8 = new StaticToNumber();
+let qr9 = new NormalToString();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithLHSIsObject.ts b/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithLHSIsObject.ts
index 6b88cd39f2..47a60b104b 100644
--- a/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithLHSIsObject.ts
+++ b/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithLHSIsObject.ts
@@ -12,3 +12,4 @@ var r1 = a instanceof x1;
var r2 = b instanceof x2;
var r3 = c instanceof x1;
var r4 = d instanceof x1;
+let qr0 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/commaOperator/commaOperatorWithSecondOperandObjectType.ts b/tests/cases/conformance/expressions/commaOperator/commaOperatorWithSecondOperandObjectType.ts
index 0a6a47dfbb..4e2e1e494d 100644
--- a/tests/cases/conformance/expressions/commaOperator/commaOperatorWithSecondOperandObjectType.ts
+++ b/tests/cases/conformance/expressions/commaOperator/commaOperatorWithSecondOperandObjectType.ts
@@ -38,3 +38,4 @@ var resultIsObject8 = (true, {});
var resultIsObject9 = (!BOOLEAN, { a: 1, b: "s" });
var resultIsObject10 = ("string", new Date());
var resultIsObject11 = (STRING.toLowerCase(), new CLASS());
+let qw10 = new CLASS();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithIdenticalBCT.ts b/tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithIdenticalBCT.ts
index 11652b023d..93bdd906c6 100644
--- a/tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithIdenticalBCT.ts
+++ b/tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithIdenticalBCT.ts
@@ -44,3 +44,6 @@ var result10: (t: X) => any = true ? (m) => m.propertyX1 : (n) => n.propertyX2;
//Expr1 and Expr2 are literals
var result11: any = true ? 1 : 'string';
+
+let qq1 = new A();
+let qq0 = new B();
diff --git a/tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping1.ts b/tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping1.ts
index 7bcde9a695..fc8bde2595 100644
--- a/tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping1.ts
+++ b/tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping1.ts
@@ -9,3 +9,5 @@ class B extends A<number, string> {
// Ensure 'value' is of type 'number (and not '{}') by using its 'toExponential()' method.
constructor() { super(value => String(value.toExponential())); }
}
+
+let qr17 = new B();
diff --git a/tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping3.ts b/tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping3.ts
index 760337f3ef..6eac51e440 100644
--- a/tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping3.ts
+++ b/tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping3.ts
@@ -28,4 +28,5 @@ class C extends CBase<string> {
}
});
}
-}
\ No newline at end of file
+}
+let qt1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/functionCalls/callWithSpread.ts b/tests/cases/conformance/expressions/functionCalls/callWithSpread.ts
index b1e2ee7578..3ba8aa488a 100644
--- a/tests/cases/conformance/expressions/functionCalls/callWithSpread.ts
+++ b/tests/cases/conformance/expressions/functionCalls/callWithSpread.ts
@@ -55,3 +55,4 @@ class D extends C {
super.foo(1, 2, ...a);
}
}
+let qr13 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/functions/arrowFunctionExpressions.ts b/tests/cases/conformance/expressions/functions/arrowFunctionExpressions.ts
index 707ef02de8..304d6792dc 100644
--- a/tests/cases/conformance/expressions/functions/arrowFunctionExpressions.ts
+++ b/tests/cases/conformance/expressions/functions/arrowFunctionExpressions.ts
@@ -96,3 +96,4 @@ function tryCatchFn() {
var m = () => this + '';
}
}
+let qr14 = new MyClass();
diff --git a/tests/cases/conformance/expressions/newOperator/newOperatorConformance.ts b/tests/cases/conformance/expressions/newOperator/newOperatorConformance.ts
index b50751c7ae..051e4e3c3e 100644
--- a/tests/cases/conformance/expressions/newOperator/newOperatorConformance.ts
+++ b/tests/cases/conformance/expressions/newOperator/newOperatorConformance.ts
@@ -60,3 +60,4 @@ var t: any;
var nested = new (new (new nestedCtor())())();
var n = new nested();
var n = new nested();
+let aa1 = new C1(null,null);
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/superCalls/superCalls.ts b/tests/cases/conformance/expressions/superCalls/superCalls.ts
index fdebc85906..da0fe9656b 100644
--- a/tests/cases/conformance/expressions/superCalls/superCalls.ts
+++ b/tests/cases/conformance/expressions/superCalls/superCalls.ts
@@ -27,3 +27,5 @@ class OtherDerived extends OtherBase {
super();
}
}
+let qr15 = new Derived(null);
+let qr16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/thisKeyword/typeOfThisGeneral.ts b/tests/cases/conformance/expressions/thisKeyword/typeOfThisGeneral.ts
new file mode 100644
index 0000000000..99d6a50b00
--- /dev/null
+++ b/tests/cases/conformance/expressions/thisKeyword/typeOfThisGeneral.ts
@@ -0,0 +1,178 @@
+// @target: esnext
+// @useDefineForClassFields: false
+class MyTestClass {
+ private canary: number;
+ static staticCanary: number;
+
+ constructor() {
+ //type of 'this' in constructor body is the class instance type
+ var p = this.canary;
+ var p: number;
+ this.canary = 3;
+ }
+
+ //type of 'this' in member function param list is the class instance type
+ memberFunc(t = this) {
+ var t: MyTestClass;
+
+ //type of 'this' in member function body is the class instance type
+ var p = this;
+ var p: MyTestClass;
+ }
+
+ //type of 'this' in member accessor(get and set) body is the class instance type
+ get prop() {
+ var p = this;
+ var p: MyTestClass;
+ return this;
+ }
+ set prop(v) {
+ var p = this;
+ var p: MyTestClass;
+ p = v;
+ v = p;
+ }
+
+ someFunc = () => {
+ //type of 'this' in member variable initializer is the class instance type
+ var t = this;
+ var t: MyTestClass;
+ };
+
+ //type of 'this' in static function param list is constructor function type
+ static staticFn(t = this) {
+ var t: typeof MyTestClass;
+ var t = MyTestClass;
+ t.staticCanary;
+
+ //type of 'this' in static function body is constructor function type
+ var p = this;
+ var p: typeof MyTestClass;
+ var p = MyTestClass;
+ p.staticCanary;
+ }
+
+ static get staticProp() {
+ //type of 'this' in static accessor body is constructor function type
+ var p = this;
+ var p: typeof MyTestClass;
+ var p = MyTestClass;
+ p.staticCanary;
+ return this;
+ }
+ static set staticProp(v: typeof MyTestClass) {
+ //type of 'this' in static accessor body is constructor function type
+ var p = this;
+ var p: typeof MyTestClass;
+ var p = MyTestClass;
+ p.staticCanary;
+ }
+}
+
+class MyGenericTestClass<T, U> {
+ private canary: number;
+ static staticCanary: number;
+
+ constructor() {
+ //type of 'this' in constructor body is the class instance type
+ var p = this.canary;
+ var p: number;
+ this.canary = 3;
+ }
+
+ //type of 'this' in member function param list is the class instance type
+ memberFunc(t = this) {
+ var t: MyGenericTestClass<T, U>;
+
+ //type of 'this' in member function body is the class instance type
+ var p = this;
+ var p: MyGenericTestClass<T, U>;
+ }
+
+ //type of 'this' in member accessor(get and set) body is the class instance type
+ get prop() {
+ var p = this;
+ var p: MyGenericTestClass<T, U>;
+ return this;
+ }
+ set prop(v) {
+ var p = this;
+ var p: MyGenericTestClass<T, U>;
+ p = v;
+ v = p;
+ }
+
+ someFunc = () => {
+ //type of 'this' in member variable initializer is the class instance type
+ var t = this;
+ var t: MyGenericTestClass<T, U>;
+ };
+
+ //type of 'this' in static function param list is constructor function type
+ static staticFn(t = this) {
+ var t: typeof MyGenericTestClass;
+ var t = MyGenericTestClass;
+ t.staticCanary;
+
+ //type of 'this' in static function body is constructor function type
+ var p = this;
+ var p: typeof MyGenericTestClass;
+ var p = MyGenericTestClass;
+ p.staticCanary;
+ }
+
+ static get staticProp() {
+ //type of 'this' in static accessor body is constructor function type
+ var p = this;
+ var p: typeof MyGenericTestClass;
+ var p = MyGenericTestClass;
+ p.staticCanary;
+ return this;
+ }
+ static set staticProp(v: typeof MyGenericTestClass) {
+ //type of 'this' in static accessor body is constructor function type
+ var p = this;
+ var p: typeof MyGenericTestClass;
+ var p = MyGenericTestClass;
+ p.staticCanary;
+ }
+}
+
+//type of 'this' in a function declaration param list is Any
+function fn(s = this) {
+ var s: any;
+ s.spaaaaaaace = 4;
+
+ //type of 'this' in a function declaration body is Any
+ var t: any;
+ var t = this;
+ this.spaaaaace = 4;
+}
+
+//type of 'this' in a function expression param list list is Any
+var q1 = function (s = this) {
+ var s: any;
+ s.spaaaaaaace = 4;
+
+ //type of 'this' in a function expression body is Any
+ var t: any;
+ var t = this;
+ this.spaaaaace = 4;
+}
+
+//type of 'this' in a fat arrow expression param list is typeof globalThis
+var q2 = (s = this) => {
+ var s: typeof globalThis;
+ s.spaaaaaaace = 4;
+
+ //type of 'this' in a fat arrow expression body is typeof globalThis
+ var t: typeof globalThis;
+ var t = this;
+ this.spaaaaace = 4;
+}
+
+//type of 'this' in global module is GlobalThis
+var t: typeof globalThis;
+var t = this;
+this.spaaaaace = 4;
+
diff --git a/tests/cases/conformance/expressions/typeGuards/TypeGuardWithArrayUnion.ts b/tests/cases/conformance/expressions/typeGuards/TypeGuardWithArrayUnion.ts
index 8884754b48..c6378e0dc3 100644
--- a/tests/cases/conformance/expressions/typeGuards/TypeGuardWithArrayUnion.ts
+++ b/tests/cases/conformance/expressions/typeGuards/TypeGuardWithArrayUnion.ts
@@ -7,3 +7,4 @@ function saySize(message: Message | Message[]) {
return message.length; // Should have type Message[] here
}
}
+let rr5 = new Message();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardFunction.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardFunction.ts
index 57d56ccc3b..0f531ea811 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardFunction.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardFunction.ts
@@ -80,4 +80,8 @@ acceptingTypeGuardFunction(isA);
// Binary expressions
let union2: C | B;
-let union3: boolean | B = isA(union2) || union2;
\ No newline at end of file
+let union3: boolean | B = isA(union2) || union2;
+
+let ee2 = new B();
+let ee3 = new C();
+let ee4 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardFunctionGenerics.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardFunctionGenerics.ts
index d0e108b573..3511cc54b1 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardFunctionGenerics.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardFunctionGenerics.ts
@@ -30,4 +30,6 @@ let test2: B = funC(isB);
if (funD(isC, a)) {
a.propC;
}
-let test3: B = funE(isB, 1);
\ No newline at end of file
+let test3: B = funE(isB, 1);
+let qw7 = new B();
+let qw8 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormExpr1AndExpr2.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormExpr1AndExpr2.ts
index 1ed8e6ebb0..e14dd79116 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormExpr1AndExpr2.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormExpr1AndExpr2.ts
@@ -43,4 +43,5 @@ if (typeof strOrNumOrBool !== "string" && numOrBool !== strOrNumOrBool) {
}
else {
var r3: string | number | boolean = strOrNumOrBool; // string | number | boolean
-}
\ No newline at end of file
+}
+let rr1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormExpr1OrExpr2.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormExpr1OrExpr2.ts
index 1d72f35828..3411e32bcf 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormExpr1OrExpr2.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormExpr1OrExpr2.ts
@@ -43,4 +43,5 @@ if (typeof strOrNumOrBool === "string" || numOrBool !== strOrNumOrBool) {
}
else {
numOrBool = strOrNumOrBool; // number | boolean
-}
\ No newline at end of file
+}
+let qw2 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormInstanceOf.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormInstanceOf.ts
index 31514fca74..db3d488209 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormInstanceOf.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormInstanceOf.ts
@@ -1,25 +1,25 @@
-// A type guard of the form x instanceof C, where C is of a subtype of the global type 'Function'
-// and C has a property named 'prototype'
-// - 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.
-
-class C1 {
- p1: string;
-}
-class C2 {
- p2: number;
-}
-class D1 extends C1 {
- p3: number;
-}
+// A type guard of the form x instanceof C, where C is of a subtype of the global type 'Function'
+// and C has a property named 'prototype'
+// - 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.
+
+class C1 {
+ p1: string;
+}
+class C2 {
+ p2: number;
+}
+class D1 extends C1 {
+ p3: number;
+}
class C3 {
p4: number;
}
-var str: string;
-var num: number;
-var strOrNum: string | number;
-
+var str: string;
+var num: number;
+var strOrNum: string | number;
+
var ctor1: C1 | C2;
str = ctor1 instanceof C1 && ctor1.p1; // C1
num = ctor1 instanceof C2 && ctor1.p2; // C2
@@ -31,7 +31,7 @@ num = ctor2 instanceof C2 && ctor2.p2; // C2
num = ctor2 instanceof D1 && ctor2.p3; // D1
str = ctor2 instanceof D1 && ctor2.p1; // D1
var r2: D1 | C2 = ctor2 instanceof C1 && ctor2; // C2 | D1
-
+
var ctor3: C1 | C2;
if (ctor3 instanceof C1) {
ctor3.p1; // C1
@@ -64,4 +64,7 @@ if (ctor6 instanceof C1 || ctor6 instanceof C2) {
}
else {
ctor6.p4; // C3
-}
\ No newline at end of file
+}
+let qw4 = new C2();
+let qw3 = new D1();
+let qw5 = new C3();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormIsType.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormIsType.ts
index 9f5ca611ee..e0953773d5 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormIsType.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormIsType.ts
@@ -34,4 +34,7 @@ var c2Ord1: C2 | D1;
num = isC2(c2Ord1) && c2Ord1.p2; // C2
num = isD1(c2Ord1) && c2Ord1.p3; // D1
str = isD1(c2Ord1) && c2Ord1.p1; // D1
-var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1
\ No newline at end of file
+var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1
+
+let rr2 = new C2();
+let rr3 = new D1();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts
index 37651071b7..610f0da2c8 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfBoolean.ts
@@ -83,3 +83,4 @@ if (typeof strOrNum !== "boolean") {
else {
let z2: {} = strOrNum; // {}
}
+let qw9 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts
index b4cdf81660..f00736781f 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNumber.ts
@@ -82,3 +82,4 @@ if (typeof strOrBool !== "number") {
else {
let y2: {} = strOrBool; // {}
}
+let ee6 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts
index f742124708..a20093f868 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfString.ts
@@ -82,3 +82,4 @@ if (typeof numOrBool !== "string") {
else {
let x2: {} = numOrBool; // {}
}
+let rr4 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFromPropNameInUnionType.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFromPropNameInUnionType.ts
index e1256e4288..ceee99f7e2 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardOfFromPropNameInUnionType.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardOfFromPropNameInUnionType.ts
@@ -103,3 +103,12 @@ function f(i: Indexed) {
}
return "c" in i && i.c;
}
+let tt1 = new A();
+let tt2 = new B();
+let tt3 = new C();
+let tt4 = new D();
+let tt5 = new AWithOptionalProp();
+let tt6 = new BWithOptionalProp();
+let tt7 = new ClassWithUnionProp();
+let tt8 = new InMemberOfClass();
+let tt9 = new SelfAssert();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInClassAccessors.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInClassAccessors.ts
index 04b9a6a394..044131068a 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardsInClassAccessors.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInClassAccessors.ts
@@ -101,3 +101,4 @@ class ClassWithAccessors {
num = typeof var2 === "string" && var2.length; // string
}
}
+let ee1 = new ClassWithAccessors();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInClassMethods.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInClassMethods.ts
index cb1327027c..7bb36dfefe 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardsInClassMethods.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInClassMethods.ts
@@ -65,3 +65,4 @@ class C1 {
num = typeof param === "string" && param.length; // string
}
}
+let qw1 = new C1(null);
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInProperties.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInProperties.ts
index bffe8d3d1b..b7fd3f9c34 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardsInProperties.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInProperties.ts
@@ -24,4 +24,5 @@ strOrNum = typeof c1.pp3 === "string" && c1.pp3; // string | number
var obj1: {
x: string | number;
};
-strOrNum = typeof obj1.x === "string" && obj1.x; // string | number
\ No newline at end of file
+strOrNum = typeof obj1.x === "string" && obj1.x; // string | number
+let ee5 = new C1();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts
index 2c26b10c6a..574f2af39c 100644
--- a/tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts
+++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts
@@ -25,4 +25,5 @@ var o: {
if (typeof o.prop1 === "string" && o.prop1.toLowerCase()) {}
var prop1 = o.prop1;
-if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { }
\ No newline at end of file
+if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { }
+let qw6 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithNumberType.ts b/tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithNumberType.ts
index b41a114503..87e1d09bea 100644
--- a/tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithNumberType.ts
+++ b/tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithNumberType.ts
@@ -43,4 +43,5 @@ var ResultIsNumber13 = ~~~(NUMBER + NUMBER);
~foo();
~objA.a;
~M.n;
-~objA.a, M.n;
\ No newline at end of file
+~objA.a, M.n;
+let qr11 = new A();
\ No newline at end of file
diff --git a/tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithStringType.ts b/tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithStringType.ts
index 0b60c73ef9..4495309b10 100644
--- a/tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithStringType.ts
+++ b/tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithStringType.ts
@@ -42,4 +42,5 @@ var ResultIsNumber14 = ~~~(STRING + STRING);
~STRING;
~STRING1;
~foo();
-~objA.a,M.n;
\ No newline at end of file
+~objA.a,M.n;
+let qr12 = new A();
\ No newline at end of file
diff --git a/tests/cases/conformance/externalModules/exportNonVisibleType.ts b/tests/cases/conformance/externalModules/exportNonVisibleType.ts
index 4f4722fd86..cc56bd2f0b 100644
--- a/tests/cases/conformance/externalModules/exportNonVisibleType.ts
+++ b/tests/cases/conformance/externalModules/exportNonVisibleType.ts
@@ -31,3 +31,4 @@ class C1 {
}
export = C1; // Should work, private type I1 of visible class C1 only used in private member m1.
+let qt8 = new C1();
\ No newline at end of file
diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension1.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension1.ts
new file mode 100644
index 0000000000..83e86fc6c6
--- /dev/null
+++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension1.ts
@@ -0,0 +1,12 @@
+// @moduleResolution: node12
+// @module: node12
+
+// @filename: /src/foo.mts
+export function foo() {
+ return "";
+}
+
+// @filename: /src/bar.mts
+// Extensionless relative path ES import in an ES module
+import { foo } from "./foo"; // should error, suggest adding ".mjs"
+import { baz } from "./baz"; // should error, ask for extension, no extension suggestion
diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension2.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension2.ts
new file mode 100644
index 0000000000..0051e17401
--- /dev/null
+++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension2.ts
@@ -0,0 +1,6 @@
+// @moduleResolution: node12
+// @module: node12
+
+// @filename: /src/buzz.mts
+// Extensionless relative path cjs import in an ES module
+import foo = require("./foo"); // should error, should not ask for extension
\ No newline at end of file
diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension3.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension3.ts
new file mode 100644
index 0000000000..2ec3ff1ad0
--- /dev/null
+++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension3.ts
@@ -0,0 +1,12 @@
+// @moduleResolution: nodenext
+// @module: nodenext
+// @jsx: preserve
+
+// @filename: /src/foo.tsx
+export function foo() {
+ return "";
+}
+
+// @filename: /src/bar.mts
+// Extensionless relative path ES import in an ES module
+import { foo } from "./foo"; // should error, suggest adding ".jsx"
diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension4.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension4.ts
new file mode 100644
index 0000000000..c1eab70f92
--- /dev/null
+++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension4.ts
@@ -0,0 +1,12 @@
+// @moduleResolution: nodenext
+// @module: nodenext
+// @jsx: react
+
+// @filename: /src/foo.tsx
+export function foo() {
+ return "";
+}
+
+// @filename: /src/bar.mts
+// Extensionless relative path ES import in an ES module
+import { foo } from "./foo"; // should error, suggest adding ".js"
diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension5.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension5.ts
new file mode 100644
index 0000000000..5053a242cd
--- /dev/null
+++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension5.ts
@@ -0,0 +1,6 @@
+// @moduleResolution: node12
+// @module: node12
+
+// @filename: /src/buzz.mts
+// Extensionless relative path dynamic import in an ES module
+import("./foo").then(x => x); // should error, ask for extension
\ No newline at end of file
diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension6.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension6.ts
new file mode 100644
index 0000000000..2a6ef2645d
--- /dev/null
+++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension6.ts
@@ -0,0 +1,8 @@
+// @moduleResolution: node12
+// @module: node12
+
+// @filename: /src/bar.cts
+// Extensionless relative path import statement in a cjs module
+// Import statements are not allowed in cjs files,
+// but other errors should not assume that they are allowed
+import { foo } from "./foo"; // should error, should not ask for extension
\ No newline at end of file
diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension7.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension7.ts
new file mode 100644
index 0000000000..3b10dd6e48
--- /dev/null
+++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension7.ts
@@ -0,0 +1,6 @@
+// @moduleResolution: node12
+// @module: node12
+
+// @filename: /src/bar.cts
+// Extensionless relative path cjs import in a cjs module
+import foo = require("./foo"); // should error, should not ask for extension
\ No newline at end of file
diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension8.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension8.ts
new file mode 100644
index 0000000000..fef17b3aa1
--- /dev/null
+++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension8.ts
@@ -0,0 +1,6 @@
+// @moduleResolution: node12
+// @module: node12
+
+// @filename: /src/bar.cts
+// Extensionless relative path dynamic import in a cjs module
+import("./foo").then(x => x); // should error, ask for extension
\ No newline at end of file
diff --git a/tests/cases/conformance/externalModules/typeOnly/exportSpecifiers.ts b/tests/cases/conformance/externalModules/typeOnly/exportSpecifiers.ts
new file mode 100644
index 0000000000..c8c584f66d
--- /dev/null
+++ b/tests/cases/conformance/externalModules/typeOnly/exportSpecifiers.ts
@@ -0,0 +1,21 @@
+// @module: esnext
+// @declaration: true
+
+// @Filename: /imports.ts
+import { type, as, something, foo, bar } from "./exports.js";
+type;
+as; // Error (used in emitting position)
+something; // Error (used in emitting position)
+foo; // Error (used in emitting position)
+bar; // Error (used in emitting position)
+
+// @Filename: /exports.ts
+const type = 0;
+const as = 0;
+const something = 0;
+export { type };
+export { type as };
+export { type something };
+export { type type as foo };
+export { type as as bar };
+export type { type something as whatever }; // Error
diff --git a/tests/cases/conformance/externalModules/typeOnly/importDefaultNamedType/a.ts b/tests/cases/conformance/externalModules/typeOnly/importDefaultNamedType/a.ts
new file mode 100644
index 0000000000..3e949a0611
--- /dev/null
+++ b/tests/cases/conformance/externalModules/typeOnly/importDefaultNamedType/a.ts
@@ -0,0 +1,2 @@
+// @Filename: /a.ts
+export default class A {}
\ No newline at end of file
diff --git a/tests/cases/conformance/externalModules/typeOnly/importDefaultNamedType/importDefaultNamedType.ts b/tests/cases/conformance/externalModules/typeOnly/importDefaultNamedType/importDefaultNamedType.ts
new file mode 100644
index 0000000000..3bb8cdfce2
--- /dev/null
+++ b/tests/cases/conformance/externalModules/typeOnly/importDefaultNamedType/importDefaultNamedType.ts
@@ -0,0 +1,5 @@
+
+
+// @Filename: /b.ts
+import type from './a';
+type;
\ No newline at end of file
diff --git a/tests/cases/conformance/externalModules/typeOnly/importSpecifiers1.ts b/tests/cases/conformance/externalModules/typeOnly/importSpecifiers1.ts
new file mode 100644
index 0000000000..348784befd
--- /dev/null
+++ b/tests/cases/conformance/externalModules/typeOnly/importSpecifiers1.ts
@@ -0,0 +1,46 @@
+// @module: esnext
+// @declaration: true
+
+// @Filename: /mod.ts
+export const as = 0;
+export const type = 0;
+export const something = 0;
+
+// @Filename: /a.ts
+import { type } from "./mod.js";
+import { type as } from "./mod.js";
+type;
+as; // Error (used in emitting position)
+
+// @Filename: /b.ts
+import { type as as } from "./mod.js";
+type; // Error (cannot resolve name)
+as;
+
+// @Filename: /c.ts
+import { type as as as } from "./mod.js";
+type; // Error (cannot resolve name)
+as; // Error (used in emitting position)
+
+// @Filename: /d.ts
+import { type as as as as } from "./mod.js"; // Error
+
+// @Filename: /e.ts
+import { type type as as } from "./mod.js";
+import { type as type } from "./mod.js";
+type;
+as; // Error (used in emitting position)
+
+// @Filename: /f.ts
+import { type import } from "./mod.js"; // Error
+import { type as export } from "./mod.js"; // Error
+import { type as as export } from "./mod.js"; // Error
+import { type something } from "./mod.js";
+import { type something as s } from "./mod.js";
+type; // Error (cannot resolve name)
+as; // Error (cannot resolve name)
+something; // Error (used in emitting position)
+s; // Error (used in emitting position)
+
+// @Filename: /g.ts
+import type { type something } from "./mod.js"; // Error
diff --git a/tests/cases/conformance/externalModules/typeOnly/preserveValueImports.ts b/tests/cases/conformance/externalModules/typeOnly/preserveValueImports.ts
new file mode 100644
index 0000000000..66326cb98b
--- /dev/null
+++ b/tests/cases/conformance/externalModules/typeOnly/preserveValueImports.ts
@@ -0,0 +1,28 @@
+// @preserveValueImports: true
+// @isolatedModules: true,false
+// @module: esnext
+
+// @Filename: a.ts
+export default {};
+export const b = 0;
+export const c = 1;
+export interface D {}
+
+// @Filename: b.ts
+import a, { b, c, D } from "./a";
+
+// @Filename: c.ts
+import * as a from "./a";
+
+// @Filename: d.ts
+export = {};
+
+// @Filename: e.ts
+import D = require("./d");
+import DD = require("./d");
+DD;
+
+// @Filename: f.ts
+import type a from "./a";
+import { b, c } from "./a";
+b;
diff --git a/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_errors.ts b/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_errors.ts
new file mode 100644
index 0000000000..fc2a3612e7
--- /dev/null
+++ b/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_errors.ts
@@ -0,0 +1,47 @@
+// @preserveValueImports: true
+// @isolatedModules: true,false
+// @module: esnext
+
+// @Filename: a.ts
+export type A = {};
+export type { A as default };
+
+// @Filename: b.ts
+class B {};
+export type { B, B as default };
+
+// @Filename: c.ts
+import DefaultA from "./a";
+import { A } from "./a";
+import DefaultB from "./b";
+import { B } from "./b";
+
+// @Filename: c.fixed.ts
+import type DefaultA from "./a";
+import type { A } from "./a";
+import type DefaultB from "./b";
+import type { B } from "./b";
+
+// @Filename: d.ts
+export { A as AA } from "./a";
+export { B as BB } from "./b";
+
+// @Filename: d.fixed.ts
+export type { A as AA } from "./a";
+export type { B as BB } from "./b";
+
+// @Filename: e.ts
+import { AA, BB } from "./d";
+
+// @Filename: e.fixed.ts
+import type { AA, BB } from "./d";
+
+// @Filename: f.ts
+import type { A } from "./a";
+import type { B } from "./b";
+export { A, B as BB };
+
+// @Filename: f.fixed.ts
+import type { A } from "./a";
+import type { B } from "./b";
+export type { A, B as BB };
diff --git a/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_importsNotUsedAsValues.ts b/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_importsNotUsedAsValues.ts
new file mode 100644
index 0000000000..4797a30727
--- /dev/null
+++ b/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_importsNotUsedAsValues.ts
@@ -0,0 +1,14 @@
+// @preserveValueImports: true
+// @importsNotUsedAsValues: preserve
+// @module: esnext
+
+// @Filename: /mod.ts
+export type A = unknown;
+export type B = never;
+export type C = any;
+
+// @Filename: /index.ts
+import { type A, type B, type C } from "./mod.js";
+
+// @Filename: /reexport.ts
+export { type A, type B, type C } from "./mod.js";
diff --git a/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_mixedImports.ts b/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_mixedImports.ts
new file mode 100644
index 0000000000..85cbae30f7
--- /dev/null
+++ b/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_mixedImports.ts
@@ -0,0 +1,13 @@
+// @preserveValueImports: true
+// @isolatedModules: true
+// @module: es2015
+
+// @Filename: /exports.ts
+export function Component() {}
+export interface ComponentProps {}
+
+// @Filename: /index.ts
+import { Component, ComponentProps } from "./exports.js";
+
+// @Filename: /index.fixed.ts
+import { Component, type ComponentProps } from "./exports.js";
diff --git a/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_module.ts b/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_module.ts
new file mode 100644
index 0000000000..27f78f707c
--- /dev/null
+++ b/tests/cases/conformance/externalModules/typeOnly/preserveValueImports_module.ts
@@ -0,0 +1,4 @@
+// @preserveValueImports: true
+// @module: amd,system,commonjs,es2015
+// @noTypesAndSymbols: true
+export {};
diff --git a/tests/cases/conformance/importAssertion/importAssertion1.ts b/tests/cases/conformance/importAssertion/importAssertion1.ts
new file mode 100644
index 0000000000..b547158cf1
--- /dev/null
+++ b/tests/cases/conformance/importAssertion/importAssertion1.ts
@@ -0,0 +1,37 @@
+// @declaration: true
+// @target: es2015
+// @module: es2015, commonjs, esnext
+
+// @filename: 0.ts
+export const a = 1;
+export const b = 2;
+
+// @filename: 1.ts
+import './0' assert { type: "json" }
+import { a, b } from './0' assert { "type": "json" }
+import * as foo from './0' assert { type: "json" }
+a;
+b;
+foo.a;
+foo.b;
+
+// @filename: 2.ts
+import { a, b } from './0' assert {}
+import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
+a;
+b;
+c;
+d;
+
+// @filename: 3.ts
+const a = import('./0')
+const b = import('./0', { assert: { type: "json" } })
+const c = import('./0', { assert: { type: "json", ttype: "typo" } })
+const d = import('./0', { assert: {} })
+const dd = import('./0', {})
+declare function foo(): any;
+const e = import('./0', foo())
+const f = import()
+const g = import('./0', {}, {})
+const h = import('./0', { assert: { type: "json" }},)
+
diff --git a/tests/cases/conformance/importAssertion/importAssertion2.ts b/tests/cases/conformance/importAssertion/importAssertion2.ts
new file mode 100644
index 0000000000..42a26af43e
--- /dev/null
+++ b/tests/cases/conformance/importAssertion/importAssertion2.ts
@@ -0,0 +1,17 @@
+// @declaration: true
+// @target: es2015
+// @module: es2015, commonjs, esnext
+
+// @filename: 0.ts
+export const a = 1;
+export const b = 2;
+
+// @filename: 1.ts
+export {} from './0' assert { type: "json" }
+export { a, b } from './0' assert { type: "json" }
+export * from './0' assert { type: "json" }
+export * as ns from './0' assert { type: "json" }
+
+// @filename: 2.ts
+export { a, b } from './0' assert {}
+export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
diff --git a/tests/cases/conformance/importAssertion/importAssertion3.ts b/tests/cases/conformance/importAssertion/importAssertion3.ts
new file mode 100644
index 0000000000..28479378b1
--- /dev/null
+++ b/tests/cases/conformance/importAssertion/importAssertion3.ts
@@ -0,0 +1,15 @@
+// @declaration: true
+// @target: es2015
+// @module: es2015, esnext
+
+// @filename: 0.ts
+export interface I { }
+
+// @filename: 1.ts
+export type {} from './0' assert { type: "json" }
+export type { I } from './0' assert { type: "json" }
+
+// @filename: 2.ts
+import type { I } from './0' assert { type: "json" }
+import type * as foo from './0' assert { type: "json" }
+
diff --git a/tests/cases/conformance/importAssertion/importAssertion4.ts b/tests/cases/conformance/importAssertion/importAssertion4.ts
new file mode 100644
index 0000000000..242d7dd375
--- /dev/null
+++ b/tests/cases/conformance/importAssertion/importAssertion4.ts
@@ -0,0 +1 @@
+import * as f from "./first" assert
diff --git a/tests/cases/conformance/importAssertion/importAssertion5.ts b/tests/cases/conformance/importAssertion/importAssertion5.ts
new file mode 100644
index 0000000000..ef09d84e66
--- /dev/null
+++ b/tests/cases/conformance/importAssertion/importAssertion5.ts
@@ -0,0 +1 @@
+import * as f from "./first" assert {
diff --git a/tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases3.ts b/tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases3.ts
index e3d076707b..8b95f5e240 100644
--- a/tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases3.ts
+++ b/tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases3.ts
@@ -32,4 +32,8 @@ class D implements A<boolean> {
d: string;
y: boolean;
z: boolean;
-}
\ No newline at end of file
+}
+let ww1 = new C();
+let ww2 = new C2();
+let ww3 = new C3();
+let ww4 = new C4();
diff --git a/tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection.ts b/tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection.ts
index 003976a2b2..1ab2942311 100644
--- a/tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection.ts
+++ b/tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendsObjectIntersection.ts
@@ -53,3 +53,15 @@ class C20 extends Constructor<Partial<T1>>() { x: string }
class C21 extends Constructor<Readonly<T1>>() { x: string }
class C22 extends Constructor<Identifiable<T1>>() { x: string }
class C23 extends Constructor<Identifiable<T1 & { b: number}>>() { x: string }
+let c1 = new C1();
+let c2 = new C2();
+let c3 = new C3();
+let c4 = new C4();
+let c5 = new C5();
+let c6 = new C6();
+let c7 = new C7();
+let cx = new CX();
+let c20 = new C20();
+let c21 = new C21();
+let c22 = new C22();
+let c23 = new C23();
\ No newline at end of file
diff --git a/tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType.ts b/tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType.ts
index 6979b40579..20d877f7a2 100644
--- a/tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType.ts
+++ b/tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyOfEveryType.ts
@@ -39,4 +39,5 @@ var a: Foo = {
m: M,
n: {},
o: E.A
-}
\ No newline at end of file
+}
+let cc = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndAmbientWithSameNameAndCommonRoot.ts b/tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndAmbientWithSameNameAndCommonRoot.ts
index 12f51f90a7..e1af2f0ac6 100644
--- a/tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndAmbientWithSameNameAndCommonRoot.ts
+++ b/tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndAmbientWithSameNameAndCommonRoot.ts
@@ -21,4 +21,3 @@ declare module A {
var p: { x: number; y: number; }
var p = A.Point.Origin;
var p = new A.Point(0, 0); // unexpected error here, bug 840000
-
\ No newline at end of file
diff --git a/tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.ts b/tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.ts
index e923f1f002..b9bb58e89e 100644
--- a/tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.ts
+++ b/tests/cases/conformance/internalModules/DeclarationMerging/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.ts
@@ -13,6 +13,7 @@ module A {
export class Point {
constructor(public x: number, public y: number) { }
}
+ let pp = new Point(1,1);
}
// @filename: test.ts
diff --git a/tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts b/tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts
index d285d9b422..9dca12bc2e 100644
--- a/tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts
+++ b/tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts
@@ -19,4 +19,6 @@ module A {
export module Point {
function Origin() { return ""; }// not an error since not exported
}
-}
\ No newline at end of file
+ let pp = new Point(1,1);
+}
+let pp1 = new Point(1,1);
\ No newline at end of file
diff --git a/tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts b/tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts
index 7d88bf6292..71433fbef5 100644
--- a/tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts
+++ b/tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts
@@ -3,6 +3,7 @@ module A {
x: number;
y: number;
}
+ let pp = new Point();
}
module A {
@@ -11,6 +12,7 @@ module A {
return { x: p.x, y: p.y };
}
}
+ let pp1 = new Point();
}
// ensure merges as expected
@@ -21,6 +23,7 @@ module X.Y.Z {
export class Line {
length: number;
}
+ let ll = new Line();
}
module X {
@@ -29,6 +32,7 @@ module X {
class Line {
name: string;
}
+ let ll1 = new Line()
}
}
}
diff --git a/tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts b/tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts
index 449e6e76a2..a0c9072675 100644
--- a/tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts
+++ b/tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts
@@ -16,6 +16,7 @@ module X.Y.Z {
export class Line {
length: number;
}
+ let ll = new Line();
}
module X {
@@ -24,6 +25,7 @@ module X {
export class Line {
name: string;
}
+ let ll1 = new Line();
}
}
}
diff --git a/tests/cases/conformance/internalModules/codeGeneration/exportCodeGen.ts b/tests/cases/conformance/internalModules/codeGeneration/exportCodeGen.ts
index 02398acbbb..321d84cd56 100644
--- a/tests/cases/conformance/internalModules/codeGeneration/exportCodeGen.ts
+++ b/tests/cases/conformance/internalModules/codeGeneration/exportCodeGen.ts
@@ -39,6 +39,7 @@ module E {
export module M {
export var x = 42;
}
+ let c1 = new C();
}
// validate all exportable statements,
@@ -51,4 +52,5 @@ module F {
module M {
var x = 42;
}
+ let c2 = new C();
}
\ No newline at end of file
diff --git a/tests/cases/conformance/internalModules/codeGeneration/nameCollision.ts b/tests/cases/conformance/internalModules/codeGeneration/nameCollision.ts
index aef48103cd..14d12af759 100644
--- a/tests/cases/conformance/internalModules/codeGeneration/nameCollision.ts
+++ b/tests/cases/conformance/internalModules/codeGeneration/nameCollision.ts
@@ -15,6 +15,7 @@ module B {
class B {
name: string;
}
+ let bb = new B();
}
module X {
diff --git a/tests/cases/conformance/jsdoc/constructorTagOnClassConstructor.ts b/tests/cases/conformance/jsdoc/constructorTagOnClassConstructor.ts
index 6d2f3780ee..72a97ff055 100644
--- a/tests/cases/conformance/jsdoc/constructorTagOnClassConstructor.ts
+++ b/tests/cases/conformance/jsdoc/constructorTagOnClassConstructor.ts
@@ -11,4 +11,6 @@ export class Beta {
}
}
-const arr = [Alpha, Beta];
+// const arr = [Alpha, Beta];
+let aa = new Alpha();
+let be = new Beta();
\ No newline at end of file
diff --git a/tests/cases/conformance/jsdoc/declarations/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.ts b/tests/cases/conformance/jsdoc/declarations/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.ts
index eb609720d7..b0bf85be74 100644
--- a/tests/cases/conformance/jsdoc/declarations/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.ts
+++ b/tests/cases/conformance/jsdoc/declarations/jsDeclarationsSubclassWithExplicitNoArgumentConstructor.ts
@@ -16,4 +16,5 @@ export class Sub extends Super {
constructor() {
super('first', 'second');
}
-}
\ No newline at end of file
+}
+let ss = new Sub();
\ No newline at end of file
diff --git a/tests/cases/conformance/jsdoc/declarations/jsDeclarationsThisTypes.ts b/tests/cases/conformance/jsdoc/declarations/jsDeclarationsThisTypes.ts
index bc2eae7dac..29ba837ef9 100644
--- a/tests/cases/conformance/jsdoc/declarations/jsDeclarationsThisTypes.ts
+++ b/tests/cases/conformance/jsdoc/declarations/jsDeclarationsThisTypes.ts
@@ -14,4 +14,6 @@ export class A {
export default class Base extends A {
// This method is required to reproduce #35932
verify() { }
-}
\ No newline at end of file
+}
+
+let b = new Base();
\ No newline at end of file
diff --git a/tests/cases/conformance/jsdoc/enumTagImported/enumTagImported.ts b/tests/cases/conformance/jsdoc/enumTagImported/enumTagImported.ts
new file mode 100644
index 0000000000..859c60103b
--- /dev/null
+++ b/tests/cases/conformance/jsdoc/enumTagImported/enumTagImported.ts
@@ -0,0 +1,23 @@
+// @allowJs: true
+// @checkJs: true
+// @noEmit: true
+// @Filename: type.js
+/** @typedef {import("./mod1").TestEnum} TE */
+/** @type {TE} */
+const test = 'add'
+/** @type {import("./mod1").TestEnum} */
+const tost = 'remove'
+
+// @Filename: value.js
+import { TestEnum } from "./mod1"
+/** @type {TestEnum} */
+const tist = TestEnum.ADD
+
+
+// @Filename: mod1.js
+
+/** @enum {string} */
+// export const TestEnum = {
+// ADD: 'add',
+// REMOVE: 'remove'
+// }
diff --git a/tests/cases/conformance/jsdoc/extendsTag1.ts b/tests/cases/conformance/jsdoc/extendsTag1.ts
index 194982760e..79b3bc7079 100644
--- a/tests/cases/conformance/jsdoc/extendsTag1.ts
+++ b/tests/cases/conformance/jsdoc/extendsTag1.ts
@@ -8,3 +8,4 @@
* @extends {Set<T>} Should prefer this Set<T>, not the Set in the heritage clause
*/
class My extends Set {}
+let q4 = new My();
diff --git a/tests/cases/conformance/jsdoc/jsdocAugments_qualifiedName/jsdocAugments_qualifiedName.ts b/tests/cases/conformance/jsdoc/jsdocAugments_qualifiedName/jsdocAugments_qualifiedName.ts
new file mode 100644
index 0000000000..ce4fb95ff2
--- /dev/null
+++ b/tests/cases/conformance/jsdoc/jsdocAugments_qualifiedName/jsdocAugments_qualifiedName.ts
@@ -0,0 +1,10 @@
+// @allowJs: true
+// @checkJs: true
+// @noEmit: true
+
+
+// @Filename: /b.js
+import * as a from "./a";
+let b = a.A;
+/** @augments a.A */
+class B {}
diff --git a/tests/cases/conformance/jsdoc/jsdocAugments_withTypeParameter.ts b/tests/cases/conformance/jsdoc/jsdocAugments_withTypeParameter.ts
index e94df03fbc..aba2b989e7 100644
--- a/tests/cases/conformance/jsdoc/jsdocAugments_withTypeParameter.ts
+++ b/tests/cases/conformance/jsdoc/jsdocAugments_withTypeParameter.ts
@@ -12,3 +12,4 @@ class B extends A {
return this.x;
}
}
+let q7 = new B();
\ No newline at end of file
diff --git a/tests/cases/conformance/jsdoc/jsdocImplements_namespacedInterface.ts b/tests/cases/conformance/jsdoc/jsdocImplements_namespacedInterface.ts
index c298e6685a..9af8207ba4 100644
--- a/tests/cases/conformance/jsdoc/jsdocImplements_namespacedInterface.ts
+++ b/tests/cases/conformance/jsdoc/jsdocImplements_namespacedInterface.ts
@@ -26,3 +26,5 @@ class BAT {
return "";
}
}
+let q1 = new B();
+let q2 = new BAT();
diff --git a/tests/cases/conformance/jsdoc/jsdocTemplateTagDefault.ts b/tests/cases/conformance/jsdoc/jsdocTemplateTagDefault.ts
new file mode 100644
index 0000000000..c93359a7a6
--- /dev/null
+++ b/tests/cases/conformance/jsdoc/jsdocTemplateTagDefault.ts
@@ -0,0 +1,71 @@
+// @allowJs: true
+// @checkJs: true
+// @declaration: true
+// @outDir: out
+// @Filename: file.js
+
+/**
+ * @template {string | number} [T=string] - ok: defaults are permitted
+ * @typedef {[T]} A
+ */
+
+/** @type {A} */ // ok, default for `T` in `A` is `string`
+const aDefault1 = [""];
+/** @type {A} */ // error: `number` is not assignable to string`
+const aDefault2 = [0];
+/** @type {A<string>} */ // ok, `T` is provided for `A`
+const aString = [""];
+/** @type {A<number>} */ // ok, `T` is provided for `A`
+const aNumber = [0];
+
+/**
+ * @template T
+ * @template [U=T] - ok: default can reference earlier type parameter
+ * @typedef {[T, U]} B
+ */
+
+/**
+ * @template {string | number} [T] - error: default requires an `=type`
+ * @typedef {[T]} C
+ */
+
+/**
+ * @template {string | number} [T=] - error: default requires a `type`
+ * @typedef {[T]} D
+ */
+
+/**
+ * @template {string | number} [T=string]
+ * @template U - error: Required type parameters cannot follow optional type parameters
+ * @typedef {[T, U]} E
+ */
+
+/**
+ * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters.
+ * @template [U=T]
+ * @typedef {[T, U]} G
+ */
+
+/**
+ * @template T
+ * @template [U=T] - ok: default can reference earlier type parameter
+ * @param {T} a
+ * @param {U} b
+ */
+function f1(a, b) {}
+
+ /**
+ * @template {string | number} [T=string]
+ * @template U - error: Required type parameters cannot follow optional type parameters
+ * @param {T} a
+ * @param {U} b
+ */
+function f2(a, b) {}
+
+/**
+ * @template [T=U] - error: Type parameter defaults can only reference previously declared type parameters.
+ * @template [U=T]
+ * @param {T} a
+ * @param {U} b
+ */
+function f3(a, b) {}
diff --git a/tests/cases/conformance/jsdoc/jsdocTemplateTagNameResolution.ts b/tests/cases/conformance/jsdoc/jsdocTemplateTagNameResolution.ts
new file mode 100644
index 0000000000..a5b4d052ad
--- /dev/null
+++ b/tests/cases/conformance/jsdoc/jsdocTemplateTagNameResolution.ts
@@ -0,0 +1,16 @@
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @declaration: true
+// @Filename: file.js
+
+/**
+ * @template T
+ * @template {keyof T} K
+ * @typedef {T[K]} Foo
+ */
+
+const x = { a: 1 };
+
+/** @type {Foo<typeof x, "a">} */
+const y = "a";
\ No newline at end of file
diff --git a/tests/cases/conformance/jsdoc/jsdocTypeReferenceUseBeforeDef.ts b/tests/cases/conformance/jsdoc/jsdocTypeReferenceUseBeforeDef.ts
index 93e735e1fa..b38836e7e7 100644
--- a/tests/cases/conformance/jsdoc/jsdocTypeReferenceUseBeforeDef.ts
+++ b/tests/cases/conformance/jsdoc/jsdocTypeReferenceUseBeforeDef.ts
@@ -6,3 +6,4 @@
const c = null
class C {
}
+let q3 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/jsdoc/jsdocVariadicType.ts b/tests/cases/conformance/jsdoc/jsdocVariadicType.ts
new file mode 100644
index 0000000000..cd4e75a54a
--- /dev/null
+++ b/tests/cases/conformance/jsdoc/jsdocVariadicType.ts
@@ -0,0 +1,12 @@
+// @allowJS: true
+// @checkJs: true
+// @noEmit: true
+
+// @filename: a.js
+/**
+ * @type {function(boolean, string, ...*):void}
+ */
+const foo = function (a, b, ...r) { };
+
+// @filename: b.ts
+foo(false, '');
diff --git a/tests/cases/conformance/jsdoc/seeTag3.ts b/tests/cases/conformance/jsdoc/seeTag3.ts
new file mode 100644
index 0000000000..abd16226fe
--- /dev/null
+++ b/tests/cases/conformance/jsdoc/seeTag3.ts
@@ -0,0 +1,7 @@
+// @outdir: out/
+// @checkJs: true
+// @filename: seeTag3.js
+
+/** @see [The typescript web site](https://typescriptlang.org) */
+function theWholeThing() {
+}
diff --git a/tests/cases/conformance/jsdoc/thisTag2.ts b/tests/cases/conformance/jsdoc/thisTag2.ts
new file mode 100644
index 0000000000..187ac9b932
--- /dev/null
+++ b/tests/cases/conformance/jsdoc/thisTag2.ts
@@ -0,0 +1,11 @@
+// @target: esnext
+// @allowJs: true
+// @declaration: true
+// @emitDeclarationOnly: true
+// @filename: a.js
+
+/** @this {string} */
+export function f1() {}
+
+/** @this */
+export function f2() {}
diff --git a/tests/cases/conformance/jsx/jsxParsingError4.tsx b/tests/cases/conformance/jsx/jsxParsingError4.tsx
new file mode 100644
index 0000000000..c4db4fe7ab
--- /dev/null
+++ b/tests/cases/conformance/jsx/jsxParsingError4.tsx
@@ -0,0 +1,18 @@
+// @strict: true, false
+// @jsx: react
+// @filename: a.tsx
+
+declare const React: any
+declare namespace JSX {
+ interface IntrinsicElements {
+ [k: string]: any
+ }
+}
+
+const a = (
+ <public-foo></public-foo>
+);
+
+const b = (
+ <public></public>
+);
diff --git a/tests/cases/conformance/jsx/jsxUnclosedParserRecovery.ts b/tests/cases/conformance/jsx/jsxUnclosedParserRecovery.ts
new file mode 100644
index 0000000000..08b6149d37
--- /dev/null
+++ b/tests/cases/conformance/jsx/jsxUnclosedParserRecovery.ts
@@ -0,0 +1,140 @@
+// @Filename: jsxParserRecovery.tsx
+// @jsx: preserve
+
+// should have no errors here; all these functions should parse and resolve
+noName(); noClose(); noCloseTypeArg(); noCloseAttrs(); noCloseTypeArgAttrs(); noCloseBracket(); noCloseBracketTypeArgAttrs(); noSelfclose(); noSelfcloseTypeArgAttrs();
+noNameTrailingTag(); noCloseTrailingTag(); noCloseTypeArgTrailingTag(); noCloseAttrsTrailingTag(); noCloseTypeArgAttrsTrailingTag(); noCloseBracketTrailingTag(); noCloseBracketTypeArgAttrsTrailingTag(); // noSelfcloseTrailingTag(); noSelfcloseTypeArgAttrsTrailingTag();
+noNameTrailingText(); noCloseTrailingText(); noCloseTypeArgTrailingText(); noCloseAttrsTrailingText(); noCloseTypeArgAttrsTrailingText(); noCloseBracketTrailingText(); noCloseBracketTypeArgAttrsTrailingText(); // noSelfcloseTrailingText(); noSelfcloseTypeArgAttrsTrailingText();
+
+function diddy() {
+ return null;
+}
+
+var donkey = <div>
+ <
+</div>;
+function noName() { }
+var donkey = <div>
+ <diddy
+</div>;
+function noClose() { }
+var donkey = <div>
+ <diddy<boolean>
+</div>;
+function noCloseTypeArg() { }
+var donkey = <div>
+ <diddy bananas="please"
+</div>;
+function noCloseAttrs() { }
+var donkey = <div>
+ <diddy<boolean> bananas="please"
+</div>;
+function noCloseTypeArgAttrs() { }
+var donkey = <div>
+ <diddy/
+</div>;
+function noCloseBracket() { }
+var donkey = <div>
+ <diddy<boolean> bananas="please"/
+</div>;
+function noCloseBracketTypeArgAttrs() { }
+var donkey = <div>
+ <diddy>
+</div>;
+function noSelfclose() { }
+var donkey = <div>
+ <diddy<boolean> bananas="please">
+</div>;
+function noSelfcloseTypeArgAttrs() { }
+
+var donkey = <div>
+ <
+ <diddy/>
+</div>;
+function noNameTrailingTag() { }
+var donkey = <div>
+ <diddy
+ <diddy/>
+</div>;
+function noCloseTrailingTag() { }
+var donkey = <div>
+ <diddy<boolean>
+ <diddy/>
+</div>;
+function noCloseTypeArgTrailingTag() { }
+var donkey = <div>
+ <diddy bananas="please"
+ <diddy/>
+</div>;
+function noCloseAttrsTrailingTag() { }
+var donkey = <div>
+ <diddy<boolean> bananas="please"
+ <diddy/>
+</div>;
+function noCloseTypeArgAttrsTrailingTag() { }
+var donkey = <div>
+ <diddy/
+ <diddy/>
+</div>;
+function noCloseBracketTrailingTag() { }
+var donkey = <div>
+ <diddy<boolean> bananas="please"/
+ <diddy/>
+</div>;
+function noCloseBracketTypeArgAttrsTrailingTag() { }
+var donkey = <div>
+ <diddy>
+ <diddy/>
+</div>;
+function noSelfcloseTrailingTag() { }
+var donkey = <div>
+ <diddy<boolean> bananas="please">
+ <diddy/>
+</div>;
+function noSelfcloseTypeArgAttrsTrailingTag() { }
+
+var donkey = <div>
+ <
+ Cranky Wrinkly Funky
+</div>;
+function noNameTrailingText() { }
+var donkey = <div>
+ <diddy
+ Cranky Wrinkly Funky
+</div>;
+function noCloseTrailingText() { }
+var donkey = <div>
+ <diddy<boolean>
+ Cranky Wrinkly Funky
+</div>;
+function noCloseTypeArgTrailingText() { }
+var donkey = <div>
+ <diddy bananas="please"
+ Cranky Wrinkly Funky
+</div>;
+function noCloseAttrsTrailingText() { }
+var donkey = <div>
+ <diddy<boolean> bananas="please"
+ Cranky Wrinkly Funky
+</div>;
+function noCloseTypeArgAttrsTrailingText() { }
+var donkey = <div>
+ <diddy/
+ Cranky Wrinkly Funky
+</div>;
+function noCloseBracketTrailingText() { }
+var donkey = <div>
+ <diddy<boolean> bananas="please"/
+ Cranky Wrinkly Funky
+</div>;
+function noCloseBracketTypeArgAttrsTrailingText() { }
+var donkey = <div>
+ <diddy>
+ Cranky Wrinkly Funky
+</div>;
+function noSelfcloseTrailingText() { }
+var donkey = <div>
+ <diddy<boolean> bananas="please">
+ Cranky Wrinkly Funky
+</div>;
+function noSelfcloseTypeArgAttrsTrailingText() { }
diff --git a/tests/cases/conformance/jsx/tsxReactEmitSpreadAttribute.ts b/tests/cases/conformance/jsx/tsxReactEmitSpreadAttribute.ts
new file mode 100644
index 0000000000..2ddc20ae39
--- /dev/null
+++ b/tests/cases/conformance/jsx/tsxReactEmitSpreadAttribute.ts
@@ -0,0 +1,32 @@
+// @jsx: react-jsx
+// @target: es2015,es2018,esnext
+// @filename: test.tsx
+/// <reference path="/.lib/react16.d.ts" />
+
+export function T1(a: any) {
+ return <div className={"T1"} { ...a }>T1</div>;
+}
+
+export function T2(a: any, b: any) {
+ return <div className={"T2"} { ...a } { ...b }>T2</div>;
+}
+
+export function T3(a: any, b: any) {
+ return <div { ...a } className={"T3"} { ...b }>T3</div>;
+}
+
+export function T4(a: any, b: any) {
+ return <div className={"T4"} { ...{ ...a, ...b } }>T4</div>;
+}
+
+export function T5(a: any, b: any, c: any, d: any) {
+ return <div className={"T5"} { ...{ ...a, ...b, ...{ c, d } } }>T5</div>;
+}
+
+export function T6(a: any, b: any, c: any, d: any) {
+ return <div className={"T6"} { ...{ ...a, ...b, ...{ ...c, ...d } } }>T6</div>;
+}
+
+export function T7(a: any, b: any, c: any, d: any) {
+ return <div>T7</div>;
+}
diff --git a/tests/cases/conformance/moduleResolution/declarationNotFoundPackageBundlesTypes.ts b/tests/cases/conformance/moduleResolution/declarationNotFoundPackageBundlesTypes.ts
new file mode 100644
index 0000000000..75c681daf0
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/declarationNotFoundPackageBundlesTypes.ts
@@ -0,0 +1,23 @@
+// @noImplicitAny: true
+// @noImplicitReferences: true
+
+// @filename: node_modules/foo/package.json
+{
+ "name": "foo",
+ "version": "1.0.0"
+}
+
+// @filename: node_modules/foo/index.js
+var foo = 0;
+module.exports = foo;
+
+// @filename: node_modules/foo/index.d.ts
+declare const foo: any;
+export = foo;
+
+// @filename: node_modules/foo/other.js
+module.exports = {};
+
+// @filename: index.ts
+import * as Foo from "foo";
+import * as Other from "foo/other"/*1*/;
\ No newline at end of file
diff --git a/tests/cases/conformance/moduleResolution/scopedPackages/index.d.ts b/tests/cases/conformance/moduleResolution/scopedPackages/index.d.ts
new file mode 100644
index 0000000000..04d4f15421
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/scopedPackages/index.d.ts
@@ -0,0 +1,3 @@
+// @filename: /node_modules/@cow/boy/index.d.ts
+export const x: number;
+export const y: number;
\ No newline at end of file
diff --git a/tests/cases/conformance/moduleResolution/scopedPackages/scopedPackages.ts b/tests/cases/conformance/moduleResolution/scopedPackages/scopedPackages.ts
new file mode 100644
index 0000000000..80db9778d1
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/scopedPackages/scopedPackages.ts
@@ -0,0 +1,12 @@
+// @noImplicitReferences: true
+// @traceResolution: true
+// @typeRoots: types
+
+
+// @filename: /a.ts
+import { x } from "./index";
+import { y } from "./index";
+import { z } from "./z";
+x;
+y;
+z;
\ No newline at end of file
diff --git a/tests/cases/conformance/moduleResolution/scopedPackages/z.d.ts b/tests/cases/conformance/moduleResolution/scopedPackages/z.d.ts
new file mode 100644
index 0000000000..8af8c4b248
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/scopedPackages/z.d.ts
@@ -0,0 +1,2 @@
+// @filename: /node_modules/@types/be__bop/e/z.d.ts
+export const z: number;
\ No newline at end of file
diff --git a/tests/cases/conformance/moduleResolution/scopedPackagesClassic/index.d.ts b/tests/cases/conformance/moduleResolution/scopedPackagesClassic/index.d.ts
new file mode 100644
index 0000000000..7cfe77597d
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/scopedPackagesClassic/index.d.ts
@@ -0,0 +1,2 @@
+// @filename: /node_modules/@types/see__saw/index.d.ts
+export const x = 0;
diff --git a/tests/cases/conformance/moduleResolution/scopedPackagesClassic/scopedPackagesClassic.ts b/tests/cases/conformance/moduleResolution/scopedPackagesClassic/scopedPackagesClassic.ts
new file mode 100644
index 0000000000..4f491b9532
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/scopedPackagesClassic/scopedPackagesClassic.ts
@@ -0,0 +1,9 @@
+// @noImplicitReferences: true
+// @traceResolution: true
+// @typeRoots: types
+// @moduleResolution: classic
+
+
+// @filename: /a.ts
+import { x } from "./index";
+x;
\ No newline at end of file
diff --git a/tests/cases/conformance/moduleResolution/untypedModuleImport_allowJs/untypedModuleImport_allowJs.ts b/tests/cases/conformance/moduleResolution/untypedModuleImport_allowJs/untypedModuleImport_allowJs.ts
new file mode 100644
index 0000000000..b2c0c1f81c
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/untypedModuleImport_allowJs/untypedModuleImport_allowJs.ts
@@ -0,0 +1,12 @@
+// @noImplicitReferences: true
+// @currentDirectory: /
+// @allowJs: true
+// @maxNodeModuleJsDepth: 1
+// Same as untypedModuleImport.ts but with --allowJs, so the package will actually be typed.
+
+// @filename: /node_modules/foo/index.js
+// exports.default = { bar() { return 0; } }
+
+// @filename: /a.ts
+import foo from "foo";
+foo.bar();
diff --git a/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/declarations.d.ts b/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/declarations.d.ts
new file mode 100644
index 0000000000..c54d01514d
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/declarations.d.ts
@@ -0,0 +1,4 @@
+// @filename: /declarations.d.ts
+declare module "foo" {
+ export const x: number;
+}
diff --git a/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/untypedModuleImport_vsAmbient.ts b/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/untypedModuleImport_vsAmbient.ts
new file mode 100644
index 0000000000..577d258b72
--- /dev/null
+++ b/tests/cases/conformance/moduleResolution/untypedModuleImport_vsAmbient/untypedModuleImport_vsAmbient.ts
@@ -0,0 +1,12 @@
+// @noImplicitReferences: true
+// @currentDirectory: /
+// This tests that an ambient module declaration overrides an untyped import.
+
+// @filename: /node_modules/foo/index.js
+// This file is not processed.
+
+
+// @filename: /a.ts
+/// <reference path="./declarations.d.ts" />
+import { x } from "foo";
+x;
diff --git a/tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts b/tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts
new file mode 100644
index 0000000000..a19a7104ae
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts
@@ -0,0 +1,24 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as self from "package";
+self;
+// @filename: index.mjs
+// esm format file
+import * as self from "package";
+self;
+// @filename: index.cjs
+// esm format file
+import * as self from "package";
+self;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts
new file mode 100644
index 0000000000..113c1fdeb8
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts
@@ -0,0 +1,324 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder/index.cjs
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder/index.mjs
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.js
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.cjs
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.mjs
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.js
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.cjs
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.mjs
+// esm format file
+const x = 1;
+export {x};
+// @filename: index.js
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones shouldn't all work - esm format files have no index resolution or extension resolution
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+// esm format file
+const x = 1;
+export {x};
+// @filename: index.cjs
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file)
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+// cjs format file
+const x = 1;
+export {x};
+// @filename: index.mjs
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones should all fail - esm format files have no index resolution or extension resolution
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+
+// esm format file
+const x = 1;
+export {x};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: subfolder2/package.json
+{
+}
+// @filename: subfolder2/another/package.json
+{
+ "type": "module"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts
new file mode 100644
index 0000000000..ea0821742f
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts
@@ -0,0 +1,8 @@
+// @module: node12,nodenext
+// @allowJs: true
+// @noEmit: true
+// @filename: foo.cjs
+exports.foo = "foo"
+// @filename: bar.ts
+import foo from "./foo.cjs"
+foo.foo;
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts
new file mode 100644
index 0000000000..1020812d5a
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts
@@ -0,0 +1,126 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.mjsSource;
+mjsi.mjsSource;
+typei.mjsSource;
+ts.mjsSource;
+// @filename: index.mjs
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.mjsSource;
+mjsi.mjsSource;
+typei.mjsSource;
+ts.mjsSource;
+// @filename: index.cjs
+// cjs format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.cjsSource;
+mjsi.cjsSource;
+typei.implicitCjsSource;
+ts.cjsSource;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const implicitCjsSource = true;
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const mjsSource = true;
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const cjsSource = true;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./a": {
+ "require": "./index.cjs",
+ "node": "./index.mjs"
+ },
+ "./b": {
+ "import": "./index.mjs",
+ "node": "./index.cjs"
+ },
+ ".": {
+ "import": "./index.mjs",
+ "node": "./index.js"
+ },
+ "./types": {
+ "types": {
+ "import": "./index.d.mts",
+ "require": "./index.d.cts",
+ },
+ "node": {
+ "import": "./index.mjs",
+ "require": "./index.cjs"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts
new file mode 100644
index 0000000000..d7032c648b
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts
@@ -0,0 +1,27 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+export async function main() {
+ const { readFile } = await import("fs");
+}
+// @filename: index.js
+// esm format file
+export async function main() {
+ const { readFile } = await import("fs");
+}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts
new file mode 100644
index 0000000000..f7d5aaf822
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts
@@ -0,0 +1,32 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+const a = {};
+export = a;
+// @filename: subfolder/file.js
+// cjs format file
+const a = {};
+module.exports = a;
+// @filename: index.js
+// esm format file
+const a = {};
+export = a;
+// @filename: file.js
+// esm format file
+import "fs";
+const a = {};
+module.exports = a;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts
new file mode 100644
index 0000000000..14783731bf
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts
@@ -0,0 +1,29 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+function require() {}
+const exports = {};
+class Object {}
+export const __esModule = false;
+export {require, exports, Object};
+// @filename: index.js
+// esm format file
+function require() {}
+const exports = {};
+class Object {}
+export const __esModule = false;
+export {require, exports, Object};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts
new file mode 100644
index 0000000000..53e6b94450
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts
@@ -0,0 +1,34 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: index.js
+// esm format file
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: file.js
+// esm format file
+const __require = null;
+const _createRequire = null;
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts
new file mode 100644
index 0000000000..d5727a3dc7
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts
@@ -0,0 +1,34 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+import {default as _fs} from "fs";
+_fs.readFile;
+import * as fs from "fs";
+fs.readFile;
+// @filename: index.js
+// esm format file
+import {default as _fs} from "fs";
+_fs.readFile;
+import * as fs from "fs";
+fs.readFile;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts
new file mode 100644
index 0000000000..032290f78b
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts
@@ -0,0 +1,30 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.ts
+// cjs format file
+export * from "fs";
+export * as fs from "fs";
+// @filename: index.js
+// esm format file
+export * from "fs";
+export * as fs from "fs";
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts
new file mode 100644
index 0000000000..9452e2003a
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts
@@ -0,0 +1,32 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+export {default} from "fs";
+export {default as foo} from "fs";
+export {bar as baz} from "fs";
+// @filename: index.js
+// esm format file
+export {default} from "fs";
+export {default as foo} from "fs";
+export {bar as baz} from "fs";
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts
new file mode 100644
index 0000000000..a8708434b9
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts
@@ -0,0 +1,23 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+const x = import.meta.url;
+export {x};
+// @filename: index.js
+// esm format file
+const x = import.meta.url;
+export {x};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts
new file mode 100644
index 0000000000..65e5721b0b
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts
@@ -0,0 +1,92 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mjs
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cjs
+// cjs format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts
new file mode 100644
index 0000000000..b9d6027f5d
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts
@@ -0,0 +1,41 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: index.mjs
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: index.cjs
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js",
+ "imports": {
+ "#cjs": "./index.cjs",
+ "#mjs": "./index.mjs",
+ "#type": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts
new file mode 100644
index 0000000000..2691885690
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts
@@ -0,0 +1,69 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mjs
+// esm format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cjs
+// cjs format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs/*": "./*.cjs",
+ "./mjs/*": "./*.mjs",
+ "./js/*": "./*.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts
new file mode 100644
index 0000000000..6b96f34758
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts
@@ -0,0 +1,69 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: index.js
+// esm format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mjs
+// esm format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cjs
+// cjs format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs/*.cjs": "./*.cjs",
+ "./mjs/*.mjs": "./*.mjs",
+ "./js/*.js": "./*.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts
new file mode 100644
index 0000000000..15892edbe3
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts
@@ -0,0 +1,37 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+import {h} from "../index.js";
+import mod = require("../index.js");
+import {f as _f} from "./index.js";
+import mod2 = require("./index.js");
+export async function f() {
+ const mod3 = await import ("../index.js");
+ const mod4 = await import ("./index.js");
+ h();
+}
+// @filename: index.js
+// esm format file
+import {h as _h} from "./index.js";
+import mod = require("./index.js");
+import {f} from "./subfolder/index.js";
+import mod2 = require("./subfolder/index.js");
+export async function h() {
+ const mod3 = await import ("./index.js");
+ const mod4 = await import ("./subfolder/index.js");
+ f();
+}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts
new file mode 100644
index 0000000000..872cad71c9
--- /dev/null
+++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts
@@ -0,0 +1,25 @@
+// @module: node12,nodenext
+// @declaration: true
+// @allowJs: true
+// @checkJs: true
+// @outDir: out
+// @filename: subfolder/index.js
+// cjs format file
+const x = await 1;
+export {x};
+for await (const y of []) {}
+// @filename: index.js
+// esm format file
+const x = await 1;
+export {x};
+for await (const y of []) {}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts b/tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts
new file mode 100644
index 0000000000..656465829e
--- /dev/null
+++ b/tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts
@@ -0,0 +1,33 @@
+// @module: commonjs
+// @lib: es2020
+// @declaration: true
+// @filename: index.ts
+export const a = async () => (await import("inner")).x();
+// @filename: node_modules/inner/index.d.ts
+export { x } from "./other.js";
+// @filename: node_modules/inner/other.d.ts
+import { Thing } from "./private.js"
+export const x: () => Thing;
+// @filename: node_modules/inner/private.d.ts
+export interface Thing {} // not exported in export map, inaccessible under new module modes
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "type": "module",
+ "exports": {
+ ".": {
+ "default": "./index.js"
+ },
+ "./other": {
+ "default": "./other.js"
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModules1.ts b/tests/cases/conformance/node/nodeModules1.ts
new file mode 100644
index 0000000000..698a6efec1
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModules1.ts
@@ -0,0 +1,321 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder/index.cts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder/index.mts
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.ts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.cts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: subfolder2/index.mts
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.ts
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.mts
+// esm format file
+const x = 1;
+export {x};
+// @filename: subfolder2/another/index.cts
+// cjs format file
+const x = 1;
+export {x};
+// @filename: index.mts
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones should all fail - esm format files have no index resolution or extension resolution
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+
+// esm format file
+const x = 1;
+export {x};
+// @filename: index.cts
+// ESM-format imports below should issue errors
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file)
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+// cjs format file
+const x = 1;
+export {x};
+// @filename: index.ts
+import * as m1 from "./index.js";
+import * as m2 from "./index.mjs";
+import * as m3 from "./index.cjs";
+import * as m4 from "./subfolder/index.js";
+import * as m5 from "./subfolder/index.mjs";
+import * as m6 from "./subfolder/index.cjs";
+import * as m7 from "./subfolder2/index.js";
+import * as m8 from "./subfolder2/index.mjs";
+import * as m9 from "./subfolder2/index.cjs";
+import * as m10 from "./subfolder2/another/index.js";
+import * as m11 from "./subfolder2/another/index.mjs";
+import * as m12 from "./subfolder2/another/index.cjs";
+// The next ones shouldn't all work - esm format files have no index resolution or extension resolution
+import * as m13 from "./";
+import * as m14 from "./index";
+import * as m15 from "./subfolder";
+import * as m16 from "./subfolder/";
+import * as m17 from "./subfolder/index";
+import * as m18 from "./subfolder2";
+import * as m19 from "./subfolder2/";
+import * as m20 from "./subfolder2/index";
+import * as m21 from "./subfolder2/another";
+import * as m22 from "./subfolder2/another/";
+import * as m23 from "./subfolder2/another/index";
+void m1;
+void m2;
+void m3;
+void m4;
+void m5;
+void m6;
+void m7;
+void m8;
+void m9;
+void m10;
+void m11;
+void m12;
+void m13;
+void m14;
+void m15;
+void m16;
+void m17;
+void m18;
+void m19;
+void m20;
+void m21;
+void m22;
+void m23;
+
+// These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!)
+import m24 = require("./");
+import m25 = require("./index");
+import m26 = require("./subfolder");
+import m27 = require("./subfolder/");
+import m28 = require("./subfolder/index");
+import m29 = require("./subfolder2");
+import m30 = require("./subfolder2/");
+import m31 = require("./subfolder2/index");
+import m32 = require("./subfolder2/another");
+import m33 = require("./subfolder2/another/");
+import m34 = require("./subfolder2/another/index");
+void m24;
+void m25;
+void m26;
+void m27;
+void m28;
+void m29;
+void m30;
+void m31;
+void m32;
+void m33;
+void m34;
+
+// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution
+const _m35 = import("./");
+const _m36 = import("./index");
+const _m37 = import("./subfolder");
+const _m38 = import("./subfolder/");
+const _m39 = import("./subfolder/index");
+const _m40 = import("./subfolder2");
+const _m41 = import("./subfolder2/");
+const _m42 = import("./subfolder2/index");
+const _m43 = import("./subfolder2/another");
+const _m44 = import("./subfolder2/another/");
+const _m45 = import("./subfolder2/another/index");
+// esm format file
+const x = 1;
+export {x};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: subfolder2/package.json
+{
+}
+// @filename: subfolder2/another/package.json
+{
+ "type": "module"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts b/tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts
new file mode 100644
index 0000000000..06c6320d77
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts
@@ -0,0 +1,19 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+export const a = 1;
+// @filename: index.ts
+// esm format file
+import mod from "./subfolder/index.js";
+mod;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts b/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts
new file mode 100644
index 0000000000..07bf9d9724
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts
@@ -0,0 +1,124 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.mjsSource;
+mjsi.mjsSource;
+typei.mjsSource;
+ts.mjsSource;
+// @filename: index.mts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.mjsSource;
+mjsi.mjsSource;
+typei.mjsSource;
+ts.mjsSource;
+// @filename: index.cts
+// cjs format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/a";
+import * as mjsi from "inner/b";
+import * as typei from "inner";
+import * as ts from "inner/types";
+cjsi.cjsSource;
+mjsi.cjsSource;
+typei.implicitCjsSource;
+ts.cjsSource;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const implicitCjsSource = true;
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const mjsSource = true;
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/a";
+import * as mjs from "inner/b";
+import * as type from "inner";
+import * as ts from "inner/types";
+export { cjs };
+export { mjs };
+export { type };
+export { ts };
+export const cjsSource = true;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./a": {
+ "require": "./index.cjs",
+ "node": "./index.mjs"
+ },
+ "./b": {
+ "import": "./index.mjs",
+ "node": "./index.cjs"
+ },
+ ".": {
+ "import": "./index.mjs",
+ "node": "./index.js"
+ },
+ "./types": {
+ "types": {
+ "import": "./index.d.mts",
+ "require": "./index.d.cts",
+ },
+ "node": {
+ "import": "./index.mjs",
+ "require": "./index.cjs"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesDeclarationEmitDynamicImportWithPackageExports.ts b/tests/cases/conformance/node/nodeModulesDeclarationEmitDynamicImportWithPackageExports.ts
new file mode 100644
index 0000000000..3f8bae7ffc
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesDeclarationEmitDynamicImportWithPackageExports.ts
@@ -0,0 +1,71 @@
+// @module: nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+export {};
+// @filename: index.mts
+// esm format file
+export {};
+// @filename: index.cts
+// cjs format file
+export {};
+// @filename: other.ts
+// esm format file
+export const a = await import("package/cjs");
+export const b = await import("package/mjs");
+export const c = await import("package");
+export const f = await import("inner");
+// @filename: other2.ts
+// esm format file
+export const d = await import("inner/cjs");
+export const e = await import("inner/mjs");
+// @filename: other.mts
+// esm format file
+export const a = await import("package/cjs");
+export const b = await import("package/mjs");
+export const c = await import("package");
+export const f = await import("inner");
+// @filename: other2.mts
+// esm format file
+export const d = await import("inner/cjs");
+export const e = await import("inner/mjs");
+// @filename: other.cts
+// cjs format file, no TLA
+export const a = import("package/cjs");
+export const b = import("package/mjs");
+export const c = import("package");
+export const f = import("inner");
+// @filename: other2.cts
+// cjs format file, no TLA
+export const d = import("inner/cjs");
+export const e = import("inner/mjs");
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+export const cjsMain = true;
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+export const esm = true;
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+export const cjsNonmain = true;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts b/tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts
new file mode 100644
index 0000000000..2599ff429f
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts
@@ -0,0 +1,93 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+export const a = cjs;
+export const b = mjs;
+export const c = type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+export const d = cjsi;
+export const e = mjsi;
+export const f = typei;
+// @filename: index.mts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+export const a = cjs;
+export const b = mjs;
+export const c = type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+export const d = cjsi;
+export const e = mjsi;
+export const f = typei;
+// @filename: index.cts
+// cjs format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+export const a = cjs;
+export const b = mjs;
+export const c = type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+export const d = cjsi;
+export const e = mjsi;
+export const f = typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+cjs;
+mjs;
+type;
+export const cjsMain = true;
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+cjs;
+mjs;
+type;
+export const esm = true;
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+cjs;
+mjs;
+type;
+export const cjsNonmain = true;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesDynamicImport.ts b/tests/cases/conformance/node/nodeModulesDynamicImport.ts
new file mode 100644
index 0000000000..46b317ca52
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesDynamicImport.ts
@@ -0,0 +1,24 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+export async function main() {
+ const { readFile } = await import("fs");
+}
+// @filename: index.ts
+// esm format file
+export async function main() {
+ const { readFile } = await import("fs");
+}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesExportAssignments.ts b/tests/cases/conformance/node/nodeModulesExportAssignments.ts
new file mode 100644
index 0000000000..7cbcd200d9
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesExportAssignments.ts
@@ -0,0 +1,20 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const a = {};
+export = a;
+// @filename: index.ts
+// esm format file
+const a = {};
+export = a;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts b/tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts
new file mode 100644
index 0000000000..ffc5adf8e0
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts
@@ -0,0 +1,27 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import { Thing } from "inner/other";
+export const a = (await import("inner")).x();
+// @filename: node_modules/inner/index.d.ts
+// esm format file
+export { x } from "./other.js";
+// @filename: node_modules/inner/other.d.ts
+// esm format file
+export interface Thing {}
+export const x: () => Thing;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts
new file mode 100644
index 0000000000..2562c7a4a1
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts
@@ -0,0 +1,34 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import { Thing } from "inner/other.js"; // should fail
+export const a = (await import("inner")).x();
+// @filename: node_modules/inner/index.d.ts
+// esm format file
+export { x } from "./other.js";
+// @filename: node_modules/inner/other.d.ts
+// esm format file
+export interface Thing {}
+export const x: () => Thing;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "type": "module",
+ "exports": {
+ ".": {
+ "default": "./index.js"
+ },
+ "./other": {
+ "default": "./other.js"
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts
new file mode 100644
index 0000000000..2eb8ac58e6
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts
@@ -0,0 +1,29 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import { Thing } from "inner/other";
+export const a = (await import("inner/index.js")).x();
+// @filename: node_modules/inner/index.d.ts
+// esm format file
+export { x } from "./other.js";
+// @filename: node_modules/inner/other.d.ts
+// esm format file
+export interface Thing {}
+export const x: () => Thing;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./": "./"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts
new file mode 100644
index 0000000000..97812da5b5
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts
@@ -0,0 +1,29 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import { Thing } from "inner/other";
+export const a = (await import("inner/index.js")).x();
+// @filename: node_modules/inner/index.d.ts
+// esm format file
+export { x } from "./other.js";
+// @filename: node_modules/inner/other.d.ts
+// esm format file
+export interface Thing {}
+export const x: () => Thing;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./*.js": "./*.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts b/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts
new file mode 100644
index 0000000000..d441627d7d
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts
@@ -0,0 +1,67 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder/index.cts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder/index.mts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/index.ts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/index.cts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/index.mts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/another/index.ts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/another/index.mts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: subfolder2/another/index.cts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: index.mts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: index.cts
+// cjs format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: index.ts
+// esm format file
+const x = <T>() => <T><any>(void 0);
+export {x};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: subfolder2/package.json
+{
+}
+// @filename: subfolder2/another/package.json
+{
+ "type": "module"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts b/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts
new file mode 100644
index 0000000000..e9a9b9d9ed
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts
@@ -0,0 +1,26 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+function require() {}
+const exports = {};
+class Object {}
+export const __esModule = false;
+export {require, exports, Object};
+// @filename: index.ts
+// esm format file
+function require() {}
+const exports = {};
+class Object {}
+export const __esModule = false;
+export {require, exports, Object};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportAssertions.ts b/tests/cases/conformance/node/nodeModulesImportAssertions.ts
new file mode 100644
index 0000000000..0fe1ccdf82
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportAssertions.ts
@@ -0,0 +1,13 @@
+// @module: node12,nodenext
+// @resolveJsonModule: true
+// @filename: index.ts
+import json from "./package.json" assert { type: "json" };
+// @filename: otherc.cts
+import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions
+const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine
+// @filename: package.json
+{
+ "name": "pkg",
+ "private": true,
+ "type": "module"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportAssignments.ts b/tests/cases/conformance/node/nodeModulesImportAssignments.ts
new file mode 100644
index 0000000000..6c22fe83e0
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportAssignments.ts
@@ -0,0 +1,31 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: index.ts
+// esm format file
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: file.ts
+// esm format file
+const __require = null;
+const _createRequire = null;
+import fs = require("fs");
+fs.readFile;
+export import fs2 = require("fs");
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts
new file mode 100644
index 0000000000..103b583712
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts
@@ -0,0 +1,31 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @filename: subfolder/index.ts
+// cjs format file
+import {default as _fs} from "fs";
+_fs.readFile;
+import * as fs from "fs";
+fs.readFile;
+// @filename: index.ts
+// esm format file
+import {default as _fs} from "fs";
+_fs.readFile;
+import * as fs from "fs";
+fs.readFile;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts
new file mode 100644
index 0000000000..7f90947a5f
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts
@@ -0,0 +1,27 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @filename: subfolder/index.ts
+// cjs format file
+export * from "fs";
+export * as fs from "fs";
+// @filename: index.ts
+// esm format file
+export * from "fs";
+export * as fs from "fs";
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts
new file mode 100644
index 0000000000..5f6984ad1f
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts
@@ -0,0 +1,25 @@
+// @module: node12,nodenext
+// @declaration: true
+// @importHelpers: true
+// @filename: subfolder/index.ts
+// cjs format file
+export {default} from "fs";
+// @filename: index.ts
+// esm format file
+export {default} from "fs";
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
+// @filename: types.d.ts
+declare module "fs";
+declare module "tslib" {
+ export {};
+ // intentionally missing all helpers
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportMeta.ts b/tests/cases/conformance/node/nodeModulesImportMeta.ts
new file mode 100644
index 0000000000..d684c7b5cb
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportMeta.ts
@@ -0,0 +1,20 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const x = import.meta.url;
+export {x};
+// @filename: index.ts
+// esm format file
+const x = import.meta.url;
+export {x};
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts b/tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts
new file mode 100644
index 0000000000..2a407b2bc6
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts
@@ -0,0 +1,24 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: index.mts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: index.cts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.cjs",
+ "imports": {
+ "#type": "package"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts b/tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts
new file mode 100644
index 0000000000..c0482c86ec
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts
@@ -0,0 +1,24 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: index.mts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: index.cts
+// esm format file
+import * as type from "#type";
+type;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "package",
+ "imports": {
+ "#type": "package"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesPackageExports.ts b/tests/cases/conformance/node/nodeModulesPackageExports.ts
new file mode 100644
index 0000000000..897d01b07d
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesPackageExports.ts
@@ -0,0 +1,90 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mts
+// esm format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cts
+// cjs format file
+import * as cjs from "package/cjs";
+import * as mjs from "package/mjs";
+import * as type from "package";
+cjs;
+mjs;
+type;
+import * as cjsi from "inner/cjs";
+import * as mjsi from "inner/mjs";
+import * as typei from "inner";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs";
+import * as mjs from "inner/mjs";
+import * as type from "inner";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs": "./index.cjs",
+ "./mjs": "./index.mjs",
+ ".": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesPackageImports.ts b/tests/cases/conformance/node/nodeModulesPackageImports.ts
new file mode 100644
index 0000000000..cccf930098
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesPackageImports.ts
@@ -0,0 +1,38 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: index.mts
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: index.cts
+// esm format file
+import * as cjs from "#cjs";
+import * as mjs from "#mjs";
+import * as type from "#type";
+cjs;
+mjs;
+type;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js",
+ "imports": {
+ "#cjs": "./index.cjs",
+ "#mjs": "./index.mjs",
+ "#type": "./index.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts
new file mode 100644
index 0000000000..e22e497a94
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts
@@ -0,0 +1,67 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mts
+// esm format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cts
+// cjs format file
+import * as cjsi from "inner/cjs/index";
+import * as mjsi from "inner/mjs/index";
+import * as typei from "inner/js/index";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs/index";
+import * as mjs from "inner/mjs/index";
+import * as type from "inner/js/index";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs/*": "./*.cjs",
+ "./mjs/*": "./*.mjs",
+ "./js/*": "./*.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts
new file mode 100644
index 0000000000..3abe36e0d6
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts
@@ -0,0 +1,67 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: index.mts
+// esm format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: index.cts
+// cjs format file
+import * as cjsi from "inner/cjs/index.cjs";
+import * as mjsi from "inner/mjs/index.mjs";
+import * as typei from "inner/js/index.js";
+cjsi;
+mjsi;
+typei;
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+import * as cjs from "inner/cjs/index.cjs";
+import * as mjs from "inner/mjs/index.mjs";
+import * as type from "inner/js/index.js";
+export { cjs };
+export { mjs };
+export { type };
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ "./cjs/*.cjs": "./*.cjs",
+ "./mjs/*.mjs": "./*.mjs",
+ "./js/*.js": "./*.js"
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesResolveJsonModule.ts b/tests/cases/conformance/node/nodeModulesResolveJsonModule.ts
new file mode 100644
index 0000000000..c298685c22
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesResolveJsonModule.ts
@@ -0,0 +1,29 @@
+// @module: node12,nodenext
+// @resolveJsonModule: true
+// @outDir: ./out
+// @declaration: true
+// @filename: index.ts
+import pkg from "./package.json"
+export const name = pkg.name;
+import * as ns from "./package.json";
+export const thing = ns;
+export const name2 = ns.default.name;
+// @filename: index.cts
+import pkg from "./package.json"
+export const name = pkg.name;
+import * as ns from "./package.json";
+export const thing = ns;
+export const name2 = ns.default.name;
+// @filename: index.mts
+import pkg from "./package.json"
+export const name = pkg.name;
+import * as ns from "./package.json";
+export const thing = ns;
+export const name2 = ns.default.name;
+// @filename: package.json
+{
+ "name": "pkg",
+ "version": "0.0.1",
+ "type": "module",
+ "default": "misedirection"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts b/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts
new file mode 100644
index 0000000000..78aa93ee17
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts
@@ -0,0 +1,34 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+import {h} from "../index.js";
+import mod = require("../index.js");
+import {f as _f} from "./index.js";
+import mod2 = require("./index.js");
+export async function f() {
+ const mod3 = await import ("../index.js");
+ const mod4 = await import ("./index.js");
+ h();
+}
+// @filename: index.ts
+// esm format file
+import {h as _h} from "./index.js";
+import mod = require("./index.js");
+import {f} from "./subfolder/index.js";
+import mod2 = require("./subfolder/index.js");
+export async function h() {
+ const mod3 = await import ("./index.js");
+ const mod4 = await import ("./subfolder/index.js");
+ f();
+}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts b/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts
new file mode 100644
index 0000000000..2fbd5d3b0c
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts
@@ -0,0 +1,22 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: subfolder/index.ts
+// cjs format file
+const x = await 1;
+export {x};
+for await (const y of []) {}
+// @filename: index.ts
+// esm format file
+const x = await 1;
+export {x};
+for await (const y of []) {}
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module"
+}
+// @filename: subfolder/package.json
+{
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts b/tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts
new file mode 100644
index 0000000000..52cda091b3
--- /dev/null
+++ b/tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts
@@ -0,0 +1,53 @@
+// @module: node12,nodenext
+// @declaration: true
+// @outDir: out
+// @filename: index.ts
+// esm format file
+import * as mod from "inner";
+mod.correctVersionApplied;
+
+// @filename: index.mts
+// esm format file
+import * as mod from "inner";
+mod.correctVersionApplied;
+
+// @filename: index.cts
+// cjs format file
+import * as mod from "inner";
+mod.correctVersionApplied;
+
+// @filename: node_modules/inner/index.d.ts
+// cjs format file
+export const noConditionsApplied = true;
+// @filename: node_modules/inner/index.d.mts
+// esm format file
+export const importConditionApplied = true;
+// @filename: node_modules/inner/index.d.cts
+// cjs format file
+export const wrongConditionApplied = true;
+// @filename: node_modules/inner/old-types.d.ts
+export const noVersionApplied = true;
+// @filename: node_modules/inner/new-types.d.ts
+export const correctVersionApplied = true;
+// @filename: node_modules/inner/future-types.d.ts
+export const futureVersionApplied = true;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+}
+// @filename: node_modules/inner/package.json
+{
+ "name": "inner",
+ "private": true,
+ "exports": {
+ ".": {
+ "types@>=10000": "./future-types.d.ts",
+ "types@>=1": "./new-types.d.ts",
+ "types": "./old-types.d.ts",
+ "import": "./index.mjs",
+ "node": "./index.js"
+ },
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodePackageSelfName.ts b/tests/cases/conformance/node/nodePackageSelfName.ts
new file mode 100644
index 0000000000..099d9c424e
--- /dev/null
+++ b/tests/cases/conformance/node/nodePackageSelfName.ts
@@ -0,0 +1,21 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import * as self from "package";
+self;
+// @filename: index.mts
+// esm format file
+import * as self from "package";
+self;
+// @filename: index.cts
+// esm format file
+import * as self from "package";
+self;
+// @filename: package.json
+{
+ "name": "package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/node/nodePackageSelfNameScoped.ts b/tests/cases/conformance/node/nodePackageSelfNameScoped.ts
new file mode 100644
index 0000000000..f4ef1e3798
--- /dev/null
+++ b/tests/cases/conformance/node/nodePackageSelfNameScoped.ts
@@ -0,0 +1,21 @@
+// @module: node12,nodenext
+// @declaration: true
+// @filename: index.ts
+// esm format file
+import * as self from "@scope/package";
+self;
+// @filename: index.mts
+// esm format file
+import * as self from "@scope/package";
+self;
+// @filename: index.cts
+// cjs format file
+import * as self from "@scope/package";
+self;
+// @filename: package.json
+{
+ "name": "@scope/package",
+ "private": true,
+ "type": "module",
+ "exports": "./index.js"
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override10.ts b/tests/cases/conformance/override/override10.ts
index 3a8eca1632..31b904811c 100644
--- a/tests/cases/conformance/override/override10.ts
+++ b/tests/cases/conformance/override/override10.ts
@@ -9,4 +9,5 @@ abstract class Base {
abstract class Sub extends Base {
abstract override foo(): number;
bar() { }
-}
\ No newline at end of file
+}
+let aa =new Sub();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override12.ts b/tests/cases/conformance/override/override12.ts
index 304caf1627..084c248b37 100644
--- a/tests/cases/conformance/override/override12.ts
+++ b/tests/cases/conformance/override/override12.ts
@@ -24,3 +24,4 @@ class B extends A {
override m3(): void {}
}
+let qq13 = new B();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override15.ts b/tests/cases/conformance/override/override15.ts
new file mode 100644
index 0000000000..882cc7eb97
--- /dev/null
+++ b/tests/cases/conformance/override/override15.ts
@@ -0,0 +1,9 @@
+// @noImplicitOverride: true
+
+class A {
+ doSomething() {}
+}
+
+class B extends A {
+ override doSomethang() {}
+}
diff --git a/tests/cases/conformance/override/override16.ts b/tests/cases/conformance/override/override16.ts
index 4468edfdc4..b869c89311 100644
--- a/tests/cases/conformance/override/override16.ts
+++ b/tests/cases/conformance/override/override16.ts
@@ -8,3 +8,4 @@ class A {
class B extends A {
override foo = "string";
}
+let qq12 = new B();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override17.ts b/tests/cases/conformance/override/override17.ts
index edabe9816d..a5f92ef955 100644
--- a/tests/cases/conformance/override/override17.ts
+++ b/tests/cases/conformance/override/override17.ts
@@ -25,3 +25,4 @@ class B extends A {
override m3(): void {}
}
+let qq11 = new B();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override18.ts b/tests/cases/conformance/override/override18.ts
index 2527449e74..6d4d132193 100644
--- a/tests/cases/conformance/override/override18.ts
+++ b/tests/cases/conformance/override/override18.ts
@@ -9,3 +9,4 @@ class A {
class B extends A {
override foo = "string";
}
+let qq7 = new B();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override19.ts b/tests/cases/conformance/override/override19.ts
new file mode 100644
index 0000000000..63e5cd9994
--- /dev/null
+++ b/tests/cases/conformance/override/override19.ts
@@ -0,0 +1,20 @@
+// @target: esnext
+// @noImplicitOverride: true
+
+type Foo = abstract new(...args: any) => any;
+declare function CreateMixin<C extends Foo, T extends Foo>(Context: C, Base: T): T & {
+ new (...args: any[]): { context: InstanceType<C> }
+}
+class Context {}
+
+class A {
+ doSomething() {}
+}
+
+class B extends CreateMixin(Context, A) {
+ override foo() {} // Remove override
+}
+
+class C extends CreateMixin(Context, A) {
+ override doSomethang() {} // Suggestion 'doSomething'
+}
diff --git a/tests/cases/conformance/override/override20.ts b/tests/cases/conformance/override/override20.ts
new file mode 100644
index 0000000000..9835cd9135
--- /dev/null
+++ b/tests/cases/conformance/override/override20.ts
@@ -0,0 +1,34 @@
+// @target: esnext
+// @noImplicitOverride: true
+
+const Foo: C1 & C2 =
+ class {
+ m1() { }
+ m2() { }
+ }
+
+interface I1 {
+ m1(): void;
+}
+
+interface I2 {
+ m1(): void;
+ m2(): void;
+}
+
+interface C1 {
+ new(...args: any[]): I1;
+}
+
+interface C2 {
+ new(...args: any[]): I2;
+}
+
+export class Bar extends Foo {
+ m1() {
+ super.m1();
+ }
+ m2() {
+ super.m2();
+ }
+}
diff --git a/tests/cases/conformance/override/override_js1.ts b/tests/cases/conformance/override/override_js1.ts
index 75df72695e..d327d1dbcf 100644
--- a/tests/cases/conformance/override/override_js1.ts
+++ b/tests/cases/conformance/override/override_js1.ts
@@ -22,4 +22,6 @@ class C {
fooo (v) {}
/** @override */
bar(v) {}
-}
\ No newline at end of file
+}
+let qq8 = new D();
+let qq9 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/override/override_js4.ts b/tests/cases/conformance/override/override_js4.ts
new file mode 100644
index 0000000000..f5a7f1b6c4
--- /dev/null
+++ b/tests/cases/conformance/override/override_js4.ts
@@ -0,0 +1,14 @@
+// @noImplicitOverride: true
+// @allowJs: true
+// @checkJs: true
+// @noEmit: true
+
+// @Filename: a.js
+class A {
+ doSomething() {}
+}
+
+class B extends A {
+ /** @override */
+ doSomethang() {}
+}
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration16.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration16.ts
index b345892ec2..39a09037ca 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration16.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration16.ts
@@ -1,4 +1,5 @@
class C {
foo();
foo() { }
-}
\ No newline at end of file
+}
+let q19 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration17.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration17.ts
index a709f7d7bc..08f7560759 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration17.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration17.ts
@@ -5,3 +5,4 @@ declare class Enumerator {
public item(): any;
constructor (o: any);
}
+let q22 = new Enumerator();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration19.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration19.ts
index 65d9bd0a57..5ed5520812 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration19.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration19.ts
@@ -1,4 +1,5 @@
class C {
foo();
"foo"() { }
-}
\ No newline at end of file
+}
+let q18 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration20.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration20.ts
index 6c8540e833..a2025ab46f 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration20.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration20.ts
@@ -1,4 +1,5 @@
class C {
0();
"0"() { }
-}
\ No newline at end of file
+}
+let q23 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration23.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration23.ts
index 5720f935a6..7ff1604575 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration23.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration23.ts
@@ -1,2 +1,3 @@
class C\u0032 {
-}
\ No newline at end of file
+}
+let q17 = new C\u0032();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration26.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration26.ts
index 4d5395733a..fbefb55710 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration26.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration26.ts
@@ -1,4 +1,5 @@
class C {
var
public
-}
\ No newline at end of file
+}
+let q20 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarationIndexSignature1.ts b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarationIndexSignature1.ts
index b99c0c6f48..bae31847e0 100644
--- a/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarationIndexSignature1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarationIndexSignature1.ts
@@ -1,3 +1,4 @@
class C {
[index:number]:number
-}
\ No newline at end of file
+}
+let q21 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration1.ts b/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration1.ts
index b845118647..024f143cad 100644
--- a/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration1.ts
@@ -1,3 +1,4 @@
class C {
public constructor() { }
-}
\ No newline at end of file
+}
+let q24 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts b/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts
index f445d70c88..7305a4098d 100644
--- a/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration5.ts
@@ -1,3 +1,4 @@
class C {
private constructor() { }
-}
\ No newline at end of file
+}
+let q25 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic11.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic11.ts
index 5ebd8f13ae..bd99e7cfb1 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic11.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic11.ts
@@ -2,3 +2,4 @@ class Outer
{
static public() {}
}
+let q12 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic14.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic14.ts
index 23fb870f86..474e281b08 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic14.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic14.ts
@@ -2,3 +2,4 @@ class Outer
{
static public<T>() {}
}
+let q14 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic2.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic2.ts
index 30045cf9f0..dfc01652e7 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic2.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic2.ts
@@ -2,3 +2,4 @@ class Outer
{
static public;
}
+let q11 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic3.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic3.ts
index c2f462b71a..f38fc7ee97 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic3.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic3.ts
@@ -2,3 +2,4 @@ class Outer
{
static public = 1;
}
+let q9 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic4.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic4.ts
index fe0ed44cf0..41f075c30c 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic4.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic4.ts
@@ -2,3 +2,4 @@ class Outer
{
static public: number;
}
+let q13 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic5.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic5.ts
index 49db39132c..ea9593bb53 100644
--- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic5.ts
+++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/AccessibilityAfterStatic/parserAccessibilityAfterStatic5.ts
@@ -2,3 +2,4 @@ class Outer
{
static public
}
+let q0 = new Outer();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass1.ts b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass1.ts
index 237910839d..a814947c9e 100644
--- a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass1.ts
@@ -1,2 +1,3 @@
class C<T> {
-}
\ No newline at end of file
+}
+let q38 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass2.ts b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass2.ts
index 949f220fbd..f4f517c52c 100644
--- a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass2.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericClass2.ts
@@ -1,2 +1,3 @@
class C<K,V> {
-}
\ No newline at end of file
+}
+let q40 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericConstraint1.ts b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericConstraint1.ts
index 585fa7dbe1..78a9ffb4db 100644
--- a/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericConstraint1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Generics/parserGenericConstraint1.ts
@@ -1,2 +1,3 @@
class C<T extends number> {
-}
\ No newline at end of file
+}
+let q39 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration1.ts b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration1.ts
index 56ba0579b0..7de740ebab 100644
--- a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration1.ts
@@ -1,3 +1,4 @@
class C {
[a: string]: number
-}
\ No newline at end of file
+}
+let q27 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration2.ts b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration2.ts
index 34108a6e71..f0224e9379 100644
--- a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration2.ts
+++ b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration2.ts
@@ -1,4 +1,5 @@
class C {
[a: string]: number
public v: number
-}
\ No newline at end of file
+}
+let q29 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration3.ts b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration3.ts
index f2180413ca..25ea575259 100644
--- a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration3.ts
+++ b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration3.ts
@@ -1,4 +1,5 @@
class C {
[a: string]: number;
public v: number
-}
\ No newline at end of file
+}
+let q30 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration4.ts b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration4.ts
index 498ad89d82..42622da3af 100644
--- a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration4.ts
+++ b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration4.ts
@@ -1,3 +1,4 @@
class C {
[a: string]: number; public v: number
-}
\ No newline at end of file
+}
+let q28 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts
index af180f585f..b89c199246 100644
--- a/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts
+++ b/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration6.ts
@@ -1,3 +1,4 @@
class C {
static [x: string]: string;
-}
\ No newline at end of file
+}
+let q26 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration5.ts b/tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration5.ts
index 98c4f9a75b..62e5062755 100644
--- a/tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration5.ts
+++ b/tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration5.ts
@@ -1,3 +1,4 @@
class C {
declare Foo;
-}
\ No newline at end of file
+}
+let q8 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts
index 2b07e1ca9a..765e7b650a 100644
--- a/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts
@@ -1,3 +1,4 @@
class C {
protected constructor() { }
-}
\ No newline at end of file
+}
+let q37 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts
index f0bf235a03..c1d4944d1e 100644
--- a/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts
@@ -1,3 +1,4 @@
class C {
protected static m() { }
-}
\ No newline at end of file
+}
+let q34 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts
index 4e24e28ec1..5ce2aa474a 100644
--- a/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts
+++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts
@@ -1,3 +1,4 @@
class C {
constructor(protected p) { }
-}
\ No newline at end of file
+}
+let q35 = new C(null);
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts
index bfb48ee0e3..29d488ffbc 100644
--- a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts
+++ b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts
@@ -1,3 +1,4 @@
export class Logger {
public
}
+let q32 = new Logger();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts
index bfb48ee0e3..18eeed1a6d 100644
--- a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts
+++ b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts
@@ -1,3 +1,4 @@
export class Logger {
public
}
+let q31 = new Logger();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts
index ca1a460120..a4609ba88c 100644
--- a/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts
+++ b/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts
@@ -3,3 +3,4 @@
export class Logger {
public
}
+let q23 = new Logger();
\ No newline at end of file
diff --git a/tests/cases/conformance/parser/ecmascript5/parserUnicode3.ts b/tests/cases/conformance/parser/ecmascript5/parserUnicode3.ts
index bb5f00ea71..99802e72b5 100644
--- a/tests/cases/conformance/parser/ecmascript5/parserUnicode3.ts
+++ b/tests/cases/conformance/parser/ecmascript5/parserUnicode3.ts
@@ -1,2 +1,3 @@
class 剩下 {
-}
\ No newline at end of file
+}
+let q5 = new 剩下();
diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement22.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement22.ts
new file mode 100644
index 0000000000..87f569dbfb
--- /dev/null
+++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement22.ts
@@ -0,0 +1,4 @@
+// @target: esnext
+
+var async;
+for (async of [1, 2]) {}
diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement23.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement23.ts
new file mode 100644
index 0000000000..5a3601380b
--- /dev/null
+++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement23.ts
@@ -0,0 +1,6 @@
+// @target: esnext
+
+async function foo(x: any) {
+ var async;
+ for await (async of x) {}
+}
diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement24.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement24.ts
new file mode 100644
index 0000000000..3846bd0a91
--- /dev/null
+++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement24.ts
@@ -0,0 +1,4 @@
+// @target: esnext
+
+var async;
+for ((async) of [1, 2]);
diff --git a/tests/cases/conformance/salsa/inferringClassMembersFromAssignments3.ts b/tests/cases/conformance/salsa/inferringClassMembersFromAssignments3.ts
index 800bd368db..f713920ad5 100644
--- a/tests/cases/conformance/salsa/inferringClassMembersFromAssignments3.ts
+++ b/tests/cases/conformance/salsa/inferringClassMembersFromAssignments3.ts
@@ -14,3 +14,4 @@ class Derived extends Base {
this.p = 1
}
}
+let w1 = new Derived();
\ No newline at end of file
diff --git a/tests/cases/conformance/salsa/plainJSBinderErrors.ts b/tests/cases/conformance/salsa/plainJSBinderErrors.ts
new file mode 100644
index 0000000000..d2019e3f78
--- /dev/null
+++ b/tests/cases/conformance/salsa/plainJSBinderErrors.ts
@@ -0,0 +1,44 @@
+// @outdir: out/
+// @target: esnext
+// @allowJS: true
+// @filename: plainJSBinderErrors.js
+export default 12
+export default 13
+const await = 1
+const yield = 2
+async function f() {
+ const await = 3
+}
+function* g() {
+ const yield = 4
+}
+class C {
+ #constructor = 5
+ deleted() {
+ function container(f) {
+ delete f
+ }
+ var g = 6
+ delete g
+ delete container
+ }
+ evalArguments() {
+ const eval = 7
+ const arguments = 8
+ }
+ withOctal() {
+ const redundant = 010
+ with (redundant) {
+ return toFixed()
+ }
+ }
+ label() {
+ for(;;) {
+ label: var x = 1
+ break label
+ }
+ return x
+ }
+}
+const eval = 9
+const arguments = 10
diff --git a/tests/cases/conformance/salsa/plainJSRedeclare.ts b/tests/cases/conformance/salsa/plainJSRedeclare.ts
new file mode 100644
index 0000000000..be6831d0cd
--- /dev/null
+++ b/tests/cases/conformance/salsa/plainJSRedeclare.ts
@@ -0,0 +1,6 @@
+// @outdir: out/
+// @allowJS: true
+// @filename: plainJSRedeclare.js
+const orbitol = 1
+var orbitol = 1 + false
+orbitol.toExponential()
diff --git a/tests/cases/conformance/salsa/plainJSRedeclare2.ts b/tests/cases/conformance/salsa/plainJSRedeclare2.ts
new file mode 100644
index 0000000000..7409b6c8fe
--- /dev/null
+++ b/tests/cases/conformance/salsa/plainJSRedeclare2.ts
@@ -0,0 +1,7 @@
+// @outdir: out/
+// @allowJS: true
+// @checkJS: true
+// @filename: plainJSRedeclare.js
+const orbitol = 1
+var orbitol = 1 + false
+orbitol.toExponential()
diff --git a/tests/cases/conformance/salsa/plainJSRedeclare3.ts b/tests/cases/conformance/salsa/plainJSRedeclare3.ts
new file mode 100644
index 0000000000..1327fcfc17
--- /dev/null
+++ b/tests/cases/conformance/salsa/plainJSRedeclare3.ts
@@ -0,0 +1,7 @@
+// @outdir: out/
+// @allowJS: true
+// @checkJS: false
+// @filename: plainJSRedeclare.js
+const orbitol = 1
+var orbitol = 1 + false
+orbitol.toExponential()
diff --git a/tests/cases/conformance/salsa/plainJSReservedStrict.ts b/tests/cases/conformance/salsa/plainJSReservedStrict.ts
new file mode 100644
index 0000000000..fbd654927d
--- /dev/null
+++ b/tests/cases/conformance/salsa/plainJSReservedStrict.ts
@@ -0,0 +1,7 @@
+// @outdir: out/
+// @target: esnext
+// @allowJS: true
+// @filename: plainJSReservedStrict.js
+"use strict"
+const eval = 1
+const arguments = 2
diff --git a/tests/cases/conformance/salsa/spellingUncheckedJS.ts b/tests/cases/conformance/salsa/spellingUncheckedJS.ts
new file mode 100644
index 0000000000..d5a1e8ac56
--- /dev/null
+++ b/tests/cases/conformance/salsa/spellingUncheckedJS.ts
@@ -0,0 +1,51 @@
+// @noEmit: true
+// @allowJs: true
+// @filename: spellingUncheckedJS.js
+export var inModule = 1
+inmodule.toFixed()
+
+function f() {
+ var locals = 2 + true
+ locale.toFixed()
+ // @ts-expect-error
+ localf.toExponential()
+ // @ts-expect-error
+ "this is fine"
+}
+class Classe {
+ non = 'oui'
+ methode() {
+ // no error on 'this' references
+ return this.none
+ }
+}
+class Derivee extends Classe {
+ methode() {
+ // no error on 'super' references
+ return super.none
+ }
+}
+
+
+var object = {
+ spaaace: 3
+}
+object.spaaaace // error on read
+object.spaace = 12 // error on write
+object.fresh = 12 // OK
+other.puuuce // OK, from another file
+new Date().getGMTDate() // OK, from another file
+
+// No suggestions for globals from other files
+const atoc = setIntegral(() => console.log('ok'), 500)
+AudioBuffin // etc
+Jimmy
+Jon
+
+// @filename: other.js
+var Jimmy = 1
+var John = 2
+Jon // error, it's from the same file
+var other = {
+ puuce: 4
+}
diff --git a/tests/cases/conformance/salsa/typeFromJSInitializer2.ts b/tests/cases/conformance/salsa/typeFromJSInitializer2.ts
new file mode 100644
index 0000000000..c1d5857624
--- /dev/null
+++ b/tests/cases/conformance/salsa/typeFromJSInitializer2.ts
@@ -0,0 +1,18 @@
+// @allowJs: true
+// @checkJs: true
+// @noEmit: true
+// @strictNullChecks: true
+// @noImplicitAny: true
+// @Filename: a.js
+
+/** @type {() => undefined} */
+function f1() {
+ return undefined;
+}
+const a = f1()
+
+/** @type {() => null} */
+function f2() {
+ return null;
+}
+const b = f2()
diff --git a/tests/cases/conformance/salsa/typeFromJSInitializer3.ts b/tests/cases/conformance/salsa/typeFromJSInitializer3.ts
new file mode 100644
index 0000000000..c5100df43d
--- /dev/null
+++ b/tests/cases/conformance/salsa/typeFromJSInitializer3.ts
@@ -0,0 +1,18 @@
+// @allowJs: true
+// @checkJs: true
+// @noEmit: true
+// @strictNullChecks: false
+// @noImplicitAny: true
+// @Filename: a.js
+
+/** @type {() => undefined} */
+function f1() {
+ return undefined;
+}
+const a = f1()
+
+/** @type {() => null} */
+function f2() {
+ return null;
+}
+const b = f2()
diff --git a/tests/cases/conformance/salsa/typeFromJSInitializer4.ts b/tests/cases/conformance/salsa/typeFromJSInitializer4.ts
new file mode 100644
index 0000000000..02d16c45a2
--- /dev/null
+++ b/tests/cases/conformance/salsa/typeFromJSInitializer4.ts
@@ -0,0 +1,29 @@
+// @allowJs: true
+// @checkJs: true
+// @noEmit: true
+// @strictNullChecks: false
+// @noImplicitAny: true
+// @Filename: a.js
+
+/** @type {number | undefined} */
+var n;
+
+// should get any on parameter initialisers
+function f(a = null, b = n, l = []) {
+ // a should be any
+ a = undefined
+ a = null
+ a = 1
+ a = true
+ a = {}
+ a = 'ok'
+
+ // b should be number | undefined, not any
+ b = 1
+ b = undefined
+ b = 'error'
+
+ // l should be any[]
+ l.push(1)
+ l.push('ok')
+}
diff --git a/tests/cases/conformance/salsa/typeFromPropertyAssignment23.ts b/tests/cases/conformance/salsa/typeFromPropertyAssignment23.ts
index 18923e0a5a..1dafa91c28 100644
--- a/tests/cases/conformance/salsa/typeFromPropertyAssignment23.ts
+++ b/tests/cases/conformance/salsa/typeFromPropertyAssignment23.ts
@@ -35,3 +35,6 @@ class NormalModule extends Module {
return 0
}
}
+let cc = new C();
+let dd = new D();
+let mo = new NormalModule();
\ No newline at end of file
diff --git a/tests/cases/conformance/statements/for-inStatements/for-inStatementsAsyncIdentifier.ts b/tests/cases/conformance/statements/for-inStatements/for-inStatementsAsyncIdentifier.ts
new file mode 100644
index 0000000000..ae63dd3136
--- /dev/null
+++ b/tests/cases/conformance/statements/for-inStatements/for-inStatementsAsyncIdentifier.ts
@@ -0,0 +1,4 @@
+// @target: esnext
+
+var async;
+for (async in { a: 1, b: 2 }) {}
diff --git a/tests/cases/conformance/statements/returnStatements/returnStatements.ts b/tests/cases/conformance/statements/returnStatements/returnStatements.ts
index ce764c1f11..945b98944c 100644
--- a/tests/cases/conformance/statements/returnStatements/returnStatements.ts
+++ b/tests/cases/conformance/statements/returnStatements/returnStatements.ts
@@ -21,3 +21,4 @@ function fn10(): I { return { id: 12 }; }
function fn11(): I { return new C(); }
function fn12(): C { return new D(); }
function fn13(): C { return null; }
+let q41 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts b/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts
index c5875327b5..313b2b7169 100644
--- a/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts
+++ b/tests/cases/conformance/statements/throwStatements/throwInEnclosingStatements.ts
@@ -45,3 +45,4 @@ var aa = {
throw this;
}
}
+let q42 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts b/tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts
index 9529b5b9a3..7996e18343 100644
--- a/tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts
+++ b/tests/cases/conformance/types/any/anyAsGenericFunctionCall.ts
@@ -7,4 +7,6 @@ var b = x<string>('hello');
class C { foo: string; }
var c = x<C>(x);
-var d = x<any>(x);
\ No newline at end of file
+var d = x<any>(x);
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/any/assignAnyToEveryType.ts b/tests/cases/conformance/types/any/assignAnyToEveryType.ts
index 0af7d94d7b..aba7eb4753 100644
--- a/tests/cases/conformance/types/any/assignAnyToEveryType.ts
+++ b/tests/cases/conformance/types/any/assignAnyToEveryType.ts
@@ -42,4 +42,6 @@ M = x;
function k<T>(a: T) {
a = x;
-}
\ No newline at end of file
+}
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/any/assignEveryTypeToAny.ts b/tests/cases/conformance/types/any/assignEveryTypeToAny.ts
index 8613550fc5..0f7f258e87 100644
--- a/tests/cases/conformance/types/any/assignEveryTypeToAny.ts
+++ b/tests/cases/conformance/types/any/assignEveryTypeToAny.ts
@@ -52,4 +52,6 @@ x = { f<T>(x: T) { return x; } }
function j<T>(a: T) {
x = a;
-}
\ No newline at end of file
+}
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/conditional/variance.ts b/tests/cases/conformance/types/conditional/variance.ts
index 1dd5db5c67..433eab8e01 100644
--- a/tests/cases/conformance/types/conditional/variance.ts
+++ b/tests/cases/conformance/types/conditional/variance.ts
@@ -25,3 +25,5 @@ class Bar<T extends string> {
Bar.instance.push(this);
}
}
+
+let ba = new Bar();
diff --git a/tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceWithTypeParameter.ts b/tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceWithTypeParameter.ts
index 530d506f64..87069a602d 100644
--- a/tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceWithTypeParameter.ts
+++ b/tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceWithTypeParameter.ts
@@ -31,3 +31,6 @@ testRest((t1: D, t2, t3) => {})
testRest((t1, t2: D, t3) => {})
testRest((t2: D, ...t3) => {})
testRest((t2, ...t3: D[]) => {})
+
+
+let d = new D();
diff --git a/tests/cases/conformance/types/import/importTypeAmbient.ts b/tests/cases/conformance/types/import/importTypeAmbient.ts
index b1ba463777..3345c3ac06 100644
--- a/tests/cases/conformance/types/import/importTypeAmbient.ts
+++ b/tests/cases/conformance/types/import/importTypeAmbient.ts
@@ -28,8 +28,8 @@ declare module "foo2" {
item: Bar.I;
constructor(input: Baz.J);
}
+
}
-
let y: import("foo2").Bar.I = { a: "", b: 0 };
class Bar2 {
@@ -40,3 +40,6 @@ class Bar2 {
let shim: typeof import("foo2") = {
Bar: Bar2
};
+
+var a;
+let ba1 = new Bar2(a);
diff --git a/tests/cases/conformance/types/import/importTypeGenericTypes.ts b/tests/cases/conformance/types/import/importTypeGenericTypes.ts
index 5bc3aa7802..cf808fc6e3 100644
--- a/tests/cases/conformance/types/import/importTypeGenericTypes.ts
+++ b/tests/cases/conformance/types/import/importTypeGenericTypes.ts
@@ -29,9 +29,10 @@ class Bar<T> {
item: Bar.I<T>;
constructor(input: Baz.J<T>) {}
}
+let bbb = new Bar(null);
export { Bar }
-// @filename: usage.ts
+// @filename: usage.
export const x: import("./foo")<{x: number}> = { x: 0, y: 0, data: {x: 12} };
export let y: import("./foo2").Bar.I<{x: number}> = { a: "", b: 0, data: {x: 12} };
@@ -43,3 +44,5 @@ export class Bar2<T> {
export let shim: typeof import("./foo2") = {
Bar: Bar2
};
+
+let ba2 = new Bar2(1);
diff --git a/tests/cases/conformance/types/import/importTypeLocal.ts b/tests/cases/conformance/types/import/importTypeLocal.ts
index 4f29a22285..6fe5ab1c18 100644
--- a/tests/cases/conformance/types/import/importTypeLocal.ts
+++ b/tests/cases/conformance/types/import/importTypeLocal.ts
@@ -26,8 +26,11 @@ class Bar {
item: Bar.I;
constructor(input: Baz.J) {}
}
+let bbb = new Bar(null)
export { Bar }
+
+
// @filename: usage.ts
export const x: import("./foo") = { x: 0, y: 0 };
export let y: import("./foo2").Bar.I = { a: "", b: 0 };
@@ -40,3 +43,5 @@ export class Bar2 {
export let shim: typeof import("./foo2") = {
Bar: Bar2
};
+
+let ba2 = new Bar2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/intersection/intersectionOfUnionNarrowing.ts b/tests/cases/conformance/types/intersection/intersectionOfUnionNarrowing.ts
new file mode 100644
index 0000000000..0f67b66bff
--- /dev/null
+++ b/tests/cases/conformance/types/intersection/intersectionOfUnionNarrowing.ts
@@ -0,0 +1,16 @@
+// @strict: true
+
+interface X {
+ a?: { aProp: string };
+ b?: { bProp: string };
+}
+type AorB = { a: object; b: undefined } | { a: undefined; b: object };
+
+declare const q: X & AorB;
+
+if (q.a !== undefined) {
+ q.a.aProp;
+} else {
+ // q.b is previously incorrectly inferred as potentially undefined
+ q.b.bProp;
+}
diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts
index 56ff157a67..7c7d0b13e0 100644
--- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts
+++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts
@@ -658,3 +658,23 @@ const cf2 = <T extends { [P in K | "cool"]: string; }, K extends keyof T>(t: T,
const s: string = t[k];
t.cool;
};
+
+let shape = new Shape();
+let ta1 = new TaggedShape();
+let it = new Item();
+let op = new Options();
+let com1 = new Component();
+let c11 = new C();
+let c12 = new C1();
+let ba1 = new Base();
+let per = new Person(1);
+let oth = new OtherPerson(1);
+var aa;
+let com2 = new Component1(aa);
+let com3 = new Component2(aa);
+let a11 = new A();
+let b11 = new B();
+let fo = new Form();
+let sam = new SampleClass(1);
+let ano = new AnotherSampleClass(1);
+let unb = new Unbounded();
diff --git a/tests/cases/conformance/types/literal/literalTypes2.ts b/tests/cases/conformance/types/literal/literalTypes2.ts
index 57e7a0bc74..46b1479857 100644
--- a/tests/cases/conformance/types/literal/literalTypes2.ts
+++ b/tests/cases/conformance/types/literal/literalTypes2.ts
@@ -176,3 +176,6 @@ type Bit = 0 | 1;
let aa = makeArray<Bit>(0);
aa = append(aa, 1);
+
+let c1 = new C1();
+let c2 = new C2();
diff --git a/tests/cases/conformance/types/localTypes/localTypes2.ts b/tests/cases/conformance/types/localTypes/localTypes2.ts
index 79f1402c70..2b81f903ac 100644
--- a/tests/cases/conformance/types/localTypes/localTypes2.ts
+++ b/tests/cases/conformance/types/localTypes/localTypes2.ts
@@ -3,6 +3,7 @@ function f1() {
class C {
constructor(public x: number, public y: number) { }
}
+ let c = new C(1,2);
return C;
}
let C = f();
@@ -17,6 +18,7 @@ function f2() {
public x = x;
constructor(public y: number) { }
}
+ let c = new C(1);
return C;
}
let C = f(10);
@@ -31,6 +33,7 @@ function f3() {
public x = x;
public y = y;
}
+ let c = new C();
return C;
}
let C = f(10, 20);
diff --git a/tests/cases/conformance/types/localTypes/localTypes3.ts b/tests/cases/conformance/types/localTypes/localTypes3.ts
index 5eb3cf2850..7b1e536270 100644
--- a/tests/cases/conformance/types/localTypes/localTypes3.ts
+++ b/tests/cases/conformance/types/localTypes/localTypes3.ts
@@ -3,6 +3,7 @@ function f1() {
class C<X, Y> {
constructor(public x: X, public y: Y) { }
}
+ let c = new C(1,2);
return C;
}
let C = f();
@@ -17,6 +18,7 @@ function f2() {
public x = x;
constructor(public y: Y) { }
}
+ let c = new C(1);
return C;
}
let C = f(10);
@@ -31,6 +33,7 @@ function f3() {
public x = x;
public y = y;
}
+ let c = new C();
return C;
}
let C = f(10, "hello");
diff --git a/tests/cases/conformance/types/mapped/mappedTypeAsClauseRelationships.ts b/tests/cases/conformance/types/mapped/mappedTypeAsClauseRelationships.ts
new file mode 100644
index 0000000000..051192159e
--- /dev/null
+++ b/tests/cases/conformance/types/mapped/mappedTypeAsClauseRelationships.ts
@@ -0,0 +1,27 @@
+// From original issue #45212:
+type Methods<T> = { [P in keyof T as T[P] extends Function ? P : never]: T[P] };
+type H<T> = T[keyof Methods<T>]; // Ok
+
+// `Filter<T>` only filters out some keys of `T`.
+type Filter<T> = { [P in keyof T as T[P] extends Function ? P : never]: T[P] };
+// `Modify<T>` might modify some keys of `T`.
+type Modify<T> = { [P in keyof T as P extends string? `bool${P}`: P]: T[P] };
+
+function fun<T>(val: T) {
+ let x: Filter<T> = val; // Ok
+ let y: Modify<T> = val; // Error
+}
+
+type FilterInclOpt<T> = { [P in keyof T as T[P] extends Function ? P : never]+?: T[P] };
+type ModifyInclOpt<T> = { [P in keyof T as P extends string? `bool${P}`: never ]+?: T[P] };
+type FilterExclOpt<T> = { [P in keyof T as T[P] extends Function ? P : never]-?: T[P] };
+type ModifyExclOpt<T> = { [P in keyof T as P extends string? `bool${P}`: never ]-?: T[P] };
+
+function fun2<T>(val: T) {
+ let x: FilterInclOpt<T> = val; // Ok
+ let y: ModifyInclOpt<T> = val; // Ok
+ let z: FilterExclOpt<T> = val; // Error
+ let w: ModifyExclOpt<T> = val; // Error
+}
+
+
diff --git a/tests/cases/conformance/types/mapped/mappedTypeProperties.ts b/tests/cases/conformance/types/mapped/mappedTypeProperties.ts
new file mode 100644
index 0000000000..407e0eaf56
--- /dev/null
+++ b/tests/cases/conformance/types/mapped/mappedTypeProperties.ts
@@ -0,0 +1,42 @@
+// @declaration: true
+export type PlaceType = 'openSky' | 'roofed' | 'garage'
+type Before = {
+ model: 'hour' | 'day';
+ [placeType in PlaceType]: void;
+}
+
+type After = {
+ [placeType in PlaceType]: void;
+ model: 'hour' | 'day'
+}
+
+type AfterQuestion = {
+ [placeType in PlaceType]?: void;
+ model: 'hour' | 'day';
+}
+type AfterMethod = {
+ [placeType in PlaceType]?: void;
+ model(duration: number): 'hour' | 'day';
+}
+
+type AfterImplicit = {
+ [placeType in PlaceType]
+ model: 'hour' | 'day';
+}
+type AfterImplicitQ = {
+ [placeType in PlaceType]?
+ model: 'hour' | 'day'
+}
+
+interface I {
+ [P in PlaceType]: any
+}
+class C {
+ [P in PlaceType]: any
+}
+const D = class {
+ [P in PlaceType]: any
+}
+const E = class {
+ [P in 'a' | 'b']: any
+}
diff --git a/tests/cases/conformance/types/mapped/mappedTypes3.ts b/tests/cases/conformance/types/mapped/mappedTypes3.ts
index bf5a4399b0..6ef1918898 100644
--- a/tests/cases/conformance/types/mapped/mappedTypes3.ts
+++ b/tests/cases/conformance/types/mapped/mappedTypes3.ts
@@ -37,4 +37,6 @@ function f3(bb: BoxifiedBacon) {
let b = unboxify<Bacon>(bb); // Explicit type parameter required
let bool = b.isPerfect;
let weight = bb.weight;
-}
\ No newline at end of file
+}
+
+let box = new Box();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts b/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts
index b3530b4696..66e25c6091 100644
--- a/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts
+++ b/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts
@@ -43,3 +43,5 @@ interface E3<T> extends Base {
class Form<T> {
private values: {[P in keyof T]?: T[P]} = {}
}
+
+let f = new Form();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/classWithProtectedProperty.ts b/tests/cases/conformance/types/members/classWithProtectedProperty.ts
index 96bc615c02..a37828eef1 100644
--- a/tests/cases/conformance/types/members/classWithProtectedProperty.ts
+++ b/tests/cases/conformance/types/members/classWithProtectedProperty.ts
@@ -24,4 +24,6 @@ class D extends C {
var r7: string = C.f();
var r8: string = C.g();
}
-}
\ No newline at end of file
+}
+
+let d = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/indexSignatures1.ts b/tests/cases/conformance/types/members/indexSignatures1.ts
new file mode 100644
index 0000000000..f888275683
--- /dev/null
+++ b/tests/cases/conformance/types/members/indexSignatures1.ts
@@ -0,0 +1,325 @@
+// @strict: true
+// @declaration: true
+// @target: esnext
+
+// Symbol index signature checking
+
+const sym = Symbol();
+
+function gg3(x: { [key: string]: string }, y: { [key: symbol]: string }, z: { [sym]: number }) {
+ x = z;
+ y = z; // Error
+}
+
+// Overlapping index signatures
+
+function gg1(x: { [key: `a${string}`]: string, [key: `${string}a`]: string }, y: { [key: `a${string}a`]: string }) {
+ x = y;
+ y = x;
+}
+
+interface IX { [key: `a${string}`]: string, [key: `${string}a`]: string }
+interface IY { [key: `a${string}a`]: string }
+
+function gg2(x: IX, y: IY) {
+ x = y; // Error
+ y = x;
+}
+
+// Intersection of multiple applicable index signatures
+
+declare let combo: { [x: `foo-${string}`]: 'a' | 'b' } & { [x: `${string}-bar`]: 'b' | 'c' };
+const x1 = combo['foo-test']; // 'a' | 'b'
+const x2 = combo['test-bar']; // 'b' | 'c'
+const x3 = combo['foo-test-bar']; // 'b' (('a' | 'b') & ('b' | 'c'))
+
+declare var str: string;
+
+const x4 = combo[`foo-${str}`];
+const x5 = combo[`${str}-bar`];
+const x6 = combo[`foo-${str}-bar`];
+
+declare let combo2: { [x: `${string}xxx${string}` & `${string}yyy${string}`]: string };
+
+const x7 = combo2['axxxbyyyc'];
+const x8 = combo2['ayyyxxxbc'];
+const x9 = combo2['axxxbbbyc']; // Error
+
+// Property access on template pattern index signature
+
+declare let dom: { [x: `data${string}`]: string };
+const y1 = dom['data123'];
+const y2 = dom.data123;
+
+// Excess property checking for template pattern index signature
+
+dom = { data123: 'hello' };
+dom = { date123: 'hello' }; // Error
+
+// Contextual typing by index signature with template literal pattern
+
+type Funcs = {
+ [key: `s${string}`]: (x: string) => void,
+ [key: `n${string}`]: (x: number) => void,
+}
+
+const funcs: Funcs = {
+ sfoo: x => x.length, // x: string
+ nfoo: x => x * 2, // n: number
+}
+
+// Duplicate index signature checking
+
+type Duplicates = {
+ [key: string | number]: any; // Error
+ [key: number | symbol]: any; // Error
+ [key: symbol | `foo${string}`]: any; // Error
+ [key: `foo${string}`]: any; // Error
+}
+
+// Conflicting index signature checking
+
+type Conflicting = {
+ [key: `a${string}`]: 'a';
+ [key: `${string}a`]: 'b';
+ [key: `a${string}a`]: 'c'; // Error
+}
+
+// Invalid index signatures
+
+type Invalid<T extends string> = {
+ [key: 'a' | 'b' | 'c']: string; // Error
+ [key: T | number]: string; // Error
+ [key: Error]: string; // Error
+ [key: T & string]: string; // Error
+}
+
+// Intersections in index signatures
+
+type Tag1 = { __tag1__: void };
+type Tag2 = { __tag2__: void };
+
+type TaggedString1 = string & Tag1;
+type TaggedString2 = string & Tag2;
+
+declare let s0: string;
+declare let s1: TaggedString1;
+declare let s2: TaggedString2;
+declare let s3: TaggedString1 | TaggedString2;
+declare let s4: TaggedString1 & TaggedString2;
+
+interface I1 { [key: TaggedString1]: string }
+interface I2 { [key: TaggedString2]: string }
+interface I3 { [key: TaggedString1 | TaggedString2]: string }
+interface I4 { [key: TaggedString1 & TaggedString2]: string }
+
+declare let i1: I1;
+declare let i2: I2;
+declare let i3: I3;
+declare let i4: I4;
+
+i1[s0]; // Error
+i1[s1];
+i1[s2]; // Error
+i1[s3]; // Error
+i1[s4];
+
+i2[s0]; // Error
+i2[s1]; // Error
+i2[s2];
+i2[s3]; // Error
+i2[s4];
+
+i3[s0]; // Error
+i3[s1];
+i3[s2];
+i3[s3];
+i3[s4];
+
+i4[s0]; // Error
+i4[s1]; // Error
+i4[s2]; // Error
+i4[s3]; // Error
+i4[s4];
+
+i1 = i2; // Error
+i1 = i3;
+i1 = i4; // Error
+
+i2 = i1; // Error
+i2 = i3;
+i2 = i4; // Error
+
+i3 = i1; // Error
+i3 = i2; // Error
+i3 = i4; // Error
+
+i4 = i1;
+i4 = i2;
+i4 = i3;
+
+declare let o1: { [key: TaggedString1]: string };
+declare let o2: { [key: TaggedString2]: string };
+declare let o3: { [key: TaggedString1 | TaggedString2]: string };
+declare let o4: { [key: TaggedString1 & TaggedString2]: string };
+
+o1[s0]; // Error
+o1[s1];
+o1[s2]; // Error
+o1[s3]; // Error
+o1[s4];
+
+o2[s0]; // Error
+o2[s1]; // Error
+o2[s2];
+o2[s3]; // Error
+o2[s4];
+
+o3[s0]; // Error
+o3[s1];
+o3[s2];
+o3[s3];
+o3[s4];
+
+o4[s0]; // Error
+o4[s1]; // Error
+o4[s2]; // Error
+o4[s3]; // Error
+o4[s4];
+
+o1 = o2;
+o1 = o3;
+o1 = o4;
+
+o2 = o1;
+o2 = o3;
+o2 = o4;
+
+o3 = o1;
+o3 = o2;
+o3 = o4;
+
+o4 = o1;
+o4 = o2;
+o4 = o3;
+
+// Index signatures inferred from computed property names
+
+const obj10 = {
+ ['x']: 0 as const,
+ ['a' + 'b']: 1 as const,
+};
+
+const obj11 = {
+ [1]: 2 as const,
+ [1 + 2]: 3 as const,
+};
+
+const obj12 = {
+ [sym]: 4 as const,
+ [Symbol()]: 5 as const,
+};
+
+const obj13 = {
+ ['x']: 0 as const,
+ ['a' + 'b']: 1 as const,
+ [1]: 2 as const,
+ [1 + 2]: 3 as const,
+ [sym]: 4 as const,
+ [Symbol()]: 5 as const,
+};
+
+// Repros from #1863
+
+const system = Symbol('system');
+const SomeSytePlugin = Symbol('SomeSytePlugin');
+
+interface Plugs {
+ [key: symbol]: (...args: any) => unknown;
+}
+
+const plugins = {
+ "user": {} as Plugs,
+ [system]: {} as Plugs
+};
+
+plugins[system][SomeSytePlugin] = () => console.log('awsome');
+plugins[system][SomeSytePlugin]();
+
+var theAnswer: symbol = Symbol('secret');
+var obj = {} as Record<symbol, number>;
+obj[theAnswer] = 42;
+
+// Repro from #26470
+
+const directive = Symbol('directive');
+declare function foo<TArg, TRet, TDir>(options: { [x in string]: (arg: TArg) => TRet } & { [directive]?: TDir }): void;
+
+let case1 = foo({
+ [directive]: (x: string) => 'str',
+ addOne: (x: number) => x + 1,
+ double: (x: number) => x + x,
+});
+
+let case2 = foo({
+ addOne: (x: number) => x + 1,
+ double: (x: number) => x + x,
+ [directive]: (x: string) => 'str',
+});
+
+let case3 = foo({
+ [directive]: 'str',
+ addOne: (x: number) => x + 1,
+ double: (x: number) => x + x,
+});
+
+// Repros from #42192
+
+type Pseudo = `&:${string}`;
+
+const AmIPseudo1: Pseudo = '&:test';
+const AmIPseudo: Pseudo = '&'; // Error
+
+type PseudoDeclaration = { [key in Pseudo]: string };
+
+const test: PseudoDeclaration = { 'someKey' : 'someValue' }; // Error
+
+type FieldPattern = `/${string}`;
+
+const path1: FieldPattern = '/one';
+const path2: FieldPattern = 'two'; // Error
+
+type PathsObject = { [P in FieldPattern]: object; };
+const pathObject: PathsObject = 123; // Error
+
+type IdType = `${number}-${number}-${number}-${number}`
+const id: IdType = '0000-0000-0000-0001';
+
+type A = Record<IdType, string>;
+
+const a: A = { [id]: 'test' }
+
+let aid = a[id];
+
+// Repro from #44793
+
+interface AA {
+ a?: string;
+ b?: number;
+ [key: symbol]: string;
+}
+
+const aa: AA = { [sym]: '123' };
+
+const obj1: { [key: symbol]: string } = { [sym]: 'hello '};
+const obj2: { [key: string]: string } = { [sym]: 'hello '}; // Permitted for backwards compatibility
+const obj3: { [key: number]: string } = { [sym]: 'hello '}; // Error
+
+// Repro from #45772
+
+type Id = string & { __tag: 'id '};
+type Rec1 = { [key: Id]: number };
+type Rec2 = Record<Id, number>;
+
+type K1 = keyof Rec1; // Id
+type K2 = keyof Rec2; // Id
diff --git a/tests/cases/conformance/types/members/objectTypeHidingMembersOfObject.ts b/tests/cases/conformance/types/members/objectTypeHidingMembersOfObject.ts
index 1a7d6f2be4..bc489541ae 100644
--- a/tests/cases/conformance/types/members/objectTypeHidingMembersOfObject.ts
+++ b/tests/cases/conformance/types/members/objectTypeHidingMembersOfObject.ts
@@ -24,4 +24,6 @@ var b: {
valueOf(): void;
}
-var r4: void = b.valueOf();
\ No newline at end of file
+var r4: void = b.valueOf();
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/objectTypePropertyAccess.ts b/tests/cases/conformance/types/members/objectTypePropertyAccess.ts
index a54890fce9..e3c2cca547 100644
--- a/tests/cases/conformance/types/members/objectTypePropertyAccess.ts
+++ b/tests/cases/conformance/types/members/objectTypePropertyAccess.ts
@@ -26,3 +26,5 @@ var r8 = a.toString();
var r9 = a['toString']();
var r10 = a.foo;
var r11 = a['foo'];
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/objectTypeWithNumericProperty.ts b/tests/cases/conformance/types/members/objectTypeWithNumericProperty.ts
index 730ab43ec9..2c1b46b5d1 100644
--- a/tests/cases/conformance/types/members/objectTypeWithNumericProperty.ts
+++ b/tests/cases/conformance/types/members/objectTypeWithNumericProperty.ts
@@ -40,4 +40,6 @@ var b = {
var r1 = b[1];
var r2 = b[1.1];
var r3 = b['1'];
-var r4 = b['1.1'];
\ No newline at end of file
+var r4 = b['1.1'];
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/objectTypeWithStringNamedPropertyOfIllegalCharacters.ts b/tests/cases/conformance/types/members/objectTypeWithStringNamedPropertyOfIllegalCharacters.ts
index 766f56bdd2..d67c011129 100644
--- a/tests/cases/conformance/types/members/objectTypeWithStringNamedPropertyOfIllegalCharacters.ts
+++ b/tests/cases/conformance/types/members/objectTypeWithStringNamedPropertyOfIllegalCharacters.ts
@@ -50,3 +50,5 @@ var r2 = b[" "];
var r3 = b["a b"];
// BUG 817263
var r4 = b["~!@#$%^&*()_+{}|:'<>?\/.,`"];
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/typesWithSpecializedCallSignatures.ts b/tests/cases/conformance/types/members/typesWithSpecializedCallSignatures.ts
index 9eef3476f2..9aea8f6a18 100644
--- a/tests/cases/conformance/types/members/typesWithSpecializedCallSignatures.ts
+++ b/tests/cases/conformance/types/members/typesWithSpecializedCallSignatures.ts
@@ -38,4 +38,7 @@ a = i;
var r1: Derived1 = c.foo('hi');
var r2: Derived2 = c.foo('bye');
-var r3: Base = c.foo('hm');
\ No newline at end of file
+var r3: Base = c.foo('hm');
+
+// let dev1 = new Derived1();
+// let dev2 = new Derived2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/members/typesWithSpecializedConstructSignatures.ts b/tests/cases/conformance/types/members/typesWithSpecializedConstructSignatures.ts
index 7c84e76f14..522fad55bf 100644
--- a/tests/cases/conformance/types/members/typesWithSpecializedConstructSignatures.ts
+++ b/tests/cases/conformance/types/members/typesWithSpecializedConstructSignatures.ts
@@ -36,4 +36,7 @@ a = i;
var r1 = new C('hi');
var r2: Derived2 = new i('bye');
-var r3: Base = new a('hm');
\ No newline at end of file
+var r3: Base = new a('hm');
+
+let dev1 = new Derived1();
+let dev2 = new Derived2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts b/tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts
index 82e7de4584..97001142ae 100644
--- a/tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts
+++ b/tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts
@@ -8,4 +8,7 @@ class C {
class C2<T> {
x?: T;
f?(x: T) {}
-}
\ No newline at end of file
+}
+
+let c = new C();
+let c2 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/namedTypes/optionalMethods.ts b/tests/cases/conformance/types/namedTypes/optionalMethods.ts
index 932521425f..dc7fe5cf4c 100644
--- a/tests/cases/conformance/types/namedTypes/optionalMethods.ts
+++ b/tests/cases/conformance/types/namedTypes/optionalMethods.ts
@@ -56,3 +56,6 @@ class Derived extends Base {
a = 1;
f(): number { return 1; }
}
+
+let ba1 = new Bar();
+let dev = new Derived();
diff --git a/tests/cases/conformance/types/never/neverType.ts b/tests/cases/conformance/types/never/neverType.ts
index d58471d62a..e548194630 100644
--- a/tests/cases/conformance/types/never/neverType.ts
+++ b/tests/cases/conformance/types/never/neverType.ts
@@ -91,3 +91,5 @@ test(() => "hello");
test(() => fail());
test(() => { throw new Error(); })
test(errorCallback);
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts
index 1cc499c7d6..16fe9f1bc5 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithoutReturnTypeAnnotationInference.ts
@@ -77,6 +77,7 @@ module M {
export var x = 1;
export class C { foo: string }
}
+let c2 = new M.C();
function foo11() {
return M;
}
@@ -119,4 +120,7 @@ module e1 { export var y = 1; }
function foo15() {
return e1;
}
-var r15 = foo15();
\ No newline at end of file
+var r15 = foo15();
+
+let c = new C();
+let c11 = new c1(1);
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts
index d5ff0c1f56..191117eb92 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts
@@ -35,4 +35,6 @@ var b = {
foo(x, x) { },
a: function foo(x: number, x: string) { },
b: <T>(x: T, x: T) => { }
-}
\ No newline at end of file
+}
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters.ts
index 34edfba671..d285c45d78 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters.ts
@@ -52,3 +52,5 @@ b.a(1);
b.a(1, 2);
b.b();
b.b(1);
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters2.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters2.ts
index 4f31726f82..bdd01987b0 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters2.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters2.ts
@@ -56,4 +56,6 @@ a(1);
a(1, 2);
a.foo(1);
a.foo(1, 2);
-a.foo(1, 2, 3);
\ No newline at end of file
+a.foo(1, 2, 3);
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/parametersWithNoAnnotationAreAny.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/parametersWithNoAnnotationAreAny.ts
index 432c905765..4c09ab1066 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/parametersWithNoAnnotationAreAny.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/parametersWithNoAnnotationAreAny.ts
@@ -26,4 +26,6 @@ var b = {
return x;
},
b: (x) => x
-}
\ No newline at end of file
+}
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts
index 01f33fbd7b..0aeddb657c 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts
@@ -62,3 +62,6 @@ var a3: {
foo(x: 'a');
foo<T extends String>(x: T);
}
+let c1 = new C();
+let c2 = new C2();
+let c3 = new C3();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsSubtypeOfNonSpecializedSignature.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsSubtypeOfNonSpecializedSignature.ts
index 70735b8edd..06ca07fbe8 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsSubtypeOfNonSpecializedSignature.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsSubtypeOfNonSpecializedSignature.ts
@@ -78,3 +78,6 @@ var a3: {
foo(x: 'a');
foo<T extends String>(x: T);
}
+let c1 = new C();
+let c2 = new C2();
+let c3 = new C3();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts
index a8bf323850..6ea1c88cfb 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts
@@ -23,3 +23,5 @@ var b = {
a: function foo(x: 'hi', y: 'hi') { },
b: (x: 'hi') => { }
}
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterAsTypeArgument.ts b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterAsTypeArgument.ts
index ef33eef5d5..5e87397a9e 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterAsTypeArgument.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/callSignatures/typeParameterAsTypeArgument.ts
@@ -24,4 +24,6 @@ interface I<T, U> {
//interface I<T, U extends T> {
// x: C<U, T>;
-//}
+//}
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts b/tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts
index 4ac60bd7f7..9a462477de 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts
@@ -29,4 +29,7 @@ var a: {
var b: {
new <T>(x: T, y: string): C2<T>;
new <T>(x: T, y: string): C; // error
-}
\ No newline at end of file
+}
+
+let c1 = new C(1);
+let c2 = new C2(1);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexingResults.ts b/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexingResults.ts
index 3d7b7eba45..4af4aba5a9 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexingResults.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexingResults.ts
@@ -53,4 +53,6 @@ var r2b = b2['2'];
var r3 = b2['3'];
var r4 = b2[1];
var r5 = b2[2];
-var r6 = b2[3];
\ No newline at end of file
+var r6 = b2[3];
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexingResults.ts b/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexingResults.ts
index f51b8e461e..48ccea819f 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexingResults.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexingResults.ts
@@ -32,3 +32,5 @@ var b: { [x: string]: string } = { y: '' }
var r10 = b['y'];
var r11 = b['a'];
var r12 = b[1];
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNameWithoutTypeAnnotation.ts b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNameWithoutTypeAnnotation.ts
index 42f42eb312..ce53505fda 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNameWithoutTypeAnnotation.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNameWithoutTypeAnnotation.ts
@@ -18,4 +18,6 @@ var b = {
var r1 = (new C()).foo;
var r2 = (<I>null).foo;
var r3 = a.foo;
-var r4 = b.foo;
\ No newline at end of file
+var r4 = b.foo;
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNamesOfReservedWords.ts b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNamesOfReservedWords.ts
index 6673465381..e8589921f5 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNamesOfReservedWords.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNamesOfReservedWords.ts
@@ -273,4 +273,6 @@ enum E {
}
var r7 = E.abstract;
-var r8 = E.as;
\ No newline at end of file
+var r8 = E.as;
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyAccess.ts b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyAccess.ts
index dbea999036..9c6eea5968 100644
--- a/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyAccess.ts
+++ b/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyAccess.ts
@@ -20,4 +20,6 @@ var r3 = a["a b"];
var b = {
"a b": 1
}
-var r4 = b["a b"];
\ No newline at end of file
+var r4 = b["a b"];
+
+let c1 = new C();
diff --git a/tests/cases/conformance/types/primitives/number/extendNumberInterface.ts b/tests/cases/conformance/types/primitives/number/extendNumberInterface.ts
index 6aa6325ee3..68641deedd 100644
--- a/tests/cases/conformance/types/primitives/number/extendNumberInterface.ts
+++ b/tests/cases/conformance/types/primitives/number/extendNumberInterface.ts
@@ -7,4 +7,4 @@ var x = 1;
var a: string = x.doStuff();
var b: string = x.doOtherStuff('hm');
var c: string = x['doStuff']();
-var d: string = x['doOtherStuff']('hm');
\ No newline at end of file
+var d: string = x['doOtherStuff']('hm');
diff --git a/tests/cases/conformance/types/primitives/undefined/invalidUndefinedValues.ts b/tests/cases/conformance/types/primitives/undefined/invalidUndefinedValues.ts
index 58a5a54386..572d96843f 100644
--- a/tests/cases/conformance/types/primitives/undefined/invalidUndefinedValues.ts
+++ b/tests/cases/conformance/types/primitives/undefined/invalidUndefinedValues.ts
@@ -28,4 +28,6 @@ x = f;
enum E { A }
x = E;
-x = E.A;
\ No newline at end of file
+x = E.A;
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/primitives/undefined/validUndefinedAssignments.ts b/tests/cases/conformance/types/primitives/undefined/validUndefinedAssignments.ts
index 71ae9f89a1..a1cad7a4a4 100644
--- a/tests/cases/conformance/types/primitives/undefined/validUndefinedAssignments.ts
+++ b/tests/cases/conformance/types/primitives/undefined/validUndefinedAssignments.ts
@@ -20,4 +20,6 @@ var h: { f(): void } = x;
function i<T>(a: T) {
a = x;
-}
\ No newline at end of file
+}
+
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/rest/objectRestParameter.ts b/tests/cases/conformance/types/rest/objectRestParameter.ts
index 5b6faeb797..a18f4afc49 100644
--- a/tests/cases/conformance/types/rest/objectRestParameter.ts
+++ b/tests/cases/conformance/types/rest/objectRestParameter.ts
@@ -19,3 +19,4 @@ function foobar({ bar={}, ...opts }: any = {}) {
foobar();
foobar({ baz: 'hello' });
foobar({ bar: { greeting: 'hello' } });
+let t1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts b/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts
index 9746dd287b..a518d15d97 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts
@@ -23,4 +23,6 @@ var c2: { (x: number): number; <T>(x: T): any; };
var z2 = [a2, b2, c2];
var r6 = z2[0];
-var r7 = r6(''); // any not string
\ No newline at end of file
+var r7 = r6(''); // any not string
+
+let c11 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts b/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts
index 4ba6a76000..1d686dcc89 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteralForOverloads2.ts
@@ -25,4 +25,7 @@ var f2: {
var f3: {
new<T>(x: string): D<T>;
new<T>(x: number): D<T>;
-} = D;
\ No newline at end of file
+} = D;
+
+let c = new C('');
+let d = new D('');
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryOnClass.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryOnClass.ts
index 3e8ee82c74..4dd74a8b9b 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryOnClass.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryOnClass.ts
@@ -53,4 +53,7 @@ class D<T> {
var d: D<string>;
var r3: typeof D;
-var r4: typeof d;
\ No newline at end of file
+var r4: typeof d;
+
+let c1 = new C(1);
+let d1 = new D(1);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryWithReservedWords.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryWithReservedWords.ts
index 5fb9d2233f..ce1748f526 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryWithReservedWords.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeQueryWithReservedWords.ts
@@ -12,3 +12,4 @@ interface IScope {
delete: typeof Controller.prototype.delete; // Should not error
var: typeof Controller.prototype.var; // Should not error
}
+let c2 = new Controller();
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClass2.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClass2.ts
index df1898a543..4dcf244525 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClass2.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofClass2.ts
@@ -18,4 +18,7 @@ class D extends C {
var d: D;
var r1: typeof D;
-var r2: typeof d;
\ No newline at end of file
+var r2: typeof d;
+
+let c = new C(1);
+let d1 = new D(1);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofModuleWithoutExports.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofModuleWithoutExports.ts
index 878885a8a9..53d74c3b71 100644
--- a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofModuleWithoutExports.ts
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofModuleWithoutExports.ts
@@ -3,6 +3,7 @@ module M {
class C {
foo: number;
}
+ var c = new C();
}
-var r: typeof M;
\ No newline at end of file
+var r: typeof M;
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThis.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThis.ts
new file mode 100644
index 0000000000..420604c550
--- /dev/null
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThis.ts
@@ -0,0 +1,146 @@
+// @noImplicitThis: true
+// @strict: true
+
+class Test {
+ data = {};
+ constructor() {
+ var copy: typeof this.data = {};
+ }
+}
+
+class Test1 {
+ data = { foo: '' };
+ ['this'] = '';
+ constructor() {
+ var copy: typeof this.data = { foo: '' };
+ var foo: typeof this.data.foo = '';
+
+ var self: typeof this = this;
+ self.data;
+
+ var str: typeof this.this = '';
+ }
+}
+
+
+function Test2() {
+ let x: typeof this.no = 1;
+}
+
+function Test3(this: { no: number }) {
+ let x: typeof this.no = 1;
+}
+
+function Test4(this: { no: number } | undefined) {
+ let x: typeof this.no = 1;
+}
+
+class Test5 {
+ no = 1;
+
+ f = () => {
+ // should not capture this.
+ let x: typeof this.no = 1;
+ }
+}
+
+namespace Test6 {
+ export let f = () => {
+ let x: typeof this.no = 1;
+ }
+}
+
+module Test7 {
+ export let f = () => {
+ let x: typeof this.no = 1;
+ }
+}
+
+const Test8 = () => {
+ let x: typeof this.no = 1;
+}
+
+class Test9 {
+ no = 0;
+ this = 0;
+
+ f() {
+ if (this instanceof Test9D1) {
+ const d1: typeof this = this;
+ d1.f1();
+ }
+
+ if (this instanceof Test9D2) {
+ const d2: typeof this = this;
+ d2.f2();
+ }
+ }
+
+ g() {
+ if (this.no === 1) {
+ const no: typeof this.no = this.no;
+ }
+
+ if (this.this === 1) {
+ const no: typeof this.this = this.this;
+ }
+ }
+}
+
+class Test9D1 {
+ f1() {}
+}
+
+class Test9D2 {
+ f2() {}
+}
+
+class Test10 {
+ a?: { b?: string }
+
+ foo() {
+ let a: typeof this.a = undefined as any;
+ if (this.a) {
+ let a: typeof this.a = undefined as any; // should narrow to { b?: string }
+ let b: typeof this.a.b = undefined as any;
+
+ if (this.a.b) {
+ let b: typeof this.a.b = undefined as any; // should narrow to string
+ }
+ }
+ }
+}
+
+class Test11 {
+ this?: { x?: string };
+
+ foo() {
+ const o = this;
+ let bar: typeof o.this = {};
+
+ if (o.this && o.this.x) {
+ let y: string = o.this.x; // should narrow to string
+ }
+ }
+}
+
+class Tests12 {
+ test1() { // OK
+ type Test = typeof this;
+ }
+
+ test2() { // OK
+ for (;;) {}
+ type Test = typeof this;
+ }
+
+ test3() { // expected no compile errors
+ for (const dummy in []) {}
+ type Test = typeof this;
+ }
+
+ test4() { // expected no compile errors
+ for (const dummy of []) {}
+ type Test = typeof this;
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThisWithImplicitThis.ts b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThisWithImplicitThis.ts
new file mode 100644
index 0000000000..d99cceaa58
--- /dev/null
+++ b/tests/cases/conformance/types/specifyingTypes/typeQueries/typeofThisWithImplicitThis.ts
@@ -0,0 +1,5 @@
+// @noImplicitThis: false
+
+function Test1() {
+ let x: typeof this.no = 1
+}
diff --git a/tests/cases/conformance/types/spread/spreadDuplicate.ts b/tests/cases/conformance/types/spread/spreadDuplicate.ts
new file mode 100644
index 0000000000..f27a2529f0
--- /dev/null
+++ b/tests/cases/conformance/types/spread/spreadDuplicate.ts
@@ -0,0 +1,21 @@
+// @strict: true
+// @declaration: true
+
+// Repro from #44438
+
+declare let a: { a: string };
+declare let b: { a?: string };
+declare let c: { a: string | undefined };
+declare let d: { a?: string | undefined };
+
+declare let t: boolean;
+
+let a1 = { a: 123, ...a }; // string (Error)
+let b1 = { a: 123, ...b }; // string | number
+let c1 = { a: 123, ...c }; // string | undefined (Error)
+let d1 = { a: 123, ...d }; // string | number
+
+let a2 = { a: 123, ...(t ? a : {}) }; // string | number
+let b2 = { a: 123, ...(t ? b : {}) }; // string | number
+let c2 = { a: 123, ...(t ? c : {}) }; // string | number
+let d2 = { a: 123, ...(t ? d : {}) }; // string | number
diff --git a/tests/cases/conformance/types/spread/spreadDuplicateExact.ts b/tests/cases/conformance/types/spread/spreadDuplicateExact.ts
new file mode 100644
index 0000000000..e395af4ce5
--- /dev/null
+++ b/tests/cases/conformance/types/spread/spreadDuplicateExact.ts
@@ -0,0 +1,22 @@
+// @strict: true
+// @exactOptionalPropertyTypes: true
+// @declaration: true
+
+// Repro from #44438
+
+declare let a: { a: string };
+declare let b: { a?: string };
+declare let c: { a: string | undefined };
+declare let d: { a?: string | undefined };
+
+declare let t: boolean;
+
+let a1 = { a: 123, ...a }; // string (Error)
+let b1 = { a: 123, ...b }; // string | number
+let c1 = { a: 123, ...c }; // string | undefined (Error)
+let d1 = { a: 123, ...d }; // string | number | undefined
+
+let a2 = { a: 123, ...(t ? a : {}) }; // string | number
+let b2 = { a: 123, ...(t ? b : {}) }; // string | number
+let c2 = { a: 123, ...(t ? c : {}) }; // string | number | undefined
+let d2 = { a: 123, ...(t ? d : {}) }; // string | number | undefined
diff --git a/tests/cases/conformance/types/spread/spreadUnion4.ts b/tests/cases/conformance/types/spread/spreadUnion4.ts
new file mode 100644
index 0000000000..6a39ac3a3c
--- /dev/null
+++ b/tests/cases/conformance/types/spread/spreadUnion4.ts
@@ -0,0 +1,4 @@
+declare const a: { x: () => void }
+declare const b: { x?: () => void }
+
+const c = { ...a, ...b };
diff --git a/tests/cases/conformance/types/thisType/fluentClasses.ts b/tests/cases/conformance/types/thisType/fluentClasses.ts
index c9e791cb6f..0aad4efe17 100644
--- a/tests/cases/conformance/types/thisType/fluentClasses.ts
+++ b/tests/cases/conformance/types/thisType/fluentClasses.ts
@@ -15,3 +15,5 @@ class C extends B {
}
var c: C;
var z = c.foo().bar().baz(); // Fluent pattern
+let b1 = new B();
+let c1 = new C();
diff --git a/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts b/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts
index f46b251c3b..c6091fd7a2 100644
--- a/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts
+++ b/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts
@@ -19,3 +19,6 @@ class B<T extends A> {
x = x.self();
}
}
+
+let a = new A();
+let b = new B();
diff --git a/tests/cases/conformance/types/thisType/thisTypeInClasses.ts b/tests/cases/conformance/types/thisType/thisTypeInClasses.ts
index 6c650341fb..0d3913de7e 100644
--- a/tests/cases/conformance/types/thisType/thisTypeInClasses.ts
+++ b/tests/cases/conformance/types/thisType/thisTypeInClasses.ts
@@ -47,3 +47,9 @@ class C5 {
let x2 = undefined as this;
}
}
+
+let c1 = new C1();
+let c2 = new C2();
+let c3 = new C3();
+let c4 = new C4();
+let c5 = new C5();
diff --git a/tests/cases/conformance/types/thisType/thisTypeInFunctions3.ts b/tests/cases/conformance/types/thisType/thisTypeInFunctions3.ts
index 01d7fd0430..8fe03ac945 100644
--- a/tests/cases/conformance/types/thisType/thisTypeInFunctions3.ts
+++ b/tests/cases/conformance/types/thisType/thisTypeInFunctions3.ts
@@ -7,3 +7,6 @@ class Test extends Base {
this.check(this);
}
}
+
+let te = new Test();
+
diff --git a/tests/cases/conformance/types/thisType/thisTypeInTaggedTemplateCall.ts b/tests/cases/conformance/types/thisType/thisTypeInTaggedTemplateCall.ts
new file mode 100644
index 0000000000..c46933329b
--- /dev/null
+++ b/tests/cases/conformance/types/thisType/thisTypeInTaggedTemplateCall.ts
@@ -0,0 +1,10 @@
+// @target: esnext
+
+class Foo {
+ static m<T>(this: new () => T, strings: TemplateStringsArray | string) {
+ return new this()
+ }
+}
+
+Foo.m`test`;
+(Foo.m)`test`;
diff --git a/tests/cases/conformance/types/tuple/readonlyArraysAndTuples2.ts b/tests/cases/conformance/types/tuple/readonlyArraysAndTuples2.ts
index 0f58f1971d..e03bc2a0c6 100644
--- a/tests/cases/conformance/types/tuple/readonlyArraysAndTuples2.ts
+++ b/tests/cases/conformance/types/tuple/readonlyArraysAndTuples2.ts
@@ -21,3 +21,5 @@ class A {
@someDec
k: readonly [string, number] = ['foo', 42];
}
+
+let a = new A();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts b/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts
index e7cca719f4..05fd3be85e 100644
--- a/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts
+++ b/tests/cases/conformance/types/typeAliases/circularTypeAliasForUnionWithClass.ts
@@ -15,3 +15,7 @@ type T4 = string | I4;
class I4 {
[x: string]: T4;
}
+
+let i0 = new I0();
+let i3 = new I3();
+let i4 = new I4();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts b/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts
index 4cc3a72395..96d1b74b83 100644
--- a/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts
+++ b/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts
@@ -9,4 +9,6 @@ var x: StringTree;
if (typeof x !== "string") {
x[0] = "";
x[0] = new StringTreeCollection;
-}
\ No newline at end of file
+}
+
+let s1 = new StringTreeCollection();
diff --git a/tests/cases/conformance/types/typeAliases/typeAliases.ts b/tests/cases/conformance/types/typeAliases/typeAliases.ts
index b9d28f4cc3..32eb8473bf 100644
--- a/tests/cases/conformance/types/typeAliases/typeAliases.ts
+++ b/tests/cases/conformance/types/typeAliases/typeAliases.ts
@@ -77,4 +77,6 @@ var x: [string, boolean];
f16(x);
var y: StringAndBoolean = ["1", false];
-y[0].toLowerCase();
\ No newline at end of file
+y[0].toLowerCase();
+
+let c7 = new C7();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithZeroTypeArguments.ts b/tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithZeroTypeArguments.ts
index 9a21c48ee1..b4a8dc7ba5 100644
--- a/tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithZeroTypeArguments.ts
+++ b/tests/cases/conformance/types/typeParameters/typeArgumentLists/callGenericFunctionWithZeroTypeArguments.ts
@@ -33,4 +33,7 @@ interface I2<T> {
f(x: T): T;
}
var i2: I2<number>;
-var r7 = i2.f(1);
\ No newline at end of file
+var r7 = i2.f(1);
+
+let c1 = new C();
+let c2 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction.ts b/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction.ts
index ba1c5b003f..7490e2bd94 100644
--- a/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction.ts
+++ b/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction.ts
@@ -58,4 +58,7 @@ function foo2<T extends { (): void }, U extends { (): void }>(x: T, y: U) {
//function foo2<T extends { (): void }, U extends T>(x: T, y: U) {
// foo(x);
// foo(y);
-//}
\ No newline at end of file
+//}
+
+let c11 = new C();
+let c12 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts b/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts
index 6c32014789..dec6cdd0bd 100644
--- a/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts
+++ b/tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts
@@ -38,4 +38,7 @@ var c2: { <T>(x: T): T; <T>(x: T, y: T): T };
var r9 = foo(function <U>(x: U) { return x; });
var r10 = foo(<U extends string>(x: U) => x);
var r12 = foo(i2);
-var r15 = foo(c2);
\ No newline at end of file
+var r15 = foo(c2);
+
+let c11 = new C();
+let c12 = new C2()
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne2.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne2.ts
index 60766c7e5e..4bd0b6c27f 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne2.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne2.ts
@@ -34,4 +34,6 @@ class C2<T extends Date, U extends Date> {
// var x: U;
// x.getDate();
// }
-//}
\ No newline at end of file
+//}
+let c1 = new C();
+let c2 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints.ts
index b89016ecff..c10bef3300 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints.ts
@@ -31,4 +31,5 @@ var b = {
}
}
-var r4 = b.foo(new Date());
\ No newline at end of file
+var r4 = b.foo(new Date());
+let c = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints2.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints2.ts
index 10f3a49884..a9992c5aa1 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints2.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints2.ts
@@ -61,7 +61,7 @@ var a: {
var r3 = a<A, A>().foo();
var r3b = a()['foo']();
// parameter supplied for type argument inference to succeed
-var aB = new B();
+// var aB = new B();
var r3c = a(aB, aB).foo();
var r3d = a(aB, aB)['foo']();
@@ -78,4 +78,7 @@ var b = {
// }
//}
-var r4 = b.foo(aB, aB); // no inferences for T so constraint isn't satisfied, error
\ No newline at end of file
+var r4 = b.foo(aB, aB); // no inferences for T so constraint isn't satisfied, error
+
+let b1 = new B();
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints3.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints3.ts
index 6167485f1b..73a10ae071 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints3.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints3.ts
@@ -53,4 +53,6 @@ var b = {
}
}
-var r4 = b.foo(new B()); // valid call to an invalid function
\ No newline at end of file
+var r4 = b.foo(new B()); // valid call to an invalid function
+let b1 = new B();
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithoutConstraints.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithoutConstraints.ts
index 1660d67a4e..b46569e9a4 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithoutConstraints.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithoutConstraints.ts
@@ -28,4 +28,6 @@ var b = {
}
}
-var r4 = b.foo(1);
\ No newline at end of file
+var r4 = b.foo(1);
+
+let c = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterUsedAsConstraint.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterUsedAsConstraint.ts
index bade67badd..b9f3e54bb7 100644
--- a/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterUsedAsConstraint.ts
+++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterUsedAsConstraint.ts
@@ -32,3 +32,10 @@ var a3: { <T extends Date, U extends T>(): void }
var a4: { <T extends U, U extends Date>(): void }
var a5: { <T extends U, U extends V, V>(): void }
var a6: { <T, U extends T, V extends U>(): void }
+
+let c1 = new C();
+let c2 = new C2();
+let c3 = new C3();
+let c4 = new C4();
+let c5 = new C5();
+let c6 = new C6();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance.ts
index cc154308a1..5dfa8f94d3 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignabilityInInheritance.ts
@@ -85,4 +85,8 @@ var r3 = foo3(a); // any
declare function foo18(x: {}): {};
declare function foo18(x: any): any;
-var r3 = foo3(a); // any
\ No newline at end of file
+var r3 = foo3(a); // any
+
+let aa1 = new A();
+let aa2 = new A2();
+let ccc = new CC();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType.ts
index 1c3bcc71ce..03e0089697 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType.ts
@@ -38,6 +38,7 @@ function foo<T, U /*extends T*/, V extends Date>(x: T, y: U, z: V) {
z = a;
}
+let cc = new C();
//function foo<T, U extends T, V extends Date>(x: T, y: U, z: V) {
// x = a;
// y = a;
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts
index 26f3eee594..74a517176d 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/anyAssignableToEveryType2.ts
@@ -127,3 +127,6 @@ interface I20 {
[x: string]: {};
foo: any;
}
+let aa = new A();
+let aa2 = new A2()
+let ccc = new c();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers.ts
index d7a94cc862..464edb67d3 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers.ts
@@ -40,6 +40,8 @@ module SimpleTypes {
a2 = b;
a2 = t2;
a2 = t;
+ let ss = new S();
+ let tt = new T();
}
module ObjectTypes {
@@ -81,5 +83,6 @@ module ObjectTypes {
a2 = b;
a2 = t2;
a2 = t;
-
+ let ss = new S();
+ let tt = new T();
}
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers2.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers2.ts
index a45da06482..a9e3bc6141 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers2.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers2.ts
@@ -39,3 +39,5 @@ b2 = a2;
a2 = b;
a2 = t2;
a2 = t;
+let qu1 = new S();
+let qu2 = new T();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers3.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers3.ts
index 6e9a210db4..b96693de94 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers3.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers3.ts
@@ -39,3 +39,5 @@ b2 = a2;
a2 = b;
a2 = t2;
a2 = t;
+let qi3 = new S();
+let qi4 = new T();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersNumericNames.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersNumericNames.ts
index b25c949f42..7372988241 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersNumericNames.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersNumericNames.ts
@@ -39,3 +39,5 @@ b2 = a2;
a2 = b;
a2 = t2;
a2 = t;
+let qi1 = new S();
+let qi2 = new T();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance2.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance2.ts
index 9e6cd52ac2..c511bfa71a 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance2.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance2.ts
@@ -66,4 +66,8 @@ interface I extends A {
a16: <T extends Base>(x: T) => number[]; // ok
a17: <T>(x: (a: T) => T) => T[]; // ok
a18: <T>(x: (a: T) => T) => T[]; // ok, no inferences for T but assignable to any
-}
\ No newline at end of file
+}
+
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance4.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance4.ts
index dd10ee7646..bb1f737657 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance4.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance4.ts
@@ -46,4 +46,8 @@ interface I extends A {
a16: <T>(x: { a: T; b: T }) => T[]; // ok, more general parameter type
a17: <T>(x: (a: T) => T) => T[]; // ok
a18: (x: <T>(a: T) => T) => any[]; // ok
-}
\ No newline at end of file
+}
+
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance5.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance5.ts
index bf60d6518c..ef4e179af9 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance5.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance5.ts
@@ -45,4 +45,7 @@ interface I extends B {
a12: <T extends Array<Base>>(x: Array<Base>, y: T) => Array<Derived>; // ok, less specific parameter type
a13: <T extends Array<Derived>>(x: Array<Base>, y: T) => T; // ok, T = Array<Derived>, satisfies constraint, contextual signature instantiation succeeds
a14: <T, U>(x: { a: T; b: U }) => T; // ok
-}
\ No newline at end of file
+}
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance2.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance2.ts
index 65e4f4c962..8d842b7d7e 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance2.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance2.ts
@@ -66,4 +66,8 @@ interface I extends A {
a16: new <T extends Base>(x: T) => number[]; // ok
a17: new <T>(x: new (a: T) => T) => T[]; // ok
a18: new <T>(x: new (a: T) => T) => T[]; // ok, no inferences for T but assignable to any
-}
\ No newline at end of file
+}
+
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance4.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance4.ts
index 9dfcf5548a..8b57d6a8c7 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance4.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance4.ts
@@ -56,4 +56,7 @@ interface I extends A {
a18: new <T extends Base>(x: T) => number[]; // ok, more general parameter type
a19: new <T extends Base>(x: new (a: T) => T) => T[]; // ok
a20: new (x: new <T extends Base>(a: T) => T) => any[]; // ok
-}
\ No newline at end of file
+}
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance5.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance5.ts
index f33820218e..6ba5e454f6 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance5.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance5.ts
@@ -45,4 +45,7 @@ interface I extends B {
a12: new <T extends Array<Base>>(x: Array<Base>, y: T) => Array<Derived>; // ok, less specific parameter type
a13: new <T extends Array<Derived>>(x: Array<Base>, y: T) => T; // ok, T = Array<Derived>, satisfies constraint, contextual signature instantiation succeeds
a14: new <T, U>(x: { a: T; b: U }) => T; // ok
-}
\ No newline at end of file
+}
+let qi14 = new Derived();
+let qi15 = new Derived2();
+let qi16 = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny.ts
index 6c8670abaa..407e128678 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/everyTypeAssignableToAny.ts
@@ -53,6 +53,8 @@ function foo<T, U /*extends T*/, V extends Date>(x: T, y: U, z: V) {
a = y;
a = z;
}
+
+let ccc = new C();
//function foo<T, U extends T, V extends Date>(x: T, y: U, z: V) {
// a = x;
// a = y;
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType.ts
index b0f55331d7..cc755558ff 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/nullAssignableToEveryType.ts
@@ -35,7 +35,7 @@ function foo<T, U, V extends Date>(x: T, y: U, z: V) {
y = null;
z = null;
}
-
+let cc = new C();
//function foo<T, U extends T, V extends Date>(x: T, y: U, z: V) {
// x = null;
// y = null;
diff --git a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType.ts b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType.ts
index 5fc14274a1..f296781ef1 100644
--- a/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType.ts
+++ b/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType.ts
@@ -35,6 +35,7 @@ function foo<T, U, V extends Date>(x: T, y: U, z: V) {
y = undefined;
z = undefined;
}
+let cc = new C();
//function foo<T, U extends T, V extends Date>(x: T, y: U, z: V) {
// x = undefined;
// y = undefined;
diff --git a/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts
index 5f02210478..1e1889cc10 100644
--- a/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts
+++ b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions.ts
@@ -23,4 +23,7 @@ var r11 = true ? base : derived2;
function foo5<T, U>(t: T, u: U): Object {
return true ? t : u; // BCT is Object
-}
\ No newline at end of file
+}
+
+let qy10 = new Derived();
+let qy11 = new Derived2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts
index 8e6f345ea4..f1512e3536 100644
--- a/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts
+++ b/tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfConditionalExpressions2.ts
@@ -21,4 +21,6 @@ function foo2<T extends U, U>(t: T, u: U) { // Error for referencing own type pa
function foo3<T extends U, U extends V, V>(t: T, u: U) {
return true ? t : u;
-}
\ No newline at end of file
+}
+let qy8 = new Derived();
+let qy9 = new Derived2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts b/tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts
index 0f498c570a..13ecea225a 100644
--- a/tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts
+++ b/tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts
@@ -99,6 +99,8 @@ function foo4<T extends Base, U extends Base>(t: T, u: U) {
var k: Base[] = [t, u];
}
+let qy8 = new Derived();
+let qy9 = new Derived2();
//function foo3<T extends U, U extends Derived>(t: T, u: U) {
// var a = [t, t]; // T[]
diff --git a/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingConstrainedTypeVariable.ts b/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingConstrainedTypeVariable.ts
index 04623503f9..491876d8ff 100644
--- a/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingConstrainedTypeVariable.ts
+++ b/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingConstrainedTypeVariable.ts
@@ -34,3 +34,6 @@ function f3<T extends E>(v: T | { x: string }) {
const y: { x: string } = v;
}
}
+let qy5 = new C();
+let qy6 = new D();
+let qy7 = new E();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/recursiveTypes/arrayLiteralsWithRecursiveGenerics.ts b/tests/cases/conformance/types/typeRelationships/recursiveTypes/arrayLiteralsWithRecursiveGenerics.ts
index e7260831a4..35de332a33 100644
--- a/tests/cases/conformance/types/typeRelationships/recursiveTypes/arrayLiteralsWithRecursiveGenerics.ts
+++ b/tests/cases/conformance/types/typeRelationships/recursiveTypes/arrayLiteralsWithRecursiveGenerics.ts
@@ -22,4 +22,8 @@ var ys = [list, list2]; // {}[]
var zs = [list, null]; // List<number>[]
var myDerivedList: DerivedList<number>;
-var as = [list, myDerivedList]; // List<number>[]
\ No newline at end of file
+var as = [list, myDerivedList]; // List<number>[]
+
+let li = new List();
+let der = new DerivedList();
+let my = new MyList();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts b/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts
index ac6286bd81..e4d37f2abe 100644
--- a/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts
+++ b/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts
@@ -10,4 +10,7 @@ class D<T> {
x: G<G<T>>;
}
-var c1 = new Foo<D<string>>(); // ok, circularity in assignment compat check causes success
\ No newline at end of file
+var c1 = new Foo<D<string>>(); // ok, circularity in assignment compat check causes success
+let g = new G();
+let foo = new Foo();
+let d = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypesUsedAsFunctionParameters.ts b/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypesUsedAsFunctionParameters.ts
index 6eba1f2836..6cdf1db8be 100644
--- a/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypesUsedAsFunctionParameters.ts
+++ b/tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypesUsedAsFunctionParameters.ts
@@ -40,4 +40,7 @@ function other<T extends List<U>, U>() {
var r = foo5(list);
var r2 = foo5(myList);
-}
\ No newline at end of file
+}
+
+let li = new List();
+let my = new MyList();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined.ts
index 24f2ab71d4..ced02bcefe 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/nullIsSubtypeOfEverythingButUndefined.ts
@@ -88,3 +88,7 @@ var r19 = true ? null : new Object();
var r20 = true ? {} : null;
var r20 = true ? null : {};
+
+let c11 = new C1();
+let c12 = new C2();
+let c13 = new c();
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts
index c7e9c0fc8e..0f00bc8c02 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts
@@ -97,4 +97,6 @@ function f15<T, U extends T>(x: any) { }
function f16<T extends String, U extends T>(x: 'a');
function f16<T extends String, U extends T>(x: U);
-function f16<T extends String, U extends T>(x: any) { }
\ No newline at end of file
+function f16<T extends String, U extends T>(x: any) { }
+
+let ccc = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny.ts
index 0e5df54319..d785a27b7b 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfAny.ts
@@ -130,4 +130,7 @@ interface I19 {
interface I20 {
[x: string]: any;
foo: {};
-}
\ No newline at end of file
+}
+let a1 = new A();
+let a2 = new A2();
+let c1 = new c();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2.ts
index 9edf4f5f41..990e4b8cc5 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints2.ts
@@ -154,4 +154,7 @@ function f20<T extends Number>(x: T) {
function f21<T extends Number>(x: T) {
var r20 = true ? {} : x; // ok
var r20 = true ? x : {}; // ok
-}
\ No newline at end of file
+}
+
+let c1 = new C1();
+let c2 = new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts
index e8ae73c5fb..4a29484b12 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures2.ts
@@ -5,6 +5,7 @@ class Derived extends Base { bar: string; }
class Derived2 extends Derived { baz: string; }
class OtherDerived extends Base { bing: string; }
+
declare function foo1(a: (x: number) => number[]): typeof a;
declare function foo1(a: any): any;
@@ -169,3 +170,8 @@ var r17arg1 = <T>(x: (a: T) => T) => <T[]>null;
var r17 = foo17(r17arg1); // any
var r18arg1 = <T>(x: (a: T) => T) => <T[]>null;
var r18 = foo18(r18arg1);
+
+
+let der1 = new Derived();
+let der2 = new Derived2();
+let oth = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures3.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures3.ts
index 505919547f..51c890854f 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures3.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures3.ts
@@ -103,6 +103,10 @@ module Errors {
var r9arg = <T>(x: (a: T) => T) => <any[]>null;
var r9 = foo17(r9arg); // (x: { <T extends Derived >(a: T): T; <T extends Base >(a: T): T; }): any[]; (x: { <T extends Derived2>(a: T): T; <T extends Base>(a: T): T; }): any[];
+ let ba = new Base();
+ let der1 = new Derived();
+ let der2 = new Derived2();
+ let oth = new OtherDerived();
}
module WithGenericSignaturesInBaseType {
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures4.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures4.ts
index e86fc51d44..e043cec402 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures4.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignatures4.ts
@@ -108,4 +108,8 @@ var r17arg = <T>(x: (a: T) => T) => <T[]>null;
var r17 = foo17(r17arg);
var r18arg = (x: <T>(a: T) => T) => <any[]>null;
-var r18 = foo18(r18arg);
\ No newline at end of file
+var r18 = foo18(r18arg);
+
+let der =new Derived();
+let der2 = new Derived2();
+let oth = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures2.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures2.ts
index 46d1c9e91d..683db9f182 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures2.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures2.ts
@@ -169,3 +169,8 @@ var r17arg1: new <T>(x: (a: T) => T) => T[];
var r17 = foo17(r17arg1); // any
var r18arg1: new <T>(x: (a: T) => T) => T[];
var r18 = foo18(r18arg1);
+
+
+let der =new Derived();
+let der2 = new Derived2();
+let oth = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures3.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures3.ts
index 215a5d1d4d..bbaddcabfc 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures3.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures3.ts
@@ -105,6 +105,10 @@ module Errors {
var r9arg: new <T>(x: new (a: T) => T) => any[];
var r9 = foo17(r9arg); // // (x: { <T extends Derived >(a: T): T; <T extends Base >(a: T): T; }): any[]; (x: { <T extends Derived2>(a: T): T; <T extends Base>(a: T): T; }): any[];
+ let ba = new Base();
+ let der1 = new Derived();
+ let der2 = new Derived2();
+ let oth = new OtherDerived();
}
module WithGenericSignaturesInBaseType {
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures4.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures4.ts
index 830139d3fa..5d5145d29d 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures4.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures4.ts
@@ -108,4 +108,8 @@ var r17arg: new <T>(x: new (a: T) => T) => T[];
var r17 = foo17(r17arg);
var r18arg: new (x: new <T>(a: T) => T) => any[];
-var r18 = foo18(r18arg);
\ No newline at end of file
+var r18 = foo18(r18arg);
+
+let der =new Derived();
+let der2 = new Derived2();
+let oth = new OtherDerived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures5.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures5.ts
index f33820218e..f3c1c5d20d 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures5.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures5.ts
@@ -6,6 +6,7 @@ class Derived extends Base { bar: string; }
class Derived2 extends Derived { baz: string; }
class OtherDerived extends Base { bing: string; }
+
interface A { // T
// M's
a: new (x: number) => number[];
@@ -45,4 +46,7 @@ interface I extends B {
a12: new <T extends Array<Base>>(x: Array<Base>, y: T) => Array<Derived>; // ok, less specific parameter type
a13: new <T extends Array<Derived>>(x: Array<Base>, y: T) => T; // ok, T = Array<Derived>, satisfies constraint, contextual signature instantiation succeeds
a14: new <T, U>(x: { a: T; b: U }) => T; // ok
-}
\ No newline at end of file
+}
+let der =new Derived();
+let der2 = new Derived2();
+let oth = new OtherDerived();
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers4.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers4.ts
index b50e1f7106..2c99af9515 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers4.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers4.ts
@@ -30,4 +30,8 @@ class A3 {
class B3 extends A3 {
'1.1': Derived; // ok, inherits '1'
-}
\ No newline at end of file
+}
+let der = new Derived();
+let b1 = new B();
+let b2 = new B2();
+let b3 = new B3();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts
index 7ee0906ee2..08c7e7d192 100644
--- a/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts
+++ b/tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts
@@ -118,3 +118,28 @@ class D16 extends Base {
class D17 extends Base {
foo: {};
}
+
+
+let d0 = new D0();
+let da = new DA();
+let d1 = new D1()
+let d1a = new D1A()
+let d2 = new D2()
+let d2a = new D2A()
+let d3 = new D3()
+let d3a = new D1A()
+let d4 = new D4()
+let d5 = new D5()
+let d6 = new D6()
+let d7 = new D7()
+let d8 = new D8()
+let d9 = new D9()
+let d10 = new D10()
+let d11 = new D11()
+let d12 = new D12()
+let c1 = new c()
+let d13 = new D13()
+let d14 = new D14()
+let d15 = new D15()
+let d16 = new D16()
+let d17 = new D17()
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts
index 225a974181..acf6300dba 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity.ts
@@ -85,4 +85,8 @@ function foo13(x: any) { }
function foo14(x: I);
function foo14(x: typeof b); // error
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts
index fefde23a69..2427d26180 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts
@@ -62,4 +62,7 @@ function foo13(x: any) { }
function foo14(x: I);
function foo14(x: typeof b); // ok
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+let aa = new A();
+let bb = new B();
+let cc = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts
index 94038f6df9..bb5d06c3fc 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures.ts
@@ -97,4 +97,7 @@ function foo14(x: any) { }
function foo15(x: I2<string>);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let qy17 = new A();
+let qy18 = new B();
+let qy19 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts
index 699f0f73f7..99aafb4b8a 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignatures2.ts
@@ -97,4 +97,7 @@ function foo14(x: any) { }
function foo15(x: I2<string>);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let aa = new A();
+let bb = new B();
+let cc = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts
index b62b558d06..8a23c2c1bd 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts
@@ -97,4 +97,7 @@ function foo14(x: any) { }
function foo15(x: I2<string>);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let aa = new A();
+let bb = new B();
+let cc = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesWithOverloads.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesWithOverloads.ts
index 0aaf7c30f2..cc561aa934 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesWithOverloads.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithCallSignaturesWithOverloads.ts
@@ -113,4 +113,8 @@ function foo14(x: any) { }
function foo15(x: I2<string>);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+
+let aa = new A();
+let bb = new B();
+let cc = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures.ts
index efec6a715b..964c2a9d43 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures.ts
@@ -84,4 +84,8 @@ function foo13(x: any) { }
function foo15(x: I2<string>);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+
+let a1 = new A('1');
+let b1 = new B('1');
+let c1 = new C(1);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures2.ts
index 63e5167a4c..09f632da93 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignatures2.ts
@@ -73,4 +73,6 @@ function foo14(x: any) { }
function foo15(x: I2<string>);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let qy38 = new B(null);
+let qy39 =new C(null);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.ts
index b8fc424b21..b6af7ec955 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.ts
@@ -73,4 +73,6 @@ function foo14(x: any) { }
function foo15(x: I2<string>);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let qo23 =new B(null,null);
+let qo24 =new C(null,null);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures.ts
index d95bc486df..72019e6b9a 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures.ts
@@ -97,4 +97,8 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures2.ts
index 5c009926a0..099927c132 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures2.ts
@@ -97,4 +97,8 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<string, number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts
index ede6da4040..21f9ed1933 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts
@@ -99,4 +99,8 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<String>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts
index 5fb315c4da..c0ce245917 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts
@@ -111,4 +111,8 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<String, String>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
+let d1 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts
index aaae2cbf33..b341b1f6c2 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts
@@ -120,4 +120,11 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<Three, Three>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+
+let one = new One();
+let two = new Two();
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
+let d1 = new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts
index 97a657606e..ab7da883ec 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts
@@ -99,4 +99,7 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let qy12 = new A();
+let qy13 = new B();
+let qy14 = new C();
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts
index df7533d906..5e419a9b14 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts
@@ -99,4 +99,8 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<Date>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+
+let qo27 = new A();
+let qo28 =new B();
+let qo29 =new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts
index e3bd868941..1bda87ea35 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts
@@ -97,4 +97,8 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<number, B<string, string>, B<number, string>>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts
index 9e01aaec49..9b74d14cfc 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts
@@ -97,4 +97,7 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let qo17 = new A();
+let qo18 =new B();
+let qo19 =new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts
index c5454cc41e..781a351188 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts
@@ -99,4 +99,7 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let qo9 = new A();
+let qo10 = new B();
+let qo11 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts
index b8620f04d1..ca2a5abb87 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts
@@ -99,4 +99,7 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<string, number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts
index f39d23637a..828b26331c 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts
@@ -99,4 +99,8 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<string, number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts
index 974f53cb9c..8d1aa46bde 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts
@@ -72,3 +72,5 @@ function foo13(x: any) { }
function foo14(x: I<Number>);
function foo14(x: typeof b); // ok
function foo14(x: any) { }
+let qo15 = new B(null);
+let qo16 = new C(null);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts
index 47bab5dab8..963aabc746 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts
@@ -83,4 +83,9 @@ function foo13(x: any) { }
function foo14(x: I<Number, Number>);
function foo14(x: typeof b); // ok
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+
+var aa = []
+let b1 = new B(aa,aa);
+let c1 = new C('','');
+let d1 = new D(1,1);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts
index 14f4933a15..b593e623e5 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts
@@ -92,4 +92,9 @@ function foo13(x: any) { }
function foo14(x: I<Five<string>, Five<string>>);
function foo14(x: typeof b); // ok
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+let qo1 = new One();
+let qo2 = new Two();
+let qo3 = new B(null,null);
+let qo4 = new C(null,null);
+let qo5 = new D(null,null);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts
index 9c072e8936..185dab627d 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts
@@ -79,4 +79,6 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<number>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+let qy49 =new B(null);
+let qy50 =new C(null);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts
index 2e0a98d557..9e63b81350 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts
@@ -75,4 +75,8 @@ function foo14(x: any) { }
function foo15(x: I2);
function foo15(x: C<Date>); // ok
-function foo15(x: any) { }
\ No newline at end of file
+function foo15(x: any) { }
+
+var aa;
+let b1 = new B(aa);
+let c1 = new C(aa);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts
index fe01df2564..8caa853954 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts
@@ -69,4 +69,6 @@ function foo13(x: any) { }
function foo14(x: I<string, Date, RegExp, boolean>);
function foo14(x: typeof b); // ok
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+let qo6 = new B(null);
+let qo7 = new C(null);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.ts
index 20d7dbab13..7573f3e8b4 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.ts
@@ -69,4 +69,8 @@ function foo13(x: any) { }
function foo14(x: I<string>);
function foo14(x: typeof b); // ok
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+
+
+let b1 = new B(a);
+let c1 = new C(a);
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.ts
index 56dc5a051c..2caea04bc0 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.ts
@@ -71,4 +71,7 @@ function foo13(x: any) { }
function foo14(x: I<string>);
function foo14(x: typeof b); // ok
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+
+let b1 = new B(a);
+let c1 = new C(a);
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.ts
index 6c4a282228..d9e2b8c184 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.ts
@@ -71,4 +71,7 @@ function foo13(x: any) { }
function foo14(x: I<string, number>);
function foo14(x: typeof b); // ok
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+
+let b1 = new B(a);
+let c1 = new C(a);
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.ts
index 8c9a08137f..0683e8d40b 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.ts
@@ -71,4 +71,6 @@ function foo13(x: any) { }
function foo14(x: I<string, number>);
function foo14(x: typeof b); // ok
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+let qy15 = new B(null,null);
+let qy16 = new C(null,null);
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers1.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers1.ts
index 867199d905..0c6b2ca24b 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers1.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers1.ts
@@ -119,3 +119,6 @@ function foo16(x: I);
function foo16(x: PB); // error
function foo16(x: any) { }
+let c1 = new C();
+let pa = new PA();
+let pb = new PB();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers2.ts
index ea9d7d04ee..bf735eb8a5 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers2.ts
@@ -122,3 +122,8 @@ function foo16(x: I);
function foo16(x: PB); // error
function foo16(x: any) { }
+
+let der = new Derived()
+let c1 = new C();
+let pa = new PA();
+let pb = new PB();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers3.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers3.ts
index d3f22604c4..337ac0b542 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers3.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithNumericIndexers3.ts
@@ -119,3 +119,6 @@ function foo16(x: I);
function foo16(x: PB); // error
function foo16(x: any) { }
+let qo32 =new C();
+let qo30 = new PA();
+let qo31 =new PB();
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithOptionality.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithOptionality.ts
index 7c24195105..21be3c5930 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithOptionality.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithOptionality.ts
@@ -53,4 +53,8 @@ function foo13(x: any) { }
function foo14(x: I);
function foo14(x: typeof b); // ok
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+
+let a1 = new A();
+let b1 = new B();
+let c1 = new C();
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates.ts
index b9e390158c..fe547befb2 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates.ts
@@ -116,4 +116,6 @@ function foo15(x: any) { }
function foo16(x: I);
function foo16(x: PB); // no error
function foo16(x: any) { }
-
+let qo26 =new C();
+let qo24 = new PA();
+let qo25 =new PB();
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates2.ts
index 769e59f06d..403c1692d7 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates2.ts
@@ -35,3 +35,4 @@ function foo6(x: D<number>): string; // error
function foo6(x: any): any { }
+let d1 = new D();
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPublics.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPublics.ts
index 813a8333e5..6f12d3d4e0 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPublics.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPublics.ts
@@ -85,4 +85,7 @@ function foo13(x: any) { }
function foo14(x: I);
function foo14(x: typeof b); // error
-function foo14(x: any) { }
\ No newline at end of file
+function foo14(x: any) { }
+let qy41 = new A();
+let qy42 =new B();
+let qy43 =new C();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers.ts
index f511e56bc3..e6d583aa06 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers.ts
@@ -119,3 +119,6 @@ function foo16(x: I);
function foo16(x: PB); // error
function foo16(x: any) { }
+let qo35 =new C();
+let qo33 = new PA();
+let qo34 =new PB();
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers2.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers2.ts
index d8af511910..7c37adc723 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithStringIndexers2.ts
@@ -122,3 +122,8 @@ function foo16(x: I);
function foo16(x: PB); // error
function foo16(x: any) { }
+
+let der = new Derived();
+let c1 = new C();
+let pa = new PA();
+let pb = new PB();
diff --git a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/typeParametersAreIdenticalToThemselves.ts b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/typeParametersAreIdenticalToThemselves.ts
index 0495789326..383623ee14 100644
--- a/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/typeParametersAreIdenticalToThemselves.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/typeParametersAreIdenticalToThemselves.ts
@@ -73,4 +73,6 @@ interface I2<T extends Date> {
foo3<T>(x: T);
foo3<T>(x: T); // no error, different declaration for each T
-}
\ No newline at end of file
+}
+let qy36 = new C();
+let qy37 =new C2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference.ts b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference.ts
index 601f790667..b8526977ef 100644
--- a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference.ts
@@ -104,3 +104,6 @@ var r8b = i.foo5(d2, d2); // Derived2
var r9 = i.foo6(); // Derived
var r10 = i.foo7(d1); // Base
var r11 = i.foo8(); // Base
+
+let qu12 = new Derived();
+let qu13 = new Derived2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments4.ts b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments4.ts
index 3d68ff7a0d..74c3573627 100644
--- a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments4.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments4.ts
@@ -19,4 +19,6 @@ var b: {
new<T>(x: T): any;
}
-var r2 = foo4(b); // T is {} (candidates boolean and {}), U is any (candidates any and {})
\ No newline at end of file
+var r2 = foo4(b); // T is {} (candidates boolean and {}), U is any (candidates any and {})
+let qy3 = new C();
+let qy4 =new D();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs2.ts b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs2.ts
index 514df351cc..52f1c5e20f 100644
--- a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs2.ts
@@ -29,4 +29,6 @@ interface I<T, U> {
}
var i: I<Base, Derived>;
-var r4 = f2(i); // Base => Derived
\ No newline at end of file
+var r4 = f2(i); // Base => Derived
+let qy0 = new Derived();
+let qy1 = new Derived2();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints.ts b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints.ts
index e1c91529d7..475dfe3dcb 100644
--- a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints.ts
@@ -19,8 +19,8 @@ function foo<T extends { x: string }>(t: X<T>, t2: X<T>) {
return x;
}
-var c1 = new X<C>();
-var d1 = new X<D>();
+// var c1 = new X<C>();
+// var d1 = new X<D>();
var r = foo(c1, d1);
var r2 = foo(c1, c1);
@@ -30,4 +30,8 @@ function foo2<T extends C>(t: X<T>, t2: X<T>) {
}
var r = foo2(c1, d1);
-var r2 = foo2(c1, c1);
\ No newline at end of file
+var r2 = foo2(c1, c1);
+
+let qu4 = new C();
+let qu5 = new D();
+let qu6 = new X();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints2.ts b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints2.ts
index c97915eaf1..5f7fee7daf 100644
--- a/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints2.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints2.ts
@@ -35,3 +35,4 @@ var r5 = f3(new Derived(), x => x);
var r6 = f3(null, null); // any
var r7 = f3(null, x => x); // any
+let qu8 = new Derived();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithObjectTypeArgsAndConstraints.ts b/tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithObjectTypeArgsAndConstraints.ts
index 1c29b3822b..a52b2b835e 100644
--- a/tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithObjectTypeArgsAndConstraints.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithObjectTypeArgsAndConstraints.ts
@@ -37,6 +37,8 @@ module Class {
var g2: G2<D>;
var r = g2.foo2(c1, d1);
var r2 = g2.foo2(c1, c1);
+ var gg1 = new G();
+ var gg2 = new G2();
}
module Interface {
@@ -57,4 +59,7 @@ module Interface {
var g2: G2<D>;
var r = g2.foo2(c1, d1);
var r2 = g2.foo2(c1, c1);
-}
\ No newline at end of file
+}
+let c = new C();
+let d = new D();
+let x = new X();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/keyofInferenceLowerPriorityThanReturn.ts b/tests/cases/conformance/types/typeRelationships/typeInference/keyofInferenceLowerPriorityThanReturn.ts
index 9de110bd1e..7a24403769 100644
--- a/tests/cases/conformance/types/typeRelationships/typeInference/keyofInferenceLowerPriorityThanReturn.ts
+++ b/tests/cases/conformance/types/typeRelationships/typeInference/keyofInferenceLowerPriorityThanReturn.ts
@@ -44,3 +44,7 @@ function insertOnConflictDoNothing<Req extends object, Def extends object>(_tabl
function f() {
insertOnConflictDoNothing(bookTable, ConflictTarget.tableColumns(["serial"])); // <-- No error here; should use the type inferred for the return type of `tableColumns`
}
+let qu9 = new Write();
+let qu10 = new Col();
+let qu11 =new Table();
+let qu12 =new ConflictTarget();
\ No newline at end of file
diff --git a/tests/cases/conformance/types/union/discriminatedUnionTypes3.ts b/tests/cases/conformance/types/union/discriminatedUnionTypes3.ts
new file mode 100644
index 0000000000..a5e51271bc
--- /dev/null
+++ b/tests/cases/conformance/types/union/discriminatedUnionTypes3.ts
@@ -0,0 +1,19 @@
+// @strict: true
+
+// Repro from #44435
+
+type Correct = {
+ code: string
+ property: true
+ err: undefined
+}
+type Err = {
+ err: `${string} is wrong!`
+}
+type SomeReturnType = Correct | Err;
+
+const example: SomeReturnType = {} as SomeReturnType;
+
+if (example.err === undefined) {
+ example.property; // true
+}
\ No newline at end of file
--
2.17.1