From 735c9d7d3d26a9a0739ec8780e94f8a6f3c3a41e Mon Sep 17 00:00:00 2001 From: DongYun Kang Date: Wed, 19 Nov 2025 16:09:22 -0500 Subject: [PATCH 1/8] fix --- crates/swc_ecma_codegen/src/lib.rs | 38 ++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/crates/swc_ecma_codegen/src/lib.rs b/crates/swc_ecma_codegen/src/lib.rs index 25ad0e760bd1..e61a8463bc6e 100644 --- a/crates/swc_ecma_codegen/src/lib.rs +++ b/crates/swc_ecma_codegen/src/lib.rs @@ -1431,13 +1431,20 @@ impl MacroNode for Program { impl MacroNode for Module { #[tracing::instrument(level = "debug", skip_all)] fn emit(&mut self, emitter: &mut Macro) -> Result { - // Don't emit leading comments at Module level when the module has a body. - // This ensures that comments appear after any injected imports (e.g., helper - // imports) rather than before them. The first body item with a real - // span will emit the comments. - if self.body.is_empty() { - // For empty modules, emit leading comments to ensure they're not lost + let first_stmt_span_lo = self.body.first().map(|s| s.span().lo); + + // If the first statement and module span are the same, then do not take the + // comment of the module. + + let should_skip = first_stmt_span_lo + .map(|lo| lo == self.span.lo) + .unwrap_or(false); + + if !should_skip { emitter.emit_leading_comments_of_span(self.span(), false)?; + } + + if self.body.is_empty() { srcmap!(emitter, self, true); } @@ -1463,13 +1470,20 @@ impl MacroNode for Module { impl MacroNode for Script { #[tracing::instrument(level = "debug", skip_all)] fn emit(&mut self, emitter: &mut Macro) -> Result { - // Don't emit leading comments at Script level when the script has a body. - // This ensures that comments appear after any injected imports (e.g., helper - // imports) rather than before them. The first body item with a real - // span will emit the comments. - if self.body.is_empty() { - // For empty scripts, emit leading comments to ensure they're not lost + let first_stmt_span_lo = self.body.first().map(|s| s.span().lo); + + // If the first statement and module span are the same, then do not take the + // comment of the module. + + let should_skip = first_stmt_span_lo + .map(|lo| lo == self.span.lo) + .unwrap_or(false); + + if !should_skip { emitter.emit_leading_comments_of_span(self.span(), false)?; + } + + if self.body.is_empty() { srcmap!(emitter, self, true); } From 22b46b8c6980c5c9ab8df4d4d995bfbd0faef281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 20 Nov 2025 06:10:26 +0900 Subject: [PATCH 2/8] Create stupid-numbers-hang.md --- .changeset/stupid-numbers-hang.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/stupid-numbers-hang.md diff --git a/.changeset/stupid-numbers-hang.md b/.changeset/stupid-numbers-hang.md new file mode 100644 index 000000000000..b3fe379f4667 --- /dev/null +++ b/.changeset/stupid-numbers-hang.md @@ -0,0 +1,6 @@ +--- +swc_ecma_codegen: patch +swc_core: patch +--- + +fix(es/codegen): Emit comments of all nodes From 5c3b19d6a085506d8f9b76adfe7f4c76c78d729f Mon Sep 17 00:00:00 2001 From: DongYun Kang Date: Wed, 19 Nov 2025 16:11:17 -0500 Subject: [PATCH 3/8] Update test refs --- .../issues-110xx/11167/output/input.js | 4 +-- .../issues-1xxx/1333/case2/output/index.js | 6 ++++- .../fixture/issues-1xxx/1345/output/index.ts | 2 +- .../issues-1xxx/1456/case1/output/index.ts | 2 +- .../issues-1xxx/1456/case2/output/index.ts | 2 +- .../issues-2xxx/2056/1/output/index.js | 6 ++--- .../issues-2xxx/2964/case-3/output/index.ts | 2 +- .../3067/amd/output/packages/c/src/index.ts | 1 + .../commonjs/output/packages/c/src/index.ts | 1 + .../systemjs/output/packages/c/src/index.ts | 1 + .../3067/umd/output/packages/c/src/index.ts | 1 + .../fixture/issues-3xxx/3782/output/index.map | 2 +- .../fixture/issues-3xxx/3782/output/index.ts | 1 + .../fixture/jest/issue-7506/output/index.map | 2 +- .../fixture/jest/issue-7506/output/index.ts | 2 ++ .../fixture/jest/issue-7506/output/util.map | 2 +- .../fixture/jest/issue-7506/output/util.ts | 2 ++ .../node_modules/nanoid/async/index.d.ts | 15 +++++++++++ .../node_modules/nanoid/index.d.ts | 13 ++++++++++ .../node_modules/nanoid/non-secure/index.d.ts | 11 ++++++++ .../fixture/sourcemap/009/output/index.js | 4 +-- .../fixture/sourcemap/009/output/index.map | 2 +- ...mberThatUsesClassTypeParameter.1.normal.js | 2 +- .../ES5For-ofTypeCheck10.1.normal.js | 2 +- ...cessorsAreNotContextuallyTyped.1.normal.js | 2 +- .../accessorsOverrideProperty9.1.normal.js | 2 ++ .../ambientDeclarations.1.normal.js | 1 + ...ropertyInitializerDoesntNarrow.1.normal.js | 4 +-- .../anyAsGenericFunctionCall.1.normal.js | 2 +- .../anyAssignabilityInInheritance.1.normal.js | 1 + .../anyAssignableToEveryType2.1.normal.js | 1 + .../apparentTypeSubtyping.1.normal.js | 4 +-- .../apparentTypeSupertype.1.normal.js | 4 +-- ...mentExpressionContextualTyping.1.normal.js | 2 +- ...eralExpressionContextualTyping.1.normal.js | 2 +- .../tsc-references/arrayLiterals.1.normal.js | 2 +- .../arrayLiterals2ES5.1.normal.js | 2 +- .../tsc-references/arrayLiterals3.1.normal.js | 2 +- .../arrayOfFunctionTypes3.1.normal.js | 2 +- .../arrowFunctionExpressions.1.normal.js | 2 +- .../assignAnyToEveryType.1.normal.js | 2 +- .../assignEveryTypeToAny.1.normal.js | 2 +- ...gnmentCompatWithCallSignatures.1.normal.js | 1 + ...nmentCompatWithCallSignatures2.1.normal.js | 1 + ...nmentCompatWithCallSignatures3.1.normal.js | 2 +- ...nmentCompatWithCallSignatures4.1.normal.js | 2 +- ...nmentCompatWithCallSignatures5.1.normal.js | 2 +- ...nmentCompatWithCallSignatures6.1.normal.js | 2 +- ...gnaturesWithOptionalParameters.1.normal.js | 1 + ...llSignaturesWithRestParameters.1.normal.js | 1 + ...tCompatWithConstructSignatures.1.normal.js | 1 + ...CompatWithConstructSignatures2.1.normal.js | 1 + ...CompatWithConstructSignatures3.1.normal.js | 2 +- ...CompatWithConstructSignatures4.1.normal.js | 2 +- ...CompatWithConstructSignatures5.1.normal.js | 2 +- ...CompatWithConstructSignatures6.1.normal.js | 2 +- ...gnaturesWithOptionalParameters.1.normal.js | 1 + ...mpatWithGenericCallSignatures2.1.normal.js | 1 + ...mpatWithGenericCallSignatures3.1.normal.js | 1 + ...mpatWithGenericCallSignatures4.1.normal.js | 1 + ...gnaturesWithOptionalParameters.1.normal.js | 2 +- ...gnmentCompatWithNumericIndexer.1.normal.js | 1 + ...nmentCompatWithNumericIndexer2.1.normal.js | 1 + ...nmentCompatWithNumericIndexer3.1.normal.js | 1 + ...ignmentCompatWithObjectMembers.1.normal.js | 2 +- ...gnmentCompatWithObjectMembers2.1.normal.js | 2 +- ...gnmentCompatWithObjectMembers3.1.normal.js | 2 +- ...gnmentCompatWithObjectMembers4.1.normal.js | 2 +- ...WithObjectMembersAccessibility.1.normal.js | 2 +- ...tWithObjectMembersNumericNames.1.normal.js | 2 +- ...atWithObjectMembersOptionality.1.normal.js | 2 +- ...tWithObjectMembersOptionality2.1.normal.js | 4 +-- ...bjectMembersStringNumericNames.1.normal.js | 2 +- ...ignmentCompatWithStringIndexer.1.normal.js | 1 + ...gnmentCompatWithStringIndexer2.1.normal.js | 1 + ...gnmentCompatWithStringIndexer3.1.normal.js | 1 + .../assignmentToVoidZero1.1.normal.js | 2 +- .../tsc-references/assignments.1.normal.js | 8 ++++++ .../asyncArrowFunction11_es5.1.normal.js | 2 +- .../asyncAwaitNestedClasses_es5.1.normal.js | 2 +- ...asyncFunctionDeclaration16_es5.1.normal.js | 6 ++--- ...meterEvaluation(target=es2015).1.normal.js | 2 +- ...meterEvaluation(target=es2015).1.normal.js | 2 +- ...meterEvaluation(target=es2017).1.normal.js | 2 +- .../asyncWithVarShadowing_es6.1.normal.js | 1 + ...onTypeOfConditionalExpressions.1.normal.js | 4 +-- ...nTypeOfConditionalExpressions2.1.normal.js | 4 +-- ...wiseNotOperatorWithBooleanType.1.normal.js | 2 +- ...twiseNotOperatorWithNumberType.1.normal.js | 2 +- ...twiseNotOperatorWithStringType.1.normal.js | 2 +- .../bivariantInferences.1.normal.js | 1 + .../callChainInference.1.normal.js | 1 + ...callChainWithSuper(target=es5).1.normal.js | 2 +- ...IncorrectNumberOfTypeArguments.1.normal.js | 2 +- ...cFunctionWithZeroTypeArguments.1.normal.js | 2 +- ...nericFunctionWithTypeArguments.1.normal.js | 2 +- ...ureAssignabilityInInheritance2.1.normal.js | 2 +- ...ureAssignabilityInInheritance3.1.normal.js | 4 +-- ...ureAssignabilityInInheritance4.1.normal.js | 2 +- ...ureAssignabilityInInheritance5.1.normal.js | 4 +-- ...ureAssignabilityInInheritance6.1.normal.js | 6 ++--- ...tReturnTypeAnnotationInference.1.normal.js | 4 +-- ...uresThatDifferOnlyByReturnType.1.normal.js | 2 ++ ...resThatDifferOnlyByReturnType2.1.normal.js | 2 ++ ...gnaturesWithOptionalParameters.1.normal.js | 2 +- ...naturesWithOptionalParameters2.1.normal.js | 1 + .../callWithMissingVoid.1.normal.js | 2 +- .../tsc-references/callbackTag2.1.normal.js | 4 +-- .../checkJsdocTypeTag7.1.normal.js | 4 +-- ...kJsdocTypeTagOnObjectProperty1.1.normal.js | 2 +- ...checkJsxChildrenCanBeTupleType.1.normal.js | 2 +- ...xSubtleSkipContextSensitiveBug.1.normal.js | 2 +- .../circularImportAlias.1.normal.js | 2 +- .../classAbstractInstantiations1.1.normal.js | 6 ++--- ...ssCanExtendConstructorFunction.1.normal.js | 26 +++++++++---------- .../classStaticBlock27.1.normal.js | 2 +- ...icMembersEquivalentToInterface.1.normal.js | 2 +- ...cMembersEquivalentToInterface2.1.normal.js | 2 +- .../classWithOptionalParameter.1.normal.js | 2 +- .../classWithPrivateProperty.1.normal.js | 2 +- .../classWithProtectedProperty.1.normal.js | 2 +- ...indingPattern.2(target=es2015).1.normal.js | 2 +- ...erBindingPattern.2(target=es5).1.normal.js | 2 +- ...erInitializer.2(target=es2015).1.normal.js | 2 +- ...meterInitializer.2(target=es5).1.normal.js | 2 +- ...risonOperatorWithNumberOperand.1.normal.js | 1 + ...lOperatorConditoinIsStringType.1.normal.js | 2 +- ...tionalOperatorWithIdenticalBCT.1.normal.js | 2 +- ...nalOperatorWithoutIdenticalBCT.1.normal.js | 2 +- ...oObjectPrototypePropertyAccess.1.normal.js | 1 + .../constEnumPropertyAccess1.1.normal.js | 3 +++ .../constEnumPropertyAccess2.1.normal.js | 3 +++ .../constraintSatisfactionWithAny.1.normal.js | 2 +- ...constraintSatisfactionWithAny2.1.normal.js | 2 ++ ...intSatisfactionWithEmptyObject.1.normal.js | 2 +- ...tureAssignabilityInInheritance.1.normal.js | 1 + ...ureAssignabilityInInheritance2.1.normal.js | 2 +- ...ureAssignabilityInInheritance3.1.normal.js | 4 +-- ...ureAssignabilityInInheritance4.1.normal.js | 2 +- ...ureAssignabilityInInheritance5.1.normal.js | 4 +-- ...ureAssignabilityInInheritance6.1.normal.js | 6 ++--- ...gnaturesWithIdenticalOverloads.1.normal.js | 2 +- ...nstructSignaturesWithOverloads.1.normal.js | 2 +- ...structSignaturesWithOverloads2.1.normal.js | 2 +- ...oadsThatDifferOnlyByReturnType.1.normal.js | 2 +- ...ionTypeIsAssignableToBaseType2.1.normal.js | 2 +- .../constructorFunctionsStrict.1.normal.js | 4 +-- ...torParameterShadowsOuterScopes.1.normal.js | 2 +- ...WithAssignableReturnExpression.1.normal.js | 2 +- ...ntextualSignatureInstantiation.1.normal.js | 5 ++++ .../contextualTypeWithTuple.1.normal.js | 2 +- ...ypeWithUnionTypeCallSignatures.1.normal.js | 5 ++++ ...peWithUnionTypeIndexSignatures.1.normal.js | 2 ++ ...extualTypeWithUnionTypeMembers.1.normal.js | 2 ++ ...ntextualTypedSpecialAssignment.1.normal.js | 2 +- .../controlFlowAliasing.1.normal.js | 2 +- ...trolFlowAssignmentPatternOrder.1.normal.js | 1 + .../controlFlowOptionalChain.1.normal.js | 1 + ...orrectlyMarkAliasAsReferences4.1.normal.js | 2 +- .../covariantCallbacks.1.normal.js | 1 + ...rementOperatorWithAnyOtherType.1.normal.js | 2 +- ...ecrementOperatorWithNumberType.1.normal.js | 2 +- ...assConstructorWithoutSuperCall.1.normal.js | 2 +- .../derivedClassTransitivity.1.normal.js | 2 +- .../derivedClassTransitivity2.1.normal.js | 2 +- .../derivedClassTransitivity3.1.normal.js | 2 +- .../derivedClassTransitivity4.1.normal.js | 2 +- ...assWithoutExplicitConstructor3.1.normal.js | 2 +- ...indingPatternAndAssignment1ES5.1.normal.js | 6 ++--- ...tternAndAssignment1ES5iterable.1.normal.js | 6 ++--- ...ayBindingPatternAndAssignment2.1.normal.js | 4 +-- ...ayBindingPatternAndAssignment4.1.normal.js | 1 + ...dAssignment5SiblingInitializer.1.normal.js | 2 +- ...EvaluationOrder(target=es2015).1.normal.js | 2 +- ...ingEvaluationOrder(target=es5).1.normal.js | 2 +- ...turingParameterDeclaration3ES5.1.normal.js | 4 +++ ...rameterDeclaration3ES5iterable.1.normal.js | 4 +++ ...turingParameterDeclaration3ES6.1.normal.js | 4 +++ ...ructuringParameterDeclaration5.1.normal.js | 1 + ...cturingVariableDeclaration1ES5.1.normal.js | 4 +-- ...ariableDeclaration1ES5iterable.1.normal.js | 4 +-- ...cturingWithLiteralInitializers.1.normal.js | 2 +- ...ctDependenceBetweenTypeAliases.1.normal.js | 2 ++ .../discriminatedUnionInference.1.normal.js | 1 + .../discriminatedUnionTypes3.1.normal.js | 1 + .../duplicateNumericIndexers.1.normal.js | 1 + .../duplicateStringIndexers.1.normal.js | 2 +- ...mitter.forAwait(target=es2015).1.normal.js | 6 ++--- .../emitter.forAwait(target=es5).1.normal.js | 6 ++--- .../enumAssignability.1.normal.js | 2 +- ...enumAssignabilityInInheritance.1.normal.js | 2 +- ...NotASubtypeOfAnythingButNumber.1.normal.js | 2 +- .../errorOnFunctionReturnType.1.normal.js | 6 ++--- .../errorSuperPropertyAccess.1.normal.js | 6 ++--- ...ntOfExportNamespaceWithDefault.1.normal.js | 1 + .../tsc-references/exportCodeGen.1.normal.js | 2 +- .../exportImportAlias.1.normal.js | 2 +- .../tsc-references/extendsTag1.1.normal.js | 10 +++---- .../tsc-references/extendsTag5.1.normal.js | 8 +++--- ...functionConstraintSatisfaction.1.normal.js | 2 +- ...unctionConstraintSatisfaction2.1.normal.js | 2 +- ...unctionConstraintSatisfaction3.1.normal.js | 2 +- ...ionExpressionContextualTyping1.1.normal.js | 2 +- ...ionExpressionContextualTyping3.1.normal.js | 1 + .../functionImplementationErrors.1.normal.js | 2 +- .../functionImplementations.1.normal.js | 2 +- .../functionLiteralForOverloads2.1.normal.js | 2 +- ...meterObjectRestAndInitializers.1.normal.js | 2 +- ...nericCallTypeArgumentInference.1.normal.js | 2 +- ...nstraintsTypeArgumentInference.1.normal.js | 2 +- ...allWithFunctionTypedArguments4.1.normal.js | 2 +- ...thObjectTypeArgsAndConstraints.1.normal.js | 2 +- ...hObjectTypeArgsAndConstraints2.1.normal.js | 4 +-- ...hObjectTypeArgsAndConstraints3.1.normal.js | 2 +- ...hObjectTypeArgsAndConstraints4.1.normal.js | 2 +- ...hObjectTypeArgsAndConstraints5.1.normal.js | 2 +- ...thFunctionTypedMemberArguments.1.normal.js | 2 +- ...thObjectTypeArgsAndConstraints.1.normal.js | 2 +- .../genericRestArity.1.normal.js | 1 + .../genericRestArityStrict.1.normal.js | 1 + ...getSetAccessorContextualTyping.1.normal.js | 4 +-- .../heterogeneousArrayLiterals.1.normal.js | 2 +- .../identicalCallSignatures.1.normal.js | 2 ++ .../importCallExpressionInAMD2.1.normal.js | 2 +- .../importCallExpressionInCJS3.1.normal.js | 2 +- .../importCallExpressionInSystem2.1.normal.js | 2 +- .../importCallExpressionInUMD2.1.normal.js | 2 +- .../importCallExpressionInUMD5.1.normal.js | 2 +- ...rementOperatorWithAnyOtherType.1.normal.js | 2 +- ...ncrementOperatorWithNumberType.1.normal.js | 2 +- .../independentPropertyVariance.1.normal.js | 1 + .../tsc-references/inferTypes2.1.normal.js | 1 + .../inferTypesWithExtends1.1.normal.js | 1 + ...eExpansionThroughInstantiation.1.normal.js | 1 + ...erReferencingConstructorLocals.1.normal.js | 2 +- ...ferencingConstructorParameters.1.normal.js | 2 +- ...xFactoryDeclarationsLocalTypes.1.normal.js | 8 +++--- ...ypeParameterShadowingOuterOne2.1.normal.js | 2 +- ...WithWrongNumberOfTypeArguments.1.normal.js | 2 +- ...ericClassWithZeroTypeArguments.1.normal.js | 2 +- ...onGenericTypeWithTypeArguments.1.normal.js | 2 +- .../instantiatedModule.1.normal.js | 2 +- ...dingPropFromGlobalAugmentation.1.normal.js | 1 + ...intersectionOfUnionOfUnitTypes.1.normal.js | 1 + .../intersectionTypeInference3.1.normal.js | 1 + .../intersectionTypeMembers.1.normal.js | 2 ++ .../intersectionTypeOverloading.1.normal.js | 2 ++ .../intersectionsAndEmptyObjects.1.normal.js | 2 ++ .../intraExpressionInferences.1.normal.js | 1 + .../intraExpressionInferencesJsx.1.normal.js | 2 ++ .../invalidImportAliasIdentifiers.1.normal.js | 2 +- .../invalidReturnStatements.1.normal.js | 2 +- ...mplementsGenericsSerialization.1.normal.js | 4 +-- .../jsDeclarationsClassesErr.1.normal.js | 4 +-- .../jsDeclarationsDefaultsErr.1.normal.js | 3 ++- ...tionClassesCjsExportAssignment.1.normal.js | 4 +-- .../jsDeclarationsFunctionJSDoc.1.normal.js | 4 +-- ...eclarationsFunctionLikeClasses.1.normal.js | 4 +-- ...clarationsFunctionLikeClasses2.1.normal.js | 4 +-- ...ortAliasExposedWithinNamespace.1.normal.js | 12 ++++----- ...AliasExposedWithinNamespaceCjs.1.normal.js | 4 +-- ...sDeclarationsImportTypeBundled.1.normal.js | 16 ++++++------ .../jsDeclarationsInterfaces.1.normal.js | 2 ++ ...arationsModuleReferenceHasEmit.1.normal.js | 4 +-- ...DeclarationsReexportedCjsAlias.1.normal.js | 4 +-- .../jsDeclarationsTypeAliases.1.normal.js | 4 +-- ...larationsTypedefAndImportTypes.1.normal.js | 8 +++--- ...eclarationsTypedefAndLatebound.1.normal.js | 4 +-- .../jsxJsxsCjsTransformChildren.1.normal.js | 2 +- ...sxJsxsCjsTransformCustomImport.1.normal.js | 2 +- ...CjsTransformCustomImportPragma.1.normal.js | 9 ++++--- .../jsxJsxsCjsTransformKeyProp.1.normal.js | 2 +- ...jsTransformKeyPropCustomImport.1.normal.js | 2 +- ...sformKeyPropCustomImportPragma.1.normal.js | 9 ++++--- ...ransformNestedSelfClosingChild.1.normal.js | 1 + ...xsCjsTransformSubstitutesNames.1.normal.js | 2 +- ...nsformSubstitutesNamesFragment.1.normal.js | 2 +- ...ferenceLowerPriorityThanReturn.1.normal.js | 1 + .../libReferenceDeclarationEmit.1.normal.js | 2 ++ ...ReferenceDeclarationEmitBundle.1.normal.js | 2 ++ .../libReferenceNoLib.1.normal.js | 2 ++ .../libReferenceNoLibBundle.1.normal.js | 2 ++ .../literalTypeWidening.1.normal.js | 2 +- ...calNotOperatorWithAnyOtherType.1.normal.js | 2 +- ...icalNotOperatorWithBooleanType.1.normal.js | 2 +- ...gicalNotOperatorWithNumberType.1.normal.js | 2 +- ...gicalNotOperatorWithStringType.1.normal.js | 2 +- ...appedTypeAsClauseRelationships.1.normal.js | 1 + .../mappedTypeAsClauses.1.normal.js | 1 + .../mappedTypeInferenceErrors.1.normal.js | 1 + .../mappedTypesGenericTuples2.1.normal.js | 1 + .../mergeThreeInterfaces.1.normal.js | 2 ++ .../mergeTwoInterfaces.1.normal.js | 2 ++ .../mergedInterfacesWithIndexers.1.normal.js | 1 + ...gedInterfacesWithMultipleBases.1.normal.js | 2 +- ...edInterfacesWithMultipleBases2.1.normal.js | 2 +- ...edInterfacesWithMultipleBases3.1.normal.js | 2 +- ...edInterfacesWithMultipleBases4.1.normal.js | 2 +- .../missingAndExcessProperties.1.normal.js | 2 +- .../moduleExportAlias3.1.normal.js | 2 +- .../moduleExportAlias4.1.normal.js | 2 +- ...uleResolutionWithoutExtension1.1.normal.js | 1 + .../multipleNumericIndexers.1.normal.js | 2 +- .../multipleStringIndexers.1.normal.js | 2 +- ...rrowingConstrainedTypeVariable.1.normal.js | 2 +- .../negateOperatorWithBooleanType.1.normal.js | 2 +- .../negateOperatorWithNumberType.1.normal.js | 2 +- .../negateOperatorWithStringType.1.normal.js | 2 +- .../tests/tsc-references/noInfer.1.normal.js | 1 + ...TypeReferenceWithTypeArguments.1.normal.js | 2 +- .../nonPrimitiveAndEmptyObject.1.normal.js | 1 + .../nonPrimitiveAndTypeVariables.1.normal.js | 1 + ...ubtypeOfEverythingButUndefined.1.normal.js | 2 +- ...nAsyncGenerator(target=es2015).1.normal.js | 2 +- ...orInAsyncGenerator(target=es5).1.normal.js | 2 +- ...ConstrainsPropertyDeclarations.1.normal.js | 1 + ...onstrainsPropertyDeclarations2.1.normal.js | 2 +- .../objectLiteralContextualTyping.1.normal.js | 4 +++ .../objectLiteralNormalization.1.normal.js | 2 +- .../tsc-references/objectRest2.1.normal.js | 1 + .../objectRestReadonly.1.normal.js | 1 + .../objectSpreadComputedProperty.1.normal.js | 2 +- ...bjectTypeHidingMembersOfObject.1.normal.js | 2 +- .../objectTypePropertyAccess.1.normal.js | 2 +- ...gnatureAppearsToBeFunctionType.1.normal.js | 2 ++ ...idingMembersOfExtendedFunction.1.normal.js | 2 ++ ...gnatureHidingMembersOfFunction.1.normal.js | 2 ++ ...gnatureAppearsToBeFunctionType.1.normal.js | 1 + .../objectTypeWithNumericProperty.1.normal.js | 2 +- ...peWithRecursiveWrappedProperty.1.normal.js | 2 +- ...eWithRecursiveWrappedProperty2.1.normal.js | 2 +- ...rappedPropertyCheckedNominally.1.normal.js | 2 +- ...ngAndNumberIndexSignatureToAny.1.normal.js | 18 +++++++++++++ ...ringIndexerHidingObjectIndexer.1.normal.js | 2 ++ .../objectTypesIdentity.1.normal.js | 2 +- .../objectTypesIdentity2.1.normal.js | 2 +- ...ypesIdentityWithCallSignatures.1.normal.js | 2 +- ...pesIdentityWithCallSignatures2.1.normal.js | 2 +- ...pesIdentityWithCallSignatures3.1.normal.js | 1 + ...SignaturesDifferingParamCounts.1.normal.js | 2 +- ...ignaturesDifferingParamCounts2.1.normal.js | 1 + ...ithCallSignaturesWithOverloads.1.normal.js | 2 +- ...dentityWithConstructSignatures.1.normal.js | 2 +- ...entityWithConstructSignatures2.1.normal.js | 2 +- ...SignaturesDifferingParamCounts.1.normal.js | 2 +- ...ntityWithGenericCallSignatures.1.normal.js | 2 +- ...tityWithGenericCallSignatures2.1.normal.js | 2 +- ...gnaturesDifferingByConstraints.1.normal.js | 2 +- ...naturesDifferingByConstraints2.1.normal.js | 2 +- ...naturesDifferingByConstraints3.1.normal.js | 2 +- ...ignaturesDifferingByReturnType.1.normal.js | 2 +- ...gnaturesDifferingByReturnType2.1.normal.js | 2 +- ...esDifferingTypeParameterCounts.1.normal.js | 2 +- ...sDifferingTypeParameterCounts2.1.normal.js | 1 + ...resDifferingTypeParameterNames.1.normal.js | 2 +- ...icCallSignaturesOptionalParams.1.normal.js | 2 +- ...cCallSignaturesOptionalParams2.1.normal.js | 2 +- ...cCallSignaturesOptionalParams3.1.normal.js | 2 +- ...gnaturesDifferingByConstraints.1.normal.js | 2 +- ...naturesDifferingByConstraints2.1.normal.js | 2 +- ...naturesDifferingByConstraints3.1.normal.js | 2 +- ...ignaturesDifferingByReturnType.1.normal.js | 2 +- ...gnaturesDifferingByReturnType2.1.normal.js | 2 +- ...esDifferingTypeParameterCounts.1.normal.js | 2 +- ...resDifferingTypeParameterNames.1.normal.js | 2 +- ...structSignaturesOptionalParams.1.normal.js | 2 +- ...tructSignaturesOptionalParams2.1.normal.js | 2 +- ...tructSignaturesOptionalParams3.1.normal.js | 2 +- ...esIdentityWithNumericIndexers1.1.normal.js | 2 +- ...esIdentityWithNumericIndexers2.1.normal.js | 2 +- ...esIdentityWithNumericIndexers3.1.normal.js | 2 +- ...ctTypesIdentityWithOptionality.1.normal.js | 2 +- ...bjectTypesIdentityWithPrivates.1.normal.js | 2 +- ...jectTypesIdentityWithPrivates2.1.normal.js | 2 +- ...objectTypesIdentityWithPublics.1.normal.js | 2 +- ...ypesIdentityWithStringIndexers.1.normal.js | 2 +- ...pesIdentityWithStringIndexers2.1.normal.js | 2 +- ...rBindingPattern(target=es2015).1.normal.js | 2 +- ...eterBindingPattern(target=es5).1.normal.js | 2 +- ...indingPattern.2(target=es2015).1.normal.js | 2 +- ...erBindingPattern.2(target=es5).1.normal.js | 2 +- .../optionalChainingInference.1.normal.js | 1 + .../tsc-references/overloadTag3.1.normal.js | 4 +-- ...rdReferencing.2(target=es2015).1.normal.js | 2 +- ...rwardReferencing.2(target=es5).1.normal.js | 2 +- .../parenthesizedContexualTyping2.1.normal.js | 5 ++++ .../parenthesizedContexualTyping3.1.normal.js | 5 +++- .../parserAstSpans1.1.normal.js | 2 +- ...very_IncompleteMemberVariable1.1.normal.js | 1 + .../parserForInStatement8.1.normal.js | 2 +- .../parserRealSource1.1.normal.js | 2 +- .../parserRealSource12.1.normal.js | 2 +- .../parserRealSource14.1.normal.js | 2 +- .../parserRealSource5.1.normal.js | 2 +- .../parserRealSource6.1.normal.js | 2 +- .../parserRealSource8.1.normal.js | 2 +- .../tsc-references/parserindenter.1.normal.js | 2 +- ...tedFunctionWitoutTypeParameter.1.normal.js | 1 + .../partiallyNamedTuples2.1.normal.js | 1 + .../plusOperatorWithBooleanType.1.normal.js | 2 +- .../plusOperatorWithNumberType.1.normal.js | 2 +- .../plusOperatorWithStringType.1.normal.js | 2 +- .../primtiveTypesAreIdentical.1.normal.js | 1 + ...sPropertyAccessibleWithinClass.1.normal.js | 2 +- ...rtyAccessibleWithinNestedClass.1.normal.js | 2 +- ...edPropertyName4(target=es2015).1.normal.js | 2 +- .../privateNameEmitHelpers.1.normal.js | 1 + .../privateNameStaticEmitHelpers.1.normal.js | 1 + .../privateNamesUnique-5.1.normal.js | 2 +- ...teStaticNotAccessibleInClodule.1.normal.js | 2 +- ...eStaticNotAccessibleInClodule2.1.normal.js | 2 +- ...sOfGenericConstructorFunctions.1.normal.js | 4 +-- ...OnTypeParameterWithConstraints.1.normal.js | 2 +- ...nTypeParameterWithConstraints2.1.normal.js | 2 +- ...nTypeParameterWithConstraints3.1.normal.js | 2 +- ...sPropertyAccessibleWithinClass.1.normal.js | 2 +- ...rtyAccessibleWithinNestedClass.1.normal.js | 2 +- ...opertyAccessibleWithinSubclass.1.normal.js | 2 +- ...edStaticNotAccessibleInClodule.1.normal.js | 2 +- .../readonlyConstructorAssignment.1.normal.js | 2 +- .../recursiveMappedTypes.1.normal.js | 1 + ...tParameterInDownlevelGenerator.1.normal.js | 2 +- .../returnStatements.1.normal.js | 2 +- .../tsc-references/scannertest1.1.normal.js | 2 +- .../scopeResolutionIdentifiers.1.normal.js | 2 +- ...btypeOfNonSpecializedSignature.1.normal.js | 2 ++ ...dContextualTypedBindingPattern.1.normal.js | 1 + .../spreadDuplicate.1.normal.js | 1 + .../spreadDuplicateExact.1.normal.js | 1 + .../spreadNonObject1.1.normal.js | 1 + .../spreadOverwritesProperty.1.normal.js | 1 + .../tsc-references/staticIndexers.1.normal.js | 2 +- ...MembersUsingClassTypeParameter.1.normal.js | 2 +- .../strictBindCallApply2.1.normal.js | 1 + .../strictPropertyInitialization.1.normal.js | 2 +- ...ConstrainsPropertyDeclarations.1.normal.js | 1 + ...onstrainsPropertyDeclarations2.1.normal.js | 2 +- ...ngLiteralTypeIsSubtypeOfString.1.normal.js | 2 ++ ...ypesInImplementationSignatures.1.normal.js | 2 +- ...pesInImplementationSignatures2.1.normal.js | 1 + ...pingDeferralInConditionalTypes.1.normal.js | 1 + ...ringMappingOverPatternLiterals.1.normal.js | 1 + .../tsc-references/subtypesOfAny.1.normal.js | 1 + .../subtypesOfTypeParameter.1.normal.js | 2 +- ...OfTypeParameterWithConstraints.1.normal.js | 2 +- ...fTypeParameterWithConstraints2.1.normal.js | 2 +- ...fTypeParameterWithConstraints4.1.normal.js | 2 +- ...ameterWithRecursiveConstraints.1.normal.js | 2 +- .../subtypingWithCallSignatures2.1.normal.js | 2 +- .../subtypingWithCallSignatures3.1.normal.js | 4 +-- .../subtypingWithCallSignatures4.1.normal.js | 2 +- ...typingWithConstructSignatures2.1.normal.js | 2 +- ...typingWithConstructSignatures3.1.normal.js | 4 +-- ...typingWithConstructSignatures4.1.normal.js | 2 +- ...typingWithConstructSignatures5.1.normal.js | 4 +-- ...typingWithConstructSignatures6.1.normal.js | 6 ++--- .../subtypingWithNumericIndexer.1.normal.js | 1 + .../subtypingWithNumericIndexer3.1.normal.js | 1 + .../subtypingWithNumericIndexer4.1.normal.js | 1 + .../subtypingWithNumericIndexer5.1.normal.js | 1 + .../subtypingWithObjectMembers4.1.normal.js | 2 +- ...WithObjectMembersAccessibility.1.normal.js | 2 +- ...ithObjectMembersAccessibility2.1.normal.js | 2 +- ...ngWithObjectMembersOptionality.1.normal.js | 1 + ...gWithObjectMembersOptionality2.1.normal.js | 1 + ...gWithObjectMembersOptionality3.1.normal.js | 1 + ...gWithObjectMembersOptionality4.1.normal.js | 1 + .../subtypingWithStringIndexer.1.normal.js | 1 + .../subtypingWithStringIndexer3.1.normal.js | 1 + .../subtypingWithStringIndexer4.1.normal.js | 1 + .../superPropertyAccessNoError.1.normal.js | 12 ++++----- ...teStringsTypeArgumentInference.1.normal.js | 2 +- ...StringsWithOverloadResolution3.1.normal.js | 1 + ...ngsWithOverloadResolution3_ES6.1.normal.js | 1 + .../templateInsideCallback.1.normal.js | 4 +-- .../templateLiteralTypes3.1.normal.js | 1 + .../templateLiteralTypes4.1.normal.js | 1 + .../templateLiteralTypes5.1.normal.js | 1 + .../templateLiteralTypes6.1.normal.js | 1 + .../templateLiteralTypes7.1.normal.js | 1 + .../tests/tsc-references/thisTag3.1.normal.js | 4 +-- .../thisTypeInFunctions.1.normal.js | 2 +- .../throwStatements.1.normal.js | 1 + .../topLevelAmbientModule.1.normal.js | 2 +- ...pLevelModuleDeclarationAndFile.1.normal.js | 2 +- .../tsNoCheckForTypescript.1.normal.js | 2 +- ...sNoCheckForTypescriptComments1.1.normal.js | 2 +- ...sNoCheckForTypescriptComments2.1.normal.js | 2 +- .../tsxElementResolution17.1.normal.js | 2 ++ .../tsxElementResolution19.1.normal.js | 1 + .../tsxPreserveEmit1.1.normal.js | 1 + .../tsxPreserveEmit3.1.normal.js | 1 + .../tsc-references/tsxTypeErrors.1.normal.js | 2 +- ...oInterfacesDifferentRootModule.1.normal.js | 1 + ...terfacesWithDifferingOverloads.1.normal.js | 1 + .../tsc-references/typeAliases.1.normal.js | 1 + ...ntInferenceConstructSignatures.1.normal.js | 1 + .../typeFromPropertyAssignment28.1.normal.js | 2 +- .../typeFromPropertyAssignment35.1.normal.js | 4 +-- .../typeGuardOfFormInstanceOf.1.normal.js | 8 +++--- ...ardOfFormInstanceOfOnInterface.1.normal.js | 5 ++++ .../typeGuardsInClassAccessors.1.normal.js | 4 +-- .../typeGuardsInClassMethods.1.normal.js | 2 +- .../typeGuardsInExternalModule.1.normal.js | 6 ++--- .../typeGuardsInProperties.1.normal.js | 4 +-- .../typeGuardsOnClassProperty.1.normal.js | 2 +- .../typeGuardsTypeParameters.1.normal.js | 2 +- ...peOfThisInConstructorParamList.1.normal.js | 2 +- ...typeOfThisInFunctionExpression.1.normal.js | 2 +- ...mberNarrowedWithLoopAntecedent.1.normal.js | 1 + .../typeParameterAsBaseType.1.normal.js | 4 +-- .../typeParameterAsTypeArgument.1.normal.js | 2 +- ...arameterConstraintTransitively.1.normal.js | 2 ++ ...rameterConstraintTransitively2.1.normal.js | 2 ++ .../typeParameterAssignability3.1.normal.js | 2 +- ...ConstModifiersWithIntersection.1.normal.js | 1 + ...terDirectlyConstrainedToItself.1.normal.js | 2 +- ...UsedAsTypeParameterConstraint4.1.normal.js | 2 +- ...metersAreIdenticalToThemselves.1.normal.js | 1 + .../typedefCrossModule2.1.normal.js | 4 +-- .../typedefCrossModule3.1.normal.js | 4 +-- .../typedefCrossModule4.1.normal.js | 4 +-- .../typedefCrossModule5.1.normal.js | 4 +-- ...typeofOperatorWithAnyOtherType.1.normal.js | 2 +- .../typeofOperatorWithBooleanType.1.normal.js | 2 +- .../typeofOperatorWithEnumType.1.normal.js | 2 +- .../typeofOperatorWithNumberType.1.normal.js | 2 +- .../typeofOperatorWithStringType.1.normal.js | 2 +- .../typesWithOptionalProperty.1.normal.js | 1 + .../typesWithPublicConstructor.1.normal.js | 2 +- ...sWithSpecializedCallSignatures.1.normal.js | 2 +- ...SpecializedConstructSignatures.1.normal.js | 2 +- ...undefinedIsSubtypeOfEverything.1.normal.js | 2 +- ...unionAndIntersectionInference1.1.normal.js | 1 + ...unionAndIntersectionInference3.1.normal.js | 1 + .../unionTypeCallSignatures5.1.normal.js | 1 + .../unionTypeCallSignatures7.1.normal.js | 1 + .../unionTypeEquivalence.1.normal.js | 2 +- .../unionTypeFromArrayLiteral.1.normal.js | 6 ++--- .../tsc-references/unknownType1.1.normal.js | 1 + .../variadicTuples1.1.normal.js | 1 + .../tests/tsc-references/variance.1.normal.js | 2 ++ ...rbatimModuleSyntaxNoElisionCJS.1.normal.js | 1 + .../voidOperatorWithAnyOtherType.1.normal.js | 2 +- .../voidOperatorWithBooleanType.1.normal.js | 2 +- .../voidOperatorWithNumberType.1.normal.js | 2 +- .../voidOperatorWithStringType.1.normal.js | 2 +- .../tests/tsc-references/witness.1.normal.js | 2 +- ...wrappedAndRecursiveConstraints.1.normal.js | 2 +- ...rappedAndRecursiveConstraints3.1.normal.js | 2 +- .../yieldExpressionInControlFlow.1.normal.js | 2 +- .../next-39460/output/snippetSession.js | 10 +++---- 552 files changed, 815 insertions(+), 511 deletions(-) diff --git a/crates/swc/tests/fixture/issues-110xx/11167/output/input.js b/crates/swc/tests/fixture/issues-110xx/11167/output/input.js index dd14b25f3dfc..2e1b74e1bd2d 100644 --- a/crates/swc/tests/fixture/issues-110xx/11167/output/input.js +++ b/crates/swc/tests/fixture/issues-110xx/11167/output/input.js @@ -1,5 +1,5 @@ -import { _ as s } from "@swc/helpers/_/_define_property"; -/* @ngInject */ class e { +/* @ngInject */ import { _ as s } from "@swc/helpers/_/_define_property"; +class e { constructor(e){ s(this, "testField", void 0); this.testField = e; diff --git a/crates/swc/tests/fixture/issues-1xxx/1333/case2/output/index.js b/crates/swc/tests/fixture/issues-1xxx/1333/case2/output/index.js index e04fbdd38ad3..85d369959a69 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1333/case2/output/index.js +++ b/crates/swc/tests/fixture/issues-1xxx/1333/case2/output/index.js @@ -1,4 +1,8 @@ -"use strict"; +/* + * Copyright (c) 2020. MeLike2D All Rights Reserved. + * Neo is licensed under the MIT License. + * See the LICENSE file in the project root for more details. + */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/crates/swc/tests/fixture/issues-1xxx/1345/output/index.ts b/crates/swc/tests/fixture/issues-1xxx/1345/output/index.ts index c46c7b906e15..37fbad844632 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1345/output/index.ts +++ b/crates/swc/tests/fixture/issues-1xxx/1345/output/index.ts @@ -1,4 +1,4 @@ -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +/** 등록된 계좌+회원의 정보 */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _ts_metadata } from "@swc/helpers/_/_ts_metadata"; export var AccountMemberView = function AccountMemberView() { diff --git a/crates/swc/tests/fixture/issues-1xxx/1456/case1/output/index.ts b/crates/swc/tests/fixture/issues-1xxx/1456/case1/output/index.ts index 16dfad1b8292..995b914a8262 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1456/case1/output/index.ts +++ b/crates/swc/tests/fixture/issues-1xxx/1456/case1/output/index.ts @@ -1,3 +1,4 @@ +// not work "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -5,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); const _ts_metadata = require("@swc/helpers/_/_ts_metadata"); const _ts_param = require("@swc/helpers/_/_ts_param"); -// not work class MyClass1 { constructor(param1){ this.param1 = param1; diff --git a/crates/swc/tests/fixture/issues-1xxx/1456/case2/output/index.ts b/crates/swc/tests/fixture/issues-1xxx/1456/case2/output/index.ts index 4c04367bd768..312641808919 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1456/case2/output/index.ts +++ b/crates/swc/tests/fixture/issues-1xxx/1456/case2/output/index.ts @@ -1,3 +1,4 @@ +// work "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -5,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); const _ts_metadata = require("@swc/helpers/_/_ts_metadata"); const _ts_param = require("@swc/helpers/_/_ts_param"); -// work class MyClass1 { constructor(param1){} } diff --git a/crates/swc/tests/fixture/issues-2xxx/2056/1/output/index.js b/crates/swc/tests/fixture/issues-2xxx/2056/1/output/index.js index ebb74da15fd7..06f1aef73472 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2056/1/output/index.js +++ b/crates/swc/tests/fixture/issues-2xxx/2056/1/output/index.js @@ -1,5 +1,3 @@ -import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; -import { _ as _type_of } from "@swc/helpers/_/_type_of"; /* Copyright (c) 2018-2020 Xiamen Yaji Software Co., Ltd. @@ -26,7 +24,9 @@ import { _ as _type_of } from "@swc/helpers/_/_type_of"; */ /** * @packageDocumentation * @module core/math - */ import { CCClass } from "../data/class"; + */ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; +import { _ as _type_of } from "@swc/helpers/_/_type_of"; +import { CCClass } from "../data/class"; import { Mat3 } from "./mat3"; import { Quat } from "./quat"; import { enumerableProps, EPSILON } from "./utils"; diff --git a/crates/swc/tests/fixture/issues-2xxx/2964/case-3/output/index.ts b/crates/swc/tests/fixture/issues-2xxx/2964/case-3/output/index.ts index d18fb32f14ac..99133ea81eef 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2964/case-3/output/index.ts +++ b/crates/swc/tests/fixture/issues-2xxx/2964/case-3/output/index.ts @@ -1,9 +1,9 @@ +// single line comment "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _object_without_properties = require("@swc/helpers/_/_object_without_properties"); -// single line comment const x = (_param)=>/*todo: refactor any type*/ { var { y } = _param, rest = _object_without_properties._(_param, [ "y" diff --git a/crates/swc/tests/fixture/issues-3xxx/3067/amd/output/packages/c/src/index.ts b/crates/swc/tests/fixture/issues-3xxx/3067/amd/output/packages/c/src/index.ts index bb3473afd71b..8e3b0d8eb446 100644 --- a/crates/swc/tests/fixture/issues-3xxx/3067/amd/output/packages/c/src/index.ts +++ b/crates/swc/tests/fixture/issues-3xxx/3067/amd/output/packages/c/src/index.ts @@ -1,3 +1,4 @@ +// Simulate accessing a .js file in a third party package that shouldn't be edited define([ "require", "exports", diff --git a/crates/swc/tests/fixture/issues-3xxx/3067/commonjs/output/packages/c/src/index.ts b/crates/swc/tests/fixture/issues-3xxx/3067/commonjs/output/packages/c/src/index.ts index 67272da07a9d..25ebc7ba3ba1 100644 --- a/crates/swc/tests/fixture/issues-3xxx/3067/commonjs/output/packages/c/src/index.ts +++ b/crates/swc/tests/fixture/issues-3xxx/3067/commonjs/output/packages/c/src/index.ts @@ -1,3 +1,4 @@ +// Simulate accessing a .js file in a third party package that shouldn't be edited "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc/tests/fixture/issues-3xxx/3067/systemjs/output/packages/c/src/index.ts b/crates/swc/tests/fixture/issues-3xxx/3067/systemjs/output/packages/c/src/index.ts index e1121fb27215..5fd339a641fd 100644 --- a/crates/swc/tests/fixture/issues-3xxx/3067/systemjs/output/packages/c/src/index.ts +++ b/crates/swc/tests/fixture/issues-3xxx/3067/systemjs/output/packages/c/src/index.ts @@ -1,3 +1,4 @@ +// Simulate accessing a .js file in a third party package that shouldn't be edited System.register([ "lodash/dist/something.js" ], function(_export, _context) { diff --git a/crates/swc/tests/fixture/issues-3xxx/3067/umd/output/packages/c/src/index.ts b/crates/swc/tests/fixture/issues-3xxx/3067/umd/output/packages/c/src/index.ts index b2e268da0877..a97d841d1cac 100644 --- a/crates/swc/tests/fixture/issues-3xxx/3067/umd/output/packages/c/src/index.ts +++ b/crates/swc/tests/fixture/issues-3xxx/3067/umd/output/packages/c/src/index.ts @@ -1,3 +1,4 @@ +// Simulate accessing a .js file in a third party package that shouldn't be edited (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(exports, require("@swc/helpers/_/_interop_require_default"), require("lodash/dist/something.js")); else if (typeof define === "function" && define.amd) define([ diff --git a/crates/swc/tests/fixture/issues-3xxx/3782/output/index.map b/crates/swc/tests/fixture/issues-3xxx/3782/output/index.map index c9e803e2ceaf..29307245a824 100644 --- a/crates/swc/tests/fixture/issues-3xxx/3782/output/index.map +++ b/crates/swc/tests/fixture/issues-3xxx/3782/output/index.map @@ -1,5 +1,5 @@ { - "mappings": ";;;;;;;;QAKaA;eAAAA;;QAJDC;;;;qBAAS;AAId,MAAMD,OAAO,CAACE;IACjB,sBAAsB;IACtB,OAAO,IAAIC,QAAQ,CAACC,UAChBC,WAAW;YACPD,QAAQ;QACZ,GAAG;AAEX", + "mappings": "AAAA,WAAW;;;;;;;;;QAKEA;eAAAA;;QAJDC;;;;qBAAS;AAId,MAAMD,OAAO,CAACE;IACjB,sBAAsB;IACtB,OAAO,IAAIC,QAAQ,CAACC,UAChBC,WAAW;YACPD,QAAQ;QACZ,GAAG;AAEX", "names": [ "byID", "get", diff --git a/crates/swc/tests/fixture/issues-3xxx/3782/output/index.ts b/crates/swc/tests/fixture/issues-3xxx/3782/output/index.ts index c3d401efaf68..11f857ef8b77 100644 --- a/crates/swc/tests/fixture/issues-3xxx/3782/output/index.ts +++ b/crates/swc/tests/fixture/issues-3xxx/3782/output/index.ts @@ -1,3 +1,4 @@ +// index.ts "use strict"; function _export(target, all) { for(var name in all)Object.defineProperty(target, name, { diff --git a/crates/swc/tests/fixture/jest/issue-7506/output/index.map b/crates/swc/tests/fixture/jest/issue-7506/output/index.map index 4cb3968e73f0..6e59d7004275 100644 --- a/crates/swc/tests/fixture/jest/issue-7506/output/index.map +++ b/crates/swc/tests/fixture/jest/issue-7506/output/index.map @@ -1,5 +1,5 @@ { - "mappings": ";;;;+BAE8B;AAE9BA,SAAS,mBAAmB;IACxBC,GAAG,4DAA4D;QAC3D,IAAIC;QACJ,SAASC;YACLD,QAAQE,IAAAA,4BAAa;QACzB;QACAD;QAEAE,OAAOH,KAAK,CAAC,EAAE,EAAEI,SAAS,CAAC;IAC/B;AACJ", + "mappings": "AAAA,4DAA4D;AAC5D,kCAAkC;;;;;+BACJ;AAE9BA,SAAS,mBAAmB;IACxBC,GAAG,4DAA4D;QAC3D,IAAIC;QACJ,SAASC;YACLD,QAAQE,IAAAA,4BAAa;QACzB;QACAD;QAEAE,OAAOH,KAAK,CAAC,EAAE,EAAEI,SAAS,CAAC;IAC/B;AACJ", "names": [ "describe", "it", diff --git a/crates/swc/tests/fixture/jest/issue-7506/output/index.ts b/crates/swc/tests/fixture/jest/issue-7506/output/index.ts index 57ce131ac195..9684ea8f6345 100644 --- a/crates/swc/tests/fixture/jest/issue-7506/output/index.ts +++ b/crates/swc/tests/fixture/jest/issue-7506/output/index.ts @@ -1,3 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc/tests/fixture/jest/issue-7506/output/util.map b/crates/swc/tests/fixture/jest/issue-7506/output/util.map index 461c4e4a2ee0..741eb2e4f9db 100644 --- a/crates/swc/tests/fixture/jest/issue-7506/output/util.map +++ b/crates/swc/tests/fixture/jest/issue-7506/output/util.map @@ -1,5 +1,5 @@ { - "mappings": ";;;;+BAGgBA;;;eAAAA;;;AAAT,SAASA;IACZ,MAAMC,WAAW,IAAIC,QAAQC,KAAK;IAElC,OAAOF,SAASG,KAAK,CAAC;AAC1B", + "mappings": "AAAA,4DAA4D;AAC5D,kCAAkC;;;;;+BAElBA;;;eAAAA;;;AAAT,SAASA;IACZ,MAAMC,WAAW,IAAIC,QAAQC,KAAK;IAElC,OAAOF,SAASG,KAAK,CAAC;AAC1B", "names": [ "getStackTrace", "rawStack", diff --git a/crates/swc/tests/fixture/jest/issue-7506/output/util.ts b/crates/swc/tests/fixture/jest/issue-7506/output/util.ts index 75f12cabd1fd..958573b76ef7 100644 --- a/crates/swc/tests/fixture/jest/issue-7506/output/util.ts +++ b/crates/swc/tests/fixture/jest/issue-7506/output/util.ts @@ -1,3 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/async/index.d.ts b/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/async/index.d.ts index 6164176d4f22..957cf93822d1 100644 --- a/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/async/index.d.ts +++ b/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/async/index.d.ts @@ -1,4 +1,19 @@ /** + * Generate secure URL-friendly unique ID. The non-blocking version. + * + * By default, the ID will have 21 symbols to have a collision probability + * similar to UUID v4. + * + * ```js + * import { nanoid } from 'nanoid/async' + * nanoid().then(id => { + * model.id = id + * }) + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A promise with a random string. + */ /** * Generate an array of random bytes collected from hardware noise. * * ```js diff --git a/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/index.d.ts b/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/index.d.ts index 7d4587ed1d96..313a66cef825 100644 --- a/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/index.d.ts +++ b/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/index.d.ts @@ -1,4 +1,17 @@ /** + * Generate secure URL-friendly unique ID. + * + * By default, the ID will have 21 symbols to have a collision probability + * similar to UUID v4. + * + * ```js + * import { nanoid } from 'nanoid' + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A random string. + */ /** * URL safe symbols. * * ```js diff --git a/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/non-secure/index.d.ts b/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/non-secure/index.d.ts index 524dd7fd1a4b..604cc919fad5 100644 --- a/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/non-secure/index.d.ts +++ b/crates/swc/tests/fixture/jsc-paths/vercel-site/1/output/node_modules/.pnpm/nanoid@4.0.2/node_modules/nanoid/non-secure/index.d.ts @@ -1,4 +1,15 @@ /** + * Generate URL-friendly unique ID. This method uses the non-secure + * predictable random generator with bigger collision probability. + * + * ```js + * import { nanoid } from 'nanoid/non-secure' + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A random string. + */ /** * Generate a unique ID based on a custom alphabet. * This method uses the non-secure predictable random generator * with bigger collision probability. diff --git a/crates/swc/tests/fixture/sourcemap/009/output/index.js b/crates/swc/tests/fixture/sourcemap/009/output/index.js index 30dab98b7706..3cb7dc48ca88 100644 --- a/crates/swc/tests/fixture/sourcemap/009/output/index.js +++ b/crates/swc/tests/fixture/sourcemap/009/output/index.js @@ -1,7 +1,7 @@ -"use strict"; /** * This is a * long * license * header - */ console.log(new Error().stack); + */ "use strict"; +console.log(new Error().stack); diff --git a/crates/swc/tests/fixture/sourcemap/009/output/index.map b/crates/swc/tests/fixture/sourcemap/009/output/index.map index b342c3ef8a8b..31ae517bcd4b 100644 --- a/crates/swc/tests/fixture/sourcemap/009/output/index.map +++ b/crates/swc/tests/fixture/sourcemap/009/output/index.map @@ -1,5 +1,5 @@ { - "mappings": ";AAAA;;;;;CAKC,GACDA,QAAQC,GAAG,CAAC,IAAIC,QAAQC,KAAK", + "mappings": "AAAA;;;;;CAKC;AACDA,QAAQC,GAAG,CAAC,IAAIC,QAAQC,KAAK", "names": [ "console", "log", diff --git a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.1.normal.js b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.1.normal.js index 76e71e76a766..3dff942d2367 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.1.normal.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.1.normal.js @@ -1,6 +1,6 @@ //// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // all expected to be errors +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var clodule1 = function clodule1() { "use strict"; _class_call_check(this, clodule1); diff --git a/crates/swc/tests/tsc-references/ES5For-ofTypeCheck10.1.normal.js b/crates/swc/tests/tsc-references/ES5For-ofTypeCheck10.1.normal.js index 27bf233db511..4616dd3dbe41 100644 --- a/crates/swc/tests/tsc-references/ES5For-ofTypeCheck10.1.normal.js +++ b/crates/swc/tests/tsc-references/ES5For-ofTypeCheck10.1.normal.js @@ -1,6 +1,6 @@ //// [ES5For-ofTypeCheck10.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // In ES3/5, you cannot for...of over an arbitrary iterable. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var StringIterator = /*#__PURE__*/ function() { "use strict"; function StringIterator() { diff --git a/crates/swc/tests/tsc-references/accessorsAreNotContextuallyTyped.1.normal.js b/crates/swc/tests/tsc-references/accessorsAreNotContextuallyTyped.1.normal.js index 20cb19222cad..e82ba23bb21c 100644 --- a/crates/swc/tests/tsc-references/accessorsAreNotContextuallyTyped.1.normal.js +++ b/crates/swc/tests/tsc-references/accessorsAreNotContextuallyTyped.1.normal.js @@ -1,7 +1,7 @@ //// [accessorsAreNotContextuallyTyped.ts] +// accessors are not contextually typed import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; -// accessors are not contextually typed var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/accessorsOverrideProperty9.1.normal.js b/crates/swc/tests/tsc-references/accessorsOverrideProperty9.1.normal.js index 599376e4d0d8..ec780f129760 100644 --- a/crates/swc/tests/tsc-references/accessorsOverrideProperty9.1.normal.js +++ b/crates/swc/tests/tsc-references/accessorsOverrideProperty9.1.normal.js @@ -1,4 +1,6 @@ //// [accessorsOverrideProperty9.ts] +// #41347, based on microsoft/rushstack +// Mixin utilities // Base class class ApiItem { get members() { diff --git a/crates/swc/tests/tsc-references/ambientDeclarations.1.normal.js b/crates/swc/tests/tsc-references/ambientDeclarations.1.normal.js index 27067142cfab..a5ee7ff03c86 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarations.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientDeclarations.1.normal.js @@ -1,4 +1,5 @@ //// [ambientDeclarations.ts] +// Ambient variable without type annotation var x = E3.B; // Ambient module members are always exported with or without export keyword var p = M1.x; diff --git a/crates/swc/tests/tsc-references/annotatedThisPropertyInitializerDoesntNarrow.1.normal.js b/crates/swc/tests/tsc-references/annotatedThisPropertyInitializerDoesntNarrow.1.normal.js index 379c63e1351c..db4fcbff2f0b 100644 --- a/crates/swc/tests/tsc-references/annotatedThisPropertyInitializerDoesntNarrow.1.normal.js +++ b/crates/swc/tests/tsc-references/annotatedThisPropertyInitializerDoesntNarrow.1.normal.js @@ -1,7 +1,7 @@ //// [Compilation.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // from webpack/lib/Compilation.js and filed at #26427 -/** @param {{ [s: string]: number }} map */ function mappy(map) {} +/** @param {{ [s: string]: number }} map */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +function mappy(map) {} export var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/anyAsGenericFunctionCall.1.normal.js b/crates/swc/tests/tsc-references/anyAsGenericFunctionCall.1.normal.js index 075e994897fa..ba9636a8e9f7 100644 --- a/crates/swc/tests/tsc-references/anyAsGenericFunctionCall.1.normal.js +++ b/crates/swc/tests/tsc-references/anyAsGenericFunctionCall.1.normal.js @@ -1,7 +1,7 @@ //// [anyAsGenericFunctionCall.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // any is considered an untyped function call // can be called except with type arguments which is an error +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var x; var a = x(); var b = x('hello'); diff --git a/crates/swc/tests/tsc-references/anyAssignabilityInInheritance.1.normal.js b/crates/swc/tests/tsc-references/anyAssignabilityInInheritance.1.normal.js index f9fcd2f7c607..474ca025ad1f 100644 --- a/crates/swc/tests/tsc-references/anyAssignabilityInInheritance.1.normal.js +++ b/crates/swc/tests/tsc-references/anyAssignabilityInInheritance.1.normal.js @@ -1,4 +1,5 @@ //// [anyAssignabilityInInheritance.ts] +// any is not a subtype of any other types, errors expected on all the below derived classes unless otherwise noted import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var a; var r3 = foo2(a); // any, not a subtype of number so it skips that overload, is a subtype of itself so it picks second (if truly ambiguous it would pick first overload) diff --git a/crates/swc/tests/tsc-references/anyAssignableToEveryType2.1.normal.js b/crates/swc/tests/tsc-references/anyAssignableToEveryType2.1.normal.js index 46a4e21ee663..ba7dac5d9430 100644 --- a/crates/swc/tests/tsc-references/anyAssignableToEveryType2.1.normal.js +++ b/crates/swc/tests/tsc-references/anyAssignableToEveryType2.1.normal.js @@ -1,4 +1,5 @@ //// [anyAssignableToEveryType2.ts] +// any is not a subtype of any other types, but is assignable, all the below should work import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = function A() { "use strict"; diff --git a/crates/swc/tests/tsc-references/apparentTypeSubtyping.1.normal.js b/crates/swc/tests/tsc-references/apparentTypeSubtyping.1.normal.js index 0f08095d6cbb..8d0be91033b8 100644 --- a/crates/swc/tests/tsc-references/apparentTypeSubtyping.1.normal.js +++ b/crates/swc/tests/tsc-references/apparentTypeSubtyping.1.normal.js @@ -1,9 +1,9 @@ //// [apparentTypeSubtyping.ts] +// subtype checks use the apparent type of the target type +// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// subtype checks use the apparent type of the target type -// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/apparentTypeSupertype.1.normal.js b/crates/swc/tests/tsc-references/apparentTypeSupertype.1.normal.js index cb6aeb7aad8f..4c3003a3a66a 100644 --- a/crates/swc/tests/tsc-references/apparentTypeSupertype.1.normal.js +++ b/crates/swc/tests/tsc-references/apparentTypeSupertype.1.normal.js @@ -1,9 +1,9 @@ //// [apparentTypeSupertype.ts] +// subtype checks use the apparent type of the target type +// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// subtype checks use the apparent type of the target type -// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js b/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js index c7a4397bc02e..23e959d5ab76 100644 --- a/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js +++ b/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js @@ -1,7 +1,7 @@ //// [argumentExpressionContextualTyping.ts] +// In a typed function call, argument expressions are contextually typed by their corresponding parameter types. import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; -// In a typed function call, argument expressions are contextually typed by their corresponding parameter types. function foo(param) { var _param_x = _sliced_to_array(param.x, 2), a = _param_x[0], b = _param_x[1], _param_y = param.y, c = _param_y.c, d = _param_y.d, e = _param_y.e; } diff --git a/crates/swc/tests/tsc-references/arrayLiteralExpressionContextualTyping.1.normal.js b/crates/swc/tests/tsc-references/arrayLiteralExpressionContextualTyping.1.normal.js index 6dca975faa26..58f19e1aaa9f 100644 --- a/crates/swc/tests/tsc-references/arrayLiteralExpressionContextualTyping.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayLiteralExpressionContextualTyping.1.normal.js @@ -1,8 +1,8 @@ //// [arrayLiteralExpressionContextualTyping.ts] -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // In a contextually typed array literal expression containing no spread elements, an element expression at index N is contextually typed by // the type of the property with the numeric name N in the contextual type, if any, or otherwise // the numeric index type of the contextual type, if any. +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var array = [ 1, 2, diff --git a/crates/swc/tests/tsc-references/arrayLiterals.1.normal.js b/crates/swc/tests/tsc-references/arrayLiterals.1.normal.js index b5e3229d6469..435a69c6649a 100644 --- a/crates/swc/tests/tsc-references/arrayLiterals.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayLiterals.1.normal.js @@ -1,8 +1,8 @@ //// [arrayLiterals.ts] +// Empty array literal with no contextual type has type Undefined[] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// Empty array literal with no contextual type has type Undefined[] var arr1 = [ [], [ diff --git a/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js b/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js index 9800682348b9..cc274866b8ea 100644 --- a/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js @@ -1,5 +1,4 @@ //// [arrayLiterals2ES5.ts] -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // ElementList: ( Modified ) // Elisionopt AssignmentExpression // Elisionopt SpreadElement @@ -7,6 +6,7 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // ElementList, Elisionopt SpreadElement // SpreadElement: // ... AssignmentExpression +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var a0 = [ , , diff --git a/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js b/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js index 322792c9005a..46dcf37ce8b7 100644 --- a/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js @@ -1,5 +1,4 @@ //// [arrayLiterals3.ts] -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // Each element expression in a non-empty array literal is processed as follows: // - If the array literal contains no spread elements, and if the array literal is contextually typed (section 4.19) // by a type T and T has a property with the numeric name N, where N is the index of the element expression in the array literal, @@ -7,6 +6,7 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is contextually typed by a tuple-like type, // the resulting type is a tuple type constructed from the types of the element expressions. +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var a0 = []; // Error var a1 = [ "string", diff --git a/crates/swc/tests/tsc-references/arrayOfFunctionTypes3.1.normal.js b/crates/swc/tests/tsc-references/arrayOfFunctionTypes3.1.normal.js index d83366f7be8f..bd95d4cb1124 100644 --- a/crates/swc/tests/tsc-references/arrayOfFunctionTypes3.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayOfFunctionTypes3.1.normal.js @@ -1,6 +1,6 @@ //// [arrayOfFunctionTypes3.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // valid uses of arrays of function types +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var x = [ function() { return 1; diff --git a/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js b/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js index 9abe498a7d0e..7b13a05a1074 100644 --- a/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js +++ b/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js @@ -1,8 +1,8 @@ //// [arrowFunctionExpressions.ts] +// ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_array } from "@swc/helpers/_/_to_array"; -// ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } var a = function(p) { return p.length; }; diff --git a/crates/swc/tests/tsc-references/assignAnyToEveryType.1.normal.js b/crates/swc/tests/tsc-references/assignAnyToEveryType.1.normal.js index 508a2c602791..178e77952c81 100644 --- a/crates/swc/tests/tsc-references/assignAnyToEveryType.1.normal.js +++ b/crates/swc/tests/tsc-references/assignAnyToEveryType.1.normal.js @@ -1,6 +1,6 @@ //// [assignAnyToEveryType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // all of these are valid +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var x; var a = x; var b = x; diff --git a/crates/swc/tests/tsc-references/assignEveryTypeToAny.1.normal.js b/crates/swc/tests/tsc-references/assignEveryTypeToAny.1.normal.js index 0a42561125c1..42285ee10d6e 100644 --- a/crates/swc/tests/tsc-references/assignEveryTypeToAny.1.normal.js +++ b/crates/swc/tests/tsc-references/assignEveryTypeToAny.1.normal.js @@ -1,6 +1,6 @@ //// [assignEveryTypeToAny.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // all of these are valid +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var x; x = 1; var a = 2; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures.1.normal.js index 122b4fda5915..3d32b5a93eb3 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithCallSignatures.ts] +// void returning call signatures can be assigned a non-void returning call signature that otherwise matches var t; var a; t = a; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures2.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures2.1.normal.js index 890fe2a75871..c914454a3aea 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures2.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithCallSignatures2.ts] +// void returning call signatures can be assigned a non-void returning call signature that otherwise matches var t; var a; t = a; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures3.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures3.1.normal.js index 1cb62ee7f02c..81f9358f4318 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures3.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures3.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithCallSignatures3.ts] +// these are all permitted with the current rules, since we do not do contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// these are all permitted with the current rules, since we do not do contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.1.normal.js index 3e188b0ced7b..818ac1def40a 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithCallSignatures4.ts] +// These are mostly permitted with the current loose rules. All ok unless otherwise noted. import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// These are mostly permitted with the current loose rules. All ok unless otherwise noted. (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures5.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures5.1.normal.js index 98f78ad4a72a..072b7e28c8e9 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures5.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures5.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithCallSignatures5.ts] +// checking assignment compat for function types. No errors in this file import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking assignment compat for function types. No errors in this file var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures6.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures6.1.normal.js index 44598e4edec2..92513cdd1c91 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures6.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures6.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithCallSignatures6.ts] +// checking assignment compatibility relations for function types. All valid import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking assignment compatibility relations for function types. All valid var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignaturesWithOptionalParameters.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignaturesWithOptionalParameters.1.normal.js index 6647d133242a..ccc2e04aa69b 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignaturesWithOptionalParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignaturesWithOptionalParameters.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithCallSignaturesWithOptionalParameters.ts] +// call signatures in derived types must have the same or fewer optional parameters as the base type var b; var a; a = function() { diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignaturesWithRestParameters.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignaturesWithRestParameters.1.normal.js index 0cd8fc7d6624..55338c2a6e73 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignaturesWithRestParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignaturesWithRestParameters.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithCallSignaturesWithRestParameters.ts] +// call signatures in derived types must have the same or fewer optional parameters as the target for assignment var a; // ok, same number of required params a = function() { return 1; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures.1.normal.js index 8ea69ee0f92e..a19f73a9564e 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithConstructSignatures.ts] +// void returning call signatures can be assigned a non-void returning call signature that otherwise matches var t; var a; t = a; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures2.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures2.1.normal.js index b381f86b78c0..35a9c3cc9037 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures2.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithConstructSignatures2.ts] +// void returning call signatures can be assigned a non-void returning call signature that otherwise matches var t; var a; t = a; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures3.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures3.1.normal.js index f9ecc720e56f..5af3696af16d 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures3.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures3.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithConstructSignatures3.ts] +// checking assignment compatibility relations for function types. All of these are valid. import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking assignment compatibility relations for function types. All of these are valid. var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.1.normal.js index 34d4b1591ae7..1bcd28267fab 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithConstructSignatures4.ts] +// checking assignment compatibility relations for function types. import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking assignment compatibility relations for function types. (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures5.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures5.1.normal.js index 1ebb16dae3a1..4daf91aec96c 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures5.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures5.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithConstructSignatures5.ts] +// checking assignment compat for function types. All valid import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking assignment compat for function types. All valid var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures6.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures6.1.normal.js index bad665cce210..4bb10c58647a 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures6.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures6.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithConstructSignatures6.ts] +// checking assignment compatibility relations for function types. All valid. import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking assignment compatibility relations for function types. All valid. var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignaturesWithOptionalParameters.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignaturesWithOptionalParameters.1.normal.js index 80a4d4fb4213..f9274e6fa811 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignaturesWithOptionalParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignaturesWithOptionalParameters.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithConstructSignaturesWithOptionalParameters.ts] +// call signatures in derived types must have the same or fewer optional parameters as the base type var b; var a; a = b.a; // ok diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures2.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures2.1.normal.js index b479740b0427..396ed8366196 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures2.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithGenericCallSignatures2.ts] +// some complex cases of assignment compat of generic signatures. No contextual signature instantiation var a; var b; // Both errors diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures3.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures3.1.normal.js index 58aae06c481b..8b35270ba842 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures3.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures3.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithGenericCallSignatures3.ts] +// some complex cases of assignment compat of generic signatures that stress contextual signature instantiation var g; var h; g = h; // ok diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures4.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures4.1.normal.js index 9f08dea55973..c7296f2073c7 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures4.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignatures4.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithGenericCallSignatures4.ts] +// some complex cases of assignment compat of generic signatures. var x; var y; // These both do not make sense as we would eventually be comparing I2 to I2>, and they are self referencing anyway diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.1.normal.js index 42ed94122d81..d0ef4ab29c57 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.1.normal.js @@ -1,6 +1,6 @@ //// [assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // call signatures in derived types must have the same or fewer optional parameters as the target for assignment +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(ClassTypeParam) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer.1.normal.js index 9b13850310b7..802f5f0e921c 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithNumericIndexer.ts] +// Derived type indexer must be subtype of base type indexer import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer2.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer2.1.normal.js index 1cc8131338e2..16ae938c2c29 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer2.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer2.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithNumericIndexer2.ts] +// Derived type indexer must be subtype of base type indexer var a; var b; a = b; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer3.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer3.1.normal.js index 5541208de6b3..3e0ca9e7e91a 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer3.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer3.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithNumericIndexer3.ts] +// Derived type indexer must be subtype of base type indexer import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.1.normal.js index 8a3584627742..6ea58b9dbd0d 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.1.normal.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembers.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(SimpleTypes) { var S = function S() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers2.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers2.1.normal.js index e1297e2c6f0c..17a1fb6bb01b 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers2.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers2.1.normal.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembers2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // additional optional properties do not cause errors +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var S = function S() { "use strict"; _class_call_check(this, S); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers3.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers3.1.normal.js index 99853cf1e5ac..9637dd4dabb5 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers3.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers3.1.normal.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembers3.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // additional optional properties do not cause errors +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var S = function S() { "use strict"; _class_call_check(this, S); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.1.normal.js index 5e9c4847051c..f4a24ad7d561 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithObjectMembers4.ts] +// members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M (function(OnlyDerived) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersAccessibility.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersAccessibility.1.normal.js index 19104b0c7739..4dbfd4417f84 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersAccessibility.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersAccessibility.1.normal.js @@ -1,6 +1,6 @@ //// [assignmentCompatWithObjectMembersAccessibility.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TargetIsPublic) { // targets var Base = function Base() { diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersNumericNames.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersNumericNames.1.normal.js index 2a55f7e941c6..5c382e939467 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersNumericNames.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersNumericNames.1.normal.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembersNumericNames.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // numeric named properties work correctly, no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var S = function S() { "use strict"; _class_call_check(this, S); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.1.normal.js index 6d08d66c40e5..07d6676d8821 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithObjectMembersOptionality.ts] +// Derived member is not optional but base member is, should be ok import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// Derived member is not optional but base member is, should be ok var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.1.normal.js index 3d74c6b95c60..68f57465b0be 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.1.normal.js @@ -1,9 +1,9 @@ //// [assignmentCompatWithObjectMembersOptionality2.ts] +// M is optional and S contains no property with the same name as M +// N is optional and T contains no property with the same name as N import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// M is optional and S contains no property with the same name as M -// N is optional and T contains no property with the same name as N var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.1.normal.js index 08eb8fe2773f..c818ef31e84b 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.1.normal.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembersStringNumericNames.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // string named numeric properties work correctly, errors below unless otherwise noted +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(JustStrings) { var S = function S() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer.1.normal.js index 61bf6a381833..a55641a58fa5 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithStringIndexer.ts] +// index signatures must be compatible in assignments import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer2.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer2.1.normal.js index 672dfb81a987..543e257a7810 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer2.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer2.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithStringIndexer2.ts] +// index signatures must be compatible in assignments var a; var b; a = b; // ok diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer3.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer3.1.normal.js index 84aebf1c5661..b1ea4e691ca1 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer3.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer3.1.normal.js @@ -1,4 +1,5 @@ //// [assignmentCompatWithStringIndexer3.ts] +// Derived type indexer must be subtype of base type indexer import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var a; var b1; diff --git a/crates/swc/tests/tsc-references/assignmentToVoidZero1.1.normal.js b/crates/swc/tests/tsc-references/assignmentToVoidZero1.1.normal.js index 3538c2bb83e8..d7fdf46ddf6c 100644 --- a/crates/swc/tests/tsc-references/assignmentToVoidZero1.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentToVoidZero1.1.normal.js @@ -1,6 +1,6 @@ //// [assignmentToVoidZero1.js] -"use strict"; // #38552 +"use strict"; exports.y = exports.x = void 0; exports.x = 1; exports.y = 2; diff --git a/crates/swc/tests/tsc-references/assignments.1.normal.js b/crates/swc/tests/tsc-references/assignments.1.normal.js index 59a591fc0543..8dfefb0c6613 100644 --- a/crates/swc/tests/tsc-references/assignments.1.normal.js +++ b/crates/swc/tests/tsc-references/assignments.1.normal.js @@ -1,4 +1,12 @@ //// [assignments.ts] +// In this file: +// Assign to a module +// Assign to a class +// Assign to an enum +// Assign to a function +// Assign to a variable +// Assign to a parameter +// Assign to an interface import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; M = null; // Error var C = function C() { diff --git a/crates/swc/tests/tsc-references/asyncArrowFunction11_es5.1.normal.js b/crates/swc/tests/tsc-references/asyncArrowFunction11_es5.1.normal.js index 3c007e0a4dcf..b7328a6d7d19 100644 --- a/crates/swc/tests/tsc-references/asyncArrowFunction11_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncArrowFunction11_es5.1.normal.js @@ -1,9 +1,9 @@ //// [asyncArrowFunction11_es5.ts] +// https://github.com/Microsoft/TypeScript/issues/24722 import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _define_property } from "@swc/helpers/_/_define_property"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; -// https://github.com/Microsoft/TypeScript/issues/24722 var A = function A() { "use strict"; var _this = this; diff --git a/crates/swc/tests/tsc-references/asyncAwaitNestedClasses_es5.1.normal.js b/crates/swc/tests/tsc-references/asyncAwaitNestedClasses_es5.1.normal.js index 8cc4faf3443f..fa269ba6db74 100644 --- a/crates/swc/tests/tsc-references/asyncAwaitNestedClasses_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncAwaitNestedClasses_es5.1.normal.js @@ -1,9 +1,9 @@ //// [asyncAwaitNestedClasses_es5.ts] +// https://github.com/Microsoft/TypeScript/issues/20744 import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; var _B; -// https://github.com/Microsoft/TypeScript/issues/20744 var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/asyncFunctionDeclaration16_es5.1.normal.js b/crates/swc/tests/tsc-references/asyncFunctionDeclaration16_es5.1.normal.js index 579b558b7b13..1caddcf5fc8b 100644 --- a/crates/swc/tests/tsc-references/asyncFunctionDeclaration16_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncFunctionDeclaration16_es5.1.normal.js @@ -1,8 +1,6 @@ //// [asyncFunctionDeclaration16_es5.ts] //// [/types.d.ts] //// [/a.js] -import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; -import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; /** * @callback T1 * @param {string} str @@ -18,7 +16,9 @@ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; */ /** * @param {string} str * @returns {string} - */ var f1 = function(str) { + */ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; +import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; +var f1 = function(str) { return _async_to_generator(function() { return _ts_generator(this, function(_state) { return [ diff --git a/crates/swc/tests/tsc-references/asyncFunctionDeclarationParameterEvaluation(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/asyncFunctionDeclarationParameterEvaluation(target=es2015).1.normal.js index a61a03ecb0eb..1094eac39552 100644 --- a/crates/swc/tests/tsc-references/asyncFunctionDeclarationParameterEvaluation(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/asyncFunctionDeclarationParameterEvaluation(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [asyncFunctionDeclarationParameterEvaluation.ts] -import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; // https://github.com/microsoft/TypeScript/issues/40410 +import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; function f1(_0) { return _async_to_generator(function*(x, y = z) {}).apply(this, arguments); } diff --git a/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2015).1.normal.js index 1a731ebb18bb..ea18e718ddd3 100644 --- a/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2015).1.normal.js @@ -1,8 +1,8 @@ //// [asyncGeneratorParameterEvaluation.ts] +// https://github.com/microsoft/TypeScript/issues/40410 import { _ as _extends } from "@swc/helpers/_/_extends"; import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; -// https://github.com/microsoft/TypeScript/issues/40410 function f1(_0) { return _wrap_async_generator(function*(x, y = z) {}).apply(this, arguments); } diff --git a/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2017).1.normal.js b/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2017).1.normal.js index 400b6e47da9a..5db8f9728b30 100644 --- a/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2017).1.normal.js +++ b/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2017).1.normal.js @@ -1,7 +1,7 @@ //// [asyncGeneratorParameterEvaluation.ts] +// https://github.com/microsoft/TypeScript/issues/40410 import { _ as _extends } from "@swc/helpers/_/_extends"; import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; -// https://github.com/microsoft/TypeScript/issues/40410 async function* f1(x, y = z) {} async function* f2({ [z]: x }) {} class Sub extends Super { diff --git a/crates/swc/tests/tsc-references/asyncWithVarShadowing_es6.1.normal.js b/crates/swc/tests/tsc-references/asyncWithVarShadowing_es6.1.normal.js index 9b110ac4e905..6938a4d03ee2 100644 --- a/crates/swc/tests/tsc-references/asyncWithVarShadowing_es6.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncWithVarShadowing_es6.1.normal.js @@ -1,4 +1,5 @@ //// [asyncWithVarShadowing_es6.ts] +// https://github.com/Microsoft/TypeScript/issues/20461 import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _extends } from "@swc/helpers/_/_extends"; import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; diff --git a/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions.1.normal.js b/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions.1.normal.js index d00f02f3828b..5f595fde11d0 100644 --- a/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions.1.normal.js +++ b/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions.1.normal.js @@ -1,9 +1,9 @@ //// [bestCommonTypeOfConditionalExpressions.ts] +// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) +// no errors expected here import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) -// no errors expected here var a; var b; var Base = function Base() { diff --git a/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions2.1.normal.js b/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions2.1.normal.js index 51c3c9a9896e..455d25d58b4b 100644 --- a/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions2.1.normal.js +++ b/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions2.1.normal.js @@ -1,9 +1,9 @@ //// [bestCommonTypeOfConditionalExpressions2.ts] +// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) +// these are errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) -// these are errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.1.normal.js index 4d46d8735663..d7496e69e54a 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.1.normal.js @@ -1,6 +1,6 @@ //// [bitwiseNotOperatorWithBooleanType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // ~ operator on boolean type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.1.normal.js index f262af5cf921..2dc31f8304c8 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [bitwiseNotOperatorWithNumberType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // ~ operator on number type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.1.normal.js index deda49a39d8a..8a65ae1eb446 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.1.normal.js @@ -1,6 +1,6 @@ //// [bitwiseNotOperatorWithStringType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // ~ operator on string type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/bivariantInferences.1.normal.js b/crates/swc/tests/tsc-references/bivariantInferences.1.normal.js index dc41689c348b..7b514081ce78 100644 --- a/crates/swc/tests/tsc-references/bivariantInferences.1.normal.js +++ b/crates/swc/tests/tsc-references/bivariantInferences.1.normal.js @@ -1,2 +1,3 @@ //// [bivariantInferences.ts] +// Repro from #27337 var x = a.equalsShallow(b); diff --git a/crates/swc/tests/tsc-references/callChainInference.1.normal.js b/crates/swc/tests/tsc-references/callChainInference.1.normal.js index 8404ba27c0fc..045ee5d9a33e 100644 --- a/crates/swc/tests/tsc-references/callChainInference.1.normal.js +++ b/crates/swc/tests/tsc-references/callChainInference.1.normal.js @@ -1,4 +1,5 @@ //// [callChainInference.ts] +// Repro from #42404 if (value) { value === null || value === void 0 ? void 0 : value.foo("a"); } diff --git a/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js b/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js index 0de3b6902d02..dad66c52a690 100644 --- a/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js @@ -1,10 +1,10 @@ //// [callChainWithSuper.ts] +// GH#34952 import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// GH#34952 var Base = /*#__PURE__*/ function() { "use strict"; function Base() { diff --git a/crates/swc/tests/tsc-references/callGenericFunctionWithIncorrectNumberOfTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/callGenericFunctionWithIncorrectNumberOfTypeArguments.1.normal.js index d0b6b3c63092..50833b7e5b49 100644 --- a/crates/swc/tests/tsc-references/callGenericFunctionWithIncorrectNumberOfTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/callGenericFunctionWithIncorrectNumberOfTypeArguments.1.normal.js @@ -1,7 +1,7 @@ //// [callGenericFunctionWithIncorrectNumberOfTypeArguments.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // type parameter lists must exactly match type argument lists // all of these invocations are errors +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f(x, y) { return null; } diff --git a/crates/swc/tests/tsc-references/callGenericFunctionWithZeroTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/callGenericFunctionWithZeroTypeArguments.1.normal.js index 6e0816909357..4ddb4f4f3755 100644 --- a/crates/swc/tests/tsc-references/callGenericFunctionWithZeroTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/callGenericFunctionWithZeroTypeArguments.1.normal.js @@ -1,6 +1,6 @@ //// [callGenericFunctionWithZeroTypeArguments.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // valid invocations of generic functions with no explicit type arguments provided +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f(x) { return null; } diff --git a/crates/swc/tests/tsc-references/callNonGenericFunctionWithTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/callNonGenericFunctionWithTypeArguments.1.normal.js index b9497ec90651..78bb9d9423a2 100644 --- a/crates/swc/tests/tsc-references/callNonGenericFunctionWithTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/callNonGenericFunctionWithTypeArguments.1.normal.js @@ -1,7 +1,7 @@ //// [callNonGenericFunctionWithTypeArguments.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // it is always illegal to provide type arguments to a non-generic function // all invocations here are illegal +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f(x) { return null; } diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance2.1.normal.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance2.1.normal.js index 4db99f177283..80c807a73d5c 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance2.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance2.1.normal.js @@ -1,8 +1,8 @@ //// [callSignatureAssignabilityInInheritance2.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.1.normal.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.1.normal.js index 919703bd91f4..51497dd3baa9 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.1.normal.js @@ -1,9 +1,9 @@ //// [callSignatureAssignabilityInInheritance3.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation +// error cases import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation -// error cases (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance4.1.normal.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance4.1.normal.js index f9023e783a1d..5292451dc3ea 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance4.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance4.1.normal.js @@ -1,8 +1,8 @@ //// [callSignatureAssignabilityInInheritance4.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance5.1.normal.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance5.1.normal.js index 07eb9918a3e7..7c6bd7a45cea 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance5.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance5.1.normal.js @@ -1,9 +1,9 @@ //// [callSignatureAssignabilityInInheritance5.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation -// same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance6.1.normal.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance6.1.normal.js index 25219398ce31..b11804a0b4f0 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance6.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance6.1.normal.js @@ -1,10 +1,10 @@ //// [callSignatureAssignabilityInInheritance6.ts] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures // all are errors +import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.1.normal.js b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.1.normal.js index 64546d9c2b96..5376140bfba6 100644 --- a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.1.normal.js @@ -1,8 +1,8 @@ //// [callSignatureWithoutReturnTypeAnnotationInference.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _type_of } from "@swc/helpers/_/_type_of"; // Call signatures without a return type should infer one from the function body (if present) // Simple types +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _type_of } from "@swc/helpers/_/_type_of"; function foo(x) { return 1; } diff --git a/crates/swc/tests/tsc-references/callSignaturesThatDifferOnlyByReturnType.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesThatDifferOnlyByReturnType.1.normal.js index 6c8254cb6a2b..a146ec37f19a 100644 --- a/crates/swc/tests/tsc-references/callSignaturesThatDifferOnlyByReturnType.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignaturesThatDifferOnlyByReturnType.1.normal.js @@ -1,3 +1,5 @@ //// [callSignaturesThatDifferOnlyByReturnType.ts] +// Each pair of signatures in these types has a signature that should cause an error. +// Overloads, generic or not, that differ only by return type are an error. var a; var a2; diff --git a/crates/swc/tests/tsc-references/callSignaturesThatDifferOnlyByReturnType2.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesThatDifferOnlyByReturnType2.1.normal.js index 44a189585b73..87022c89a733 100644 --- a/crates/swc/tests/tsc-references/callSignaturesThatDifferOnlyByReturnType2.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignaturesThatDifferOnlyByReturnType2.1.normal.js @@ -1,4 +1,6 @@ //// [callSignaturesThatDifferOnlyByReturnType2.ts] +// Normally it is an error to have multiple overloads which differ only by return type in a single type declaration. +// Here the multiple overloads come from multiple bases. var x; // BUG 822524 var r = x.foo(1); // no error diff --git a/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.1.normal.js index 7b3310b452f2..832c9bc0f2bb 100644 --- a/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.1.normal.js @@ -1,6 +1,6 @@ //// [callSignaturesWithOptionalParameters.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Optional parameters should be valid in all the below casts +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x) {} var f = function foo(x) {}; var f2 = function(x, y) {}; diff --git a/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters2.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters2.1.normal.js index 6f20c1c20d30..f1a5cc98b41b 100644 --- a/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters2.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters2.1.normal.js @@ -1,4 +1,5 @@ //// [callSignaturesWithOptionalParameters2.ts] +// Optional parameters should be valid in all the below casts import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x) {} foo(1); diff --git a/crates/swc/tests/tsc-references/callWithMissingVoid.1.normal.js b/crates/swc/tests/tsc-references/callWithMissingVoid.1.normal.js index 090c8e7c90d4..9397add1380b 100644 --- a/crates/swc/tests/tsc-references/callWithMissingVoid.1.normal.js +++ b/crates/swc/tests/tsc-references/callWithMissingVoid.1.normal.js @@ -1,6 +1,6 @@ //// [callWithMissingVoid.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // From #4260 +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var X = /*#__PURE__*/ function() { "use strict"; function X() { diff --git a/crates/swc/tests/tsc-references/callbackTag2.1.normal.js b/crates/swc/tests/tsc-references/callbackTag2.1.normal.js index ab4dbce184d6..ca3541a504a9 100644 --- a/crates/swc/tests/tsc-references/callbackTag2.1.normal.js +++ b/crates/swc/tests/tsc-references/callbackTag2.1.normal.js @@ -1,10 +1,10 @@ //// [cb.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** @template T * @callback Id * @param {T} t * @returns {T} Maybe just return 120 and cast it? - */ var x = 1; + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var x = 1; /** @type {Id} I actually wanted to write `const "120"` */ var one_twenty = function(s) { return "120"; }; diff --git a/crates/swc/tests/tsc-references/checkJsdocTypeTag7.1.normal.js b/crates/swc/tests/tsc-references/checkJsdocTypeTag7.1.normal.js index 3c50f0bf6845..e8bd3ffab2a5 100644 --- a/crates/swc/tests/tsc-references/checkJsdocTypeTag7.1.normal.js +++ b/crates/swc/tests/tsc-references/checkJsdocTypeTag7.1.normal.js @@ -1,8 +1,8 @@ //// [test.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @typedef {(a: string, b: number) => void} Foo - */ var C = /*#__PURE__*/ function() { + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var C = /*#__PURE__*/ function() { "use strict"; function C() { _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty1.1.normal.js b/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty1.1.normal.js index f8b98095b708..206142a1f5a7 100644 --- a/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty1.1.normal.js +++ b/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty1.1.normal.js @@ -1,7 +1,7 @@ //// [checkJsdocTypeTagOnObjectProperty1.ts] //// [0.js] -import { _ as _define_property } from "@swc/helpers/_/_define_property"; // @ts-check +import { _ as _define_property } from "@swc/helpers/_/_define_property"; var lol = "hello Lol"; var _obj; var obj = (_obj = { diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js b/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js index 99d08ea8cde7..088120f993e2 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js @@ -1,8 +1,8 @@ //// [checkJsxChildrenCanBeTupleType.tsx] +/// import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -/// import React from 'react'; var ResizablePanel = /*#__PURE__*/ function(_React_Component) { "use strict"; diff --git a/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js b/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js index d0574305c599..683071714fe9 100644 --- a/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js +++ b/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js @@ -1,10 +1,10 @@ //// [checkJsxSubtleSkipContextSensitiveBug.tsx] +/// import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; -/// import * as React from "react"; var AsyncLoader = /*#__PURE__*/ function(_React_Component) { "use strict"; diff --git a/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js b/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js index 6ad513f26891..edd79fab1b3d 100644 --- a/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js +++ b/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js @@ -1,8 +1,8 @@ //// [circularImportAlias.ts] +// expected no error import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// expected no error (function(B) { B.a = A; var D = /*#__PURE__*/ function(_B_a_C) { diff --git a/crates/swc/tests/tsc-references/classAbstractInstantiations1.1.normal.js b/crates/swc/tests/tsc-references/classAbstractInstantiations1.1.normal.js index 6a0a94f908fa..8175fac00738 100644 --- a/crates/swc/tests/tsc-references/classAbstractInstantiations1.1.normal.js +++ b/crates/swc/tests/tsc-references/classAbstractInstantiations1.1.normal.js @@ -1,10 +1,10 @@ //// [classAbstractInstantiations1.ts] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; // // Calling new with (non)abstract classes. // +import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction.1.normal.js b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction.1.normal.js index 2ec34f0321ca..c346a75b441a 100644 --- a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction.1.normal.js +++ b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction.1.normal.js @@ -1,13 +1,13 @@ //// [first.js] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; +/** + * @constructor + * @param {number} numberOxen + */ import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -/** - * @constructor - * @param {number} numberOxen - */ function Wagon(numberOxen) { +function Wagon(numberOxen) { this.numberOxen = numberOxen; } /** @param {Wagon[]=} wagons */ Wagon.circle = function(wagons) { @@ -61,12 +61,12 @@ var Drakkhen = /*#__PURE__*/ function(Dragon1) { return Drakkhen; }(Dragon); //// [second.ts] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; /** * @constructor - */ function Dragon(numberEaten) { + */ import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +function Dragon(numberEaten) { this.numberEaten = numberEaten; } // error! @@ -102,13 +102,13 @@ var c = new Conestoga(true); c.drunkOO; c.numberOxen; //// [generic.js] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; /** * @template T * @param {T} flavour - */ function Soup(flavour) { + */ import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +function Soup(flavour) { this.flavour = flavour; } /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ var Chowder = /*#__PURE__*/ function(Soup) { diff --git a/crates/swc/tests/tsc-references/classStaticBlock27.1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock27.1.normal.js index 477e2a9633b7..17eb39c2a251 100644 --- a/crates/swc/tests/tsc-references/classStaticBlock27.1.normal.js +++ b/crates/swc/tests/tsc-references/classStaticBlock27.1.normal.js @@ -1,7 +1,7 @@ //// [classStaticBlock27.ts] +// https://github.com/microsoft/TypeScript/issues/44872 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var _Foo; -// https://github.com/microsoft/TypeScript/issues/44872 void (_Foo = function Foo() { "use strict"; _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface.1.normal.js b/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface.1.normal.js index c38ac867a09f..9109e476d6eb 100644 --- a/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface.1.normal.js @@ -1,7 +1,7 @@ //// [classWithOnlyPublicMembersEquivalentToInterface.ts] +// no errors expected import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; -// no errors expected var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface2.1.normal.js b/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface2.1.normal.js index 4bbb38ee1ab5..a5c7ad3da958 100644 --- a/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface2.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface2.1.normal.js @@ -1,7 +1,7 @@ //// [classWithOnlyPublicMembersEquivalentToInterface2.ts] +// no errors expected import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; -// no errors expected var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/classWithOptionalParameter.1.normal.js b/crates/swc/tests/tsc-references/classWithOptionalParameter.1.normal.js index f5dbbe8f50f1..66f559d08d70 100644 --- a/crates/swc/tests/tsc-references/classWithOptionalParameter.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithOptionalParameter.1.normal.js @@ -1,6 +1,6 @@ //// [classWithOptionalParameter.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // classes do not permit optional parameters, these are errors +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/classWithPrivateProperty.1.normal.js b/crates/swc/tests/tsc-references/classWithPrivateProperty.1.normal.js index 3acfcbbb50d6..35b2546fc9a6 100644 --- a/crates/swc/tests/tsc-references/classWithPrivateProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithPrivateProperty.1.normal.js @@ -1,6 +1,6 @@ //// [classWithPrivateProperty.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // accessing any private outside the class is an error +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/classWithProtectedProperty.1.normal.js b/crates/swc/tests/tsc-references/classWithProtectedProperty.1.normal.js index 8a16c3da644a..040a000fb89d 100644 --- a/crates/swc/tests/tsc-references/classWithProtectedProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithProtectedProperty.1.normal.js @@ -1,8 +1,8 @@ //// [classWithProtectedProperty.ts] +// accessing any protected outside the class is an error import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// accessing any protected outside the class is an error var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es2015).1.normal.js index d3bc37d35df4..ecdc949e6bae 100644 --- a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [classWithStaticFieldInParameterBindingPattern.2.ts] -var _class, _class1; // https://github.com/microsoft/TypeScript/issues/36295 +var _class, _class1; class C { } (({ [(_class = class extends C { diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es5).1.normal.js index dbc14cecc69a..1d32423d4838 100644 --- a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es5).1.normal.js @@ -1,9 +1,9 @@ //// [classWithStaticFieldInParameterBindingPattern.2.ts] +// https://github.com/microsoft/TypeScript/issues/36295 import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; var _class, _class1; -// https://github.com/microsoft/TypeScript/issues/36295 var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es2015).1.normal.js index 0c59eaf0390b..8082aa8df171 100644 --- a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [classWithStaticFieldInParameterInitializer.2.ts] -var _class, _class1; // https://github.com/microsoft/TypeScript/issues/36295 +var _class, _class1; class C { } ((b = (_class = class extends C { diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es5).1.normal.js index 567d6fcbd59b..205ee2361d88 100644 --- a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es5).1.normal.js @@ -1,9 +1,9 @@ //// [classWithStaticFieldInParameterInitializer.2.ts] +// https://github.com/microsoft/TypeScript/issues/36295 import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; var _class, _class1; -// https://github.com/microsoft/TypeScript/issues/36295 var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/comparisonOperatorWithNumberOperand.1.normal.js b/crates/swc/tests/tsc-references/comparisonOperatorWithNumberOperand.1.normal.js index 1168ea7cbf04..e439ace35bad 100644 --- a/crates/swc/tests/tsc-references/comparisonOperatorWithNumberOperand.1.normal.js +++ b/crates/swc/tests/tsc-references/comparisonOperatorWithNumberOperand.1.normal.js @@ -1,2 +1,3 @@ //// [comparisonOperatorWithNumberOperand.ts] +// repro #52036 t1 >= 0; // error diff --git a/crates/swc/tests/tsc-references/conditionalOperatorConditoinIsStringType.1.normal.js b/crates/swc/tests/tsc-references/conditionalOperatorConditoinIsStringType.1.normal.js index 7440d1ea6bb0..0a6c35083dc9 100644 --- a/crates/swc/tests/tsc-references/conditionalOperatorConditoinIsStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/conditionalOperatorConditoinIsStringType.1.normal.js @@ -1,6 +1,6 @@ //// [conditionalOperatorConditoinIsStringType.ts] -import { _ as _type_of } from "@swc/helpers/_/_type_of"; //Cond ? Expr1 : Expr2, Cond is of string type, Expr1 and Expr2 have the same type +import { _ as _type_of } from "@swc/helpers/_/_type_of"; var condString; var exprAny1; var exprBoolean1; diff --git a/crates/swc/tests/tsc-references/conditionalOperatorWithIdenticalBCT.1.normal.js b/crates/swc/tests/tsc-references/conditionalOperatorWithIdenticalBCT.1.normal.js index 48b7d20ed035..2e17ed9d15a9 100644 --- a/crates/swc/tests/tsc-references/conditionalOperatorWithIdenticalBCT.1.normal.js +++ b/crates/swc/tests/tsc-references/conditionalOperatorWithIdenticalBCT.1.normal.js @@ -1,8 +1,8 @@ //// [conditionalOperatorWithIdenticalBCT.ts] +//Cond ? Expr1 : Expr2, Expr1 and Expr2 have identical best common type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -//Cond ? Expr1 : Expr2, Expr1 and Expr2 have identical best common type var X = function X() { "use strict"; _class_call_check(this, X); diff --git a/crates/swc/tests/tsc-references/conditionalOperatorWithoutIdenticalBCT.1.normal.js b/crates/swc/tests/tsc-references/conditionalOperatorWithoutIdenticalBCT.1.normal.js index 499c01c70544..ca17cf55996e 100644 --- a/crates/swc/tests/tsc-references/conditionalOperatorWithoutIdenticalBCT.1.normal.js +++ b/crates/swc/tests/tsc-references/conditionalOperatorWithoutIdenticalBCT.1.normal.js @@ -1,8 +1,8 @@ //// [conditionalOperatorWithoutIdenticalBCT.ts] +//Cond ? Expr1 : Expr2, Expr1 and Expr2 have no identical best common type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -//Cond ? Expr1 : Expr2, Expr1 and Expr2 have no identical best common type var X = function X() { "use strict"; _class_call_check(this, X); diff --git a/crates/swc/tests/tsc-references/constEnumNoObjectPrototypePropertyAccess.1.normal.js b/crates/swc/tests/tsc-references/constEnumNoObjectPrototypePropertyAccess.1.normal.js index b15c1677d73e..74af9bc68610 100644 --- a/crates/swc/tests/tsc-references/constEnumNoObjectPrototypePropertyAccess.1.normal.js +++ b/crates/swc/tests/tsc-references/constEnumNoObjectPrototypePropertyAccess.1.normal.js @@ -1,4 +1,5 @@ //// [constEnumNoObjectPrototypePropertyAccess.ts] +// https://github.com/microsoft/TypeScript/issues/55421 console.log(Bebra.constructor); console.log(Bebra.hasOwnProperty); console.log(Bebra.isPrototypeOf); diff --git a/crates/swc/tests/tsc-references/constEnumPropertyAccess1.1.normal.js b/crates/swc/tests/tsc-references/constEnumPropertyAccess1.1.normal.js index 5a9f45faefb5..25e21ce4deb2 100644 --- a/crates/swc/tests/tsc-references/constEnumPropertyAccess1.1.normal.js +++ b/crates/swc/tests/tsc-references/constEnumPropertyAccess1.1.normal.js @@ -1,4 +1,7 @@ //// [constEnumPropertyAccess1.ts] +// constant enum declarations are completely erased in the emitted JavaScript code. +// it is an error to reference a constant enum object in any other context +// than a property access that selects one of the enum's members var o = { 1: true }; diff --git a/crates/swc/tests/tsc-references/constEnumPropertyAccess2.1.normal.js b/crates/swc/tests/tsc-references/constEnumPropertyAccess2.1.normal.js index dfd4920cb55b..fa167d11292c 100644 --- a/crates/swc/tests/tsc-references/constEnumPropertyAccess2.1.normal.js +++ b/crates/swc/tests/tsc-references/constEnumPropertyAccess2.1.normal.js @@ -1,4 +1,7 @@ //// [constEnumPropertyAccess2.ts] +// constant enum declarations are completely erased in the emitted JavaScript code. +// it is an error to reference a constant enum object in any other context +// than a property access that selects one of the enum's members // Error from referring constant enum in any other context than a property access var z = G; var z1 = G[1]; diff --git a/crates/swc/tests/tsc-references/constraintSatisfactionWithAny.1.normal.js b/crates/swc/tests/tsc-references/constraintSatisfactionWithAny.1.normal.js index 932c31b34a75..3378722e59e8 100644 --- a/crates/swc/tests/tsc-references/constraintSatisfactionWithAny.1.normal.js +++ b/crates/swc/tests/tsc-references/constraintSatisfactionWithAny.1.normal.js @@ -1,6 +1,6 @@ //// [constraintSatisfactionWithAny.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // any is not a valid type argument unless there is no constraint, or the constraint is any +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x) { return null; } diff --git a/crates/swc/tests/tsc-references/constraintSatisfactionWithAny2.1.normal.js b/crates/swc/tests/tsc-references/constraintSatisfactionWithAny2.1.normal.js index 8c8fdc7cdb3b..90e5c2b881ae 100644 --- a/crates/swc/tests/tsc-references/constraintSatisfactionWithAny2.1.normal.js +++ b/crates/swc/tests/tsc-references/constraintSatisfactionWithAny2.1.normal.js @@ -1,4 +1,6 @@ //// [constraintSatisfactionWithAny2.ts] +// errors expected for type parameter cannot be referenced in the constraints of the same list +// any is not a valid type argument unless there is no constraint, or the constraint is any var a; foo(a); foo(a); diff --git a/crates/swc/tests/tsc-references/constraintSatisfactionWithEmptyObject.1.normal.js b/crates/swc/tests/tsc-references/constraintSatisfactionWithEmptyObject.1.normal.js index 6fcda10af1f3..6a75695f09fe 100644 --- a/crates/swc/tests/tsc-references/constraintSatisfactionWithEmptyObject.1.normal.js +++ b/crates/swc/tests/tsc-references/constraintSatisfactionWithEmptyObject.1.normal.js @@ -1,7 +1,7 @@ //// [constraintSatisfactionWithEmptyObject.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // valid uses of a basic object constraint, no errors expected // Object constraint +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x) {} var r = foo({}); var a = {}; diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance.1.normal.js index 90904024534e..41193cb6e649 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance.1.normal.js @@ -1,4 +1,5 @@ //// [constructSignatureAssignabilityInInheritance.ts] +// Checking basic subtype relations with construct signatures (function(MemberWithConstructSignature) { var b; var r = new b.a(1); diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance2.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance2.1.normal.js index 2a70a7388ad9..820cbc6b4bf9 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance2.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance2.1.normal.js @@ -1,8 +1,8 @@ //// [constructSignatureAssignabilityInInheritance2.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.1.normal.js index f2ea1db07a96..ad2c6aae5d64 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.1.normal.js @@ -1,9 +1,9 @@ //// [constructSignatureAssignabilityInInheritance3.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation +// error cases import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation -// error cases (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance4.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance4.1.normal.js index f8ff22967183..213e2b882cd4 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance4.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance4.1.normal.js @@ -1,8 +1,8 @@ //// [constructSignatureAssignabilityInInheritance4.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance5.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance5.1.normal.js index 73ee163f27b2..10eb75d08443 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance5.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance5.1.normal.js @@ -1,9 +1,9 @@ //// [constructSignatureAssignabilityInInheritance5.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation -// same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance6.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance6.1.normal.js index b2f35634832f..0390cea6609e 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance6.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance6.1.normal.js @@ -1,10 +1,10 @@ //// [constructSignatureAssignabilityInInheritance6.ts] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors +import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/constructSignaturesWithIdenticalOverloads.1.normal.js b/crates/swc/tests/tsc-references/constructSignaturesWithIdenticalOverloads.1.normal.js index cc5192c5c023..9e31c81b18a9 100644 --- a/crates/swc/tests/tsc-references/constructSignaturesWithIdenticalOverloads.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignaturesWithIdenticalOverloads.1.normal.js @@ -1,6 +1,6 @@ //// [constructSignaturesWithIdenticalOverloads.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Duplicate overloads of construct signatures should generate errors +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/constructSignaturesWithOverloads.1.normal.js b/crates/swc/tests/tsc-references/constructSignaturesWithOverloads.1.normal.js index bb07fd0d3297..5f12c8abceb0 100644 --- a/crates/swc/tests/tsc-references/constructSignaturesWithOverloads.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignaturesWithOverloads.1.normal.js @@ -1,6 +1,6 @@ //// [constructSignaturesWithOverloads.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // No errors expected for basic overloads of construct signatures +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/constructSignaturesWithOverloads2.1.normal.js b/crates/swc/tests/tsc-references/constructSignaturesWithOverloads2.1.normal.js index d683cbf25662..ab7cf4a9177b 100644 --- a/crates/swc/tests/tsc-references/constructSignaturesWithOverloads2.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignaturesWithOverloads2.1.normal.js @@ -1,7 +1,7 @@ //// [constructSignaturesWithOverloads2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // No errors expected for basic overloads of construct signatures with merged declarations // clodules +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.1.normal.js b/crates/swc/tests/tsc-references/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.1.normal.js index 25616e1852a8..f5836c143293 100644 --- a/crates/swc/tests/tsc-references/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.1.normal.js @@ -1,6 +1,6 @@ //// [constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Error for construct signature overloads to differ only by return type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/constructorFunctionTypeIsAssignableToBaseType2.1.normal.js b/crates/swc/tests/tsc-references/constructorFunctionTypeIsAssignableToBaseType2.1.normal.js index a1444de52073..665d37e93647 100644 --- a/crates/swc/tests/tsc-references/constructorFunctionTypeIsAssignableToBaseType2.1.normal.js +++ b/crates/swc/tests/tsc-references/constructorFunctionTypeIsAssignableToBaseType2.1.normal.js @@ -1,9 +1,9 @@ //// [constructorFunctionTypeIsAssignableToBaseType2.ts] +// the constructor function itself does not need to be a subtype of the base type constructor function import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _possible_constructor_return } from "@swc/helpers/_/_possible_constructor_return"; -// the constructor function itself does not need to be a subtype of the base type constructor function var Base = function Base(x) { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/constructorFunctionsStrict.1.normal.js b/crates/swc/tests/tsc-references/constructorFunctionsStrict.1.normal.js index bb3c5ec00901..5b30cf206d4f 100644 --- a/crates/swc/tests/tsc-references/constructorFunctionsStrict.1.normal.js +++ b/crates/swc/tests/tsc-references/constructorFunctionsStrict.1.normal.js @@ -1,6 +1,6 @@ //// [a.js] -import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; -/** @param {number} x */ function C(x) { +/** @param {number} x */ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; +function C(x) { this.x = x; } C.prototype.m = function() { diff --git a/crates/swc/tests/tsc-references/constructorParameterShadowsOuterScopes.1.normal.js b/crates/swc/tests/tsc-references/constructorParameterShadowsOuterScopes.1.normal.js index 146e0c0d6e65..7b3a66c0bf51 100644 --- a/crates/swc/tests/tsc-references/constructorParameterShadowsOuterScopes.1.normal.js +++ b/crates/swc/tests/tsc-references/constructorParameterShadowsOuterScopes.1.normal.js @@ -1,9 +1,9 @@ //// [constructorParameterShadowsOuterScopes.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Initializer expressions for instance member variables are evaluated in the scope of the class constructor // body but are not permitted to reference parameters or local variables of the constructor. // This effectively means that entities from outer scopes by the same name as a constructor parameter or // local variable are inaccessible in initializer expressions for instance member variables +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var x = 1; var C = function C(x1) { "use strict"; diff --git a/crates/swc/tests/tsc-references/constructorWithAssignableReturnExpression.1.normal.js b/crates/swc/tests/tsc-references/constructorWithAssignableReturnExpression.1.normal.js index 3eb8220f41f7..e6da795f8f1b 100644 --- a/crates/swc/tests/tsc-references/constructorWithAssignableReturnExpression.1.normal.js +++ b/crates/swc/tests/tsc-references/constructorWithAssignableReturnExpression.1.normal.js @@ -1,6 +1,6 @@ //// [constructorWithAssignableReturnExpression.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // a class constructor may return an expression, it must be assignable to the class instance type to be valid +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/contextualSignatureInstantiation.1.normal.js b/crates/swc/tests/tsc-references/contextualSignatureInstantiation.1.normal.js index 41a5625f0ec3..cc1f4f79a767 100644 --- a/crates/swc/tests/tsc-references/contextualSignatureInstantiation.1.normal.js +++ b/crates/swc/tests/tsc-references/contextualSignatureInstantiation.1.normal.js @@ -1,4 +1,9 @@ //// [contextualSignatureInstantiation.ts] +// TypeScript Spec, section 4.12.2: +// If e is an expression of a function type that contains exactly one generic call signature and no other members, +// and T is a function type with exactly one non - generic call signature and no other members, then any inferences +// made for type parameters referenced by the parameters of T's call signature are fixed, and e's type is changed +// to a function type with e's call signature instantiated in the context of T's call signature (section 3.8.5). var a; var a = bar(1, 1, g); // Should be number var a = baz(1, 1, g); // Should be number diff --git a/crates/swc/tests/tsc-references/contextualTypeWithTuple.1.normal.js b/crates/swc/tests/tsc-references/contextualTypeWithTuple.1.normal.js index 2c68697d7b2c..9ee8fe0ed07b 100644 --- a/crates/swc/tests/tsc-references/contextualTypeWithTuple.1.normal.js +++ b/crates/swc/tests/tsc-references/contextualTypeWithTuple.1.normal.js @@ -1,6 +1,6 @@ //// [contextualTypeWithTuple.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // no error +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var numStrTuple = [ 5, "hello" diff --git a/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeCallSignatures.1.normal.js b/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeCallSignatures.1.normal.js index 28053e41df0f..612f152033ae 100644 --- a/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeCallSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeCallSignatures.1.normal.js @@ -1,4 +1,9 @@ //// [contextualTypeWithUnionTypeCallSignatures.ts] +//When used as a contextual type, a union type U has those members that are present in any of +// its constituent types, with types that are unions of the respective members in the constituent types. +// Let S be the set of types in U that have call signatures. +// If S is not empty and the sets of call signatures of the types in S are identical ignoring return types, +// U has the same set of call signatures, but with return types that are unions of the return types of the respective call signatures from each type in S. // With no call signature | callSignatures var x = function(a) { return a.toString(); diff --git a/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeIndexSignatures.1.normal.js b/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeIndexSignatures.1.normal.js index b773439b7921..19b57567f454 100644 --- a/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeIndexSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeIndexSignatures.1.normal.js @@ -1,4 +1,6 @@ //// [contextualTypeWithUnionTypeIndexSignatures.ts] +//When used as a contextual type, a union type U has those members that are present in any of +// its constituent types, with types that are unions of the respective members in the constituent types. // When an object literal is contextually typed by a type that includes a string index signature, // the resulting type of the object literal includes a string index signature with the union type of // the types of the properties declared in the object literal, or the Undefined type if the object literal diff --git a/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeMembers.1.normal.js b/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeMembers.1.normal.js index 65958d545259..830f636f4b51 100644 --- a/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeMembers.1.normal.js +++ b/crates/swc/tests/tsc-references/contextualTypeWithUnionTypeMembers.1.normal.js @@ -1,4 +1,6 @@ //// [contextualTypeWithUnionTypeMembers.ts] +//When used as a contextual type, a union type U has those members that are present in any of +// its constituent types, with types that are unions of the respective members in the constituent types. // Let S be the set of types in U that has a property P. // If S is not empty, U has a property P of a union type of the types of P from each type in S. var i1; diff --git a/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment.1.normal.js b/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment.1.normal.js index 044fd0e2aa42..88f37990bbec 100644 --- a/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment.1.normal.js +++ b/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment.1.normal.js @@ -1,9 +1,9 @@ //// [test.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** @typedef {{ status: 'done' m(n: number): void }} DoneStatus */ // property assignment +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var ns = {}; /** @type {DoneStatus} */ ns.x = { status: 'done', diff --git a/crates/swc/tests/tsc-references/controlFlowAliasing.1.normal.js b/crates/swc/tests/tsc-references/controlFlowAliasing.1.normal.js index 79ce021bf964..c84fe48859fa 100644 --- a/crates/swc/tests/tsc-references/controlFlowAliasing.1.normal.js +++ b/crates/swc/tests/tsc-references/controlFlowAliasing.1.normal.js @@ -1,6 +1,6 @@ //// [controlFlowAliasing.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Narrowing by aliased conditional expressions +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f10(x) { var isString = typeof x === "string"; if (isString) { diff --git a/crates/swc/tests/tsc-references/controlFlowAssignmentPatternOrder.1.normal.js b/crates/swc/tests/tsc-references/controlFlowAssignmentPatternOrder.1.normal.js index db4b901b5911..cb5a762079c8 100644 --- a/crates/swc/tests/tsc-references/controlFlowAssignmentPatternOrder.1.normal.js +++ b/crates/swc/tests/tsc-references/controlFlowAssignmentPatternOrder.1.normal.js @@ -1,4 +1,5 @@ //// [controlFlowAssignmentPatternOrder.ts] +// https://github.com/microsoft/TypeScript/pull/41094#issuecomment-716044363 { let a = 0; let b; diff --git a/crates/swc/tests/tsc-references/controlFlowOptionalChain.1.normal.js b/crates/swc/tests/tsc-references/controlFlowOptionalChain.1.normal.js index c6f5d9de611c..10629cbf9c0d 100644 --- a/crates/swc/tests/tsc-references/controlFlowOptionalChain.1.normal.js +++ b/crates/swc/tests/tsc-references/controlFlowOptionalChain.1.normal.js @@ -1,4 +1,5 @@ //// [controlFlowOptionalChain.ts] +// assignments in shortcutting chain import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; var _o4_x, _o4_x1, _o5_x_y_z, _o5_x, _o5_x1, _o5_x2, _o5_x_y_z1, _o5_x3, _arr_i; diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4.1.normal.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4.1.normal.js index d46eef5955c2..4406730a28a0 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4.1.normal.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4.1.normal.js @@ -1,9 +1,9 @@ //// [correctlyMarkAliasAsReferences4.tsx] //// [declaration.d.ts] //// [0.tsx] +/// import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; -/// import * as cx from 'classnames'; import * as React from "react"; let buttonProps; diff --git a/crates/swc/tests/tsc-references/covariantCallbacks.1.normal.js b/crates/swc/tests/tsc-references/covariantCallbacks.1.normal.js index cdad211941ad..7dca0c446054 100644 --- a/crates/swc/tests/tsc-references/covariantCallbacks.1.normal.js +++ b/crates/swc/tests/tsc-references/covariantCallbacks.1.normal.js @@ -1,4 +1,5 @@ //// [covariantCallbacks.ts] +// Test that callback parameters are related covariantly function f1(a, b) { a = b; b = a; // Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.1.normal.js index d2f063e5fcf6..9bc2c4986e12 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.1.normal.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.1.normal.js @@ -1,6 +1,6 @@ //// [decrementOperatorWithAnyOtherType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // -- operator on any type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var ANY; var ANY1; var ANY2 = [ diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.1.normal.js index 1a9ea0a52160..89dcb453ff78 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [decrementOperatorWithNumberType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // -- operator on number type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/derivedClassConstructorWithoutSuperCall.1.normal.js b/crates/swc/tests/tsc-references/derivedClassConstructorWithoutSuperCall.1.normal.js index d28d16fa048e..04124cf84b27 100644 --- a/crates/swc/tests/tsc-references/derivedClassConstructorWithoutSuperCall.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassConstructorWithoutSuperCall.1.normal.js @@ -1,9 +1,9 @@ //// [derivedClassConstructorWithoutSuperCall.ts] +// derived class constructors must contain a super call import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized"; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// derived class constructors must contain a super call var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/derivedClassTransitivity.1.normal.js b/crates/swc/tests/tsc-references/derivedClassTransitivity.1.normal.js index e482c0caa0d2..06a0788abac1 100644 --- a/crates/swc/tests/tsc-references/derivedClassTransitivity.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassTransitivity.1.normal.js @@ -1,8 +1,8 @@ //// [derivedClassTransitivity.ts] +// subclassing is not transitive when you can remove required parameters and add optional parameters import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// subclassing is not transitive when you can remove required parameters and add optional parameters var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/derivedClassTransitivity2.1.normal.js b/crates/swc/tests/tsc-references/derivedClassTransitivity2.1.normal.js index d5f4d54c27f0..06d58ea86f11 100644 --- a/crates/swc/tests/tsc-references/derivedClassTransitivity2.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassTransitivity2.1.normal.js @@ -1,8 +1,8 @@ //// [derivedClassTransitivity2.ts] +// subclassing is not transitive when you can remove required parameters and add optional parameters import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// subclassing is not transitive when you can remove required parameters and add optional parameters var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/derivedClassTransitivity3.1.normal.js b/crates/swc/tests/tsc-references/derivedClassTransitivity3.1.normal.js index 489fc92b0ced..737006bb7b29 100644 --- a/crates/swc/tests/tsc-references/derivedClassTransitivity3.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassTransitivity3.1.normal.js @@ -1,8 +1,8 @@ //// [derivedClassTransitivity3.ts] +// subclassing is not transitive when you can remove required parameters and add optional parameters import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// subclassing is not transitive when you can remove required parameters and add optional parameters var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/derivedClassTransitivity4.1.normal.js b/crates/swc/tests/tsc-references/derivedClassTransitivity4.1.normal.js index 146b5b077e01..91015d8f7751 100644 --- a/crates/swc/tests/tsc-references/derivedClassTransitivity4.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassTransitivity4.1.normal.js @@ -1,8 +1,8 @@ //// [derivedClassTransitivity4.ts] +// subclassing is not transitive when you can remove required parameters and add optional parameters on protected members import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// subclassing is not transitive when you can remove required parameters and add optional parameters on protected members var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/derivedClassWithoutExplicitConstructor3.1.normal.js b/crates/swc/tests/tsc-references/derivedClassWithoutExplicitConstructor3.1.normal.js index fd6f4e8b43cb..4ba3169cb726 100644 --- a/crates/swc/tests/tsc-references/derivedClassWithoutExplicitConstructor3.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassWithoutExplicitConstructor3.1.normal.js @@ -1,8 +1,8 @@ //// [derivedClassWithoutExplicitConstructor3.ts] +// automatic constructors with a class hieararchy of depth > 2 import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// automatic constructors with a class hieararchy of depth > 2 var Base = function Base(x) { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js index 7da484ac29f0..a39c2cc368a2 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js @@ -1,7 +1,4 @@ //// [destructuringArrayBindingPatternAndAssignment1ES5.ts] -import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; -import { _ as _to_array } from "@swc/helpers/_/_to_array"; -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; /* AssignmentPattern: * ObjectAssignmentPattern * ArrayAssignmentPattern @@ -21,6 +18,9 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // An expression of type S is considered assignable to an assignment target V if one of the following is true // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, // S is the type Any, or +import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; +import { _ as _to_array } from "@swc/helpers/_/_to_array"; +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var _undefined = _sliced_to_array(undefined, 2), a0 = _undefined[0], a1 = _undefined[1]; var _undefined1 = _sliced_to_array(undefined, 2), tmp = _undefined1[0], a2 = tmp === void 0 ? false : tmp, tmp1 = _undefined1[1], a3 = tmp1 === void 0 ? 1 : tmp1; // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js index 5bde4093dcd2..1db628053533 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js @@ -1,7 +1,4 @@ //// [destructuringArrayBindingPatternAndAssignment1ES5iterable.ts] -import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; -import { _ as _to_array } from "@swc/helpers/_/_to_array"; -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; /* AssignmentPattern: * ObjectAssignmentPattern * ArrayAssignmentPattern @@ -21,6 +18,9 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // An expression of type S is considered assignable to an assignment target V if one of the following is true // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, // S is the type Any, or +import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; +import { _ as _to_array } from "@swc/helpers/_/_to_array"; +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var _undefined = _sliced_to_array(undefined, 2), a0 = _undefined[0], a1 = _undefined[1]; var _undefined1 = _sliced_to_array(undefined, 2), tmp = _undefined1[0], a2 = tmp === void 0 ? false : tmp, tmp1 = _undefined1[1], a3 = tmp1 === void 0 ? 1 : tmp1; // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js index 8a1f95404ee1..824e5a8c710f 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js @@ -1,8 +1,8 @@ //// [destructuringArrayBindingPatternAndAssignment2.ts] -import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, // S is the type Any, or +import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var _ref // Error = [], _ref_ = _sliced_to_array(_ref[0], 1), a0 = _ref_[0], _ref_1 = _sliced_to_array(_ref[1], 1), _ref__ = _sliced_to_array(_ref_1[0], 1), a1 = _ref__[0]; var _undefined // Error diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment4.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment4.1.normal.js index 87f5961d6933..fc3b33ff057b 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment4.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment4.1.normal.js @@ -1,3 +1,4 @@ //// [destructuringArrayBindingPatternAndAssignment4.ts] +// #35497 import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; var _data = _sliced_to_array(data, 1), value = _data[0]; // Error diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment5SiblingInitializer.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment5SiblingInitializer.1.normal.js index b9607eb1755a..8351bf4e3639 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment5SiblingInitializer.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment5SiblingInitializer.1.normal.js @@ -1,6 +1,6 @@ //// [destructuringArrayBindingPatternAndAssignment5SiblingInitializer.ts] -import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; // To be inferred as `number` +import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; function f1() { var _ref = [ 1 diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js index 2d0aa1ad5eff..5ff9c35c35f1 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js @@ -1,9 +1,9 @@ //// [destructuringEvaluationOrder.ts] +// https://github.com/microsoft/TypeScript/issues/39205 import { _ as _extends } from "@swc/helpers/_/_extends"; import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; import { _ as _to_property_key } from "@swc/helpers/_/_to_property_key"; -// https://github.com/microsoft/TypeScript/issues/39205 let trace = []; let order = (n)=>trace.push(n); // order(0) should evaluate before order(1) because the first element is undefined diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js index 3efaaf4f32dd..888e86ee4b00 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js @@ -1,10 +1,10 @@ //// [destructuringEvaluationOrder.ts] +// https://github.com/microsoft/TypeScript/issues/39205 import { _ as _extends } from "@swc/helpers/_/_extends"; import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_property_key } from "@swc/helpers/_/_to_property_key"; -// https://github.com/microsoft/TypeScript/issues/39205 var trace = []; var order = function(n) { return trace.push(n); diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5.1.normal.js index af400e707263..9a1d3df98bc1 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5.1.normal.js @@ -1,4 +1,8 @@ //// [destructuringParameterDeclaration3ES5.ts] +// If the parameter is a rest parameter, the parameter type is any[] +// A type annotation for a rest parameter must denote an array type. +// RestParameter: +// ... Identifier TypeAnnotation(opt) function a1(...x) {} function a2(...a) {} function a3(...a) {} diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.1.normal.js index ab8e0843ff84..3a2e18f2b27e 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.1.normal.js @@ -1,4 +1,8 @@ //// [destructuringParameterDeclaration3ES5iterable.ts] +// If the parameter is a rest parameter, the parameter type is any[] +// A type annotation for a rest parameter must denote an array type. +// RestParameter: +// ... Identifier TypeAnnotation(opt) import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_array } from "@swc/helpers/_/_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES6.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES6.1.normal.js index a11155b9a857..a9efe13fcfea 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES6.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES6.1.normal.js @@ -1,4 +1,8 @@ //// [destructuringParameterDeclaration3ES6.ts] +// If the parameter is a rest parameter, the parameter type is any[] +// A type annotation for a rest parameter must denote an array type. +// RestParameter: +// ... Identifier TypeAnnotation(opt) function a1(...x) {} function a2(...a) {} function a3(...a) {} diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration5.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration5.1.normal.js index 6102b8d7b6f4..7254975d30e7 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration5.1.normal.js @@ -1,4 +1,5 @@ //// [destructuringParameterDeclaration5.ts] +// Parameter Declaration with generic import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js index f43de7496101..f42f0532cffd 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js @@ -1,8 +1,8 @@ //// [destructuringVariableDeclaration1ES5.ts] -import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // The type T associated with a destructuring variable declaration is determined as follows: // If the declaration includes a type annotation, T is that type. +import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var _ref = { a1: 10, a2: "world" diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js index 529505721758..02cc5b2d4d28 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js @@ -1,8 +1,8 @@ //// [destructuringVariableDeclaration1ES5iterable.ts] -import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // The type T associated with a destructuring variable declaration is determined as follows: // If the declaration includes a type annotation, T is that type. +import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var _ref = { a1: 10, a2: "world" diff --git a/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js b/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js index 33ff197d3121..3e82477eb478 100644 --- a/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js @@ -1,6 +1,6 @@ //// [destructuringWithLiteralInitializers.ts] -import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; // (arg: { x: any, y: any }) => void +import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; function f1(param) { var x = param.x, y = param.y; } diff --git a/crates/swc/tests/tsc-references/directDependenceBetweenTypeAliases.1.normal.js b/crates/swc/tests/tsc-references/directDependenceBetweenTypeAliases.1.normal.js index c5decd1e9a78..748ef9be3791 100644 --- a/crates/swc/tests/tsc-references/directDependenceBetweenTypeAliases.1.normal.js +++ b/crates/swc/tests/tsc-references/directDependenceBetweenTypeAliases.1.normal.js @@ -1,4 +1,6 @@ //// [directDependenceBetweenTypeAliases.ts] +// It is an error for the type specified in a type alias to depend on that type alias +// A type alias directly depends on the type it aliases. import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; diff --git a/crates/swc/tests/tsc-references/discriminatedUnionInference.1.normal.js b/crates/swc/tests/tsc-references/discriminatedUnionInference.1.normal.js index fb3d1f268572..2a683c85940b 100644 --- a/crates/swc/tests/tsc-references/discriminatedUnionInference.1.normal.js +++ b/crates/swc/tests/tsc-references/discriminatedUnionInference.1.normal.js @@ -1,4 +1,5 @@ //// [discriminatedUnionInference.ts] +// Repro from #28862 var x1 = foo({ kind: 'a', data: 42 diff --git a/crates/swc/tests/tsc-references/discriminatedUnionTypes3.1.normal.js b/crates/swc/tests/tsc-references/discriminatedUnionTypes3.1.normal.js index d1d6d712aa90..96b88d19ceb9 100644 --- a/crates/swc/tests/tsc-references/discriminatedUnionTypes3.1.normal.js +++ b/crates/swc/tests/tsc-references/discriminatedUnionTypes3.1.normal.js @@ -1,4 +1,5 @@ //// [discriminatedUnionTypes3.ts] +// Repro from #44435 var example = {}; if (example.err === undefined) { example.property; // true diff --git a/crates/swc/tests/tsc-references/duplicateNumericIndexers.1.normal.js b/crates/swc/tests/tsc-references/duplicateNumericIndexers.1.normal.js index ff1dc30af29c..cef2dfe0592a 100644 --- a/crates/swc/tests/tsc-references/duplicateNumericIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/duplicateNumericIndexers.1.normal.js @@ -1,4 +1,5 @@ //// [duplicateNumericIndexers.ts] +// it is an error to have duplicate index signatures of the same kind in a type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; diff --git a/crates/swc/tests/tsc-references/duplicateStringIndexers.1.normal.js b/crates/swc/tests/tsc-references/duplicateStringIndexers.1.normal.js index 28839a407b75..14df11193195 100644 --- a/crates/swc/tests/tsc-references/duplicateStringIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/duplicateStringIndexers.1.normal.js @@ -1,6 +1,6 @@ //// [duplicateStringIndexers.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // it is an error to have duplicate index signatures of the same kind in a type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(test) { var C = function C() { "use strict"; diff --git a/crates/swc/tests/tsc-references/emitter.forAwait(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/emitter.forAwait(target=es2015).1.normal.js index 20ab754bf31e..05287885cb3a 100644 --- a/crates/swc/tests/tsc-references/emitter.forAwait(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.forAwait(target=es2015).1.normal.js @@ -121,9 +121,9 @@ function f4() { })(); } //// [file5.ts] +// https://github.com/Microsoft/TypeScript/issues/21363 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; -// https://github.com/Microsoft/TypeScript/issues/21363 function f5() { return _async_to_generator(function*() { let y; @@ -153,10 +153,10 @@ function f5() { })(); } //// [file6.ts] +// https://github.com/Microsoft/TypeScript/issues/21363 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator"; import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; -// https://github.com/Microsoft/TypeScript/issues/21363 function f6() { return _wrap_async_generator(function*() { let y; @@ -186,10 +186,10 @@ function f6() { })(); } //// [file7.ts] +// https://github.com/microsoft/TypeScript/issues/36166 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator"; import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; -// https://github.com/microsoft/TypeScript/issues/36166 function f7() { return _wrap_async_generator(function*() { let y; diff --git a/crates/swc/tests/tsc-references/emitter.forAwait(target=es5).1.normal.js b/crates/swc/tests/tsc-references/emitter.forAwait(target=es5).1.normal.js index 97d91e814869..a5b40e73a3d9 100644 --- a/crates/swc/tests/tsc-references/emitter.forAwait(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.forAwait(target=es5).1.normal.js @@ -381,10 +381,10 @@ function f4() { })(); } //// [file5.ts] +// https://github.com/Microsoft/TypeScript/issues/21363 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; -// https://github.com/Microsoft/TypeScript/issues/21363 function f5() { return _async_to_generator(function() { var y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x, err; @@ -478,11 +478,11 @@ function f5() { })(); } //// [file6.ts] +// https://github.com/Microsoft/TypeScript/issues/21363 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator"; import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; -// https://github.com/Microsoft/TypeScript/issues/21363 function f6() { return _wrap_async_generator(function() { var y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x, err; @@ -576,11 +576,11 @@ function f6() { })(); } //// [file7.ts] +// https://github.com/microsoft/TypeScript/issues/36166 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator"; import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; -// https://github.com/microsoft/TypeScript/issues/36166 function f7() { return _wrap_async_generator(function() { var y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x, err; diff --git a/crates/swc/tests/tsc-references/enumAssignability.1.normal.js b/crates/swc/tests/tsc-references/enumAssignability.1.normal.js index 6e08bc22e319..64c760107ab6 100644 --- a/crates/swc/tests/tsc-references/enumAssignability.1.normal.js +++ b/crates/swc/tests/tsc-references/enumAssignability.1.normal.js @@ -1,6 +1,6 @@ //// [enumAssignability.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // enums assignable to number, any, Object, errors unless otherwise noted +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var E = /*#__PURE__*/ function(E) { E[E["A"] = 0] = "A"; return E; diff --git a/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.1.normal.js b/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.1.normal.js index 976e5bcc20f0..812a64607905 100644 --- a/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.1.normal.js +++ b/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.1.normal.js @@ -1,6 +1,6 @@ //// [enumAssignabilityInInheritance.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // enum is only a subtype of number, no types are subtypes of enum, all of these except the first are errors +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var E = /*#__PURE__*/ function(E) { E[E["A"] = 0] = "A"; return E; diff --git a/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.1.normal.js b/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.1.normal.js index 46f5d1a277d3..5465d602de8f 100644 --- a/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.1.normal.js +++ b/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.1.normal.js @@ -1,6 +1,6 @@ //// [enumIsNotASubtypeOfAnythingButNumber.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // enums are only subtypes of number, any and no other types +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var E = /*#__PURE__*/ function(E) { E[E["A"] = 0] = "A"; return E; diff --git a/crates/swc/tests/tsc-references/errorOnFunctionReturnType.1.normal.js b/crates/swc/tests/tsc-references/errorOnFunctionReturnType.1.normal.js index 9fc6aa194330..13ad1552f797 100644 --- a/crates/swc/tests/tsc-references/errorOnFunctionReturnType.1.normal.js +++ b/crates/swc/tests/tsc-references/errorOnFunctionReturnType.1.normal.js @@ -1,10 +1,10 @@ //// [foo.js] -import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; -import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; /** * @callback FunctionReturningPromise * @returns {Promise} - */ /** @type {FunctionReturningPromise} */ function testPromise1() { + */ /** @type {FunctionReturningPromise} */ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; +import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; +function testPromise1() { console.log("Nope"); } /** @type {FunctionReturningPromise} */ function testPromise2() { diff --git a/crates/swc/tests/tsc-references/errorSuperPropertyAccess.1.normal.js b/crates/swc/tests/tsc-references/errorSuperPropertyAccess.1.normal.js index e854895ea0c2..3092573067dc 100644 --- a/crates/swc/tests/tsc-references/errorSuperPropertyAccess.1.normal.js +++ b/crates/swc/tests/tsc-references/errorSuperPropertyAccess.1.normal.js @@ -1,4 +1,7 @@ //// [errorSuperPropertyAccess.ts] +//super property access in constructor of class with no base type +//super property access in instance member function of class with no base type +//super property access in instance member accessor(get and set) of class with no base type import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized"; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; @@ -7,9 +10,6 @@ import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _set } from "@swc/helpers/_/_set"; -//super property access in constructor of class with no base type -//super property access in instance member function of class with no base type -//super property access in instance member accessor(get and set) of class with no base type var NoBase = /*#__PURE__*/ function() { "use strict"; function NoBase() { diff --git a/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault.1.normal.js index 404db8a617b3..375291d8d70b 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault.1.normal.js @@ -1,4 +1,5 @@ //// [main.ts] +// https://github.com/microsoft/TypeScript/issues/39149 "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc/tests/tsc-references/exportCodeGen.1.normal.js b/crates/swc/tests/tsc-references/exportCodeGen.1.normal.js index ce998ccbfe5d..fc5c62da0044 100644 --- a/crates/swc/tests/tsc-references/exportCodeGen.1.normal.js +++ b/crates/swc/tests/tsc-references/exportCodeGen.1.normal.js @@ -1,7 +1,7 @@ //// [exportCodeGen.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // should replace all refs to 'x' in the body, // with fully qualified +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(A) { A.x = 12; function lt12() { diff --git a/crates/swc/tests/tsc-references/exportImportAlias.1.normal.js b/crates/swc/tests/tsc-references/exportImportAlias.1.normal.js index d23a534f25d1..119c80ebbd49 100644 --- a/crates/swc/tests/tsc-references/exportImportAlias.1.normal.js +++ b/crates/swc/tests/tsc-references/exportImportAlias.1.normal.js @@ -1,6 +1,6 @@ //// [exportImportAlias.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // expect no errors here +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(A) { A.x = 'hello world'; var Point = function Point(x, y) { diff --git a/crates/swc/tests/tsc-references/extendsTag1.1.normal.js b/crates/swc/tests/tsc-references/extendsTag1.1.normal.js index 1087dfb9ea1f..715db9d752ad 100644 --- a/crates/swc/tests/tsc-references/extendsTag1.1.normal.js +++ b/crates/swc/tests/tsc-references/extendsTag1.1.normal.js @@ -1,12 +1,12 @@ //// [bug25101.js] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; -import { _ as _wrap_native_super } from "@swc/helpers/_/_wrap_native_super"; /** * @template T * @extends {Set} Should prefer this Set, not the Set in the heritage clause - */ var My = /*#__PURE__*/ function(Set1) { + */ import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _wrap_native_super } from "@swc/helpers/_/_wrap_native_super"; +var My = /*#__PURE__*/ function(Set1) { "use strict"; _inherits(My, Set1); function My() { diff --git a/crates/swc/tests/tsc-references/extendsTag5.1.normal.js b/crates/swc/tests/tsc-references/extendsTag5.1.normal.js index dbf625ea8038..1e4c6efc9558 100644 --- a/crates/swc/tests/tsc-references/extendsTag5.1.normal.js +++ b/crates/swc/tests/tsc-references/extendsTag5.1.normal.js @@ -1,7 +1,4 @@ //// [/a.js] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; /** * @typedef {{ * a: number | string; @@ -9,7 +6,10 @@ import { _ as _inherits } from "@swc/helpers/_/_inherits"; * }} Foo */ /** * @template {Foo} T -*/ var A = function A(a) { +*/ import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +var A = function A(a) { "use strict"; _class_call_check(this, A); return a; diff --git a/crates/swc/tests/tsc-references/functionConstraintSatisfaction.1.normal.js b/crates/swc/tests/tsc-references/functionConstraintSatisfaction.1.normal.js index 1208ef225ab0..b365d4762764 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction.1.normal.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction.1.normal.js @@ -1,6 +1,6 @@ //// [functionConstraintSatisfaction.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // satisfaction of a constraint to Function, no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x) { return x; } diff --git a/crates/swc/tests/tsc-references/functionConstraintSatisfaction2.1.normal.js b/crates/swc/tests/tsc-references/functionConstraintSatisfaction2.1.normal.js index ebd6dc65fb2b..c8512dd36c48 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction2.1.normal.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction2.1.normal.js @@ -1,6 +1,6 @@ //// [functionConstraintSatisfaction2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // satisfaction of a constraint to Function, all of these invocations are errors unless otherwise noted +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x) { return x; } diff --git a/crates/swc/tests/tsc-references/functionConstraintSatisfaction3.1.normal.js b/crates/swc/tests/tsc-references/functionConstraintSatisfaction3.1.normal.js index ab6445f0b880..e05c098623e7 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction3.1.normal.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction3.1.normal.js @@ -1,6 +1,6 @@ //// [functionConstraintSatisfaction3.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // satisfaction of a constraint to Function, no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x) { return x; } diff --git a/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.1.normal.js b/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.1.normal.js index 54aab6c4ecbf..1c905a3555cd 100644 --- a/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.1.normal.js +++ b/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.1.normal.js @@ -1,7 +1,7 @@ //// [functionExpressionContextualTyping1.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // When a function expression with no type parameters and no parameter type annotations // is contextually typed (section 4.19) by a type T and a contextual signature S can be extracted from T +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var E = /*#__PURE__*/ function(E) { E[E["red"] = 0] = "red"; E[E["blue"] = 1] = "blue"; diff --git a/crates/swc/tests/tsc-references/functionExpressionContextualTyping3.1.normal.js b/crates/swc/tests/tsc-references/functionExpressionContextualTyping3.1.normal.js index 08ef6ff8cad9..094b88e23f21 100644 --- a/crates/swc/tests/tsc-references/functionExpressionContextualTyping3.1.normal.js +++ b/crates/swc/tests/tsc-references/functionExpressionContextualTyping3.1.normal.js @@ -1,4 +1,5 @@ //// [functionExpressionContextualTyping3.ts] +// #31114 f(function(a) { return ""; }); diff --git a/crates/swc/tests/tsc-references/functionImplementationErrors.1.normal.js b/crates/swc/tests/tsc-references/functionImplementationErrors.1.normal.js index 900830f6fb35..433693246a50 100644 --- a/crates/swc/tests/tsc-references/functionImplementationErrors.1.normal.js +++ b/crates/swc/tests/tsc-references/functionImplementationErrors.1.normal.js @@ -1,8 +1,8 @@ //// [functionImplementationErrors.ts] +// FunctionExpression with no return type annotation with multiple return statements with unrelated types import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// FunctionExpression with no return type annotation with multiple return statements with unrelated types var f1 = function f1() { return ''; return 3; diff --git a/crates/swc/tests/tsc-references/functionImplementations.1.normal.js b/crates/swc/tests/tsc-references/functionImplementations.1.normal.js index b15726d1d948..822ba8ee8f16 100644 --- a/crates/swc/tests/tsc-references/functionImplementations.1.normal.js +++ b/crates/swc/tests/tsc-references/functionImplementations.1.normal.js @@ -1,8 +1,8 @@ //// [functionImplementations.ts] +// FunctionExpression with no return type annotation and no return statement returns void import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// FunctionExpression with no return type annotation and no return statement returns void var v = function() {}(); // FunctionExpression f with no return type annotation and directly references f in its body returns any var a = function f() { diff --git a/crates/swc/tests/tsc-references/functionLiteralForOverloads2.1.normal.js b/crates/swc/tests/tsc-references/functionLiteralForOverloads2.1.normal.js index 3d71417e44e8..8205887926fc 100644 --- a/crates/swc/tests/tsc-references/functionLiteralForOverloads2.1.normal.js +++ b/crates/swc/tests/tsc-references/functionLiteralForOverloads2.1.normal.js @@ -1,6 +1,6 @@ //// [functionLiteralForOverloads2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // basic uses of function literals with constructor overloads +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/functionParameterObjectRestAndInitializers.1.normal.js b/crates/swc/tests/tsc-references/functionParameterObjectRestAndInitializers.1.normal.js index 2811a1867b77..c45ab010a0f0 100644 --- a/crates/swc/tests/tsc-references/functionParameterObjectRestAndInitializers.1.normal.js +++ b/crates/swc/tests/tsc-references/functionParameterObjectRestAndInitializers.1.normal.js @@ -1,6 +1,6 @@ //// [functionParameterObjectRestAndInitializers.ts] -import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; // https://github.com/microsoft/TypeScript/issues/47079 +import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; function f(_param, b = a) { var { a } = _param, x = _object_without_properties(_param, [ "a" diff --git a/crates/swc/tests/tsc-references/genericCallTypeArgumentInference.1.normal.js b/crates/swc/tests/tsc-references/genericCallTypeArgumentInference.1.normal.js index e8a9f8e1a213..c9659372163e 100644 --- a/crates/swc/tests/tsc-references/genericCallTypeArgumentInference.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallTypeArgumentInference.1.normal.js @@ -1,6 +1,6 @@ //// [genericCallTypeArgumentInference.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Basic type inference with generic calls, no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(t) { return t; } diff --git a/crates/swc/tests/tsc-references/genericCallWithConstraintsTypeArgumentInference.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithConstraintsTypeArgumentInference.1.normal.js index 5a5ba6115f59..47967bb5ae14 100644 --- a/crates/swc/tests/tsc-references/genericCallWithConstraintsTypeArgumentInference.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithConstraintsTypeArgumentInference.1.normal.js @@ -1,8 +1,8 @@ //// [genericCallWithConstraintsTypeArgumentInference.ts] +// Basic type inference with generic calls and constraints, no errors expected import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// Basic type inference with generic calls and constraints, no errors expected var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/genericCallWithFunctionTypedArguments4.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithFunctionTypedArguments4.1.normal.js index ec4f1d79cd9a..5f2c9c277830 100644 --- a/crates/swc/tests/tsc-references/genericCallWithFunctionTypedArguments4.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithFunctionTypedArguments4.1.normal.js @@ -1,6 +1,6 @@ //// [genericCallWithFunctionTypedArguments4.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // No inference is made from function typed arguments which have multiple call signatures +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints.1.normal.js index 0a30d30ab28f..62b280e019b2 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints.1.normal.js @@ -1,7 +1,7 @@ //// [genericCallWithObjectTypeArgsAndConstraints.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Generic call with constraints infering type parameter from object member properties // No errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints2.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints2.1.normal.js index 6b73d627f31d..4c8eb9026f51 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints2.1.normal.js @@ -1,9 +1,9 @@ //// [genericCallWithObjectTypeArgsAndConstraints2.ts] +// Generic call with constraints infering type parameter from object member properties +// No errors expected import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// Generic call with constraints infering type parameter from object member properties -// No errors expected var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.1.normal.js index ec600bea741a..60b7457924c2 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.1.normal.js @@ -1,8 +1,8 @@ //// [genericCallWithObjectTypeArgsAndConstraints3.ts] +// Generic call with constraints infering type parameter from object member properties import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// Generic call with constraints infering type parameter from object member properties var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints4.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints4.1.normal.js index abfd9d662e3b..5697aa14bf13 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints4.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints4.1.normal.js @@ -1,6 +1,6 @@ //// [genericCallWithObjectTypeArgsAndConstraints4.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Generic call with constraints infering type parameter from object member properties +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints5.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints5.1.normal.js index ecba338f3342..c9cc4f579c2f 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints5.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints5.1.normal.js @@ -1,6 +1,6 @@ //// [genericCallWithObjectTypeArgsAndConstraints5.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Generic call with constraints infering type parameter from object member properties +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.1.normal.js b/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.1.normal.js index c1e4bdb8476f..3a61ab1a47ef 100644 --- a/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.1.normal.js @@ -1,7 +1,7 @@ //// [genericClassWithFunctionTypedMemberArguments.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Generic functions used as arguments for function typed parameters are not used to make inferences from // Using function arguments, no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(ImmediatelyFix) { var C = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.1.normal.js b/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.1.normal.js index 57f400e3c567..dd30ddb257ff 100644 --- a/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.1.normal.js @@ -1,7 +1,7 @@ //// [genericClassWithObjectTypeArgsAndConstraints.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Generic call with constraints infering type parameter from object member properties // No errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/genericRestArity.1.normal.js b/crates/swc/tests/tsc-references/genericRestArity.1.normal.js index c92b508a4d06..a1c1babb3b18 100644 --- a/crates/swc/tests/tsc-references/genericRestArity.1.normal.js +++ b/crates/swc/tests/tsc-references/genericRestArity.1.normal.js @@ -1,4 +1,5 @@ //// [genericRestArity.ts] +// Repro from #25559 call(function(x, y) { return x + y; }); diff --git a/crates/swc/tests/tsc-references/genericRestArityStrict.1.normal.js b/crates/swc/tests/tsc-references/genericRestArityStrict.1.normal.js index 8bae5afdd2a1..e97caae44a95 100644 --- a/crates/swc/tests/tsc-references/genericRestArityStrict.1.normal.js +++ b/crates/swc/tests/tsc-references/genericRestArityStrict.1.normal.js @@ -1,4 +1,5 @@ //// [genericRestArityStrict.ts] +// Repro from #25559 call(function(x, y) { return x + y; }); diff --git a/crates/swc/tests/tsc-references/getSetAccessorContextualTyping.1.normal.js b/crates/swc/tests/tsc-references/getSetAccessorContextualTyping.1.normal.js index b184bf64e3ba..8513f2f55f58 100644 --- a/crates/swc/tests/tsc-references/getSetAccessorContextualTyping.1.normal.js +++ b/crates/swc/tests/tsc-references/getSetAccessorContextualTyping.1.normal.js @@ -1,9 +1,9 @@ //// [getSetAccessorContextualTyping.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _create_class } from "@swc/helpers/_/_create_class"; // In the body of a get accessor with no return type annotation, // if a matching set accessor exists and that set accessor has a parameter type annotation, // return expressions are contextually typed by the type given in the set accessor's parameter type annotation. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _create_class } from "@swc/helpers/_/_create_class"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.1.normal.js b/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.1.normal.js index c368ae04dc39..fe0bc8d10b16 100644 --- a/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.1.normal.js +++ b/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.1.normal.js @@ -1,8 +1,8 @@ //// [heterogeneousArrayLiterals.ts] +// type of an array is the best common type of its elements (plus its contextual type if it exists) import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// type of an array is the best common type of its elements (plus its contextual type if it exists) var a = [ 1, '' diff --git a/crates/swc/tests/tsc-references/identicalCallSignatures.1.normal.js b/crates/swc/tests/tsc-references/identicalCallSignatures.1.normal.js index 6deb200eb7b3..46708f438710 100644 --- a/crates/swc/tests/tsc-references/identicalCallSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/identicalCallSignatures.1.normal.js @@ -1,2 +1,4 @@ //// [identicalCallSignatures.ts] +// Each pair of call signatures in these types have a duplicate signature error. +// Identical call signatures should generate an error. var a; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInAMD2.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInAMD2.1.normal.js index b7e02adc947b..df23af1a5a93 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInAMD2.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInAMD2.1.normal.js @@ -20,6 +20,7 @@ define([ } }); //// [2.ts] +// We use Promise for now as there is no way to specify shape of module object define([ "require", "exports", @@ -29,7 +30,6 @@ define([ Object.defineProperty(exports, "__esModule", { value: true }); - // We use Promise for now as there is no way to specify shape of module object function foo(x) { x.then((value)=>{ let b = new value.B(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS3.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS3.1.normal.js index ba278fe5f076..bba99bb94603 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS3.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS3.1.normal.js @@ -15,12 +15,12 @@ class B { } } //// [2.ts] +// We use Promise for now as there is no way to specify shape of module object "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"); -// We use Promise for now as there is no way to specify shape of module object function foo(x) { x.then((value)=>{ let b = new value.B(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem2.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem2.1.normal.js index 4e3dc15ca906..8187b121a81c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem2.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem2.1.normal.js @@ -15,9 +15,9 @@ System.register([], function(_export, _context) { }; }); //// [2.ts] +// We use Promise for now as there is no way to specify shape of module object System.register([], function(_export, _context) { "use strict"; - // We use Promise for now as there is no way to specify shape of module object function foo(x) { x.then((value)=>{ let b = new value.B(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD2.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD2.1.normal.js index 0b47662fa7dc..b6abf50b8042 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD2.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD2.1.normal.js @@ -23,6 +23,7 @@ } }); //// [2.ts] +// We use Promise for now as there is no way to specify shape of module object (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(exports, require("@swc/helpers/_/_interop_require_wildcard")); else if (typeof define === "function" && define.amd) define([ @@ -35,7 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); - // We use Promise for now as there is no way to specify shape of module object function foo(x) { x.then((value)=>{ let b = new value.B(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD5.1.normal.js index 76ad02ed328e..a25eba1a55a9 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD5.1.normal.js @@ -21,6 +21,7 @@ } }); //// [1.ts] +// https://github.com/microsoft/TypeScript/issues/36780 (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(exports, require("@swc/helpers/_/_async_to_generator"), require("@swc/helpers/_/_interop_require_wildcard")); else if (typeof define === "function" && define.amd) define([ @@ -34,7 +35,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); - // https://github.com/microsoft/TypeScript/issues/36780 function func() { return _async_to_generator._(function*() { const packageName = '.'; diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.1.normal.js index a9ccae443b4f..fcdf63c773cb 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.1.normal.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.1.normal.js @@ -1,6 +1,6 @@ //// [incrementOperatorWithAnyOtherType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // ++ operator on any type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var ANY; var ANY1; var ANY2 = [ diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.1.normal.js index bf567ff18e70..711f576d69f1 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [incrementOperatorWithNumberType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // ++ operator on number type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/independentPropertyVariance.1.normal.js b/crates/swc/tests/tsc-references/independentPropertyVariance.1.normal.js index b516c07d1109..917b50ff613a 100644 --- a/crates/swc/tests/tsc-references/independentPropertyVariance.1.normal.js +++ b/crates/swc/tests/tsc-references/independentPropertyVariance.1.normal.js @@ -1,2 +1,3 @@ //// [independentPropertyVariance.ts] +// Verify that properties can vary independently in comparable relationship x === y; diff --git a/crates/swc/tests/tsc-references/inferTypes2.1.normal.js b/crates/swc/tests/tsc-references/inferTypes2.1.normal.js index f551878b8624..95d821796279 100644 --- a/crates/swc/tests/tsc-references/inferTypes2.1.normal.js +++ b/crates/swc/tests/tsc-references/inferTypes2.1.normal.js @@ -1,4 +1,5 @@ //// [inferTypes2.ts] +// Repros from #22755 export function bar(obj) { return foo(obj); } diff --git a/crates/swc/tests/tsc-references/inferTypesWithExtends1.1.normal.js b/crates/swc/tests/tsc-references/inferTypesWithExtends1.1.normal.js index 33bb2c2b457a..720eebfe002c 100644 --- a/crates/swc/tests/tsc-references/inferTypesWithExtends1.1.normal.js +++ b/crates/swc/tests/tsc-references/inferTypesWithExtends1.1.normal.js @@ -1,4 +1,5 @@ //// [inferTypesWithExtends1.ts] +// infer to tuple element function f1() { return x1; } diff --git a/crates/swc/tests/tsc-references/infiniteExpansionThroughInstantiation.1.normal.js b/crates/swc/tests/tsc-references/infiniteExpansionThroughInstantiation.1.normal.js index c11800006e5e..87b1d8dcf565 100644 --- a/crates/swc/tests/tsc-references/infiniteExpansionThroughInstantiation.1.normal.js +++ b/crates/swc/tests/tsc-references/infiniteExpansionThroughInstantiation.1.normal.js @@ -1,4 +1,5 @@ //// [infiniteExpansionThroughInstantiation.ts] +// instantiating a derived type can cause an infinitely expanding type reference to be generated var list; var ownerList; list = ownerList; diff --git a/crates/swc/tests/tsc-references/initializerReferencingConstructorLocals.1.normal.js b/crates/swc/tests/tsc-references/initializerReferencingConstructorLocals.1.normal.js index c70ffb9167ac..336a125364f4 100644 --- a/crates/swc/tests/tsc-references/initializerReferencingConstructorLocals.1.normal.js +++ b/crates/swc/tests/tsc-references/initializerReferencingConstructorLocals.1.normal.js @@ -1,6 +1,6 @@ //// [initializerReferencingConstructorLocals.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/initializerReferencingConstructorParameters.1.normal.js b/crates/swc/tests/tsc-references/initializerReferencingConstructorParameters.1.normal.js index f10031bdd360..28c5f74e4691 100644 --- a/crates/swc/tests/tsc-references/initializerReferencingConstructorParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/initializerReferencingConstructorParameters.1.normal.js @@ -1,6 +1,6 @@ //// [initializerReferencingConstructorParameters.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C(x1) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes.1.normal.js index e859ea6f0525..697c9599d539 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes.1.normal.js @@ -3,10 +3,10 @@ export { }; //// [renderer2.d.ts] export { }; //// [component.tsx] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +/** @jsx predom */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var _this = this; -/** @jsx predom */ import { predom } from "./renderer2"; +import { predom } from "./renderer2"; export var MySFC = function(props) { return /*#__PURE__*/ predom.apply(void 0, [ "p", @@ -50,9 +50,9 @@ export var tree = /*#__PURE__*/ predom(MySFC, { })); export default /*#__PURE__*/ predom("h", null); //// [index.tsx] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +/** @jsx dom */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; -/** @jsx dom */ import { dom } from "./renderer"; +import { dom } from "./renderer"; import prerendered, { MySFC, MyClass, tree } from "./component"; var elem = prerendered; elem = /*#__PURE__*/ dom("h", null); // Expect assignability error here diff --git a/crates/swc/tests/tsc-references/innerTypeParameterShadowingOuterOne2.1.normal.js b/crates/swc/tests/tsc-references/innerTypeParameterShadowingOuterOne2.1.normal.js index cd13f6360d7d..7c969fe1dd54 100644 --- a/crates/swc/tests/tsc-references/innerTypeParameterShadowingOuterOne2.1.normal.js +++ b/crates/swc/tests/tsc-references/innerTypeParameterShadowingOuterOne2.1.normal.js @@ -1,7 +1,7 @@ //// [innerTypeParameterShadowingOuterOne2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // inner type parameters shadow outer ones of the same name // no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/instantiateGenericClassWithWrongNumberOfTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/instantiateGenericClassWithWrongNumberOfTypeArguments.1.normal.js index 1ad69b182087..97089411db71 100644 --- a/crates/swc/tests/tsc-references/instantiateGenericClassWithWrongNumberOfTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/instantiateGenericClassWithWrongNumberOfTypeArguments.1.normal.js @@ -1,7 +1,7 @@ //// [instantiateGenericClassWithWrongNumberOfTypeArguments.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // it is always an error to provide a type argument list whose count does not match the type parameter list // both of these attempts to construct a type is an error +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/instantiateGenericClassWithZeroTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/instantiateGenericClassWithZeroTypeArguments.1.normal.js index 426c53d010d1..386af28050ba 100644 --- a/crates/swc/tests/tsc-references/instantiateGenericClassWithZeroTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/instantiateGenericClassWithZeroTypeArguments.1.normal.js @@ -1,6 +1,6 @@ //// [instantiateGenericClassWithZeroTypeArguments.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // no errors expected when instantiating a generic type with no type arguments provided +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments.1.normal.js index 761cdd7c5c46..da7bfad969d5 100644 --- a/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments.1.normal.js @@ -1,7 +1,7 @@ //// [instantiateNonGenericTypeWithTypeArguments.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // it is an error to provide type arguments to a non-generic call // all of these are errors +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/instantiatedModule.1.normal.js b/crates/swc/tests/tsc-references/instantiatedModule.1.normal.js index b0d9becf68e2..2aee6961f696 100644 --- a/crates/swc/tests/tsc-references/instantiatedModule.1.normal.js +++ b/crates/swc/tests/tsc-references/instantiatedModule.1.normal.js @@ -1,6 +1,6 @@ //// [instantiatedModule.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // adding the var makes this an instantiated module +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(M) { M.Point = 1; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/intersectionIncludingPropFromGlobalAugmentation.1.normal.js b/crates/swc/tests/tsc-references/intersectionIncludingPropFromGlobalAugmentation.1.normal.js index 5ced1f6e0904..d2a247e33028 100644 --- a/crates/swc/tests/tsc-references/intersectionIncludingPropFromGlobalAugmentation.1.normal.js +++ b/crates/swc/tests/tsc-references/intersectionIncludingPropFromGlobalAugmentation.1.normal.js @@ -1,4 +1,5 @@ //// [intersectionIncludingPropFromGlobalAugmentation.ts] +// repro from https://github.com/microsoft/TypeScript/issues/54345 import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; var target = _object_spread({}, source); var toString = target.toString; diff --git a/crates/swc/tests/tsc-references/intersectionOfUnionOfUnitTypes.1.normal.js b/crates/swc/tests/tsc-references/intersectionOfUnionOfUnitTypes.1.normal.js index d865b0c7c379..7f4494dc79bf 100644 --- a/crates/swc/tests/tsc-references/intersectionOfUnionOfUnitTypes.1.normal.js +++ b/crates/swc/tests/tsc-references/intersectionOfUnionOfUnitTypes.1.normal.js @@ -1,4 +1,5 @@ //// [intersectionOfUnionOfUnitTypes.ts] +// @strict var x0; // 'a' | 'b' | 'c' var x1; // 'b' | 'c' var x2; // 'c' diff --git a/crates/swc/tests/tsc-references/intersectionTypeInference3.1.normal.js b/crates/swc/tests/tsc-references/intersectionTypeInference3.1.normal.js index 10ec4d11dce9..e4f455596a24 100644 --- a/crates/swc/tests/tsc-references/intersectionTypeInference3.1.normal.js +++ b/crates/swc/tests/tsc-references/intersectionTypeInference3.1.normal.js @@ -1,3 +1,4 @@ //// [intersectionTypeInference3.ts] +// Repro from #19682 const c1 = Array.from(a).concat(Array.from(b)); const c2 = from(); diff --git a/crates/swc/tests/tsc-references/intersectionTypeMembers.1.normal.js b/crates/swc/tests/tsc-references/intersectionTypeMembers.1.normal.js index 8935adb448c3..218c470a4afe 100644 --- a/crates/swc/tests/tsc-references/intersectionTypeMembers.1.normal.js +++ b/crates/swc/tests/tsc-references/intersectionTypeMembers.1.normal.js @@ -1,4 +1,6 @@ //// [intersectionTypeMembers.ts] +// An intersection type has those members that are present in any of its constituent types, +// with types that are intersections of the respective members in the constituent types var abc; abc.a = "hello"; abc.b = "hello"; diff --git a/crates/swc/tests/tsc-references/intersectionTypeOverloading.1.normal.js b/crates/swc/tests/tsc-references/intersectionTypeOverloading.1.normal.js index 10009f7ed5db..ac492061acf9 100644 --- a/crates/swc/tests/tsc-references/intersectionTypeOverloading.1.normal.js +++ b/crates/swc/tests/tsc-references/intersectionTypeOverloading.1.normal.js @@ -1,4 +1,6 @@ //// [intersectionTypeOverloading.ts] +// Check that order is preserved in intersection types for purposes of +// overload resolution var fg; var gf; var x = fg("abc"); diff --git a/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects.1.normal.js b/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects.1.normal.js index 4593ab42787d..e246924d8c03 100644 --- a/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects.1.normal.js +++ b/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects.1.normal.js @@ -1,4 +1,6 @@ //// [intersectionsAndEmptyObjects.ts] +// Empty object type literals are removed from intersections types +// that contain other object types "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc/tests/tsc-references/intraExpressionInferences.1.normal.js b/crates/swc/tests/tsc-references/intraExpressionInferences.1.normal.js index 04261a7a75fc..246112eec8e0 100644 --- a/crates/swc/tests/tsc-references/intraExpressionInferences.1.normal.js +++ b/crates/swc/tests/tsc-references/intraExpressionInferences.1.normal.js @@ -1,4 +1,5 @@ //// [intraExpressionInferences.ts] +// Repros from #47599 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; callIt({ diff --git a/crates/swc/tests/tsc-references/intraExpressionInferencesJsx.1.normal.js b/crates/swc/tests/tsc-references/intraExpressionInferencesJsx.1.normal.js index d3711478e92c..0f1df489db4b 100644 --- a/crates/swc/tests/tsc-references/intraExpressionInferencesJsx.1.normal.js +++ b/crates/swc/tests/tsc-references/intraExpressionInferencesJsx.1.normal.js @@ -1,4 +1,6 @@ //// [intraExpressionInferencesJsx.tsx] +/// +// repro from #52798 var Component = function(param) { var animations = param.animations, style = param.style; return /*#__PURE__*/ React.createElement(React.Fragment, null); diff --git a/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.1.normal.js b/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.1.normal.js index 9dc61f7ecd8d..047cc3c2cbaf 100644 --- a/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.1.normal.js +++ b/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.1.normal.js @@ -1,6 +1,6 @@ //// [invalidImportAliasIdentifiers.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // none of these should work, since non are actually modules +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var V = 12; var C = function C() { "use strict"; diff --git a/crates/swc/tests/tsc-references/invalidReturnStatements.1.normal.js b/crates/swc/tests/tsc-references/invalidReturnStatements.1.normal.js index 0e26b36624a1..5e3e49cee3a5 100644 --- a/crates/swc/tests/tsc-references/invalidReturnStatements.1.normal.js +++ b/crates/swc/tests/tsc-references/invalidReturnStatements.1.normal.js @@ -1,8 +1,8 @@ //// [invalidReturnStatements.ts] +// all the following should be error import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// all the following should be error function fn1() {} function fn2() {} function fn3() {} diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization.1.normal.js index 3e854cb1c5a1..1aa0d378e736 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization.1.normal.js @@ -1,11 +1,11 @@ //// [interface.ts] export { }; //// [lib.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @template T * @implements {IEncoder} - */ export var Encoder = /*#__PURE__*/ function() { + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +export var Encoder = /*#__PURE__*/ function() { "use strict"; function Encoder() { _class_call_check(this, Encoder); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassesErr.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsClassesErr.1.normal.js index 545b325e5d82..d5387505a86d 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassesErr.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassesErr.1.normal.js @@ -1,9 +1,9 @@ //// [index.js] +// Pretty much all of this should be an error, (since index signatures and generics are forbidden in js), +// but we should be able to synthesize declarations from the symbols regardless import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// Pretty much all of this should be an error, (since index signatures and generics are forbidden in js), -// but we should be able to synthesize declarations from the symbols regardless export var M = function M() { "use strict"; _class_call_check(this, M); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr.1.normal.js index 27ea5c452957..8a21371f0650 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr.1.normal.js @@ -1,6 +1,6 @@ //// [index1.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // merge type alias and alias (should error, see #32367) +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var Cls = function Cls() { "use strict"; _class_call_check(this, Cls); @@ -11,6 +11,7 @@ export default Cls; /** * @typedef {string | number} default */ //// [index2.js] +// merge type alias and class (error message improvement needed, see #32368) import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment.1.normal.js index a570dfbbe33a..69c50516d810 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment.1.normal.js @@ -15,7 +15,6 @@ module.exports = Timer; } module.exports = Hook; //// [context.js] -import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; /** * Imports * @@ -39,7 +38,8 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; * * @class * @param {Input} input - */ function Context(input) { + */ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; +function Context(input) { if (!_instanceof(this, Context)) { return new Context(input); } diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionJSDoc.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionJSDoc.1.normal.js index abd76872a754..8914f397b005 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionJSDoc.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionJSDoc.1.normal.js @@ -1,10 +1,10 @@ //// [source.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * Foos a bar together using an `a` and a `b` * @param {number} a * @param {string} b - */ export function foo(a, b) {} + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +export function foo(a, b) {} /** * Legacy - DO NOT USE */ export var Aleph = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses.1.normal.js index cf20dc5ebbd8..bc703289228d 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses.1.normal.js @@ -1,9 +1,9 @@ //// [source.js] -import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; /** * @param {number} x * @param {number} y - */ export function Point(x, y) { + */ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; +export function Point(x, y) { if (!_instanceof(this, Point)) { return new Point(x, y); } diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2.1.normal.js index 321a37d4d35e..8ca319848c22 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2.1.normal.js @@ -1,8 +1,8 @@ //// [source.js] -import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; /** * @param {number} len - */ export function Vec(len) { + */ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; +export function Vec(len) { /** * @type {number[]} */ this.storage = new Array(len); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace.1.normal.js index 7108dbca89ad..d19e09349c64 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace.1.normal.js @@ -1,5 +1,9 @@ //// [file.js] -"use strict"; +/** + * @namespace myTypes + * @global + * @type {Object} + */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -9,11 +13,7 @@ Object.defineProperty(exports, "myTypes", { return myTypes; } }); -/** - * @namespace myTypes - * @global - * @type {Object} - */ const myTypes = { +const myTypes = { }; //// [file2.js] "use strict"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs.1.normal.js index c31357a7d62e..3d34e50415d1 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs.1.normal.js @@ -1,10 +1,10 @@ //// [file.js] -"use strict"; /** * @namespace myTypes * @global * @type {Object} - */ const myTypes = { + */ "use strict"; +const myTypes = { }; /** @typedef {string|RegExp|Array} myTypes.typeA */ /** * @typedef myTypes.typeB diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled.1.normal.js index 64c5655e17c7..e9d08cd0b223 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled.1.normal.js @@ -1,23 +1,23 @@ //// [folder/mod1.js] -define([ - "require" -], function(require) { - "use strict"; - /** +/** * @typedef {{x: number}} Item */ /** * @type {Item}; - */ var x = { + */ define([ + "require" +], function(require) { + "use strict"; + var x = { x: 12 }; module.exports = x; }); //// [index.js] -define([ +/** @type {(typeof import("./folder/mod1"))[]} */ define([ "require" ], function(require) { "use strict"; - /** @type {(typeof import("./folder/mod1"))[]} */ var items = [ + var items = [ { x: 12 } diff --git a/crates/swc/tests/tsc-references/jsDeclarationsInterfaces.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsInterfaces.1.normal.js index 6e5ef12dc3e9..9074e11ed22c 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsInterfaces.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsInterfaces.1.normal.js @@ -1,2 +1,4 @@ //// [index.js] +// Pretty much all of this should be an error, (since interfaces are forbidden in js), +// but we should be able to synthesize declarations from the symbols regardless export { }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.1.normal.js index 2f0e831e819e..c98209153411 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.1.normal.js @@ -1,8 +1,8 @@ //// [index.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @module A - */ var A = function A() { + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var A = function A() { "use strict"; _class_call_check(this, A); }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js index b200e01af162..90bda97fc170 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js @@ -1,8 +1,8 @@ //// [lib.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @param {string} a - */ function bar(a) { + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +function bar(a) { return a + a; } var SomeClass = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.1.normal.js index 0706c0563537..a2dd20450e49 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.1.normal.js @@ -20,13 +20,13 @@ export { }; // flag file as module * @returns {T} */ //// [mixed.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType */ /** * @param {number} x * @returns {SomeType} - */ function doTheThing(x) { + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +function doTheThing(x) { return { x: "" + x }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.1.normal.js index 54d65e55b776..54ae7e2cf3fe 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.1.normal.js @@ -1,8 +1,8 @@ //// [conn.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @typedef {string | number} Whatever - */ var Conn = /*#__PURE__*/ function() { + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var Conn = /*#__PURE__*/ function() { "use strict"; function Conn() { _class_call_check(this, Conn); @@ -14,10 +14,10 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; }(); module.exports = Conn; //// [usage.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @typedef {import("./conn")} Conn - */ var Wrap = function Wrap(c) { + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var Wrap = function Wrap(c) { "use strict"; _class_call_check(this, Wrap); this.connItem = c.item; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndLatebound.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndLatebound.1.normal.js index 9a55644108c4..dfe65e3d4001 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndLatebound.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndLatebound.1.normal.js @@ -5,11 +5,11 @@ var LazySet = require("./LazySet"); /** @type {LazySet} */ var stringSet = undefined; stringSet.addAll(stringSet); //// [LazySet.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Comment out this JSDoc, and note that the errors index.js go away. /** * @typedef {Object} SomeObject - */ var LazySet = /*#__PURE__*/ function() { + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var LazySet = /*#__PURE__*/ function() { "use strict"; function LazySet() { _class_call_check(this, LazySet); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren.1.normal.js index a0fad2f36272..3e386f35b7aa 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren.1.normal.js @@ -1,7 +1,7 @@ //// [jsxJsxsCjsTransformChildren.tsx] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -/// var a = /*#__PURE__*/ React.createElement("div", null, "text"); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport.1.normal.js index 6d8caf72453a..fcf1cf1d5766 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport.1.normal.js @@ -1,9 +1,9 @@ //// [jsxJsxsCjsTransformCustomImport.tsx] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -/// var a = /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("p", null), "text", /*#__PURE__*/ React.createElement("div", { className: "foo" })); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma.1.normal.js index 6ab2886f8f4f..a061d0ee193d 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma.1.normal.js @@ -1,11 +1,11 @@ //// [preact.tsx] -"use strict"; +/// +/* @jsxImportSource preact */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _jsxruntime = require("preact/jsx-runtime"); -/// -/* @jsxImportSource preact */ var a = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, { +var a = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, { children: [ /*#__PURE__*/ (0, _jsxruntime.jsx)("p", {}), "text", @@ -15,7 +15,8 @@ var _jsxruntime = require("preact/jsx-runtime"); ] }); //// [react.tsx] -"use strict"; +/// +/* @jsxImportSource react */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp.1.normal.js index c35a6087e816..defbd9dd1cf6 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp.1.normal.js @@ -1,11 +1,11 @@ //// [jsxJsxsCjsTransformKeyProp.tsx] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _object_spread = require("@swc/helpers/_/_object_spread"); var _object_spread_props = require("@swc/helpers/_/_object_spread_props"); -/// var props = { answer: 42 }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport.1.normal.js index aff83ba3c2db..ed92477f6a90 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport.1.normal.js @@ -1,11 +1,11 @@ //// [jsxJsxsCjsTransformKeyPropCustomImport.tsx] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _object_spread = require("@swc/helpers/_/_object_spread"); var _object_spread_props = require("@swc/helpers/_/_object_spread_props"); -/// var props = { answer: 42 }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma.1.normal.js index b2cdf7217e2d..999afa429200 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma.1.normal.js @@ -1,5 +1,6 @@ //// [preact.tsx] -"use strict"; +/// +/* @jsxImportSource preact */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -7,8 +8,7 @@ var _object_spread = require("@swc/helpers/_/_object_spread"); var _object_spread_props = require("@swc/helpers/_/_object_spread_props"); var _jsxruntime = require("preact/jsx-runtime"); var _preact = require("preact"); -/// -/* @jsxImportSource preact */ var props = { +var props = { answer: 42 }; var a = /*#__PURE__*/ (0, _jsxruntime.jsx)("div", _object_spread_props._(_object_spread._({}, props), { @@ -18,7 +18,8 @@ var b = /*#__PURE__*/ (0, _preact.createElement)("div", _object_spread_props._(_ key: "bar" }), "text"); //// [react.tsx] -"use strict"; +/// +/* @jsxImportSource react */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformNestedSelfClosingChild.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformNestedSelfClosingChild.1.normal.js index a9c31806f572..a4d9d693412f 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformNestedSelfClosingChild.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformNestedSelfClosingChild.1.normal.js @@ -1,4 +1,5 @@ //// [jsxJsxsCjsTransformNestedSelfClosingChild.tsx] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames.1.normal.js index 4a1d561c74f1..985cbe32c5f8 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames.1.normal.js @@ -1,7 +1,7 @@ //// [jsxJsxsCjsTransformSubstitutesNames.tsx] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -/// var a = /*#__PURE__*/ React.createElement("div", null); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment.1.normal.js index e8903ec4b876..30ad05fc9741 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment.1.normal.js @@ -1,7 +1,7 @@ //// [jsxJsxsCjsTransformSubstitutesNamesFragment.tsx] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -/// var a = /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("p", null), "text", /*#__PURE__*/ React.createElement("div", null)); diff --git a/crates/swc/tests/tsc-references/keyofInferenceLowerPriorityThanReturn.1.normal.js b/crates/swc/tests/tsc-references/keyofInferenceLowerPriorityThanReturn.1.normal.js index 40a11e8d1ee2..dabd170a1e11 100644 --- a/crates/swc/tests/tsc-references/keyofInferenceLowerPriorityThanReturn.1.normal.js +++ b/crates/swc/tests/tsc-references/keyofInferenceLowerPriorityThanReturn.1.normal.js @@ -1,4 +1,5 @@ //// [keyofInferenceLowerPriorityThanReturn.ts] +// #22736 var bookTable = null; function insertOnConflictDoNothing(_table, _conflictTarget) { throw new Error(); diff --git a/crates/swc/tests/tsc-references/libReferenceDeclarationEmit.1.normal.js b/crates/swc/tests/tsc-references/libReferenceDeclarationEmit.1.normal.js index f4c1b3493c44..25d23d45f6b1 100644 --- a/crates/swc/tests/tsc-references/libReferenceDeclarationEmit.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceDeclarationEmit.1.normal.js @@ -1,9 +1,11 @@ //// [file1.ts] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); //// [file2.ts] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle.1.normal.js b/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle.1.normal.js index de80afc0e73f..d5b8c7c2721a 100644 --- a/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle.1.normal.js @@ -1,4 +1,5 @@ //// [file1.ts] +/// define([ "require", "exports" @@ -9,6 +10,7 @@ define([ }); }); //// [file2.ts] +/// define([ "require", "exports" diff --git a/crates/swc/tests/tsc-references/libReferenceNoLib.1.normal.js b/crates/swc/tests/tsc-references/libReferenceNoLib.1.normal.js index 75946f30da13..f2883d9daca2 100644 --- a/crates/swc/tests/tsc-references/libReferenceNoLib.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceNoLib.1.normal.js @@ -1,8 +1,10 @@ //// [libReferenceNoLib.ts] +// Test that passing noLib disables resolution. "use strict"; //// [fakelib.ts] "use strict"; //// [file1.ts] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc/tests/tsc-references/libReferenceNoLibBundle.1.normal.js b/crates/swc/tests/tsc-references/libReferenceNoLibBundle.1.normal.js index bfaaba0de396..18f607fe3632 100644 --- a/crates/swc/tests/tsc-references/libReferenceNoLibBundle.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceNoLibBundle.1.normal.js @@ -1,4 +1,5 @@ //// [libReferenceNoLibBundle.ts] +// Test that passing noLib disables resolution. define([ "require" ], function(require) { @@ -11,6 +12,7 @@ define([ "use strict"; }); //// [file1.ts] +/// define([ "require", "exports" diff --git a/crates/swc/tests/tsc-references/literalTypeWidening.1.normal.js b/crates/swc/tests/tsc-references/literalTypeWidening.1.normal.js index 16ebeb11d0e2..06323ad5364a 100644 --- a/crates/swc/tests/tsc-references/literalTypeWidening.1.normal.js +++ b/crates/swc/tests/tsc-references/literalTypeWidening.1.normal.js @@ -1,7 +1,7 @@ //// [literalTypeWidening.ts] +// Widening vs. non-widening literal types import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; -// Widening vs. non-widening literal types function f1() { var c1 = "hello"; // Widening type "hello" var v1 = c1; // Type string diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.1.normal.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.1.normal.js index 721103b98e23..aaa9c42d9c10 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.1.normal.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.1.normal.js @@ -1,6 +1,6 @@ //// [logicalNotOperatorWithAnyOtherType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // ! operator on any type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var ANY; var ANY1; var ANY2 = [ diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.1.normal.js index 272878e062ba..4e00b81aef6e 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.1.normal.js @@ -1,6 +1,6 @@ //// [logicalNotOperatorWithBooleanType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // ! operator on boolean type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.1.normal.js index 51a546a237be..1a193ed1a9cc 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [logicalNotOperatorWithNumberType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // ! operator on number type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.1.normal.js index 8f2856cac56e..f990833611da 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.1.normal.js @@ -1,6 +1,6 @@ //// [logicalNotOperatorWithStringType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // ! operator on string type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/mappedTypeAsClauseRelationships.1.normal.js b/crates/swc/tests/tsc-references/mappedTypeAsClauseRelationships.1.normal.js index cf340fa3c7f9..8045b4b7284f 100644 --- a/crates/swc/tests/tsc-references/mappedTypeAsClauseRelationships.1.normal.js +++ b/crates/swc/tests/tsc-references/mappedTypeAsClauseRelationships.1.normal.js @@ -1,4 +1,5 @@ //// [mappedTypeAsClauseRelationships.ts] +// From original issue #45212: function fun(val) { var x = val; // Ok var y = val; // Error diff --git a/crates/swc/tests/tsc-references/mappedTypeAsClauses.1.normal.js b/crates/swc/tests/tsc-references/mappedTypeAsClauses.1.normal.js index bdc80b22d40b..11c8d2d421f1 100644 --- a/crates/swc/tests/tsc-references/mappedTypeAsClauses.1.normal.js +++ b/crates/swc/tests/tsc-references/mappedTypeAsClauses.1.normal.js @@ -1,4 +1,5 @@ //// [mappedTypeAsClauses.ts] +// Mapped type 'as N' clauses var e1 = { foo: "hello" }; diff --git a/crates/swc/tests/tsc-references/mappedTypeInferenceErrors.1.normal.js b/crates/swc/tests/tsc-references/mappedTypeInferenceErrors.1.normal.js index c366a9ca5f15..ea3fadc258cd 100644 --- a/crates/swc/tests/tsc-references/mappedTypeInferenceErrors.1.normal.js +++ b/crates/swc/tests/tsc-references/mappedTypeInferenceErrors.1.normal.js @@ -1,4 +1,5 @@ //// [mappedTypeInferenceErrors.ts] +// Repro from #19316 foo({ props: { x: 10, diff --git a/crates/swc/tests/tsc-references/mappedTypesGenericTuples2.1.normal.js b/crates/swc/tests/tsc-references/mappedTypesGenericTuples2.1.normal.js index 51feafbc93c6..0c068df05270 100644 --- a/crates/swc/tests/tsc-references/mappedTypesGenericTuples2.1.normal.js +++ b/crates/swc/tests/tsc-references/mappedTypesGenericTuples2.1.normal.js @@ -1,4 +1,5 @@ //// [mappedTypesGenericTuples2.ts] +// https://github.com/microsoft/TypeScript/issues/57389 import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; Promise.all([ getT() diff --git a/crates/swc/tests/tsc-references/mergeThreeInterfaces.1.normal.js b/crates/swc/tests/tsc-references/mergeThreeInterfaces.1.normal.js index 55bb07629b43..925b25401a6a 100644 --- a/crates/swc/tests/tsc-references/mergeThreeInterfaces.1.normal.js +++ b/crates/swc/tests/tsc-references/mergeThreeInterfaces.1.normal.js @@ -1,4 +1,6 @@ //// [mergeThreeInterfaces.ts] +// interfaces with the same root module should merge +// basic case var a; var r1 = a.foo; var r2 = a.bar; diff --git a/crates/swc/tests/tsc-references/mergeTwoInterfaces.1.normal.js b/crates/swc/tests/tsc-references/mergeTwoInterfaces.1.normal.js index b7a3309d0834..44312c8764aa 100644 --- a/crates/swc/tests/tsc-references/mergeTwoInterfaces.1.normal.js +++ b/crates/swc/tests/tsc-references/mergeTwoInterfaces.1.normal.js @@ -1,4 +1,6 @@ //// [mergeTwoInterfaces.ts] +// two interfaces with the same root module should merge +// basic case var a; var r1 = a.foo; var r2 = a.bar; diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithIndexers.1.normal.js b/crates/swc/tests/tsc-references/mergedInterfacesWithIndexers.1.normal.js index 16d32d1c72df..d51b5d7f3dc9 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithIndexers.1.normal.js @@ -1,4 +1,5 @@ //// [mergedInterfacesWithIndexers.ts] +// indexers should behave like other members when merging interface declarations var a; var r = a[1]; var r2 = a['1']; diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.1.normal.js b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.1.normal.js index 67efa98137f2..6a4a4e4053c5 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.1.normal.js @@ -1,7 +1,7 @@ //// [mergedInterfacesWithMultipleBases.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // merged interfaces behave as if all extends clauses from each declaration are merged together // no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.1.normal.js b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.1.normal.js index 64b14967d413..7e01dfc25ec2 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.1.normal.js @@ -1,7 +1,7 @@ //// [mergedInterfacesWithMultipleBases2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // merged interfaces behave as if all extends clauses from each declaration are merged together // no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases3.1.normal.js b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases3.1.normal.js index 9b414e8d059b..da25fdc18246 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases3.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases3.1.normal.js @@ -1,7 +1,7 @@ //// [mergedInterfacesWithMultipleBases3.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // merged interfaces behave as if all extends clauses from each declaration are merged together // no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases4.1.normal.js b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases4.1.normal.js index 99b82d170fa4..1348dcc53f4a 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases4.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases4.1.normal.js @@ -1,6 +1,6 @@ //// [mergedInterfacesWithMultipleBases4.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // merged interfaces behave as if all extends clauses from each declaration are merged together +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js b/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js index 775e6bcf636a..a585317c3e6b 100644 --- a/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js +++ b/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js @@ -1,6 +1,6 @@ //// [missingAndExcessProperties.ts] -import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; // Missing properties +import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; function f1() { var _ref = {}, x = _ref.x, y = _ref.y; var _ref1 = {}, _ref_x = _ref1.x, x = _ref_x === void 0 ? 1 : _ref_x, y = _ref1.y; diff --git a/crates/swc/tests/tsc-references/moduleExportAlias3.1.normal.js b/crates/swc/tests/tsc-references/moduleExportAlias3.1.normal.js index fd26fff73916..168523302e95 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias3.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias3.1.normal.js @@ -1,6 +1,6 @@ //// [bug24062.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // #24062 +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/moduleExportAlias4.1.normal.js b/crates/swc/tests/tsc-references/moduleExportAlias4.1.normal.js index dcc8cf9a7e0a..a21799773c78 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias4.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias4.1.normal.js @@ -1,6 +1,6 @@ //// [bug24024.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // #24024 +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var wat = require('./bug24024'); module.exports = function C() { "use strict"; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1.1.normal.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1.1.normal.js index ab455c5e7251..6c44e6e1fc24 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1.1.normal.js @@ -4,4 +4,5 @@ export function foo() { return ""; } //// [/src/bar.mts] +// Extensionless relative path ES import in an ES module export { }; // should error, ask for extension, no extension suggestion diff --git a/crates/swc/tests/tsc-references/multipleNumericIndexers.1.normal.js b/crates/swc/tests/tsc-references/multipleNumericIndexers.1.normal.js index 723c775d833d..5dadb2697ce3 100644 --- a/crates/swc/tests/tsc-references/multipleNumericIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleNumericIndexers.1.normal.js @@ -1,6 +1,6 @@ //// [multipleNumericIndexers.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Multiple indexers of the same type are an error +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/multipleStringIndexers.1.normal.js b/crates/swc/tests/tsc-references/multipleStringIndexers.1.normal.js index e49c750e6556..751b60c3d289 100644 --- a/crates/swc/tests/tsc-references/multipleStringIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleStringIndexers.1.normal.js @@ -1,6 +1,6 @@ //// [multipleStringIndexers.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Multiple indexers of the same type are an error +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/narrowingConstrainedTypeVariable.1.normal.js b/crates/swc/tests/tsc-references/narrowingConstrainedTypeVariable.1.normal.js index f357e83d3939..68f2440d7624 100644 --- a/crates/swc/tests/tsc-references/narrowingConstrainedTypeVariable.1.normal.js +++ b/crates/swc/tests/tsc-references/narrowingConstrainedTypeVariable.1.normal.js @@ -1,7 +1,7 @@ //// [narrowingConstrainedTypeVariable.ts] +// Repro from #20138 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; -// Repro from #20138 var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.1.normal.js index b755ba2a1d24..5132a0dec33b 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.1.normal.js @@ -1,6 +1,6 @@ //// [negateOperatorWithBooleanType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // - operator on boolean type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/negateOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/negateOperatorWithNumberType.1.normal.js index bc9bf8e7be81..bd30d7b9b19e 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [negateOperatorWithNumberType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // - operator on number type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/negateOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/negateOperatorWithStringType.1.normal.js index d2946e8c286f..5d51e8c0c2fd 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithStringType.1.normal.js @@ -1,6 +1,6 @@ //// [negateOperatorWithStringType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // - operator on string type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/noInfer.1.normal.js b/crates/swc/tests/tsc-references/noInfer.1.normal.js index 5b9214288520..dd8eb7c33cb1 100644 --- a/crates/swc/tests/tsc-references/noInfer.1.normal.js +++ b/crates/swc/tests/tsc-references/noInfer.1.normal.js @@ -1,4 +1,5 @@ //// [noInfer.ts] +// NoInfer is erased for primitives import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; foo1('foo', 'foo'); // ok diff --git a/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.1.normal.js index 73f61fc6b4f0..b7bc9d479840 100644 --- a/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.1.normal.js @@ -1,6 +1,6 @@ //// [nonGenericTypeReferenceWithTypeArguments.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Check that errors are reported for non-generic types with type arguments +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/nonPrimitiveAndEmptyObject.1.normal.js b/crates/swc/tests/tsc-references/nonPrimitiveAndEmptyObject.1.normal.js index 43605e69f31e..d016e0c51dd2 100644 --- a/crates/swc/tests/tsc-references/nonPrimitiveAndEmptyObject.1.normal.js +++ b/crates/swc/tests/tsc-references/nonPrimitiveAndEmptyObject.1.normal.js @@ -1,4 +1,5 @@ //// [nonPrimitiveAndEmptyObject.ts] +// Repro from #49480 var _foo_fooProps = foo.fooProps, fooProps = _foo_fooProps === void 0 ? {} : _foo_fooProps; fooProps.barProp; export { }; diff --git a/crates/swc/tests/tsc-references/nonPrimitiveAndTypeVariables.1.normal.js b/crates/swc/tests/tsc-references/nonPrimitiveAndTypeVariables.1.normal.js index 3bfe989b831e..84cee14f9a69 100644 --- a/crates/swc/tests/tsc-references/nonPrimitiveAndTypeVariables.1.normal.js +++ b/crates/swc/tests/tsc-references/nonPrimitiveAndTypeVariables.1.normal.js @@ -1,4 +1,5 @@ //// [nonPrimitiveAndTypeVariables.ts] +// Repros from #23800 var a = { a: 0 }; diff --git a/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.1.normal.js b/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.1.normal.js index a3deeaa66926..0ee1c0a49f2d 100644 --- a/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.1.normal.js +++ b/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.1.normal.js @@ -1,6 +1,6 @@ //// [nullIsSubtypeOfEverythingButUndefined.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // null is a subtype of any other types except undefined +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var r0 = true ? null : null; var r0 = true ? null : null; var u; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js index fc5c9173bcfc..223ea00694b1 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [nullishCoalescingOperatorInAsyncGenerator.ts] -import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; // https://github.com/microsoft/TypeScript/issues/37686 +import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; function f(a) { return _wrap_async_generator(function*() { var _a_b; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js index 8d00d3b80c07..baa5619b5401 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js @@ -1,7 +1,7 @@ //// [nullishCoalescingOperatorInAsyncGenerator.ts] +// https://github.com/microsoft/TypeScript/issues/37686 import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; -// https://github.com/microsoft/TypeScript/issues/37686 function f(a) { return _wrap_async_generator(function() { var _a_b, c; diff --git a/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations.1.normal.js b/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations.1.normal.js index 9b651f95d647..ab5a4a9dc52c 100644 --- a/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations.1.normal.js +++ b/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations.1.normal.js @@ -1,4 +1,5 @@ //// [numericIndexerConstrainsPropertyDeclarations.ts] +// String indexer types constrain the types of named properties in their containing type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; var C = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations2.1.normal.js b/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations2.1.normal.js index 66f552b23726..c160a8aa696f 100644 --- a/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations2.1.normal.js +++ b/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations2.1.normal.js @@ -1,8 +1,8 @@ //// [numericIndexerConstrainsPropertyDeclarations2.ts] +// String indexer providing a constraint of a user defined type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// String indexer providing a constraint of a user defined type var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectLiteralContextualTyping.1.normal.js b/crates/swc/tests/tsc-references/objectLiteralContextualTyping.1.normal.js index 975edc02a7c2..1c282f426764 100644 --- a/crates/swc/tests/tsc-references/objectLiteralContextualTyping.1.normal.js +++ b/crates/swc/tests/tsc-references/objectLiteralContextualTyping.1.normal.js @@ -1,4 +1,8 @@ //// [objectLiteralContextualTyping.ts] +// In a contextually typed object literal, each property value expression is contextually typed by +// the type of the property with a matching name in the contextual type, if any, or otherwise +// for a numerically named property, the numeric index type of the contextual type, if any, or otherwise +// the string index type of the contextual type, if any. var x = foo({ name: "Sprocket" }); diff --git a/crates/swc/tests/tsc-references/objectLiteralNormalization.1.normal.js b/crates/swc/tests/tsc-references/objectLiteralNormalization.1.normal.js index ddeb8047e09c..8bcf1beadfc7 100644 --- a/crates/swc/tests/tsc-references/objectLiteralNormalization.1.normal.js +++ b/crates/swc/tests/tsc-references/objectLiteralNormalization.1.normal.js @@ -1,7 +1,7 @@ //// [objectLiteralNormalization.ts] +// Object literals in unions are normalized upon widening import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; -// Object literals in unions are normalized upon widening var a1 = [ { a: 0 diff --git a/crates/swc/tests/tsc-references/objectRest2.1.normal.js b/crates/swc/tests/tsc-references/objectRest2.1.normal.js index 7ca2de130bc9..c3da7a6d5d19 100644 --- a/crates/swc/tests/tsc-references/objectRest2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectRest2.1.normal.js @@ -1,4 +1,5 @@ //// [objectRest2.ts] +// test for #12203 import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; function rootConnection(name) { diff --git a/crates/swc/tests/tsc-references/objectRestReadonly.1.normal.js b/crates/swc/tests/tsc-references/objectRestReadonly.1.normal.js index fd73e93d0a6b..7066801ee36b 100644 --- a/crates/swc/tests/tsc-references/objectRestReadonly.1.normal.js +++ b/crates/swc/tests/tsc-references/objectRestReadonly.1.normal.js @@ -1,4 +1,5 @@ //// [objectRestReadonly.ts] +// #23734 import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; var obj = { foo: 'bar', diff --git a/crates/swc/tests/tsc-references/objectSpreadComputedProperty.1.normal.js b/crates/swc/tests/tsc-references/objectSpreadComputedProperty.1.normal.js index 432f80e6d125..a83d5928d60f 100644 --- a/crates/swc/tests/tsc-references/objectSpreadComputedProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/objectSpreadComputedProperty.1.normal.js @@ -1,8 +1,8 @@ //// [objectSpreadComputedProperty.ts] +// fixes #12200 import { _ as _define_property } from "@swc/helpers/_/_define_property"; import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; -// fixes #12200 function f() { var n = 12; var m = 13; diff --git a/crates/swc/tests/tsc-references/objectTypeHidingMembersOfObject.1.normal.js b/crates/swc/tests/tsc-references/objectTypeHidingMembersOfObject.1.normal.js index 79954bafa956..005ad2efa0ec 100644 --- a/crates/swc/tests/tsc-references/objectTypeHidingMembersOfObject.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeHidingMembersOfObject.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypeHidingMembersOfObject.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // all of these valueOf calls should return the type shown in the overriding signatures here +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/objectTypePropertyAccess.1.normal.js b/crates/swc/tests/tsc-references/objectTypePropertyAccess.1.normal.js index c9174e6363f8..99d6bb1cc05c 100644 --- a/crates/swc/tests/tsc-references/objectTypePropertyAccess.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypePropertyAccess.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypePropertyAccess.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Index notation should resolve to the type of a declared property with that same name +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/objectTypeWithCallSignatureAppearsToBeFunctionType.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithCallSignatureAppearsToBeFunctionType.1.normal.js index 352ab2bc2670..059e48fb517e 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithCallSignatureAppearsToBeFunctionType.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithCallSignatureAppearsToBeFunctionType.1.normal.js @@ -1,4 +1,6 @@ //// [objectTypeWithCallSignatureAppearsToBeFunctionType.ts] +// objects with call signatures should be permitted where function types are expected +// no errors expected below var i; var r2 = i(); var r2b = i.apply; diff --git a/crates/swc/tests/tsc-references/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.1.normal.js index a1741d05efa6..bdfa706bb342 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithCallSignatureHidingMembersOfExtendedFunction.1.normal.js @@ -1,4 +1,6 @@ //// [objectTypeWithCallSignatureHidingMembersOfExtendedFunction.ts] +// object types with call signatures can override members of Function +// no errors expected below var i; var r1 = i.apply; var r1b = i.call; diff --git a/crates/swc/tests/tsc-references/objectTypeWithCallSignatureHidingMembersOfFunction.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithCallSignatureHidingMembersOfFunction.1.normal.js index fb512113f042..a9ffa1befa0e 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithCallSignatureHidingMembersOfFunction.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithCallSignatureHidingMembersOfFunction.1.normal.js @@ -1,4 +1,6 @@ //// [objectTypeWithCallSignatureHidingMembersOfFunction.ts] +// object types with call signatures can override members of Function +// no errors expected below var i; var r1 = i.apply; var r1b = i.call; diff --git a/crates/swc/tests/tsc-references/objectTypeWithConstructSignatureAppearsToBeFunctionType.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithConstructSignatureAppearsToBeFunctionType.1.normal.js index a12906718ecf..f0c4ba94b667 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithConstructSignatureAppearsToBeFunctionType.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithConstructSignatureAppearsToBeFunctionType.1.normal.js @@ -1,4 +1,5 @@ //// [objectTypeWithConstructSignatureAppearsToBeFunctionType.ts] +// no errors expected below var i; var r2 = i(); var r2b = new i(); diff --git a/crates/swc/tests/tsc-references/objectTypeWithNumericProperty.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithNumericProperty.1.normal.js index 6ab21b9f1b1a..ef249963c995 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithNumericProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithNumericProperty.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypeWithNumericProperty.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // no errors here +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty.1.normal.js index 9f8900874db7..5649c5efae3e 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypeWithRecursiveWrappedProperty.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Basic recursive type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var List = function List() { "use strict"; _class_call_check(this, List); diff --git a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty2.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty2.1.normal.js index 0b6a422c5863..981898c8e09b 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty2.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypeWithRecursiveWrappedProperty2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Basic recursive type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var List = function List() { "use strict"; _class_call_check(this, List); diff --git a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedPropertyCheckedNominally.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedPropertyCheckedNominally.1.normal.js index e8ebb49bb630..643e1647e929 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedPropertyCheckedNominally.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedPropertyCheckedNominally.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Types with infinitely expanding recursive types are type checked nominally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var List = function List() { "use strict"; _class_call_check(this, List); diff --git a/crates/swc/tests/tsc-references/objectTypeWithStringAndNumberIndexSignatureToAny.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithStringAndNumberIndexSignatureToAny.1.normal.js index 9cb85c1c04dc..01efe8f1bd4b 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithStringAndNumberIndexSignatureToAny.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithStringAndNumberIndexSignatureToAny.1.normal.js @@ -1,4 +1,22 @@ //// [objectTypeWithStringAndNumberIndexSignatureToAny.ts] +// When checking compatibility between two types, +// TypeScript should not require an index signature if +// the target side index signature maps to `any` *and* +// the target side has *any* string index signature to `any`. +// +// So an index signature like in +// +// { [x: number]: any } +// +// is still required of a source type, but neither index signature in +// +// { [x: number]: any, [x: string]: any; } +// +// should be required; *however*, the number index signature in +// +// { [x: number]: number, [x: string]: any; } +// +// should always be required. function f1(sToAny, nToAny, bothToAny, someObj) { sToAny = nToAny; sToAny = bothToAny; diff --git a/crates/swc/tests/tsc-references/objectTypeWithStringIndexerHidingObjectIndexer.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithStringIndexerHidingObjectIndexer.1.normal.js index d5d566c25d7e..723ab8e3e101 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithStringIndexerHidingObjectIndexer.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithStringIndexerHidingObjectIndexer.1.normal.js @@ -1,4 +1,6 @@ //// [objectTypeWithStringIndexerHidingObjectIndexer.ts] +// object types can define string indexers that are more specific than the default 'any' that would be returned +// no errors expected below import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var o = {}; var r = o['']; // should be Object diff --git a/crates/swc/tests/tsc-references/objectTypesIdentity.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentity.1.normal.js index 4e6a30a7d5d8..0af7c0453b18 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentity.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentity.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentity.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentity2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentity2.1.normal.js index 775d25c56d85..c13945138333 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentity2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentity2.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentity2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures.1.normal.js index 5606a9a4b058..67c0ee8efaae 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithCallSignatures.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures2.1.normal.js index 9c54a4fd9b2c..cffcd6ce2d58 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures2.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithCallSignatures2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures3.1.normal.js index ea1b949d17b9..5e1af0501252 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures3.1.normal.js @@ -1,4 +1,5 @@ //// [objectTypesIdentityWithCallSignatures3.ts] +// object types are identical structurally var a; function foo2(x) {} function foo3(x) {} diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts.1.normal.js index 4864c8534034..07f592a955e0 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.1.normal.js index cf51dd2f25b2..7a8ef8f527cb 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts2.1.normal.js @@ -1,4 +1,5 @@ //// [objectTypesIdentityWithCallSignaturesDifferingParamCounts2.ts] +// object types are identical structurally var a; function foo2(x) {} function foo3(x) {} diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesWithOverloads.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesWithOverloads.1.normal.js index c2926245d4d1..46fe15f6d99e 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesWithOverloads.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesWithOverloads.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithCallSignaturesWithOverloads.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures.1.normal.js index e7797e3fe83d..070a57f7448a 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithConstructSignatures.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = function A(x) { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures2.1.normal.js index b83e560d12be..eac41bc29cfe 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures2.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithConstructSignatures2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.1.normal.js index c29bcee8b4df..9dc8194cb428 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithConstructSignaturesDifferingParamCounts.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x, y) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures.1.normal.js index 17d728b73d59..16b97105ca6d 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericCallSignatures.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures2.1.normal.js index 6032ff0041c9..9d5726ece42f 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures2.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericCallSignatures2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.1.normal.js index f9c1f3d008a2..12cdab9f562a 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.1.normal.js index 9adaae423879..80eac15703e1 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.1.normal.js index 7953c1b7acd0..872f3d5ab27b 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var One = function One() { "use strict"; _class_call_check(this, One); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.1.normal.js index 266f42ed1280..1ad81760cca9 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.1.normal.js index 499715e73ecf..770b08bd3d2d 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.1.normal.js index 6bb15a53135f..ac44e7d9a7b0 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.1.normal.js index aa30b58d16a9..8e639c9ef394 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.1.normal.js @@ -1,4 +1,5 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts] +// object types are identical structurally var a; function foo1(x) {} function foo2(x) {} diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.1.normal.js index 1bfa3a153b75..4a8f6d0ea24d 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams.1.normal.js index 6259db5029a6..1864e11f42a1 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.1.normal.js index 00bbe032f463..25c4cb790940 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.1.normal.js index 06f0e829bcd9..a13f7ec180e8 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.1.normal.js index edd74eb20e0c..0d4099ecc9e0 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.1.normal.js index ff6200df0cce..a3b0e33d5093 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x, y) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.1.normal.js index d4656ea1c208..e59c0415339b 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var One = function One() { "use strict"; _class_call_check(this, One); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.1.normal.js index f8ddf5c69eb3..7b8d068c19b1 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.1.normal.js index 3917c0ecad4b..53c87401fc6b 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.1.normal.js index 6ca283b221b8..8f89fc06e9e5 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.1.normal.js index 4ecb75d7bb4b..e739d00dd12a 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.1.normal.js index 1e7a85b792eb..89552cf978f3 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesOptionalParams.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x, y) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.1.normal.js index 4c867b3ec3cf..115760300134 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x, y) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.1.normal.js index 37ab79c5e8dd..add1b2bd6904 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x, y) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers1.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers1.1.normal.js index f90b7fe5c925..3fc8a22c978a 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers1.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers1.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithNumericIndexers1.ts] +// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers2.1.normal.js index 0e8bc3d97952..cb79788d5bca 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithNumericIndexers2.ts] +// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// object types are identical structurally var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers3.1.normal.js index 0ace9a6cdc3c..cb92e4008351 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers3.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithNumericIndexers3.ts] +// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithOptionality.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithOptionality.1.normal.js index 5c03518f7519..f3fa7d989930 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithOptionality.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithOptionality.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithOptionality.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates.1.normal.js index 902967efa38f..2873f7696e86 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithPrivates.ts] +// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates2.1.normal.js index 53406f9a4849..7c56af366a65 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithPrivates2.ts] +// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// object types are identical structurally var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithPublics.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithPublics.1.normal.js index ba604a6efc58..b622486d0aa0 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithPublics.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithPublics.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithPublics.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // object types are identical structurally +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers.1.normal.js index d8d17d46325a..6921e60d6620 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithStringIndexers.ts] +// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers2.1.normal.js index 3e7c7e2b922b..d77643d8f74c 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithStringIndexers2.ts] +// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// object types are identical structurally var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js index 38fd3f843dd3..3d28a98050e1 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js @@ -1,5 +1,5 @@ //// [optionalChainingInParameterBindingPattern.ts] -var _a; // https://github.com/microsoft/TypeScript/issues/36295 +var _a; const a = ()=>undefined; (({ [(_a = a()) === null || _a === void 0 ? void 0 : _a.d]: c = "" })=>{})(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js index 49521c0823f2..9b8528b50e00 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js @@ -1,6 +1,6 @@ //// [optionalChainingInParameterBindingPattern.ts] -var _a; // https://github.com/microsoft/TypeScript/issues/36295 +var _a; var a = function() { return undefined; }; diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js index a38f5dccabea..23ddcb34eb48 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [optionalChainingInParameterBindingPattern.2.ts] -var _a, _a1; // https://github.com/microsoft/TypeScript/issues/36295 +var _a, _a1; const a = ()=>undefined; (({ [(_a = a()) === null || _a === void 0 ? void 0 : _a.d]: c = "" })=>{ var a1; diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js index a5e4ff7a9945..f1e790c9b056 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js @@ -1,6 +1,6 @@ //// [optionalChainingInParameterBindingPattern.2.ts] -var _a, _a1; // https://github.com/microsoft/TypeScript/issues/36295 +var _a, _a1; var a = function() { return undefined; }; diff --git a/crates/swc/tests/tsc-references/optionalChainingInference.1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInference.1.normal.js index e73c3006d334..d0600a4181df 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInference.1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInference.1.normal.js @@ -1,4 +1,5 @@ //// [optionalChainingInference.ts] +// https://github.com/microsoft/TypeScript/issues/34579 var b1 = { value: su === null || su === void 0 ? void 0 : su.length }; diff --git a/crates/swc/tests/tsc-references/overloadTag3.1.normal.js b/crates/swc/tests/tsc-references/overloadTag3.1.normal.js index 1cf859da67ab..89497aec20f3 100644 --- a/crates/swc/tests/tsc-references/overloadTag3.1.normal.js +++ b/crates/swc/tests/tsc-references/overloadTag3.1.normal.js @@ -1,8 +1,8 @@ //// [/a.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @template T - */ export var Foo = /*#__PURE__*/ function() { + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +export var Foo = /*#__PURE__*/ function() { "use strict"; function Foo() { _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es2015).1.normal.js index 54ffcf21340e..273e67f9d735 100644 --- a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [parameterInitializersForwardReferencing.2.ts] -import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; // https://github.com/microsoft/TypeScript/issues/36295 +import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; function a() {} function b(_param = a()) { var { b: b1 = a() } = _param, x = _object_without_properties(_param, [ diff --git a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js index 104ce02276b4..f997315e6740 100644 --- a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js @@ -1,6 +1,6 @@ //// [parameterInitializersForwardReferencing.2.ts] -import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; // https://github.com/microsoft/TypeScript/issues/36295 +import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; function a() {} function b() { var _param = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a(); diff --git a/crates/swc/tests/tsc-references/parenthesizedContexualTyping2.1.normal.js b/crates/swc/tests/tsc-references/parenthesizedContexualTyping2.1.normal.js index 1038feb8cce2..0e967d50c9bb 100644 --- a/crates/swc/tests/tsc-references/parenthesizedContexualTyping2.1.normal.js +++ b/crates/swc/tests/tsc-references/parenthesizedContexualTyping2.1.normal.js @@ -1,4 +1,9 @@ //// [parenthesizedContexualTyping2.ts] +// These tests ensure that in cases where it may *appear* that a value has a type, +// they actually are properly being contextually typed. The way we test this is +// that we invoke contextually typed arguments with type arguments. +// Since 'any' cannot be invoked with type arguments, we should get errors +// back if contextual typing is not taking effect. function fun() { for(var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++){ rest[_key] = arguments[_key]; diff --git a/crates/swc/tests/tsc-references/parenthesizedContexualTyping3.1.normal.js b/crates/swc/tests/tsc-references/parenthesizedContexualTyping3.1.normal.js index 94bfa3593fed..94aa080f7f08 100644 --- a/crates/swc/tests/tsc-references/parenthesizedContexualTyping3.1.normal.js +++ b/crates/swc/tests/tsc-references/parenthesizedContexualTyping3.1.normal.js @@ -1,5 +1,8 @@ //// [parenthesizedContexualTyping3.ts] -function tempFun(tempStrs, g, x) { +// Contextual typing for parenthesized substitution expressions in tagged templates. +/** + * tempFun - Can't have fun for too long. + */ function tempFun(tempStrs, g, x) { return g(x); } var a = tempFun`${(x)=>x} ${10}`; diff --git a/crates/swc/tests/tsc-references/parserAstSpans1.1.normal.js b/crates/swc/tests/tsc-references/parserAstSpans1.1.normal.js index 3a6991722977..2c3beae11413 100644 --- a/crates/swc/tests/tsc-references/parserAstSpans1.1.normal.js +++ b/crates/swc/tests/tsc-references/parserAstSpans1.1.normal.js @@ -1,5 +1,5 @@ //// [parserAstSpans1.ts] -import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized"; +/** i1 is interface with properties*/ import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized"; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; diff --git a/crates/swc/tests/tsc-references/parserErrorRecovery_IncompleteMemberVariable1.1.normal.js b/crates/swc/tests/tsc-references/parserErrorRecovery_IncompleteMemberVariable1.1.normal.js index 4b0988909cbb..1d2077f6905f 100644 --- a/crates/swc/tests/tsc-references/parserErrorRecovery_IncompleteMemberVariable1.1.normal.js +++ b/crates/swc/tests/tsc-references/parserErrorRecovery_IncompleteMemberVariable1.1.normal.js @@ -1,4 +1,5 @@ //// [parserErrorRecovery_IncompleteMemberVariable1.ts] +// Interface import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Module (function(Shapes) { diff --git a/crates/swc/tests/tsc-references/parserForInStatement8.1.normal.js b/crates/swc/tests/tsc-references/parserForInStatement8.1.normal.js index 8be8569cf68f..9925a11ea329 100644 --- a/crates/swc/tests/tsc-references/parserForInStatement8.1.normal.js +++ b/crates/swc/tests/tsc-references/parserForInStatement8.1.normal.js @@ -1,6 +1,6 @@ //// [parserForInStatement8.ts] -import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; // repro from https://github.com/microsoft/TypeScript/issues/54769 +import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; for(var ref in { '': 0 }){ diff --git a/crates/swc/tests/tsc-references/parserRealSource1.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource1.1.normal.js index 71147fc13f55..7ba24e612998 100644 --- a/crates/swc/tests/tsc-references/parserRealSource1.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource1.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource1.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { (function(CompilerDiagnostics) { CompilerDiagnostics.debug = false; diff --git a/crates/swc/tests/tsc-references/parserRealSource12.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource12.1.normal.js index 74b20694d0e8..73758de7251c 100644 --- a/crates/swc/tests/tsc-references/parserRealSource12.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource12.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource12.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { var AstWalkOptions = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/parserRealSource14.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource14.1.normal.js index bd5b9773b35f..52788e494c14 100644 --- a/crates/swc/tests/tsc-references/parserRealSource14.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource14.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource14.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { function lastOf(items) { return items === null || items.length === 0 ? null : items[items.length - 1]; diff --git a/crates/swc/tests/tsc-references/parserRealSource5.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource5.1.normal.js index 8b00713819fc..1dea7b5db57b 100644 --- a/crates/swc/tests/tsc-references/parserRealSource5.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource5.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource5.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { var PrintContext = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/parserRealSource6.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource6.1.normal.js index 511f1a59a143..c0e25a830b36 100644 --- a/crates/swc/tests/tsc-references/parserRealSource6.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource6.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource6.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { var TypeCollectionContext = function TypeCollectionContext(scopeChain, checker) { "use strict"; diff --git a/crates/swc/tests/tsc-references/parserRealSource8.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource8.1.normal.js index 8ba6af091373..3624652fa724 100644 --- a/crates/swc/tests/tsc-references/parserRealSource8.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource8.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource8.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { var AssignScopeContext = function AssignScopeContext(scopeChain, typeFlow, modDeclChain) { "use strict"; diff --git a/crates/swc/tests/tsc-references/parserindenter.1.normal.js b/crates/swc/tests/tsc-references/parserindenter.1.normal.js index 6f36a33fb4c7..2f040dd85da0 100644 --- a/crates/swc/tests/tsc-references/parserindenter.1.normal.js +++ b/crates/swc/tests/tsc-references/parserindenter.1.normal.js @@ -1,5 +1,4 @@ //// [parserindenter.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // // Copyright (c) Microsoft Corporation. All rights reserved. // @@ -15,6 +14,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // limitations under the License. // /// +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(Formatting) { var Indenter = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/partiallyAnnotatedFunctionWitoutTypeParameter.1.normal.js b/crates/swc/tests/tsc-references/partiallyAnnotatedFunctionWitoutTypeParameter.1.normal.js index 425235c7d605..f66d34d79058 100644 --- a/crates/swc/tests/tsc-references/partiallyAnnotatedFunctionWitoutTypeParameter.1.normal.js +++ b/crates/swc/tests/tsc-references/partiallyAnnotatedFunctionWitoutTypeParameter.1.normal.js @@ -1,3 +1,4 @@ //// [partiallyAnnotatedFunctionWitoutTypeParameter.ts] +// simple case simple(function(a, b) {}); simple(function(a, b) {}); diff --git a/crates/swc/tests/tsc-references/partiallyNamedTuples2.1.normal.js b/crates/swc/tests/tsc-references/partiallyNamedTuples2.1.normal.js index d50f0d220ade..570951e75e9b 100644 --- a/crates/swc/tests/tsc-references/partiallyNamedTuples2.1.normal.js +++ b/crates/swc/tests/tsc-references/partiallyNamedTuples2.1.normal.js @@ -1,4 +1,5 @@ //// [partiallyNamedTuples2.ts] +// https://github.com/microsoft/TypeScript/issues/55693 var x = null; var id1 = "abc"; var matches = x.get(id1); diff --git a/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.1.normal.js index fe2707f44df2..12f967f65c09 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.1.normal.js @@ -1,6 +1,6 @@ //// [plusOperatorWithBooleanType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // + operator on boolean type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/plusOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/plusOperatorWithNumberType.1.normal.js index cc6978c20d8c..9af13bb201d9 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [plusOperatorWithNumberType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // + operator on number type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/plusOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/plusOperatorWithStringType.1.normal.js index 0bae4f085bc5..0cdb7cacb1c5 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithStringType.1.normal.js @@ -1,6 +1,6 @@ //// [plusOperatorWithStringType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // + operator on string type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/primtiveTypesAreIdentical.1.normal.js b/crates/swc/tests/tsc-references/primtiveTypesAreIdentical.1.normal.js index 91deb0247e6c..ec46588cb132 100644 --- a/crates/swc/tests/tsc-references/primtiveTypesAreIdentical.1.normal.js +++ b/crates/swc/tests/tsc-references/primtiveTypesAreIdentical.1.normal.js @@ -1,4 +1,5 @@ //// [primtiveTypesAreIdentical.ts] +// primitive types are identical to themselves so these overloads will all cause errors function foo1(x) {} function foo2(x) {} function foo3(x) {} diff --git a/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinClass.1.normal.js b/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinClass.1.normal.js index c98609cd9a4f..c26f17a72b40 100644 --- a/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinClass.1.normal.js +++ b/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinClass.1.normal.js @@ -1,7 +1,7 @@ //// [privateClassPropertyAccessibleWithinClass.ts] +// no errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; -// no errors var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinNestedClass.1.normal.js b/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinNestedClass.1.normal.js index 2c196d245658..4bffec5dd791 100644 --- a/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinNestedClass.1.normal.js +++ b/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinNestedClass.1.normal.js @@ -1,7 +1,7 @@ //// [privateClassPropertyAccessibleWithinNestedClass.ts] +// no errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; -// no errors var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=es2015).1.normal.js index fa75b5e73c5c..5d7f9d137859 100644 --- a/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [privateNameComputedPropertyName4.ts] -import { _ as _define_property } from "@swc/helpers/_/_define_property"; // https://github.com/microsoft/TypeScript/issues/44113 +import { _ as _define_property } from "@swc/helpers/_/_define_property"; class C1 { ["bar"]() {} } diff --git a/crates/swc/tests/tsc-references/privateNameEmitHelpers.1.normal.js b/crates/swc/tests/tsc-references/privateNameEmitHelpers.1.normal.js index 1ad70259262d..92f3ddae7142 100644 --- a/crates/swc/tests/tsc-references/privateNameEmitHelpers.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameEmitHelpers.1.normal.js @@ -26,4 +26,5 @@ function set_c(v) { _class_private_field_set(this, _a, _class_private_field_get(this, _a) + v); } //// [tslib.d.ts] +// these are pre-TS4.3 versions of emit helpers, which only supported private instance fields export { }; diff --git a/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers.1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers.1.normal.js index 419c9ca6f031..161ac89835d3 100644 --- a/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers.1.normal.js @@ -19,4 +19,5 @@ function get_c() { return _class_static_private_method_get(S, S, b).call(S); } //// [tslib.d.ts] +// these are pre-TS4.3 versions of emit helpers, which only supported private instance fields export { }; diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-5.1.normal.js b/crates/swc/tests/tsc-references/privateNamesUnique-5.1.normal.js index 771fe96f7c43..85000afdc760 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-5.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-5.1.normal.js @@ -1,7 +1,7 @@ //// [privateNamesUnique-5.ts] +// same as privateNamesUnique-1, but with an interface import { _ as _class_private_field_init } from "@swc/helpers/_/_class_private_field_init"; var _foo = /*#__PURE__*/ new WeakMap(); -// same as privateNamesUnique-1, but with an interface class A { constructor(){ _class_private_field_init(this, _foo, { diff --git a/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule.1.normal.js b/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule.1.normal.js index e38c3ee1f13c..72b10a0fe54b 100644 --- a/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule.1.normal.js +++ b/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule.1.normal.js @@ -1,6 +1,6 @@ //// [privateStaticNotAccessibleInClodule.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule2.1.normal.js b/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule2.1.normal.js index aefd473241db..9a29f0a91cc6 100644 --- a/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule2.1.normal.js +++ b/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule2.1.normal.js @@ -1,8 +1,8 @@ //// [privateStaticNotAccessibleInClodule2.ts] +// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/propertiesOfGenericConstructorFunctions.1.normal.js b/crates/swc/tests/tsc-references/propertiesOfGenericConstructorFunctions.1.normal.js index dfc2a695a9c6..360b653e1ee9 100644 --- a/crates/swc/tests/tsc-references/propertiesOfGenericConstructorFunctions.1.normal.js +++ b/crates/swc/tests/tsc-references/propertiesOfGenericConstructorFunctions.1.normal.js @@ -1,11 +1,11 @@ //// [propertiesOfGenericConstructorFunctions.js] -import { _ as _define_property } from "@swc/helpers/_/_define_property"; /** * @template {string} K * @template V * @param {string} ik * @param {V} iv - */ function Multimap(ik, iv) { + */ import { _ as _define_property } from "@swc/helpers/_/_define_property"; +function Multimap(ik, iv) { /** @type {{ [s: string]: V }} */ this._map = {}; // without type annotation this._map2 = _define_property({}, ik, iv); diff --git a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints.1.normal.js b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints.1.normal.js index af464620cd88..dc020650080a 100644 --- a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints.1.normal.js @@ -1,7 +1,7 @@ //// [propertyAccessOnTypeParameterWithConstraints.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // generic types should behave as if they have properties of their constraint type // no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints2.1.normal.js b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints2.1.normal.js index 1462bdbb665b..bfede069144a 100644 --- a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints2.1.normal.js @@ -1,8 +1,8 @@ //// [propertyAccessOnTypeParameterWithConstraints2.ts] +// generic types should behave as if they have properties of their constraint type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// generic types should behave as if they have properties of their constraint type var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints3.1.normal.js b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints3.1.normal.js index d37765dcb323..34524214bc76 100644 --- a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints3.1.normal.js +++ b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints3.1.normal.js @@ -1,8 +1,8 @@ //// [propertyAccessOnTypeParameterWithConstraints3.ts] +// generic types should behave as if they have properties of their constraint type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// generic types should behave as if they have properties of their constraint type var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinClass.1.normal.js b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinClass.1.normal.js index ea3841ab3c43..f09b3df9d141 100644 --- a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinClass.1.normal.js +++ b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinClass.1.normal.js @@ -1,7 +1,7 @@ //// [protectedClassPropertyAccessibleWithinClass.ts] +// no errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; -// no errors var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinNestedClass.1.normal.js b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinNestedClass.1.normal.js index 4631d0236e4f..e3aa8f728744 100644 --- a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinNestedClass.1.normal.js +++ b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinNestedClass.1.normal.js @@ -1,7 +1,7 @@ //// [protectedClassPropertyAccessibleWithinNestedClass.ts] +// no errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; -// no errors var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinSubclass.1.normal.js b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinSubclass.1.normal.js index b99ebcf93df7..963bb810c56c 100644 --- a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinSubclass.1.normal.js +++ b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinSubclass.1.normal.js @@ -1,9 +1,9 @@ //// [protectedClassPropertyAccessibleWithinSubclass.ts] +// no errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// no errors var B = function B() { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/protectedStaticNotAccessibleInClodule.1.normal.js b/crates/swc/tests/tsc-references/protectedStaticNotAccessibleInClodule.1.normal.js index c50e0c1ae7cc..1d0fbad01c04 100644 --- a/crates/swc/tests/tsc-references/protectedStaticNotAccessibleInClodule.1.normal.js +++ b/crates/swc/tests/tsc-references/protectedStaticNotAccessibleInClodule.1.normal.js @@ -1,6 +1,6 @@ //// [protectedStaticNotAccessibleInClodule.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/readonlyConstructorAssignment.1.normal.js b/crates/swc/tests/tsc-references/readonlyConstructorAssignment.1.normal.js index 082e25ac465c..a8042199c868 100644 --- a/crates/swc/tests/tsc-references/readonlyConstructorAssignment.1.normal.js +++ b/crates/swc/tests/tsc-references/readonlyConstructorAssignment.1.normal.js @@ -1,8 +1,8 @@ //// [readonlyConstructorAssignment.ts] +// Tests that readonly parameter properties behave like regular readonly properties import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// Tests that readonly parameter properties behave like regular readonly properties var A = function A(x) { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/recursiveMappedTypes.1.normal.js b/crates/swc/tests/tsc-references/recursiveMappedTypes.1.normal.js index 7dad85d03355..d41f028c8115 100644 --- a/crates/swc/tests/tsc-references/recursiveMappedTypes.1.normal.js +++ b/crates/swc/tests/tsc-references/recursiveMappedTypes.1.normal.js @@ -1,4 +1,5 @@ //// [recursiveMappedTypes.ts] +// Recursive mapped types simply appear empty function foo(arg) { return arg; } diff --git a/crates/swc/tests/tsc-references/restParameterInDownlevelGenerator.1.normal.js b/crates/swc/tests/tsc-references/restParameterInDownlevelGenerator.1.normal.js index 21026e65a515..2b3495806177 100644 --- a/crates/swc/tests/tsc-references/restParameterInDownlevelGenerator.1.normal.js +++ b/crates/swc/tests/tsc-references/restParameterInDownlevelGenerator.1.normal.js @@ -1,6 +1,6 @@ //// [restParameterInDownlevelGenerator.ts] -import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; // https://github.com/Microsoft/TypeScript/issues/30653 +import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; function mergeStringLists() { var _len, strings, _key, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, str; var _arguments = arguments; diff --git a/crates/swc/tests/tsc-references/returnStatements.1.normal.js b/crates/swc/tests/tsc-references/returnStatements.1.normal.js index 5a03aedf0ae5..e4a0d48b0b2d 100644 --- a/crates/swc/tests/tsc-references/returnStatements.1.normal.js +++ b/crates/swc/tests/tsc-references/returnStatements.1.normal.js @@ -1,8 +1,8 @@ //// [returnStatements.ts] +// all the following should be valid import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// all the following should be valid function fn1() { return 1; } diff --git a/crates/swc/tests/tsc-references/scannertest1.1.normal.js b/crates/swc/tests/tsc-references/scannertest1.1.normal.js index 55d53c0bd057..29db31b9c3ba 100644 --- a/crates/swc/tests/tsc-references/scannertest1.1.normal.js +++ b/crates/swc/tests/tsc-references/scannertest1.1.normal.js @@ -1,6 +1,6 @@ //// [scannertest1.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /// +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var CharacterInfo = /*#__PURE__*/ function() { "use strict"; function CharacterInfo() { diff --git a/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.1.normal.js b/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.1.normal.js index 1ca5f033e088..1ffe4aaf1523 100644 --- a/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.1.normal.js +++ b/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.1.normal.js @@ -1,6 +1,6 @@ //// [scopeResolutionIdentifiers.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // EveryType used in a nested scope of a different EveryType with the same name, type of the identifier is the one defined in the inner scope +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var s; (function(M1) { var n = M1.s; diff --git a/crates/swc/tests/tsc-references/specializedSignatureIsSubtypeOfNonSpecializedSignature.1.normal.js b/crates/swc/tests/tsc-references/specializedSignatureIsSubtypeOfNonSpecializedSignature.1.normal.js index a6a260b3632e..42136e3f7dff 100644 --- a/crates/swc/tests/tsc-references/specializedSignatureIsSubtypeOfNonSpecializedSignature.1.normal.js +++ b/crates/swc/tests/tsc-references/specializedSignatureIsSubtypeOfNonSpecializedSignature.1.normal.js @@ -1,4 +1,6 @@ //// [specializedSignatureIsSubtypeOfNonSpecializedSignature.ts] +// Specialized signatures must be a subtype of a non-specialized signature +// All the below should not be errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x) {} var C = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.1.normal.js b/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.1.normal.js index c7ec472e038d..e482bd81e100 100644 --- a/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.1.normal.js +++ b/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.1.normal.js @@ -1,4 +1,5 @@ //// [spreadContextualTypedBindingPattern.ts] +// #18308 import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; // [ts] Initializer provides no value for this binding element and the binding element has no default value. var _$_object_spread = _object_spread({}, bob, alice), naam = _$_object_spread.naam, age = _$_object_spread.age; diff --git a/crates/swc/tests/tsc-references/spreadDuplicate.1.normal.js b/crates/swc/tests/tsc-references/spreadDuplicate.1.normal.js index 8a09a186294e..89d2d82d5b82 100644 --- a/crates/swc/tests/tsc-references/spreadDuplicate.1.normal.js +++ b/crates/swc/tests/tsc-references/spreadDuplicate.1.normal.js @@ -1,4 +1,5 @@ //// [spreadDuplicate.ts] +// Repro from #44438 import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; var a1 = _object_spread({ a: 123 diff --git a/crates/swc/tests/tsc-references/spreadDuplicateExact.1.normal.js b/crates/swc/tests/tsc-references/spreadDuplicateExact.1.normal.js index c3a5186195f3..05c88eb3ead7 100644 --- a/crates/swc/tests/tsc-references/spreadDuplicateExact.1.normal.js +++ b/crates/swc/tests/tsc-references/spreadDuplicateExact.1.normal.js @@ -1,4 +1,5 @@ //// [spreadDuplicateExact.ts] +// Repro from #44438 import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; var a1 = _object_spread({ a: 123 diff --git a/crates/swc/tests/tsc-references/spreadNonObject1.1.normal.js b/crates/swc/tests/tsc-references/spreadNonObject1.1.normal.js index dfe90095036c..25a8eeb414e8 100644 --- a/crates/swc/tests/tsc-references/spreadNonObject1.1.normal.js +++ b/crates/swc/tests/tsc-references/spreadNonObject1.1.normal.js @@ -1,4 +1,5 @@ //// [spreadNonObject1.ts] +// https://github.com/microsoft/TypeScript/issues/45493 import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; var b = { diff --git a/crates/swc/tests/tsc-references/spreadOverwritesProperty.1.normal.js b/crates/swc/tests/tsc-references/spreadOverwritesProperty.1.normal.js index 32e56dc757a2..532b9f294fe0 100644 --- a/crates/swc/tests/tsc-references/spreadOverwritesProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/spreadOverwritesProperty.1.normal.js @@ -1,4 +1,5 @@ //// [spreadOverwritesProperty.ts] +// without strict null checks, none of these should be an error import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; var unused1 = _object_spread({ b: 1 diff --git a/crates/swc/tests/tsc-references/staticIndexers.1.normal.js b/crates/swc/tests/tsc-references/staticIndexers.1.normal.js index f98188b8bfbc..15b767591a9c 100644 --- a/crates/swc/tests/tsc-references/staticIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/staticIndexers.1.normal.js @@ -1,6 +1,6 @@ //// [staticIndexers.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // static indexers not allowed +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/staticMembersUsingClassTypeParameter.1.normal.js b/crates/swc/tests/tsc-references/staticMembersUsingClassTypeParameter.1.normal.js index f2f069305bc4..acf9dfcd1864 100644 --- a/crates/swc/tests/tsc-references/staticMembersUsingClassTypeParameter.1.normal.js +++ b/crates/swc/tests/tsc-references/staticMembersUsingClassTypeParameter.1.normal.js @@ -1,6 +1,6 @@ //// [staticMembersUsingClassTypeParameter.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // BUG 745747 +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/strictBindCallApply2.1.normal.js b/crates/swc/tests/tsc-references/strictBindCallApply2.1.normal.js index 63ef9f66b3bb..e3b819b69620 100644 --- a/crates/swc/tests/tsc-references/strictBindCallApply2.1.normal.js +++ b/crates/swc/tests/tsc-references/strictBindCallApply2.1.normal.js @@ -1,4 +1,5 @@ //// [strictBindCallApply2.ts] +// Repro from #32964 function fn() {} var fb = fn.bind({ blub: "blub" diff --git a/crates/swc/tests/tsc-references/strictPropertyInitialization.1.normal.js b/crates/swc/tests/tsc-references/strictPropertyInitialization.1.normal.js index 4d46d0f54190..5014c8b041cd 100644 --- a/crates/swc/tests/tsc-references/strictPropertyInitialization.1.normal.js +++ b/crates/swc/tests/tsc-references/strictPropertyInitialization.1.normal.js @@ -1,9 +1,9 @@ //// [strictPropertyInitialization.ts] +// Properties with non-undefined types require initialization import { _ as _class_private_field_get } from "@swc/helpers/_/_class_private_field_get"; import { _ as _class_private_field_init } from "@swc/helpers/_/_class_private_field_init"; import { _ as _class_private_field_set } from "@swc/helpers/_/_class_private_field_set"; var _f = /*#__PURE__*/ new WeakMap(), _g = /*#__PURE__*/ new WeakMap(), _h = /*#__PURE__*/ new WeakMap(), _i = /*#__PURE__*/ new WeakMap(); -// Properties with non-undefined types require initialization class C1 { constructor(){ _class_private_field_init(this, _f, { diff --git a/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations.1.normal.js b/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations.1.normal.js index cc903d8522d6..53b93b72dad7 100644 --- a/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations.1.normal.js +++ b/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations.1.normal.js @@ -1,4 +1,5 @@ //// [stringIndexerConstrainsPropertyDeclarations.ts] +// String indexer types constrain the types of named properties in their containing type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; var C = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations2.1.normal.js b/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations2.1.normal.js index f32f8f906268..d327b922c960 100644 --- a/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations2.1.normal.js +++ b/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations2.1.normal.js @@ -1,8 +1,8 @@ //// [stringIndexerConstrainsPropertyDeclarations2.ts] +// String indexer providing a constraint of a user defined type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// String indexer providing a constraint of a user defined type var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/stringLiteralTypeIsSubtypeOfString.1.normal.js b/crates/swc/tests/tsc-references/stringLiteralTypeIsSubtypeOfString.1.normal.js index 3ff04b725e71..796cf4780197 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypeIsSubtypeOfString.1.normal.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypeIsSubtypeOfString.1.normal.js @@ -1,4 +1,6 @@ //// [stringLiteralTypeIsSubtypeOfString.ts] +// string literal types are subtypes of string, any +// ok import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f1(x) {} function f2(x) {} diff --git a/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures.1.normal.js b/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures.1.normal.js index 9e6410c37255..ecd808934274 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures.1.normal.js @@ -1,6 +1,6 @@ //// [stringLiteralTypesInImplementationSignatures.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // String literal types are only valid in overload signatures +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x) {} var f = function foo(x) {}; var f2 = function(x, y) {}; diff --git a/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures2.1.normal.js b/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures2.1.normal.js index 65f1cb8d5ce8..0d4fa712fab5 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures2.1.normal.js @@ -1,4 +1,5 @@ //// [stringLiteralTypesInImplementationSignatures2.ts] +// String literal types are only valid in overload signatures import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _define_property } from "@swc/helpers/_/_define_property"; function foo(x) {} diff --git a/crates/swc/tests/tsc-references/stringMappingDeferralInConditionalTypes.1.normal.js b/crates/swc/tests/tsc-references/stringMappingDeferralInConditionalTypes.1.normal.js index a7519051f6a0..da42b466e628 100644 --- a/crates/swc/tests/tsc-references/stringMappingDeferralInConditionalTypes.1.normal.js +++ b/crates/swc/tests/tsc-references/stringMappingDeferralInConditionalTypes.1.normal.js @@ -1,4 +1,5 @@ //// [stringMappingDeferralInConditionalTypes.ts] +// https://github.com/microsoft/TypeScript/issues/55847 var x1 = 1; // ok var x2 = 1; // ok var x3 = 1; // ok diff --git a/crates/swc/tests/tsc-references/stringMappingOverPatternLiterals.1.normal.js b/crates/swc/tests/tsc-references/stringMappingOverPatternLiterals.1.normal.js index 2ecfc4ee629f..81c7dbca5e20 100644 --- a/crates/swc/tests/tsc-references/stringMappingOverPatternLiterals.1.normal.js +++ b/crates/swc/tests/tsc-references/stringMappingOverPatternLiterals.1.normal.js @@ -1,4 +1,5 @@ //// [stringMappingOverPatternLiterals.ts] +// non-template function f1(a, b, c, a_template, b_template, c_template) { // non-template versions should be assignable to templated versions (empty string matches string) a_template = a; diff --git a/crates/swc/tests/tsc-references/subtypesOfAny.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfAny.1.normal.js index 29bc12944672..28ea7dc2b355 100644 --- a/crates/swc/tests/tsc-references/subtypesOfAny.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfAny.1.normal.js @@ -1,4 +1,5 @@ //// [subtypesOfAny.ts] +// every type is a subtype of any, no errors expected import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = function A() { "use strict"; diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameter.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameter.1.normal.js index 930e2564df93..34cb7ad41e12 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameter.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameter.1.normal.js @@ -1,8 +1,8 @@ //// [subtypesOfTypeParameter.ts] +// checking whether other types are subtypes of type parameters import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking whether other types are subtypes of type parameters var C3 = function C3() { "use strict"; _class_call_check(this, C3); diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints.1.normal.js index 9bccd8518e66..9363b72fb07c 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints.1.normal.js @@ -1,8 +1,8 @@ //// [subtypesOfTypeParameterWithConstraints.ts] +// checking whether other types are subtypes of type parameters with constraints import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking whether other types are subtypes of type parameters with constraints var C3 = function C3() { "use strict"; _class_call_check(this, C3); diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.1.normal.js index 2d617e2c6140..20a80a386063 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.1.normal.js @@ -1,6 +1,6 @@ //// [subtypesOfTypeParameterWithConstraints2.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // checking whether other types are subtypes of type parameters with constraints +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f1(x, y) { var r = true ? x : y; var r = true ? y : x; diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints4.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints4.1.normal.js index ccc51b0c264c..d16c38996409 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints4.1.normal.js @@ -1,8 +1,8 @@ //// [subtypesOfTypeParameterWithConstraints4.ts] +// checking whether other types are subtypes of type parameters with constraints import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking whether other types are subtypes of type parameters with constraints var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.1.normal.js index f318c7a449fa..09917977a1d7 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.1.normal.js @@ -1,8 +1,8 @@ //// [subtypesOfTypeParameterWithRecursiveConstraints.ts] +// checking whether other types are subtypes of type parameters with constraints import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking whether other types are subtypes of type parameters with constraints var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/subtypingWithCallSignatures2.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithCallSignatures2.1.normal.js index f47f46b598ab..f98b576580f7 100644 --- a/crates/swc/tests/tsc-references/subtypingWithCallSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithCallSignatures2.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithCallSignatures2.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.1.normal.js index 41265e2b06c1..5c710b14b022 100644 --- a/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.1.normal.js @@ -1,9 +1,9 @@ //// [subtypingWithCallSignatures3.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation +// error cases, so function calls will all result in 'any' import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation -// error cases, so function calls will all result in 'any' (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/subtypingWithCallSignatures4.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithCallSignatures4.1.normal.js index bb82a38772c9..c2971efc546a 100644 --- a/crates/swc/tests/tsc-references/subtypingWithCallSignatures4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithCallSignatures4.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithCallSignatures4.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures2.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures2.1.normal.js index d41f938338da..5c86a050ecfb 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures2.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithConstructSignatures2.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.1.normal.js index 39e783eceb5d..89161253577f 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.1.normal.js @@ -1,9 +1,9 @@ //// [subtypingWithConstructSignatures3.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation +// error cases, so function calls will all result in 'any' import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation -// error cases, so function calls will all result in 'any' (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures4.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures4.1.normal.js index 1fa9da33f9fb..43ec80a76a4d 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures4.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithConstructSignatures4.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures5.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures5.1.normal.js index 6d0b5fdc8abb..d974921a94c1 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures5.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures5.1.normal.js @@ -1,9 +1,9 @@ //// [subtypingWithConstructSignatures5.ts] +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// checking subtype relations for function types as it relates to contextual signature instantiation -// same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures6.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures6.1.normal.js index 8c454953aa6f..24eb1bcf877b 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures6.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures6.1.normal.js @@ -1,10 +1,10 @@ //// [subtypingWithConstructSignatures6.ts] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors +import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer.1.normal.js index f10f2dce91ea..f4445436320a 100644 --- a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithNumericIndexer.ts] +// Derived type indexer must be subtype of base type indexer import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; diff --git a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer3.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer3.1.normal.js index e1da128b103f..8f11acfa855e 100644 --- a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer3.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer3.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithNumericIndexer3.ts] +// Derived type indexer must be subtype of base type indexer import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; diff --git a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer4.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer4.1.normal.js index 07ceb8ddf9ba..a94809f7c11e 100644 --- a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer4.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithNumericIndexer4.ts] +// Derived type indexer must be subtype of base type indexer import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; diff --git a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer5.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer5.1.normal.js index 2f7298124de5..ee07fbb2d4c0 100644 --- a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer5.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer5.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithNumericIndexer5.ts] +// Derived type indexer must be subtype of base type indexer import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B() { "use strict"; diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembers4.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembers4.1.normal.js index ce22bf54ee9d..7c767810c7b8 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembers4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembers4.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithObjectMembers4.ts] +// subtyping when property names do not match import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// subtyping when property names do not match var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility.1.normal.js index 9c6d3385454b..1ebf62d85107 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithObjectMembersAccessibility.ts] +// Derived member is private, base member is not causes errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// Derived member is private, base member is not causes errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.1.normal.js index a9dbcf7a2e87..1c56c5101219 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithObjectMembersAccessibility2.ts] +// Derived member is private, base member is not causes errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// Derived member is private, base member is not causes errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality.1.normal.js index b2fd845b77d5..c68dddf69941 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithObjectMembersOptionality.ts] +// Derived member is not optional but base member is, should be ok // object literal case var a; var b = { diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality2.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality2.1.normal.js index 3ca8ee0f5100..c2ca02ed66c7 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality2.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality2.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithObjectMembersOptionality2.ts] +// Derived member is optional but base member is not, should be an error // object literal case var a; var b; diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality3.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality3.1.normal.js index e05b6dda6f96..8bbd5eebd206 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality3.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality3.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithObjectMembersOptionality3.ts] +// Base property is optional and derived type has no property of that name // object literal case var a; var b; diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality4.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality4.1.normal.js index 48d930204fbe..f86b3b31db9e 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality4.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithObjectMembersOptionality4.ts] +// Base has required property, derived adds an optional property, no errors // object literal case var a; var b; diff --git a/crates/swc/tests/tsc-references/subtypingWithStringIndexer.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithStringIndexer.1.normal.js index 604f974d46a4..67d1e4f70a23 100644 --- a/crates/swc/tests/tsc-references/subtypingWithStringIndexer.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithStringIndexer.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithStringIndexer.ts] +// Derived type indexer must be subtype of base type indexer import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; diff --git a/crates/swc/tests/tsc-references/subtypingWithStringIndexer3.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithStringIndexer3.1.normal.js index 8054677e9d6d..91f8606071ec 100644 --- a/crates/swc/tests/tsc-references/subtypingWithStringIndexer3.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithStringIndexer3.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithStringIndexer3.ts] +// Derived type indexer must be subtype of base type indexer import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; diff --git a/crates/swc/tests/tsc-references/subtypingWithStringIndexer4.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithStringIndexer4.1.normal.js index e2fd84aebcdf..218db35ba890 100644 --- a/crates/swc/tests/tsc-references/subtypingWithStringIndexer4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithStringIndexer4.1.normal.js @@ -1,4 +1,5 @@ //// [subtypingWithStringIndexer4.ts] +// Derived type indexer must be subtype of base type indexer import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; diff --git a/crates/swc/tests/tsc-references/superPropertyAccessNoError.1.normal.js b/crates/swc/tests/tsc-references/superPropertyAccessNoError.1.normal.js index 806789fff08f..0220643506d0 100644 --- a/crates/swc/tests/tsc-references/superPropertyAccessNoError.1.normal.js +++ b/crates/swc/tests/tsc-references/superPropertyAccessNoError.1.normal.js @@ -1,4 +1,10 @@ //// [superPropertyAccessNoError.ts] +//super.publicInstanceMemberFunction in constructor of derived class +//super.publicInstanceMemberFunction in instance member function of derived class +//super.publicInstanceMemberFunction in instance member accessor(get and set) of derived class +//super.publicInstanceMemberFunction in lambda in member function +//super.publicStaticMemberFunction in static member function of derived class +//super.publicStaticMemberFunction in static member accessor(get and set) of derived class import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized"; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; @@ -6,12 +12,6 @@ import { _ as _create_class } from "@swc/helpers/_/_create_class"; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -//super.publicInstanceMemberFunction in constructor of derived class -//super.publicInstanceMemberFunction in instance member function of derived class -//super.publicInstanceMemberFunction in instance member accessor(get and set) of derived class -//super.publicInstanceMemberFunction in lambda in member function -//super.publicStaticMemberFunction in static member function of derived class -//super.publicStaticMemberFunction in static member accessor(get and set) of derived class var SomeBaseClass = /*#__PURE__*/ function() { "use strict"; function SomeBaseClass() { diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js index 47e781b605c7..a84081b66df4 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js @@ -1,4 +1,5 @@ //// [taggedTemplateStringsTypeArgumentInference.ts] +// Generic tag with one parameter import { _ as _tagged_template_literal } from "@swc/helpers/_/_tagged_template_literal"; function _templateObject() { var data = _tagged_template_literal([ @@ -308,7 +309,6 @@ function _templateObject27() { }; return data; } -// Generic tag with one parameter function noParams(n) {} noParams(_templateObject()); // Generic tag with parameter which does not use type parameter diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.1.normal.js index 5d6deffa4a8c..ebb75280a2aa 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.1.normal.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3.1.normal.js @@ -1,4 +1,5 @@ //// [taggedTemplateStringsWithOverloadResolution3.ts] +// Ambiguous call picks the first overload in declaration order import { _ as _tagged_template_literal } from "@swc/helpers/_/_tagged_template_literal"; function _templateObject() { var data = _tagged_template_literal([ diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3_ES6.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3_ES6.1.normal.js index 56896dd4bd35..43a2687d3e0d 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3_ES6.1.normal.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithOverloadResolution3_ES6.1.normal.js @@ -1,4 +1,5 @@ //// [taggedTemplateStringsWithOverloadResolution3_ES6.ts] +// Ambiguous call picks the first overload in declaration order function fn1() { return null; } diff --git a/crates/swc/tests/tsc-references/templateInsideCallback.1.normal.js b/crates/swc/tests/tsc-references/templateInsideCallback.1.normal.js index 36fc7f59ef02..5089e3c7c1c4 100644 --- a/crates/swc/tests/tsc-references/templateInsideCallback.1.normal.js +++ b/crates/swc/tests/tsc-references/templateInsideCallback.1.normal.js @@ -1,5 +1,4 @@ //// [templateInsideCallback.js] -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; /** * @typedef Oops * @template T @@ -13,7 +12,8 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; */ /** * @template T * @type {Call} - */ var identity = function(x) { + */ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; +var identity = function(x) { return x; }; /** diff --git a/crates/swc/tests/tsc-references/templateLiteralTypes3.1.normal.js b/crates/swc/tests/tsc-references/templateLiteralTypes3.1.normal.js index ff53645e35b1..2363f10d72aa 100644 --- a/crates/swc/tests/tsc-references/templateLiteralTypes3.1.normal.js +++ b/crates/swc/tests/tsc-references/templateLiteralTypes3.1.normal.js @@ -1,4 +1,5 @@ //// [templateLiteralTypes3.ts] +// Inference from template literal type to template literal type function f1(s, n, b, t) { var x1 = foo1('hello'); // Error var x2 = foo1('*hello*'); diff --git a/crates/swc/tests/tsc-references/templateLiteralTypes4.1.normal.js b/crates/swc/tests/tsc-references/templateLiteralTypes4.1.normal.js index b6d3a9199dcd..b8417bbcb556 100644 --- a/crates/swc/tests/tsc-references/templateLiteralTypes4.1.normal.js +++ b/crates/swc/tests/tsc-references/templateLiteralTypes4.1.normal.js @@ -1,4 +1,5 @@ //// [templateLiteralTypes4.ts] +// infer from number p.getIndex(0); // ok, 0 is a valid index p.getIndex(1); // ok, 1 is a valid index p.getIndex(2); // error, 2 is not a valid index diff --git a/crates/swc/tests/tsc-references/templateLiteralTypes5.1.normal.js b/crates/swc/tests/tsc-references/templateLiteralTypes5.1.normal.js index aae48561ecb1..b1ed7654a674 100644 --- a/crates/swc/tests/tsc-references/templateLiteralTypes5.1.normal.js +++ b/crates/swc/tests/tsc-references/templateLiteralTypes5.1.normal.js @@ -1,4 +1,5 @@ //// [templateLiteralTypes5.ts] +// https://github.com/microsoft/TypeScript/issues/55364 const f1 = f; const f2 = f; function f3(x) { diff --git a/crates/swc/tests/tsc-references/templateLiteralTypes6.1.normal.js b/crates/swc/tests/tsc-references/templateLiteralTypes6.1.normal.js index 5829c50d8580..837be90a7c6b 100644 --- a/crates/swc/tests/tsc-references/templateLiteralTypes6.1.normal.js +++ b/crates/swc/tests/tsc-references/templateLiteralTypes6.1.normal.js @@ -1,4 +1,5 @@ //// [templateLiteralTypes6.ts] +// https://github.com/microsoft/TypeScript/issues/56659 function f2(scope, event) { f1(`${scope}:${event}`); } diff --git a/crates/swc/tests/tsc-references/templateLiteralTypes7.1.normal.js b/crates/swc/tests/tsc-references/templateLiteralTypes7.1.normal.js index d496ab04d56e..23213ef967db 100644 --- a/crates/swc/tests/tsc-references/templateLiteralTypes7.1.normal.js +++ b/crates/swc/tests/tsc-references/templateLiteralTypes7.1.normal.js @@ -1,4 +1,5 @@ //// [templateLiteralTypes7.ts] +// https://github.com/microsoft/TypeScript/issues/57807 const g1 = g; // ok const g2 = g; // error const g3 = g; // ok diff --git a/crates/swc/tests/tsc-references/thisTag3.1.normal.js b/crates/swc/tests/tsc-references/thisTag3.1.normal.js index 9a96d264d3eb..0fc60ebb150e 100644 --- a/crates/swc/tests/tsc-references/thisTag3.1.normal.js +++ b/crates/swc/tests/tsc-references/thisTag3.1.normal.js @@ -1,8 +1,8 @@ //// [/a.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @typedef {{fn(a: string): void}} T - */ var C = function C() { + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var C = function C() { "use strict"; var _this = this; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/thisTypeInFunctions.1.normal.js b/crates/swc/tests/tsc-references/thisTypeInFunctions.1.normal.js index f500eb7d6f67..1e9f203059a0 100644 --- a/crates/swc/tests/tsc-references/thisTypeInFunctions.1.normal.js +++ b/crates/swc/tests/tsc-references/thisTypeInFunctions.1.normal.js @@ -1,9 +1,9 @@ //// [thisTypeInFunctions.ts] +// body checking import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; var _this = this; -// body checking var B = function B() { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/throwStatements.1.normal.js b/crates/swc/tests/tsc-references/throwStatements.1.normal.js index e3d60c2d45f8..cd3917283192 100644 --- a/crates/swc/tests/tsc-references/throwStatements.1.normal.js +++ b/crates/swc/tests/tsc-references/throwStatements.1.normal.js @@ -1,4 +1,5 @@ //// [throwStatements.ts] +// all legal import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; var C = function C() { diff --git a/crates/swc/tests/tsc-references/topLevelAmbientModule.1.normal.js b/crates/swc/tests/tsc-references/topLevelAmbientModule.1.normal.js index a08bfe0da712..464acddbd614 100644 --- a/crates/swc/tests/tsc-references/topLevelAmbientModule.1.normal.js +++ b/crates/swc/tests/tsc-references/topLevelAmbientModule.1.normal.js @@ -1,10 +1,10 @@ //// [foo_0.ts] "use strict"; //// [foo_1.ts] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -/// var foo = require("foo"); var z = foo.x + 10; diff --git a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile.1.normal.js b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile.1.normal.js index e9ce80afa4af..8df8d12cd55c 100644 --- a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile.1.normal.js +++ b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile.1.normal.js @@ -13,11 +13,11 @@ var x = 42; //// [foo_1.ts] "use strict"; //// [foo_2.ts] +/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -/// var foo = require("vs/foo_0"); var z1 = foo.x + 10; // Should error, as declaration should win var z2 = foo.y() + 10; // Should resolve diff --git a/crates/swc/tests/tsc-references/tsNoCheckForTypescript.1.normal.js b/crates/swc/tests/tsc-references/tsNoCheckForTypescript.1.normal.js index e0b1e6eda6bc..25aabd23e158 100644 --- a/crates/swc/tests/tsc-references/tsNoCheckForTypescript.1.normal.js +++ b/crates/swc/tests/tsc-references/tsNoCheckForTypescript.1.normal.js @@ -1,6 +1,6 @@ //// [file.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // @ts-nocheck +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; export var a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment export var Bet = function Bet() { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments1.1.normal.js b/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments1.1.normal.js index 6d9b2371b1c4..8f685024ddd6 100644 --- a/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments1.1.normal.js +++ b/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments1.1.normal.js @@ -1,6 +1,6 @@ //// [file.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // @ts-nocheck additional comments +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; export var a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment export var Bet = function Bet() { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments2.1.normal.js b/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments2.1.normal.js index eead981337da..2ba4e38033df 100644 --- a/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments2.1.normal.js +++ b/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments2.1.normal.js @@ -1,6 +1,6 @@ //// [file.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // @ts-nocheck: additional comments +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; export var a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment export var Bet = function Bet() { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsxElementResolution17.1.normal.js b/crates/swc/tests/tsc-references/tsxElementResolution17.1.normal.js index c2dbc6a19de3..fc9aad8cb821 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution17.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution17.1.normal.js @@ -11,6 +11,8 @@ define([ "use strict"; }); //// [consumer.tsx] +/// +// Should keep s1 and elide s2 define([ "require", "exports", diff --git a/crates/swc/tests/tsc-references/tsxElementResolution19.1.normal.js b/crates/swc/tests/tsc-references/tsxElementResolution19.1.normal.js index 1a191bcda468..c290afc781c8 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution19.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution19.1.normal.js @@ -32,6 +32,7 @@ define([ }; }); //// [file2.tsx] +// Should not elide React import define([ "require", "exports", diff --git a/crates/swc/tests/tsc-references/tsxPreserveEmit1.1.normal.js b/crates/swc/tests/tsc-references/tsxPreserveEmit1.1.normal.js index 7a553993431c..21df9d3e7f41 100644 --- a/crates/swc/tests/tsc-references/tsxPreserveEmit1.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxPreserveEmit1.1.normal.js @@ -11,6 +11,7 @@ define([ "use strict"; }); //// [test.tsx] +// Should emit 'react-router' in the AMD dependency list define([ "require", "exports", diff --git a/crates/swc/tests/tsc-references/tsxPreserveEmit3.1.normal.js b/crates/swc/tests/tsc-references/tsxPreserveEmit3.1.normal.js index 100f96afa8a9..e154042f8208 100644 --- a/crates/swc/tests/tsc-references/tsxPreserveEmit3.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxPreserveEmit3.1.normal.js @@ -28,6 +28,7 @@ define([ var React; }); //// [react-consumer.tsx] +// This import should be elided define([ "require", "exports", diff --git a/crates/swc/tests/tsc-references/tsxTypeErrors.1.normal.js b/crates/swc/tests/tsc-references/tsxTypeErrors.1.normal.js index 87b3724600e3..83b096809626 100644 --- a/crates/swc/tests/tsc-references/tsxTypeErrors.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxTypeErrors.1.normal.js @@ -1,6 +1,6 @@ //// [tsxTypeErrors.tsx] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // A built-in element (OK) +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var a1 = /*#__PURE__*/ React.createElement("div", { id: "foo" }); diff --git a/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule.1.normal.js b/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule.1.normal.js index 20ab131a80bc..50d6e6b6fce9 100644 --- a/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule.1.normal.js +++ b/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule.1.normal.js @@ -1,4 +1,5 @@ //// [twoInterfacesDifferentRootModule.ts] +// two interfaces with different root modules should not merge (function(M2) { var a; var r1 = a.foo; // error diff --git a/crates/swc/tests/tsc-references/twoMergedInterfacesWithDifferingOverloads.1.normal.js b/crates/swc/tests/tsc-references/twoMergedInterfacesWithDifferingOverloads.1.normal.js index 68bbf433bb56..c21eee905ed6 100644 --- a/crates/swc/tests/tsc-references/twoMergedInterfacesWithDifferingOverloads.1.normal.js +++ b/crates/swc/tests/tsc-references/twoMergedInterfacesWithDifferingOverloads.1.normal.js @@ -1,4 +1,5 @@ //// [twoMergedInterfacesWithDifferingOverloads.ts] +// interfaces that merge must not have members that conflict var b; var r = b.foo(true); // returns Date var c; diff --git a/crates/swc/tests/tsc-references/typeAliases.1.normal.js b/crates/swc/tests/tsc-references/typeAliases.1.normal.js index 52e16bbd0444..6d39109add92 100644 --- a/crates/swc/tests/tsc-references/typeAliases.1.normal.js +++ b/crates/swc/tests/tsc-references/typeAliases.1.normal.js @@ -1,4 +1,5 @@ //// [typeAliases.ts] +// Writing a reference to a type alias has exactly the same effect as writing the aliased type itself. import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var x1; var x1; diff --git a/crates/swc/tests/tsc-references/typeArgumentInferenceConstructSignatures.1.normal.js b/crates/swc/tests/tsc-references/typeArgumentInferenceConstructSignatures.1.normal.js index 6a6d5764c0d5..efbeba1e8585 100644 --- a/crates/swc/tests/tsc-references/typeArgumentInferenceConstructSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/typeArgumentInferenceConstructSignatures.1.normal.js @@ -1,4 +1,5 @@ //// [typeArgumentInferenceConstructSignatures.ts] +// Generic call with no parameters var noParams; new noParams(); new noParams(); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment28.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment28.1.normal.js index bf02e66ecac2..09442c6b7e30 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment28.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment28.1.normal.js @@ -1,6 +1,6 @@ //// [a.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // mixed prototype-assignment+class declaration +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment35.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment35.1.normal.js index f7bee3adc22c..e2867dd0f30a 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment35.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment35.1.normal.js @@ -1,7 +1,7 @@ //// [typeFromPropertyAssignment35.ts] //// [bug26877.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -/** @param {Emu.D} x */ function ollKorrect(x) { +/** @param {Emu.D} x */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +function ollKorrect(x) { x._model; var y = new Emu.D(); var z = Emu.D._wrapperInstance; diff --git a/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOf.1.normal.js b/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOf.1.normal.js index 71a900d1ecb3..4079dd33bb16 100644 --- a/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOf.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOf.1.normal.js @@ -1,13 +1,13 @@ //// [typeGuardOfFormInstanceOf.ts] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; -import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; // 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. +import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; var C1 = function C1() { "use strict"; _class_call_check(this, C1); diff --git a/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOfOnInterface.1.normal.js b/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOfOnInterface.1.normal.js index 186ec678e4a4..544262bba4f4 100644 --- a/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOfOnInterface.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOfOnInterface.1.normal.js @@ -1,4 +1,9 @@ //// [typeGuardOfFormInstanceOfOnInterface.ts] +// 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. import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; var str; var num; diff --git a/crates/swc/tests/tsc-references/typeGuardsInClassAccessors.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsInClassAccessors.1.normal.js index 07ce0748080c..6b2cda0a44e0 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInClassAccessors.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsInClassAccessors.1.normal.js @@ -1,9 +1,9 @@ //// [typeGuardsInClassAccessors.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _create_class } from "@swc/helpers/_/_create_class"; // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. // variables in global +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _create_class } from "@swc/helpers/_/_create_class"; var num; var strOrNum; var var1; diff --git a/crates/swc/tests/tsc-references/typeGuardsInClassMethods.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsInClassMethods.1.normal.js index e8dd5d5dd789..38676ea83685 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInClassMethods.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsInClassMethods.1.normal.js @@ -1,8 +1,8 @@ //// [typeGuardsInClassMethods.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. // variables in global +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var num; var var1; var C1 = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/typeGuardsInExternalModule.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsInExternalModule.1.normal.js index 53b944048a5b..cc0928fd81cb 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInExternalModule.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsInExternalModule.1.normal.js @@ -1,4 +1,7 @@ //// [typeGuardsInExternalModule.ts] +// Note that type guards affect types of variables and parameters only and +// have no effect on members of objects such as properties. +// local variable in external module "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -9,9 +12,6 @@ Object.defineProperty(exports, "var2", { return var2; } }); -// Note that type guards affect types of variables and parameters only and -// have no effect on members of objects such as properties. -// local variable in external module var num; var var1; if (typeof var1 === "string") { diff --git a/crates/swc/tests/tsc-references/typeGuardsInProperties.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsInProperties.1.normal.js index 52fdcf211ac7..aef0763720e1 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInProperties.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsInProperties.1.normal.js @@ -1,8 +1,8 @@ //// [typeGuardsInProperties.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _create_class } from "@swc/helpers/_/_create_class"; // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _create_class } from "@swc/helpers/_/_create_class"; var num; var strOrNum; var C1 = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/typeGuardsOnClassProperty.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsOnClassProperty.1.normal.js index 0c2de9f9eb2c..0ced8289a895 100644 --- a/crates/swc/tests/tsc-references/typeGuardsOnClassProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsOnClassProperty.1.normal.js @@ -1,9 +1,9 @@ //// [typeGuardsOnClassProperty.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. // Note that the class's property must be copied to a local variable for // the type guard to have an effect +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var D = /*#__PURE__*/ function() { "use strict"; function D() { diff --git a/crates/swc/tests/tsc-references/typeGuardsTypeParameters.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsTypeParameters.1.normal.js index 861b4dd87f77..45d849e75f2d 100644 --- a/crates/swc/tests/tsc-references/typeGuardsTypeParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsTypeParameters.1.normal.js @@ -1,7 +1,7 @@ //// [typeGuardsTypeParameters.ts] +// Type guards involving type parameters produce intersection types import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; -// Type guards involving type parameters produce intersection types var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/typeOfThisInConstructorParamList.1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInConstructorParamList.1.normal.js index 33cc9c34102c..2fe66db3d454 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInConstructorParamList.1.normal.js +++ b/crates/swc/tests/tsc-references/typeOfThisInConstructorParamList.1.normal.js @@ -1,6 +1,6 @@ //// [typeOfThisInConstructorParamList.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; //type of 'this' in constructor param list is the class instance type (error) +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var ErrClass = function ErrClass() { "use strict"; var f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this; diff --git a/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.1.normal.js index 36de7e600694..7fbabdc8ee0d 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.1.normal.js +++ b/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.1.normal.js @@ -1,6 +1,6 @@ //// [typeOfThisInFunctionExpression.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // type of 'this' in FunctionExpression is Any +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function fn() { var p = this; var p; diff --git a/crates/swc/tests/tsc-references/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.1.normal.js index 2930b7484c2b..5a71e0a9e519 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.1.normal.js +++ b/crates/swc/tests/tsc-references/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.1.normal.js @@ -1,4 +1,5 @@ //// [typeOfThisInstanceMemberNarrowedWithLoopAntecedent.ts] +// #31995 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var SomeClass = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/typeParameterAsBaseType.1.normal.js b/crates/swc/tests/tsc-references/typeParameterAsBaseType.1.normal.js index 7309645472f9..1db4c5c82a26 100644 --- a/crates/swc/tests/tsc-references/typeParameterAsBaseType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterAsBaseType.1.normal.js @@ -1,9 +1,9 @@ //// [typeParameterAsBaseType.ts] +// type parameters cannot be used as base types +// these are all errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// type parameters cannot be used as base types -// these are all errors var C = /*#__PURE__*/ function(T1) { "use strict"; _inherits(C, T1); diff --git a/crates/swc/tests/tsc-references/typeParameterAsTypeArgument.1.normal.js b/crates/swc/tests/tsc-references/typeParameterAsTypeArgument.1.normal.js index 346b3786cc43..67885c4cc3b5 100644 --- a/crates/swc/tests/tsc-references/typeParameterAsTypeArgument.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterAsTypeArgument.1.normal.js @@ -1,6 +1,6 @@ //// [typeParameterAsTypeArgument.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // These are all errors because type parameters cannot reference other type parameters from the same list +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x, y) { foo(y, y); return new C(); diff --git a/crates/swc/tests/tsc-references/typeParameterAsTypeParameterConstraintTransitively.1.normal.js b/crates/swc/tests/tsc-references/typeParameterAsTypeParameterConstraintTransitively.1.normal.js index 0d064ffcee7c..28a6ec569570 100644 --- a/crates/swc/tests/tsc-references/typeParameterAsTypeParameterConstraintTransitively.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterAsTypeParameterConstraintTransitively.1.normal.js @@ -1,4 +1,6 @@ //// [typeParameterAsTypeParameterConstraintTransitively.ts] +// using a type parameter as a constraint for a type parameter is valid +// no errors expected var a; var b; var c; diff --git a/crates/swc/tests/tsc-references/typeParameterAsTypeParameterConstraintTransitively2.1.normal.js b/crates/swc/tests/tsc-references/typeParameterAsTypeParameterConstraintTransitively2.1.normal.js index 6ee9d63bdd79..52c5ffa07ade 100644 --- a/crates/swc/tests/tsc-references/typeParameterAsTypeParameterConstraintTransitively2.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterAsTypeParameterConstraintTransitively2.1.normal.js @@ -1,4 +1,6 @@ //// [typeParameterAsTypeParameterConstraintTransitively2.ts] +// using a type parameter as a constraint for a type parameter is invalid +// these should be errors at the type parameter constraint declarations, and have no downstream errors var a; var b; var c; diff --git a/crates/swc/tests/tsc-references/typeParameterAssignability3.1.normal.js b/crates/swc/tests/tsc-references/typeParameterAssignability3.1.normal.js index 7af6f12629fd..a9dec1462f25 100644 --- a/crates/swc/tests/tsc-references/typeParameterAssignability3.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterAssignability3.1.normal.js @@ -1,6 +1,6 @@ //// [typeParameterAssignability3.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // type parameters are not assignable to one another unless directly or indirectly constrained to one another +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/typeParameterConstModifiersWithIntersection.1.normal.js b/crates/swc/tests/tsc-references/typeParameterConstModifiersWithIntersection.1.normal.js index 6f0c2db6c0a3..00b91fc4ce9d 100644 --- a/crates/swc/tests/tsc-references/typeParameterConstModifiersWithIntersection.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterConstModifiersWithIntersection.1.normal.js @@ -1,4 +1,5 @@ //// [typeParameterConstModifiersWithIntersection.ts] +// https://github.com/microsoft/TypeScript/issues/55778 var result = test({ produceThing: {}, useIt: { diff --git a/crates/swc/tests/tsc-references/typeParameterDirectlyConstrainedToItself.1.normal.js b/crates/swc/tests/tsc-references/typeParameterDirectlyConstrainedToItself.1.normal.js index 1169ef145634..f0a8f65050f9 100644 --- a/crates/swc/tests/tsc-references/typeParameterDirectlyConstrainedToItself.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterDirectlyConstrainedToItself.1.normal.js @@ -1,6 +1,6 @@ //// [typeParameterDirectlyConstrainedToItself.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // all of the below should be errors +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/typeParameterUsedAsTypeParameterConstraint4.1.normal.js b/crates/swc/tests/tsc-references/typeParameterUsedAsTypeParameterConstraint4.1.normal.js index 40ce42181c92..5c8e69643c40 100644 --- a/crates/swc/tests/tsc-references/typeParameterUsedAsTypeParameterConstraint4.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterUsedAsTypeParameterConstraint4.1.normal.js @@ -1,7 +1,7 @@ //// [typeParameterUsedAsTypeParameterConstraint4.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Type parameters are in scope in their own and other type parameter lists // Some negative cases +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/typeParametersAreIdenticalToThemselves.1.normal.js b/crates/swc/tests/tsc-references/typeParametersAreIdenticalToThemselves.1.normal.js index e775a3e328d4..cdae603e40b9 100644 --- a/crates/swc/tests/tsc-references/typeParametersAreIdenticalToThemselves.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParametersAreIdenticalToThemselves.1.normal.js @@ -1,4 +1,5 @@ //// [typeParametersAreIdenticalToThemselves.ts] +// type parameters from the same declaration are identical to themself import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo1(x) {} function foo2(x) {} diff --git a/crates/swc/tests/tsc-references/typedefCrossModule2.1.normal.js b/crates/swc/tests/tsc-references/typedefCrossModule2.1.normal.js index 43f9cb3dcccb..760800aa52ee 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule2.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule2.1.normal.js @@ -1,7 +1,7 @@ //// [mod1.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // error -/** @typedef {number} Foo */ var Foo = function Foo() { +/** @typedef {number} Foo */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); } // should error diff --git a/crates/swc/tests/tsc-references/typedefCrossModule3.1.normal.js b/crates/swc/tests/tsc-references/typedefCrossModule3.1.normal.js index ddfc755e1977..d93af613ccc7 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule3.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule3.1.normal.js @@ -1,6 +1,6 @@ //// [mod2.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -/** @typedef {number} Foo */ var ns = {}; +/** @typedef {number} Foo */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var ns = {}; ns.Foo = function _class() { "use strict"; _class_call_check(this, _class); diff --git a/crates/swc/tests/tsc-references/typedefCrossModule4.1.normal.js b/crates/swc/tests/tsc-references/typedefCrossModule4.1.normal.js index ae6266bdf7a3..11e7a388363e 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule4.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule4.1.normal.js @@ -1,6 +1,6 @@ //// [mod3.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -/** @typedef {number} Foo */ var Bar = function Bar() { +/** @typedef {number} Foo */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var Bar = function Bar() { "use strict"; _class_call_check(this, Bar); }; diff --git a/crates/swc/tests/tsc-references/typedefCrossModule5.1.normal.js b/crates/swc/tests/tsc-references/typedefCrossModule5.1.normal.js index d31a2a6a7951..733d0bc711fd 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule5.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule5.1.normal.js @@ -1,6 +1,6 @@ //// [mod1.js] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -/** @typedef {number} Foo */ var Bar = function Bar() { +/** @typedef {number} Foo */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +var Bar = function Bar() { "use strict"; _class_call_check(this, Bar); }; diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.1.normal.js b/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.1.normal.js index 975d668ed3ea..a26bf594507b 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.1.normal.js @@ -1,7 +1,7 @@ //// [typeofOperatorWithAnyOtherType.ts] +// typeof operator on any type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; -// typeof operator on any type var ANY; var ANY1; var ANY2 = [ diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.1.normal.js index b090c375c6d3..535acefeb15e 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.1.normal.js @@ -1,7 +1,7 @@ //// [typeofOperatorWithBooleanType.ts] +// typeof operator on boolean type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; -// typeof operator on boolean type var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.1.normal.js b/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.1.normal.js index ad4fb37a6a38..0754976ac8b0 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.1.normal.js @@ -1,6 +1,6 @@ //// [typeofOperatorWithEnumType.ts] -import { _ as _type_of } from "@swc/helpers/_/_type_of"; // typeof operator on enum type +import { _ as _type_of } from "@swc/helpers/_/_type_of"; var ENUM = /*#__PURE__*/ function(ENUM) { return ENUM; }(ENUM || {}); diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.1.normal.js index 0183e56f32bf..69f37acb8a90 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.1.normal.js @@ -1,7 +1,7 @@ //// [typeofOperatorWithNumberType.ts] +// typeof operator on number type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; -// typeof operator on number type var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/typeofOperatorWithStringType.1.normal.js index a7afee43df9c..265011992ca3 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithStringType.1.normal.js @@ -1,7 +1,7 @@ //// [typeofOperatorWithStringType.ts] +// typeof operator on string type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; -// typeof operator on string type var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/typesWithOptionalProperty.1.normal.js b/crates/swc/tests/tsc-references/typesWithOptionalProperty.1.normal.js index 30ef58bca492..83a9a8ffa048 100644 --- a/crates/swc/tests/tsc-references/typesWithOptionalProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/typesWithOptionalProperty.1.normal.js @@ -1,4 +1,5 @@ //// [typesWithOptionalProperty.ts] +// basic uses of optional properties without errors var a; var b = { foo: '' diff --git a/crates/swc/tests/tsc-references/typesWithPublicConstructor.1.normal.js b/crates/swc/tests/tsc-references/typesWithPublicConstructor.1.normal.js index d3c08cde5a8f..6d8a06334fa5 100644 --- a/crates/swc/tests/tsc-references/typesWithPublicConstructor.1.normal.js +++ b/crates/swc/tests/tsc-references/typesWithPublicConstructor.1.normal.js @@ -1,6 +1,6 @@ //// [typesWithPublicConstructor.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // public is allowed on a constructor but is not meaningful +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/typesWithSpecializedCallSignatures.1.normal.js b/crates/swc/tests/tsc-references/typesWithSpecializedCallSignatures.1.normal.js index b34a3cc5d670..33d39cefbca4 100644 --- a/crates/swc/tests/tsc-references/typesWithSpecializedCallSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/typesWithSpecializedCallSignatures.1.normal.js @@ -1,8 +1,8 @@ //// [typesWithSpecializedCallSignatures.ts] +// basic uses of specialized signatures without errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// basic uses of specialized signatures without errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/typesWithSpecializedConstructSignatures.1.normal.js b/crates/swc/tests/tsc-references/typesWithSpecializedConstructSignatures.1.normal.js index be897c7a11e4..72cde8843d1b 100644 --- a/crates/swc/tests/tsc-references/typesWithSpecializedConstructSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/typesWithSpecializedConstructSignatures.1.normal.js @@ -1,8 +1,8 @@ //// [typesWithSpecializedConstructSignatures.ts] +// basic uses of specialized signatures without errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// basic uses of specialized signatures without errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.1.normal.js b/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.1.normal.js index 303537e2d88b..c47f98012763 100644 --- a/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.1.normal.js +++ b/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.1.normal.js @@ -1,8 +1,8 @@ //// [undefinedIsSubtypeOfEverything.ts] +// undefined is a subtype of every other types, no errors expected below import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// undefined is a subtype of every other types, no errors expected below var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/unionAndIntersectionInference1.1.normal.js b/crates/swc/tests/tsc-references/unionAndIntersectionInference1.1.normal.js index ac1ff1effb20..f687a295cdfc 100644 --- a/crates/swc/tests/tsc-references/unionAndIntersectionInference1.1.normal.js +++ b/crates/swc/tests/tsc-references/unionAndIntersectionInference1.1.normal.js @@ -1,4 +1,5 @@ //// [unionAndIntersectionInference1.ts] +// Repro from #2264 var y = undefined; function destructure(something, haveValue, haveY) { return something === y ? haveY(y) : haveValue(something); diff --git a/crates/swc/tests/tsc-references/unionAndIntersectionInference3.1.normal.js b/crates/swc/tests/tsc-references/unionAndIntersectionInference3.1.normal.js index 79363807ed26..35923a2ec038 100644 --- a/crates/swc/tests/tsc-references/unionAndIntersectionInference3.1.normal.js +++ b/crates/swc/tests/tsc-references/unionAndIntersectionInference3.1.normal.js @@ -1,4 +1,5 @@ //// [unionAndIntersectionInference3.ts] +// Repro from #30720 concatMaybe([ 1, 2, diff --git a/crates/swc/tests/tsc-references/unionTypeCallSignatures5.1.normal.js b/crates/swc/tests/tsc-references/unionTypeCallSignatures5.1.normal.js index c2220c057fc4..e9265bf08f54 100644 --- a/crates/swc/tests/tsc-references/unionTypeCallSignatures5.1.normal.js +++ b/crates/swc/tests/tsc-references/unionTypeCallSignatures5.1.normal.js @@ -1,2 +1,3 @@ //// [unionTypeCallSignatures5.ts] +// #31485 fn(0); diff --git a/crates/swc/tests/tsc-references/unionTypeCallSignatures7.1.normal.js b/crates/swc/tests/tsc-references/unionTypeCallSignatures7.1.normal.js index 1d6a0e75a592..bf9eadd768f1 100644 --- a/crates/swc/tests/tsc-references/unionTypeCallSignatures7.1.normal.js +++ b/crates/swc/tests/tsc-references/unionTypeCallSignatures7.1.normal.js @@ -1,2 +1,3 @@ //// [unionTypeCallSignatures7.ts] +// https://github.com/microsoft/TypeScript/issues/55203 var result = f(123); diff --git a/crates/swc/tests/tsc-references/unionTypeEquivalence.1.normal.js b/crates/swc/tests/tsc-references/unionTypeEquivalence.1.normal.js index 48e9278db163..f2891af7f0a6 100644 --- a/crates/swc/tests/tsc-references/unionTypeEquivalence.1.normal.js +++ b/crates/swc/tests/tsc-references/unionTypeEquivalence.1.normal.js @@ -1,8 +1,8 @@ //// [unionTypeEquivalence.ts] +// A | B is equivalent to A if B is a subtype of A import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -// A | B is equivalent to A if B is a subtype of A var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/unionTypeFromArrayLiteral.1.normal.js b/crates/swc/tests/tsc-references/unionTypeFromArrayLiteral.1.normal.js index c96c06cf38e4..ad460ccc3cbe 100644 --- a/crates/swc/tests/tsc-references/unionTypeFromArrayLiteral.1.normal.js +++ b/crates/swc/tests/tsc-references/unionTypeFromArrayLiteral.1.normal.js @@ -1,11 +1,11 @@ //// [unionTypeFromArrayLiteral.ts] -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; // The resulting type an array literal expression is determined as follows: // If the array literal is empty, the resulting type is an array type with the element type Undefined. // Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions. // Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. +import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; var arr1 = [ 1, 2 diff --git a/crates/swc/tests/tsc-references/unknownType1.1.normal.js b/crates/swc/tests/tsc-references/unknownType1.1.normal.js index a3520dcf878a..8adac3798a62 100644 --- a/crates/swc/tests/tsc-references/unknownType1.1.normal.js +++ b/crates/swc/tests/tsc-references/unknownType1.1.normal.js @@ -1,4 +1,5 @@ //// [unknownType1.ts] +// In an intersection everything absorbs unknown import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _extends } from "@swc/helpers/_/_extends"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; diff --git a/crates/swc/tests/tsc-references/variadicTuples1.1.normal.js b/crates/swc/tests/tsc-references/variadicTuples1.1.normal.js index 409f098250af..6f31817c4243 100644 --- a/crates/swc/tests/tsc-references/variadicTuples1.1.normal.js +++ b/crates/swc/tests/tsc-references/variadicTuples1.1.normal.js @@ -1,4 +1,5 @@ //// [variadicTuples1.ts] +// Variadics in tuple types import { _ as _to_array } from "@swc/helpers/_/_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // Variadics in array literals diff --git a/crates/swc/tests/tsc-references/variance.1.normal.js b/crates/swc/tests/tsc-references/variance.1.normal.js index 4b3c1f64f774..fdccabf1f2b0 100644 --- a/crates/swc/tests/tsc-references/variance.1.normal.js +++ b/crates/swc/tests/tsc-references/variance.1.normal.js @@ -1,4 +1,6 @@ //// [variance.ts] +// Test cases for parameter variances affected by conditional types. +// Repro from #30047 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var foo = { prop: true diff --git a/crates/swc/tests/tsc-references/verbatimModuleSyntaxNoElisionCJS.1.normal.js b/crates/swc/tests/tsc-references/verbatimModuleSyntaxNoElisionCJS.1.normal.js index b95836cc1c38..851187f56bbb 100644 --- a/crates/swc/tests/tsc-references/verbatimModuleSyntaxNoElisionCJS.1.normal.js +++ b/crates/swc/tests/tsc-references/verbatimModuleSyntaxNoElisionCJS.1.normal.js @@ -28,4 +28,5 @@ module.exports = I; const I = {}; module.exports = I; //// [/z.ts] +// test harness is weird if the last file includs a require >:( "use strict"; diff --git a/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.1.normal.js b/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.1.normal.js index a9978e0c1c80..c091a716ace3 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.1.normal.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.1.normal.js @@ -1,6 +1,6 @@ //// [voidOperatorWithAnyOtherType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // void operator on any type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var ANY; var ANY1; var ANY2 = [ diff --git a/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.1.normal.js index 0cd2d94873be..272d12b8a01c 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.1.normal.js @@ -1,6 +1,6 @@ //// [voidOperatorWithBooleanType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // void operator on boolean type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/voidOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/voidOperatorWithNumberType.1.normal.js index 9024efe26568..ffbc7a4a23e8 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [voidOperatorWithNumberType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // void operator on number type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/voidOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/voidOperatorWithStringType.1.normal.js index 7eda370760e1..0ca7fdabbca9 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithStringType.1.normal.js @@ -1,6 +1,6 @@ //// [voidOperatorWithStringType.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // void operator on string type +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/witness.1.normal.js b/crates/swc/tests/tsc-references/witness.1.normal.js index 96db76824025..b947374e26c9 100644 --- a/crates/swc/tests/tsc-references/witness.1.normal.js +++ b/crates/swc/tests/tsc-references/witness.1.normal.js @@ -1,6 +1,6 @@ //// [witness.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Initializers +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var varInit = varInit; // any var pInit; function fn() { diff --git a/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints.1.normal.js b/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints.1.normal.js index 22f9743face0..3f93b015131e 100644 --- a/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints.1.normal.js @@ -1,6 +1,6 @@ //// [wrappedAndRecursiveConstraints.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C(data) { diff --git a/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints3.1.normal.js b/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints3.1.normal.js index 7e8a38acc2e8..d419671882ea 100644 --- a/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints3.1.normal.js +++ b/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints3.1.normal.js @@ -1,6 +1,6 @@ //// [wrappedAndRecursiveConstraints3.ts] -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // no errors expected +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C(x) { diff --git a/crates/swc/tests/tsc-references/yieldExpressionInControlFlow.1.normal.js b/crates/swc/tests/tsc-references/yieldExpressionInControlFlow.1.normal.js index 269f5021c236..e80ad3923cf7 100644 --- a/crates/swc/tests/tsc-references/yieldExpressionInControlFlow.1.normal.js +++ b/crates/swc/tests/tsc-references/yieldExpressionInControlFlow.1.normal.js @@ -27,9 +27,9 @@ function f() { }); } //// [alsoFails.ts] +// fails in Typescript too import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; import { _ as _ts_values } from "@swc/helpers/_/_ts_values"; -// fails in Typescript too function g() { var o; return _ts_generator(this, function(_state) { diff --git a/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js b/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js index b745d7476a29..04534538bfd6 100644 --- a/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js +++ b/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js @@ -1,13 +1,13 @@ -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ import { groupBy } from '../../../base/common/arrays.js'; +import { groupBy } from '../../../base/common/arrays.js'; import { dispose } from '../../../base/common/lifecycle.js'; import { getLeadingWhitespace } from '../../../base/common/strings.js'; import './snippetSession.css'; From 69dd256547da7046f9f1fee55f203350453d279c Mon Sep 17 00:00:00 2001 From: DongYun Kang Date: Wed, 19 Nov 2025 16:12:40 -0500 Subject: [PATCH 4/8] clippy --- crates/swc_ecma_codegen/src/lib.rs | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/crates/swc_ecma_codegen/src/lib.rs b/crates/swc_ecma_codegen/src/lib.rs index e61a8463bc6e..6c6f533e1227 100644 --- a/crates/swc_ecma_codegen/src/lib.rs +++ b/crates/swc_ecma_codegen/src/lib.rs @@ -1431,16 +1431,12 @@ impl MacroNode for Program { impl MacroNode for Module { #[tracing::instrument(level = "debug", skip_all)] fn emit(&mut self, emitter: &mut Macro) -> Result { - let first_stmt_span_lo = self.body.first().map(|s| s.span().lo); + let should_skip_leading_comments = self + .body + .first() + .is_some_and(|s| s.span().lo == self.span.lo); - // If the first statement and module span are the same, then do not take the - // comment of the module. - - let should_skip = first_stmt_span_lo - .map(|lo| lo == self.span.lo) - .unwrap_or(false); - - if !should_skip { + if !should_skip_leading_comments { emitter.emit_leading_comments_of_span(self.span(), false)?; } @@ -1470,16 +1466,12 @@ impl MacroNode for Module { impl MacroNode for Script { #[tracing::instrument(level = "debug", skip_all)] fn emit(&mut self, emitter: &mut Macro) -> Result { - let first_stmt_span_lo = self.body.first().map(|s| s.span().lo); - - // If the first statement and module span are the same, then do not take the - // comment of the module. - - let should_skip = first_stmt_span_lo - .map(|lo| lo == self.span.lo) - .unwrap_or(false); + let should_skip_leading_comments = self + .body + .first() + .is_some_and(|s| s.span().lo == self.span.lo); - if !should_skip { + if !should_skip_leading_comments { emitter.emit_leading_comments_of_span(self.span(), false)?; } From b3dfe69125114a9a833e3c34bef8cf5539de53a7 Mon Sep 17 00:00:00 2001 From: DongYun Kang Date: Wed, 19 Nov 2025 16:14:22 -0500 Subject: [PATCH 5/8] iter any --- crates/swc_ecma_codegen/src/lib.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/crates/swc_ecma_codegen/src/lib.rs b/crates/swc_ecma_codegen/src/lib.rs index 6c6f533e1227..c60bf4e9dc31 100644 --- a/crates/swc_ecma_codegen/src/lib.rs +++ b/crates/swc_ecma_codegen/src/lib.rs @@ -1431,10 +1431,7 @@ impl MacroNode for Program { impl MacroNode for Module { #[tracing::instrument(level = "debug", skip_all)] fn emit(&mut self, emitter: &mut Macro) -> Result { - let should_skip_leading_comments = self - .body - .first() - .is_some_and(|s| s.span().lo == self.span.lo); + let should_skip_leading_comments = self.body.iter().any(|s| s.span().lo == self.span.lo); if !should_skip_leading_comments { emitter.emit_leading_comments_of_span(self.span(), false)?; @@ -1466,10 +1463,7 @@ impl MacroNode for Module { impl MacroNode for Script { #[tracing::instrument(level = "debug", skip_all)] fn emit(&mut self, emitter: &mut Macro) -> Result { - let should_skip_leading_comments = self - .body - .first() - .is_some_and(|s| s.span().lo == self.span.lo); + let should_skip_leading_comments = self.body.iter().any(|s| s.span().lo == self.span.lo); if !should_skip_leading_comments { emitter.emit_leading_comments_of_span(self.span(), false)?; From e409794f7041e463809790765ac1ab79b6d47887 Mon Sep 17 00:00:00 2001 From: DongYun Kang Date: Wed, 19 Nov 2025 16:14:57 -0500 Subject: [PATCH 6/8] Update test refs --- .../issues-110xx/11167/output/input.js | 4 +-- .../issues-1xxx/1456/case1/output/index.ts | 2 +- .../issues-1xxx/1456/case2/output/index.ts | 2 +- .../issues-2xxx/2056/1/output/index.js | 6 ++--- .../issues-2xxx/2964/case-3/output/index.ts | 2 +- .../fixture/sourcemap/009/output/index.js | 4 +-- .../fixture/sourcemap/009/output/index.map | 2 +- ...mberThatUsesClassTypeParameter.1.normal.js | 2 +- .../ES5For-ofTypeCheck10.1.normal.js | 2 +- ...cessorsAreNotContextuallyTyped.1.normal.js | 2 +- ...ropertyInitializerDoesntNarrow.1.normal.js | 4 +-- .../anyAsGenericFunctionCall.1.normal.js | 2 +- .../apparentTypeSubtyping.1.normal.js | 4 +-- .../apparentTypeSupertype.1.normal.js | 4 +-- ...mentExpressionContextualTyping.1.normal.js | 2 +- ...eralExpressionContextualTyping.1.normal.js | 2 +- .../tsc-references/arrayLiterals.1.normal.js | 2 +- .../arrayLiterals2ES5.1.normal.js | 2 +- .../tsc-references/arrayLiterals3.1.normal.js | 2 +- .../arrayOfFunctionTypes3.1.normal.js | 2 +- .../arrowFunctionExpressions.1.normal.js | 2 +- .../assignAnyToEveryType.1.normal.js | 2 +- .../assignEveryTypeToAny.1.normal.js | 2 +- ...nmentCompatWithCallSignatures3.1.normal.js | 2 +- ...nmentCompatWithCallSignatures4.1.normal.js | 2 +- ...nmentCompatWithCallSignatures5.1.normal.js | 2 +- ...nmentCompatWithCallSignatures6.1.normal.js | 2 +- ...CompatWithConstructSignatures3.1.normal.js | 2 +- ...CompatWithConstructSignatures4.1.normal.js | 2 +- ...CompatWithConstructSignatures5.1.normal.js | 2 +- ...CompatWithConstructSignatures6.1.normal.js | 2 +- ...gnaturesWithOptionalParameters.1.normal.js | 2 +- ...ignmentCompatWithObjectMembers.1.normal.js | 2 +- ...gnmentCompatWithObjectMembers2.1.normal.js | 2 +- ...gnmentCompatWithObjectMembers3.1.normal.js | 2 +- ...gnmentCompatWithObjectMembers4.1.normal.js | 2 +- ...WithObjectMembersAccessibility.1.normal.js | 2 +- ...tWithObjectMembersNumericNames.1.normal.js | 2 +- ...atWithObjectMembersOptionality.1.normal.js | 2 +- ...tWithObjectMembersOptionality2.1.normal.js | 4 +-- ...bjectMembersStringNumericNames.1.normal.js | 2 +- .../assignmentToVoidZero1.1.normal.js | 2 +- .../asyncArrowFunction11_es5.1.normal.js | 2 +- .../asyncAwaitNestedClasses_es5.1.normal.js | 2 +- ...asyncFunctionDeclaration16_es5.1.normal.js | 6 ++--- ...meterEvaluation(target=es2015).1.normal.js | 2 +- ...meterEvaluation(target=es2015).1.normal.js | 2 +- ...meterEvaluation(target=es2017).1.normal.js | 2 +- ...onTypeOfConditionalExpressions.1.normal.js | 4 +-- ...nTypeOfConditionalExpressions2.1.normal.js | 4 +-- ...wiseNotOperatorWithBooleanType.1.normal.js | 2 +- ...twiseNotOperatorWithNumberType.1.normal.js | 2 +- ...twiseNotOperatorWithStringType.1.normal.js | 2 +- ...callChainWithSuper(target=es5).1.normal.js | 2 +- ...IncorrectNumberOfTypeArguments.1.normal.js | 2 +- ...cFunctionWithZeroTypeArguments.1.normal.js | 2 +- ...nericFunctionWithTypeArguments.1.normal.js | 2 +- ...ureAssignabilityInInheritance2.1.normal.js | 2 +- ...ureAssignabilityInInheritance3.1.normal.js | 4 +-- ...ureAssignabilityInInheritance4.1.normal.js | 2 +- ...ureAssignabilityInInheritance5.1.normal.js | 4 +-- ...ureAssignabilityInInheritance6.1.normal.js | 6 ++--- ...tReturnTypeAnnotationInference.1.normal.js | 4 +-- ...gnaturesWithOptionalParameters.1.normal.js | 2 +- .../callWithMissingVoid.1.normal.js | 2 +- .../tsc-references/callbackTag2.1.normal.js | 4 +-- .../checkJsdocTypeTag7.1.normal.js | 4 +-- ...kJsdocTypeTagOnObjectProperty1.1.normal.js | 2 +- ...checkJsxChildrenCanBeTupleType.1.normal.js | 2 +- ...xSubtleSkipContextSensitiveBug.1.normal.js | 2 +- .../circularImportAlias.1.normal.js | 2 +- .../classAbstractInstantiations1.1.normal.js | 6 ++--- ...ssCanExtendConstructorFunction.1.normal.js | 26 +++++++++---------- .../classStaticBlock27.1.normal.js | 2 +- ...icMembersEquivalentToInterface.1.normal.js | 2 +- ...cMembersEquivalentToInterface2.1.normal.js | 2 +- .../classWithOptionalParameter.1.normal.js | 2 +- .../classWithPrivateProperty.1.normal.js | 2 +- .../classWithProtectedProperty.1.normal.js | 2 +- ...indingPattern.2(target=es2015).1.normal.js | 2 +- ...erBindingPattern.2(target=es5).1.normal.js | 2 +- ...erInitializer.2(target=es2015).1.normal.js | 2 +- ...meterInitializer.2(target=es5).1.normal.js | 2 +- ...lOperatorConditoinIsStringType.1.normal.js | 2 +- ...tionalOperatorWithIdenticalBCT.1.normal.js | 2 +- ...nalOperatorWithoutIdenticalBCT.1.normal.js | 2 +- .../constraintSatisfactionWithAny.1.normal.js | 2 +- ...intSatisfactionWithEmptyObject.1.normal.js | 2 +- ...ureAssignabilityInInheritance2.1.normal.js | 2 +- ...ureAssignabilityInInheritance3.1.normal.js | 4 +-- ...ureAssignabilityInInheritance4.1.normal.js | 2 +- ...ureAssignabilityInInheritance5.1.normal.js | 4 +-- ...ureAssignabilityInInheritance6.1.normal.js | 6 ++--- ...gnaturesWithIdenticalOverloads.1.normal.js | 2 +- ...nstructSignaturesWithOverloads.1.normal.js | 2 +- ...structSignaturesWithOverloads2.1.normal.js | 2 +- ...oadsThatDifferOnlyByReturnType.1.normal.js | 2 +- ...ionTypeIsAssignableToBaseType2.1.normal.js | 2 +- .../constructorFunctionsStrict.1.normal.js | 4 +-- ...torParameterShadowsOuterScopes.1.normal.js | 2 +- ...WithAssignableReturnExpression.1.normal.js | 2 +- .../contextualTypeWithTuple.1.normal.js | 2 +- ...ntextualTypedSpecialAssignment.1.normal.js | 2 +- .../controlFlowAliasing.1.normal.js | 2 +- ...orrectlyMarkAliasAsReferences4.1.normal.js | 2 +- ...rementOperatorWithAnyOtherType.1.normal.js | 2 +- ...ecrementOperatorWithNumberType.1.normal.js | 2 +- ...assConstructorWithoutSuperCall.1.normal.js | 2 +- .../derivedClassTransitivity.1.normal.js | 2 +- .../derivedClassTransitivity2.1.normal.js | 2 +- .../derivedClassTransitivity3.1.normal.js | 2 +- .../derivedClassTransitivity4.1.normal.js | 2 +- ...assWithoutExplicitConstructor3.1.normal.js | 2 +- ...indingPatternAndAssignment1ES5.1.normal.js | 6 ++--- ...tternAndAssignment1ES5iterable.1.normal.js | 6 ++--- ...ayBindingPatternAndAssignment2.1.normal.js | 4 +-- ...dAssignment5SiblingInitializer.1.normal.js | 2 +- ...EvaluationOrder(target=es2015).1.normal.js | 2 +- ...ingEvaluationOrder(target=es5).1.normal.js | 2 +- ...cturingVariableDeclaration1ES5.1.normal.js | 4 +-- ...ariableDeclaration1ES5iterable.1.normal.js | 4 +-- ...cturingWithLiteralInitializers.1.normal.js | 2 +- .../duplicateStringIndexers.1.normal.js | 2 +- ...mitter.forAwait(target=es2015).1.normal.js | 6 ++--- .../emitter.forAwait(target=es5).1.normal.js | 6 ++--- .../enumAssignability.1.normal.js | 2 +- ...enumAssignabilityInInheritance.1.normal.js | 2 +- ...NotASubtypeOfAnythingButNumber.1.normal.js | 2 +- .../errorOnFunctionReturnType.1.normal.js | 6 ++--- .../errorSuperPropertyAccess.1.normal.js | 6 ++--- .../tsc-references/exportCodeGen.1.normal.js | 2 +- .../exportImportAlias.1.normal.js | 2 +- .../tsc-references/extendsTag1.1.normal.js | 10 +++---- .../tsc-references/extendsTag5.1.normal.js | 8 +++--- ...functionConstraintSatisfaction.1.normal.js | 2 +- ...unctionConstraintSatisfaction2.1.normal.js | 2 +- ...unctionConstraintSatisfaction3.1.normal.js | 2 +- ...ionExpressionContextualTyping1.1.normal.js | 2 +- .../functionImplementationErrors.1.normal.js | 2 +- .../functionImplementations.1.normal.js | 2 +- .../functionLiteralForOverloads2.1.normal.js | 2 +- ...meterObjectRestAndInitializers.1.normal.js | 2 +- ...nericCallTypeArgumentInference.1.normal.js | 2 +- ...nstraintsTypeArgumentInference.1.normal.js | 2 +- ...allWithFunctionTypedArguments4.1.normal.js | 2 +- ...thObjectTypeArgsAndConstraints.1.normal.js | 2 +- ...hObjectTypeArgsAndConstraints2.1.normal.js | 4 +-- ...hObjectTypeArgsAndConstraints3.1.normal.js | 2 +- ...hObjectTypeArgsAndConstraints4.1.normal.js | 2 +- ...hObjectTypeArgsAndConstraints5.1.normal.js | 2 +- ...thFunctionTypedMemberArguments.1.normal.js | 2 +- ...thObjectTypeArgsAndConstraints.1.normal.js | 2 +- ...getSetAccessorContextualTyping.1.normal.js | 4 +-- .../heterogeneousArrayLiterals.1.normal.js | 2 +- .../importCallExpressionInCJS3.1.normal.js | 2 +- ...rementOperatorWithAnyOtherType.1.normal.js | 2 +- ...ncrementOperatorWithNumberType.1.normal.js | 2 +- ...erReferencingConstructorLocals.1.normal.js | 2 +- ...ferencingConstructorParameters.1.normal.js | 2 +- ...xFactoryDeclarationsLocalTypes.1.normal.js | 8 +++--- ...ypeParameterShadowingOuterOne2.1.normal.js | 2 +- ...WithWrongNumberOfTypeArguments.1.normal.js | 2 +- ...ericClassWithZeroTypeArguments.1.normal.js | 2 +- ...onGenericTypeWithTypeArguments.1.normal.js | 2 +- .../instantiatedModule.1.normal.js | 2 +- .../invalidImportAliasIdentifiers.1.normal.js | 2 +- .../invalidReturnStatements.1.normal.js | 2 +- ...mplementsGenericsSerialization.1.normal.js | 4 +-- .../jsDeclarationsClassesErr.1.normal.js | 4 +-- .../jsDeclarationsDefaultsErr.1.normal.js | 2 +- ...tionClassesCjsExportAssignment.1.normal.js | 4 +-- .../jsDeclarationsFunctionJSDoc.1.normal.js | 4 +-- ...eclarationsFunctionLikeClasses.1.normal.js | 4 +-- ...clarationsFunctionLikeClasses2.1.normal.js | 4 +-- ...ortAliasExposedWithinNamespace.1.normal.js | 12 ++++----- ...AliasExposedWithinNamespaceCjs.1.normal.js | 4 +-- ...arationsModuleReferenceHasEmit.1.normal.js | 4 +-- ...DeclarationsReexportedCjsAlias.1.normal.js | 4 +-- .../jsDeclarationsTypeAliases.1.normal.js | 4 +-- ...larationsTypedefAndImportTypes.1.normal.js | 8 +++--- ...eclarationsTypedefAndLatebound.1.normal.js | 4 +-- .../jsxJsxsCjsTransformChildren.1.normal.js | 2 +- ...sxJsxsCjsTransformCustomImport.1.normal.js | 2 +- ...CjsTransformCustomImportPragma.1.normal.js | 6 ++--- .../jsxJsxsCjsTransformKeyProp.1.normal.js | 2 +- ...jsTransformKeyPropCustomImport.1.normal.js | 2 +- ...sformKeyPropCustomImportPragma.1.normal.js | 6 ++--- ...xsCjsTransformSubstitutesNames.1.normal.js | 2 +- ...nsformSubstitutesNamesFragment.1.normal.js | 2 +- .../literalTypeWidening.1.normal.js | 2 +- ...calNotOperatorWithAnyOtherType.1.normal.js | 2 +- ...icalNotOperatorWithBooleanType.1.normal.js | 2 +- ...gicalNotOperatorWithNumberType.1.normal.js | 2 +- ...gicalNotOperatorWithStringType.1.normal.js | 2 +- ...gedInterfacesWithMultipleBases.1.normal.js | 2 +- ...edInterfacesWithMultipleBases2.1.normal.js | 2 +- ...edInterfacesWithMultipleBases3.1.normal.js | 2 +- ...edInterfacesWithMultipleBases4.1.normal.js | 2 +- .../missingAndExcessProperties.1.normal.js | 2 +- .../moduleExportAlias3.1.normal.js | 2 +- .../moduleExportAlias4.1.normal.js | 2 +- .../multipleNumericIndexers.1.normal.js | 2 +- .../multipleStringIndexers.1.normal.js | 2 +- ...rrowingConstrainedTypeVariable.1.normal.js | 2 +- .../negateOperatorWithBooleanType.1.normal.js | 2 +- .../negateOperatorWithNumberType.1.normal.js | 2 +- .../negateOperatorWithStringType.1.normal.js | 2 +- ...TypeReferenceWithTypeArguments.1.normal.js | 2 +- ...ubtypeOfEverythingButUndefined.1.normal.js | 2 +- ...nAsyncGenerator(target=es2015).1.normal.js | 2 +- ...orInAsyncGenerator(target=es5).1.normal.js | 2 +- ...onstrainsPropertyDeclarations2.1.normal.js | 2 +- .../objectLiteralNormalization.1.normal.js | 2 +- .../objectSpreadComputedProperty.1.normal.js | 2 +- ...bjectTypeHidingMembersOfObject.1.normal.js | 2 +- .../objectTypePropertyAccess.1.normal.js | 2 +- .../objectTypeWithNumericProperty.1.normal.js | 2 +- ...peWithRecursiveWrappedProperty.1.normal.js | 2 +- ...eWithRecursiveWrappedProperty2.1.normal.js | 2 +- ...rappedPropertyCheckedNominally.1.normal.js | 2 +- .../objectTypesIdentity.1.normal.js | 2 +- .../objectTypesIdentity2.1.normal.js | 2 +- ...ypesIdentityWithCallSignatures.1.normal.js | 2 +- ...pesIdentityWithCallSignatures2.1.normal.js | 2 +- ...SignaturesDifferingParamCounts.1.normal.js | 2 +- ...ithCallSignaturesWithOverloads.1.normal.js | 2 +- ...dentityWithConstructSignatures.1.normal.js | 2 +- ...entityWithConstructSignatures2.1.normal.js | 2 +- ...SignaturesDifferingParamCounts.1.normal.js | 2 +- ...ntityWithGenericCallSignatures.1.normal.js | 2 +- ...tityWithGenericCallSignatures2.1.normal.js | 2 +- ...gnaturesDifferingByConstraints.1.normal.js | 2 +- ...naturesDifferingByConstraints2.1.normal.js | 2 +- ...naturesDifferingByConstraints3.1.normal.js | 2 +- ...ignaturesDifferingByReturnType.1.normal.js | 2 +- ...gnaturesDifferingByReturnType2.1.normal.js | 2 +- ...esDifferingTypeParameterCounts.1.normal.js | 2 +- ...resDifferingTypeParameterNames.1.normal.js | 2 +- ...icCallSignaturesOptionalParams.1.normal.js | 2 +- ...cCallSignaturesOptionalParams2.1.normal.js | 2 +- ...cCallSignaturesOptionalParams3.1.normal.js | 2 +- ...gnaturesDifferingByConstraints.1.normal.js | 2 +- ...naturesDifferingByConstraints2.1.normal.js | 2 +- ...naturesDifferingByConstraints3.1.normal.js | 2 +- ...ignaturesDifferingByReturnType.1.normal.js | 2 +- ...gnaturesDifferingByReturnType2.1.normal.js | 2 +- ...esDifferingTypeParameterCounts.1.normal.js | 2 +- ...resDifferingTypeParameterNames.1.normal.js | 2 +- ...structSignaturesOptionalParams.1.normal.js | 2 +- ...tructSignaturesOptionalParams2.1.normal.js | 2 +- ...tructSignaturesOptionalParams3.1.normal.js | 2 +- ...esIdentityWithNumericIndexers1.1.normal.js | 2 +- ...esIdentityWithNumericIndexers2.1.normal.js | 2 +- ...esIdentityWithNumericIndexers3.1.normal.js | 2 +- ...ctTypesIdentityWithOptionality.1.normal.js | 2 +- ...bjectTypesIdentityWithPrivates.1.normal.js | 2 +- ...jectTypesIdentityWithPrivates2.1.normal.js | 2 +- ...objectTypesIdentityWithPublics.1.normal.js | 2 +- ...ypesIdentityWithStringIndexers.1.normal.js | 2 +- ...pesIdentityWithStringIndexers2.1.normal.js | 2 +- ...rBindingPattern(target=es2015).1.normal.js | 2 +- ...eterBindingPattern(target=es5).1.normal.js | 2 +- ...indingPattern.2(target=es2015).1.normal.js | 2 +- ...erBindingPattern.2(target=es5).1.normal.js | 2 +- .../tsc-references/overloadTag3.1.normal.js | 4 +-- ...rdReferencing.2(target=es2015).1.normal.js | 2 +- ...rwardReferencing.2(target=es5).1.normal.js | 2 +- .../parserForInStatement8.1.normal.js | 2 +- .../parserRealSource1.1.normal.js | 2 +- .../parserRealSource12.1.normal.js | 2 +- .../parserRealSource14.1.normal.js | 2 +- .../parserRealSource5.1.normal.js | 2 +- .../parserRealSource6.1.normal.js | 2 +- .../parserRealSource8.1.normal.js | 2 +- .../tsc-references/parserindenter.1.normal.js | 2 +- .../plusOperatorWithBooleanType.1.normal.js | 2 +- .../plusOperatorWithNumberType.1.normal.js | 2 +- .../plusOperatorWithStringType.1.normal.js | 2 +- ...sPropertyAccessibleWithinClass.1.normal.js | 2 +- ...rtyAccessibleWithinNestedClass.1.normal.js | 2 +- ...edPropertyName4(target=es2015).1.normal.js | 2 +- .../privateNamesUnique-5.1.normal.js | 2 +- ...teStaticNotAccessibleInClodule.1.normal.js | 2 +- ...eStaticNotAccessibleInClodule2.1.normal.js | 2 +- ...sOfGenericConstructorFunctions.1.normal.js | 4 +-- ...OnTypeParameterWithConstraints.1.normal.js | 2 +- ...nTypeParameterWithConstraints2.1.normal.js | 2 +- ...nTypeParameterWithConstraints3.1.normal.js | 2 +- ...sPropertyAccessibleWithinClass.1.normal.js | 2 +- ...rtyAccessibleWithinNestedClass.1.normal.js | 2 +- ...opertyAccessibleWithinSubclass.1.normal.js | 2 +- ...edStaticNotAccessibleInClodule.1.normal.js | 2 +- .../readonlyConstructorAssignment.1.normal.js | 2 +- ...tParameterInDownlevelGenerator.1.normal.js | 2 +- .../returnStatements.1.normal.js | 2 +- .../tsc-references/scannertest1.1.normal.js | 2 +- .../scopeResolutionIdentifiers.1.normal.js | 2 +- .../tsc-references/staticIndexers.1.normal.js | 2 +- ...MembersUsingClassTypeParameter.1.normal.js | 2 +- .../strictPropertyInitialization.1.normal.js | 2 +- ...onstrainsPropertyDeclarations2.1.normal.js | 2 +- ...ypesInImplementationSignatures.1.normal.js | 2 +- .../subtypesOfTypeParameter.1.normal.js | 2 +- ...OfTypeParameterWithConstraints.1.normal.js | 2 +- ...fTypeParameterWithConstraints2.1.normal.js | 2 +- ...fTypeParameterWithConstraints4.1.normal.js | 2 +- ...ameterWithRecursiveConstraints.1.normal.js | 2 +- .../subtypingWithCallSignatures2.1.normal.js | 2 +- .../subtypingWithCallSignatures3.1.normal.js | 4 +-- .../subtypingWithCallSignatures4.1.normal.js | 2 +- ...typingWithConstructSignatures2.1.normal.js | 2 +- ...typingWithConstructSignatures3.1.normal.js | 4 +-- ...typingWithConstructSignatures4.1.normal.js | 2 +- ...typingWithConstructSignatures5.1.normal.js | 4 +-- ...typingWithConstructSignatures6.1.normal.js | 6 ++--- .../subtypingWithObjectMembers4.1.normal.js | 2 +- ...WithObjectMembersAccessibility.1.normal.js | 2 +- ...ithObjectMembersAccessibility2.1.normal.js | 2 +- .../superPropertyAccessNoError.1.normal.js | 12 ++++----- ...teStringsTypeArgumentInference.1.normal.js | 2 +- .../templateInsideCallback.1.normal.js | 4 +-- .../tests/tsc-references/thisTag3.1.normal.js | 4 +-- .../thisTypeInFunctions.1.normal.js | 2 +- .../topLevelAmbientModule.1.normal.js | 2 +- ...pLevelModuleDeclarationAndFile.1.normal.js | 2 +- .../tsNoCheckForTypescript.1.normal.js | 2 +- ...sNoCheckForTypescriptComments1.1.normal.js | 2 +- ...sNoCheckForTypescriptComments2.1.normal.js | 2 +- .../tsc-references/tsxTypeErrors.1.normal.js | 2 +- .../typeFromPropertyAssignment28.1.normal.js | 2 +- .../typeFromPropertyAssignment35.1.normal.js | 4 +-- .../typeGuardOfFormInstanceOf.1.normal.js | 8 +++--- .../typeGuardsInClassAccessors.1.normal.js | 4 +-- .../typeGuardsInClassMethods.1.normal.js | 2 +- .../typeGuardsInExternalModule.1.normal.js | 6 ++--- .../typeGuardsInProperties.1.normal.js | 4 +-- .../typeGuardsOnClassProperty.1.normal.js | 2 +- .../typeGuardsTypeParameters.1.normal.js | 2 +- ...peOfThisInConstructorParamList.1.normal.js | 2 +- ...typeOfThisInFunctionExpression.1.normal.js | 2 +- .../typeParameterAsBaseType.1.normal.js | 4 +-- .../typeParameterAsTypeArgument.1.normal.js | 2 +- .../typeParameterAssignability3.1.normal.js | 2 +- ...terDirectlyConstrainedToItself.1.normal.js | 2 +- ...UsedAsTypeParameterConstraint4.1.normal.js | 2 +- .../typedefCrossModule2.1.normal.js | 4 +-- .../typedefCrossModule3.1.normal.js | 4 +-- .../typedefCrossModule4.1.normal.js | 4 +-- .../typedefCrossModule5.1.normal.js | 4 +-- ...typeofOperatorWithAnyOtherType.1.normal.js | 2 +- .../typeofOperatorWithBooleanType.1.normal.js | 2 +- .../typeofOperatorWithEnumType.1.normal.js | 2 +- .../typeofOperatorWithNumberType.1.normal.js | 2 +- .../typeofOperatorWithStringType.1.normal.js | 2 +- .../typesWithPublicConstructor.1.normal.js | 2 +- ...sWithSpecializedCallSignatures.1.normal.js | 2 +- ...SpecializedConstructSignatures.1.normal.js | 2 +- ...undefinedIsSubtypeOfEverything.1.normal.js | 2 +- .../unionTypeEquivalence.1.normal.js | 2 +- .../unionTypeFromArrayLiteral.1.normal.js | 6 ++--- .../voidOperatorWithAnyOtherType.1.normal.js | 2 +- .../voidOperatorWithBooleanType.1.normal.js | 2 +- .../voidOperatorWithNumberType.1.normal.js | 2 +- .../voidOperatorWithStringType.1.normal.js | 2 +- .../tests/tsc-references/witness.1.normal.js | 2 +- ...wrappedAndRecursiveConstraints.1.normal.js | 2 +- ...rappedAndRecursiveConstraints3.1.normal.js | 2 +- .../yieldExpressionInControlFlow.1.normal.js | 2 +- .../next-39460/output/snippetSession.js | 10 +++---- 369 files changed, 490 insertions(+), 490 deletions(-) diff --git a/crates/swc/tests/fixture/issues-110xx/11167/output/input.js b/crates/swc/tests/fixture/issues-110xx/11167/output/input.js index 2e1b74e1bd2d..dd14b25f3dfc 100644 --- a/crates/swc/tests/fixture/issues-110xx/11167/output/input.js +++ b/crates/swc/tests/fixture/issues-110xx/11167/output/input.js @@ -1,5 +1,5 @@ -/* @ngInject */ import { _ as s } from "@swc/helpers/_/_define_property"; -class e { +import { _ as s } from "@swc/helpers/_/_define_property"; +/* @ngInject */ class e { constructor(e){ s(this, "testField", void 0); this.testField = e; diff --git a/crates/swc/tests/fixture/issues-1xxx/1456/case1/output/index.ts b/crates/swc/tests/fixture/issues-1xxx/1456/case1/output/index.ts index 995b914a8262..16dfad1b8292 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1456/case1/output/index.ts +++ b/crates/swc/tests/fixture/issues-1xxx/1456/case1/output/index.ts @@ -1,4 +1,3 @@ -// not work "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -6,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); const _ts_metadata = require("@swc/helpers/_/_ts_metadata"); const _ts_param = require("@swc/helpers/_/_ts_param"); +// not work class MyClass1 { constructor(param1){ this.param1 = param1; diff --git a/crates/swc/tests/fixture/issues-1xxx/1456/case2/output/index.ts b/crates/swc/tests/fixture/issues-1xxx/1456/case2/output/index.ts index 312641808919..4c04367bd768 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1456/case2/output/index.ts +++ b/crates/swc/tests/fixture/issues-1xxx/1456/case2/output/index.ts @@ -1,4 +1,3 @@ -// work "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -6,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); const _ts_metadata = require("@swc/helpers/_/_ts_metadata"); const _ts_param = require("@swc/helpers/_/_ts_param"); +// work class MyClass1 { constructor(param1){} } diff --git a/crates/swc/tests/fixture/issues-2xxx/2056/1/output/index.js b/crates/swc/tests/fixture/issues-2xxx/2056/1/output/index.js index 06f1aef73472..ebb74da15fd7 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2056/1/output/index.js +++ b/crates/swc/tests/fixture/issues-2xxx/2056/1/output/index.js @@ -1,3 +1,5 @@ +import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; +import { _ as _type_of } from "@swc/helpers/_/_type_of"; /* Copyright (c) 2018-2020 Xiamen Yaji Software Co., Ltd. @@ -24,9 +26,7 @@ */ /** * @packageDocumentation * @module core/math - */ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; -import { _ as _type_of } from "@swc/helpers/_/_type_of"; -import { CCClass } from "../data/class"; + */ import { CCClass } from "../data/class"; import { Mat3 } from "./mat3"; import { Quat } from "./quat"; import { enumerableProps, EPSILON } from "./utils"; diff --git a/crates/swc/tests/fixture/issues-2xxx/2964/case-3/output/index.ts b/crates/swc/tests/fixture/issues-2xxx/2964/case-3/output/index.ts index 99133ea81eef..d18fb32f14ac 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2964/case-3/output/index.ts +++ b/crates/swc/tests/fixture/issues-2xxx/2964/case-3/output/index.ts @@ -1,9 +1,9 @@ -// single line comment "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _object_without_properties = require("@swc/helpers/_/_object_without_properties"); +// single line comment const x = (_param)=>/*todo: refactor any type*/ { var { y } = _param, rest = _object_without_properties._(_param, [ "y" diff --git a/crates/swc/tests/fixture/sourcemap/009/output/index.js b/crates/swc/tests/fixture/sourcemap/009/output/index.js index 3cb7dc48ca88..30dab98b7706 100644 --- a/crates/swc/tests/fixture/sourcemap/009/output/index.js +++ b/crates/swc/tests/fixture/sourcemap/009/output/index.js @@ -1,7 +1,7 @@ +"use strict"; /** * This is a * long * license * header - */ "use strict"; -console.log(new Error().stack); + */ console.log(new Error().stack); diff --git a/crates/swc/tests/fixture/sourcemap/009/output/index.map b/crates/swc/tests/fixture/sourcemap/009/output/index.map index 31ae517bcd4b..b342c3ef8a8b 100644 --- a/crates/swc/tests/fixture/sourcemap/009/output/index.map +++ b/crates/swc/tests/fixture/sourcemap/009/output/index.map @@ -1,5 +1,5 @@ { - "mappings": "AAAA;;;;;CAKC;AACDA,QAAQC,GAAG,CAAC,IAAIC,QAAQC,KAAK", + "mappings": ";AAAA;;;;;CAKC,GACDA,QAAQC,GAAG,CAAC,IAAIC,QAAQC,KAAK", "names": [ "console", "log", diff --git a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.1.normal.js b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.1.normal.js index 3dff942d2367..76e71e76a766 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.1.normal.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.1.normal.js @@ -1,6 +1,6 @@ //// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts] -// all expected to be errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// all expected to be errors var clodule1 = function clodule1() { "use strict"; _class_call_check(this, clodule1); diff --git a/crates/swc/tests/tsc-references/ES5For-ofTypeCheck10.1.normal.js b/crates/swc/tests/tsc-references/ES5For-ofTypeCheck10.1.normal.js index 4616dd3dbe41..27bf233db511 100644 --- a/crates/swc/tests/tsc-references/ES5For-ofTypeCheck10.1.normal.js +++ b/crates/swc/tests/tsc-references/ES5For-ofTypeCheck10.1.normal.js @@ -1,6 +1,6 @@ //// [ES5For-ofTypeCheck10.ts] -// In ES3/5, you cannot for...of over an arbitrary iterable. import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// In ES3/5, you cannot for...of over an arbitrary iterable. var StringIterator = /*#__PURE__*/ function() { "use strict"; function StringIterator() { diff --git a/crates/swc/tests/tsc-references/accessorsAreNotContextuallyTyped.1.normal.js b/crates/swc/tests/tsc-references/accessorsAreNotContextuallyTyped.1.normal.js index e82ba23bb21c..20cb19222cad 100644 --- a/crates/swc/tests/tsc-references/accessorsAreNotContextuallyTyped.1.normal.js +++ b/crates/swc/tests/tsc-references/accessorsAreNotContextuallyTyped.1.normal.js @@ -1,7 +1,7 @@ //// [accessorsAreNotContextuallyTyped.ts] -// accessors are not contextually typed import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; +// accessors are not contextually typed var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/annotatedThisPropertyInitializerDoesntNarrow.1.normal.js b/crates/swc/tests/tsc-references/annotatedThisPropertyInitializerDoesntNarrow.1.normal.js index db4fcbff2f0b..379c63e1351c 100644 --- a/crates/swc/tests/tsc-references/annotatedThisPropertyInitializerDoesntNarrow.1.normal.js +++ b/crates/swc/tests/tsc-references/annotatedThisPropertyInitializerDoesntNarrow.1.normal.js @@ -1,7 +1,7 @@ //// [Compilation.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // from webpack/lib/Compilation.js and filed at #26427 -/** @param {{ [s: string]: number }} map */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -function mappy(map) {} +/** @param {{ [s: string]: number }} map */ function mappy(map) {} export var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/anyAsGenericFunctionCall.1.normal.js b/crates/swc/tests/tsc-references/anyAsGenericFunctionCall.1.normal.js index ba9636a8e9f7..075e994897fa 100644 --- a/crates/swc/tests/tsc-references/anyAsGenericFunctionCall.1.normal.js +++ b/crates/swc/tests/tsc-references/anyAsGenericFunctionCall.1.normal.js @@ -1,7 +1,7 @@ //// [anyAsGenericFunctionCall.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // any is considered an untyped function call // can be called except with type arguments which is an error -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var x; var a = x(); var b = x('hello'); diff --git a/crates/swc/tests/tsc-references/apparentTypeSubtyping.1.normal.js b/crates/swc/tests/tsc-references/apparentTypeSubtyping.1.normal.js index 8d0be91033b8..0f08095d6cbb 100644 --- a/crates/swc/tests/tsc-references/apparentTypeSubtyping.1.normal.js +++ b/crates/swc/tests/tsc-references/apparentTypeSubtyping.1.normal.js @@ -1,9 +1,9 @@ //// [apparentTypeSubtyping.ts] -// subtype checks use the apparent type of the target type -// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// subtype checks use the apparent type of the target type +// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/apparentTypeSupertype.1.normal.js b/crates/swc/tests/tsc-references/apparentTypeSupertype.1.normal.js index 4c3003a3a66a..cb6aeb7aad8f 100644 --- a/crates/swc/tests/tsc-references/apparentTypeSupertype.1.normal.js +++ b/crates/swc/tests/tsc-references/apparentTypeSupertype.1.normal.js @@ -1,9 +1,9 @@ //// [apparentTypeSupertype.ts] -// subtype checks use the apparent type of the target type -// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// subtype checks use the apparent type of the target type +// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js b/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js index 23e959d5ab76..c7a4397bc02e 100644 --- a/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js +++ b/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js @@ -1,7 +1,7 @@ //// [argumentExpressionContextualTyping.ts] -// In a typed function call, argument expressions are contextually typed by their corresponding parameter types. import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; +// In a typed function call, argument expressions are contextually typed by their corresponding parameter types. function foo(param) { var _param_x = _sliced_to_array(param.x, 2), a = _param_x[0], b = _param_x[1], _param_y = param.y, c = _param_y.c, d = _param_y.d, e = _param_y.e; } diff --git a/crates/swc/tests/tsc-references/arrayLiteralExpressionContextualTyping.1.normal.js b/crates/swc/tests/tsc-references/arrayLiteralExpressionContextualTyping.1.normal.js index 58f19e1aaa9f..6dca975faa26 100644 --- a/crates/swc/tests/tsc-references/arrayLiteralExpressionContextualTyping.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayLiteralExpressionContextualTyping.1.normal.js @@ -1,8 +1,8 @@ //// [arrayLiteralExpressionContextualTyping.ts] +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // In a contextually typed array literal expression containing no spread elements, an element expression at index N is contextually typed by // the type of the property with the numeric name N in the contextual type, if any, or otherwise // the numeric index type of the contextual type, if any. -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var array = [ 1, 2, diff --git a/crates/swc/tests/tsc-references/arrayLiterals.1.normal.js b/crates/swc/tests/tsc-references/arrayLiterals.1.normal.js index 435a69c6649a..b5e3229d6469 100644 --- a/crates/swc/tests/tsc-references/arrayLiterals.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayLiterals.1.normal.js @@ -1,8 +1,8 @@ //// [arrayLiterals.ts] -// Empty array literal with no contextual type has type Undefined[] import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// Empty array literal with no contextual type has type Undefined[] var arr1 = [ [], [ diff --git a/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js b/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js index cc274866b8ea..9800682348b9 100644 --- a/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js @@ -1,4 +1,5 @@ //// [arrayLiterals2ES5.ts] +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // ElementList: ( Modified ) // Elisionopt AssignmentExpression // Elisionopt SpreadElement @@ -6,7 +7,6 @@ // ElementList, Elisionopt SpreadElement // SpreadElement: // ... AssignmentExpression -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var a0 = [ , , diff --git a/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js b/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js index 46dcf37ce8b7..322792c9005a 100644 --- a/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js @@ -1,4 +1,5 @@ //// [arrayLiterals3.ts] +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; // Each element expression in a non-empty array literal is processed as follows: // - If the array literal contains no spread elements, and if the array literal is contextually typed (section 4.19) // by a type T and T has a property with the numeric name N, where N is the index of the element expression in the array literal, @@ -6,7 +7,6 @@ // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is contextually typed by a tuple-like type, // the resulting type is a tuple type constructed from the types of the element expressions. -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var a0 = []; // Error var a1 = [ "string", diff --git a/crates/swc/tests/tsc-references/arrayOfFunctionTypes3.1.normal.js b/crates/swc/tests/tsc-references/arrayOfFunctionTypes3.1.normal.js index bd95d4cb1124..d83366f7be8f 100644 --- a/crates/swc/tests/tsc-references/arrayOfFunctionTypes3.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayOfFunctionTypes3.1.normal.js @@ -1,6 +1,6 @@ //// [arrayOfFunctionTypes3.ts] -// valid uses of arrays of function types import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// valid uses of arrays of function types var x = [ function() { return 1; diff --git a/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js b/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js index 7b13a05a1074..9abe498a7d0e 100644 --- a/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js +++ b/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js @@ -1,8 +1,8 @@ //// [arrowFunctionExpressions.ts] -// ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_array } from "@swc/helpers/_/_to_array"; +// ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } var a = function(p) { return p.length; }; diff --git a/crates/swc/tests/tsc-references/assignAnyToEveryType.1.normal.js b/crates/swc/tests/tsc-references/assignAnyToEveryType.1.normal.js index 178e77952c81..508a2c602791 100644 --- a/crates/swc/tests/tsc-references/assignAnyToEveryType.1.normal.js +++ b/crates/swc/tests/tsc-references/assignAnyToEveryType.1.normal.js @@ -1,6 +1,6 @@ //// [assignAnyToEveryType.ts] -// all of these are valid import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// all of these are valid var x; var a = x; var b = x; diff --git a/crates/swc/tests/tsc-references/assignEveryTypeToAny.1.normal.js b/crates/swc/tests/tsc-references/assignEveryTypeToAny.1.normal.js index 42285ee10d6e..0a42561125c1 100644 --- a/crates/swc/tests/tsc-references/assignEveryTypeToAny.1.normal.js +++ b/crates/swc/tests/tsc-references/assignEveryTypeToAny.1.normal.js @@ -1,6 +1,6 @@ //// [assignEveryTypeToAny.ts] -// all of these are valid import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// all of these are valid var x; x = 1; var a = 2; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures3.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures3.1.normal.js index 81f9358f4318..1cb62ee7f02c 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures3.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures3.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithCallSignatures3.ts] -// these are all permitted with the current rules, since we do not do contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// these are all permitted with the current rules, since we do not do contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.1.normal.js index 818ac1def40a..3e188b0ced7b 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithCallSignatures4.ts] -// These are mostly permitted with the current loose rules. All ok unless otherwise noted. import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// These are mostly permitted with the current loose rules. All ok unless otherwise noted. (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures5.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures5.1.normal.js index 072b7e28c8e9..98f78ad4a72a 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures5.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures5.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithCallSignatures5.ts] -// checking assignment compat for function types. No errors in this file import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking assignment compat for function types. No errors in this file var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures6.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures6.1.normal.js index 92513cdd1c91..44598e4edec2 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures6.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures6.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithCallSignatures6.ts] -// checking assignment compatibility relations for function types. All valid import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking assignment compatibility relations for function types. All valid var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures3.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures3.1.normal.js index 5af3696af16d..f9ecc720e56f 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures3.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures3.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithConstructSignatures3.ts] -// checking assignment compatibility relations for function types. All of these are valid. import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking assignment compatibility relations for function types. All of these are valid. var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.1.normal.js index 1bcd28267fab..34d4b1591ae7 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithConstructSignatures4.ts] -// checking assignment compatibility relations for function types. import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking assignment compatibility relations for function types. (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures5.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures5.1.normal.js index 4daf91aec96c..1ebb16dae3a1 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures5.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures5.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithConstructSignatures5.ts] -// checking assignment compat for function types. All valid import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking assignment compat for function types. All valid var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures6.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures6.1.normal.js index 4bb10c58647a..bad665cce210 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures6.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures6.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithConstructSignatures6.ts] -// checking assignment compatibility relations for function types. All valid. import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking assignment compatibility relations for function types. All valid. var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.1.normal.js index d0ef4ab29c57..42ed94122d81 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.1.normal.js @@ -1,6 +1,6 @@ //// [assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts] -// call signatures in derived types must have the same or fewer optional parameters as the target for assignment import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// call signatures in derived types must have the same or fewer optional parameters as the target for assignment (function(ClassTypeParam) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.1.normal.js index 6ea58b9dbd0d..8a3584627742 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.1.normal.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembers.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // no errors expected -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(SimpleTypes) { var S = function S() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers2.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers2.1.normal.js index 17a1fb6bb01b..e1297e2c6f0c 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers2.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers2.1.normal.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembers2.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // additional optional properties do not cause errors -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var S = function S() { "use strict"; _class_call_check(this, S); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers3.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers3.1.normal.js index 9637dd4dabb5..99853cf1e5ac 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers3.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers3.1.normal.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembers3.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // additional optional properties do not cause errors -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var S = function S() { "use strict"; _class_call_check(this, S); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.1.normal.js index f4a24ad7d561..5e9c4847051c 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithObjectMembers4.ts] -// members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M (function(OnlyDerived) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersAccessibility.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersAccessibility.1.normal.js index 4dbfd4417f84..19104b0c7739 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersAccessibility.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersAccessibility.1.normal.js @@ -1,6 +1,6 @@ //// [assignmentCompatWithObjectMembersAccessibility.ts] -// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M (function(TargetIsPublic) { // targets var Base = function Base() { diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersNumericNames.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersNumericNames.1.normal.js index 5c382e939467..2a55f7e941c6 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersNumericNames.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersNumericNames.1.normal.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembersNumericNames.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // numeric named properties work correctly, no errors expected -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var S = function S() { "use strict"; _class_call_check(this, S); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.1.normal.js index 07d6676d8821..6d08d66c40e5 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.1.normal.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithObjectMembersOptionality.ts] -// Derived member is not optional but base member is, should be ok import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// Derived member is not optional but base member is, should be ok var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.1.normal.js index 68f57465b0be..3d74c6b95c60 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.1.normal.js @@ -1,9 +1,9 @@ //// [assignmentCompatWithObjectMembersOptionality2.ts] -// M is optional and S contains no property with the same name as M -// N is optional and T contains no property with the same name as N import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// M is optional and S contains no property with the same name as M +// N is optional and T contains no property with the same name as N var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.1.normal.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.1.normal.js index c818ef31e84b..08eb8fe2773f 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.1.normal.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembersStringNumericNames.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M // string named numeric properties work correctly, errors below unless otherwise noted -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(JustStrings) { var S = function S() { "use strict"; diff --git a/crates/swc/tests/tsc-references/assignmentToVoidZero1.1.normal.js b/crates/swc/tests/tsc-references/assignmentToVoidZero1.1.normal.js index d7fdf46ddf6c..3538c2bb83e8 100644 --- a/crates/swc/tests/tsc-references/assignmentToVoidZero1.1.normal.js +++ b/crates/swc/tests/tsc-references/assignmentToVoidZero1.1.normal.js @@ -1,6 +1,6 @@ //// [assignmentToVoidZero1.js] -// #38552 "use strict"; +// #38552 exports.y = exports.x = void 0; exports.x = 1; exports.y = 2; diff --git a/crates/swc/tests/tsc-references/asyncArrowFunction11_es5.1.normal.js b/crates/swc/tests/tsc-references/asyncArrowFunction11_es5.1.normal.js index b7328a6d7d19..3c007e0a4dcf 100644 --- a/crates/swc/tests/tsc-references/asyncArrowFunction11_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncArrowFunction11_es5.1.normal.js @@ -1,9 +1,9 @@ //// [asyncArrowFunction11_es5.ts] -// https://github.com/Microsoft/TypeScript/issues/24722 import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _define_property } from "@swc/helpers/_/_define_property"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; +// https://github.com/Microsoft/TypeScript/issues/24722 var A = function A() { "use strict"; var _this = this; diff --git a/crates/swc/tests/tsc-references/asyncAwaitNestedClasses_es5.1.normal.js b/crates/swc/tests/tsc-references/asyncAwaitNestedClasses_es5.1.normal.js index fa269ba6db74..8cc4faf3443f 100644 --- a/crates/swc/tests/tsc-references/asyncAwaitNestedClasses_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncAwaitNestedClasses_es5.1.normal.js @@ -1,9 +1,9 @@ //// [asyncAwaitNestedClasses_es5.ts] -// https://github.com/Microsoft/TypeScript/issues/20744 import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; var _B; +// https://github.com/Microsoft/TypeScript/issues/20744 var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/asyncFunctionDeclaration16_es5.1.normal.js b/crates/swc/tests/tsc-references/asyncFunctionDeclaration16_es5.1.normal.js index 1caddcf5fc8b..579b558b7b13 100644 --- a/crates/swc/tests/tsc-references/asyncFunctionDeclaration16_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncFunctionDeclaration16_es5.1.normal.js @@ -1,6 +1,8 @@ //// [asyncFunctionDeclaration16_es5.ts] //// [/types.d.ts] //// [/a.js] +import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; +import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; /** * @callback T1 * @param {string} str @@ -16,9 +18,7 @@ */ /** * @param {string} str * @returns {string} - */ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; -import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; -var f1 = function(str) { + */ var f1 = function(str) { return _async_to_generator(function() { return _ts_generator(this, function(_state) { return [ diff --git a/crates/swc/tests/tsc-references/asyncFunctionDeclarationParameterEvaluation(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/asyncFunctionDeclarationParameterEvaluation(target=es2015).1.normal.js index 1094eac39552..a61a03ecb0eb 100644 --- a/crates/swc/tests/tsc-references/asyncFunctionDeclarationParameterEvaluation(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/asyncFunctionDeclarationParameterEvaluation(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [asyncFunctionDeclarationParameterEvaluation.ts] -// https://github.com/microsoft/TypeScript/issues/40410 import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; +// https://github.com/microsoft/TypeScript/issues/40410 function f1(_0) { return _async_to_generator(function*(x, y = z) {}).apply(this, arguments); } diff --git a/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2015).1.normal.js index ea18e718ddd3..1a731ebb18bb 100644 --- a/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2015).1.normal.js @@ -1,8 +1,8 @@ //// [asyncGeneratorParameterEvaluation.ts] -// https://github.com/microsoft/TypeScript/issues/40410 import { _ as _extends } from "@swc/helpers/_/_extends"; import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; +// https://github.com/microsoft/TypeScript/issues/40410 function f1(_0) { return _wrap_async_generator(function*(x, y = z) {}).apply(this, arguments); } diff --git a/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2017).1.normal.js b/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2017).1.normal.js index 5db8f9728b30..400b6e47da9a 100644 --- a/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2017).1.normal.js +++ b/crates/swc/tests/tsc-references/asyncGeneratorParameterEvaluation(target=es2017).1.normal.js @@ -1,7 +1,7 @@ //// [asyncGeneratorParameterEvaluation.ts] -// https://github.com/microsoft/TypeScript/issues/40410 import { _ as _extends } from "@swc/helpers/_/_extends"; import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; +// https://github.com/microsoft/TypeScript/issues/40410 async function* f1(x, y = z) {} async function* f2({ [z]: x }) {} class Sub extends Super { diff --git a/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions.1.normal.js b/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions.1.normal.js index 5f595fde11d0..d00f02f3828b 100644 --- a/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions.1.normal.js +++ b/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions.1.normal.js @@ -1,9 +1,9 @@ //// [bestCommonTypeOfConditionalExpressions.ts] -// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) -// no errors expected here import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) +// no errors expected here var a; var b; var Base = function Base() { diff --git a/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions2.1.normal.js b/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions2.1.normal.js index 455d25d58b4b..51c3c9a9896e 100644 --- a/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions2.1.normal.js +++ b/crates/swc/tests/tsc-references/bestCommonTypeOfConditionalExpressions2.1.normal.js @@ -1,9 +1,9 @@ //// [bestCommonTypeOfConditionalExpressions2.ts] -// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) -// these are errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) +// these are errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.1.normal.js index d7496e69e54a..4d46d8735663 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.1.normal.js @@ -1,6 +1,6 @@ //// [bitwiseNotOperatorWithBooleanType.ts] -// ~ operator on boolean type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// ~ operator on boolean type var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.1.normal.js index 2dc31f8304c8..f262af5cf921 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [bitwiseNotOperatorWithNumberType.ts] -// ~ operator on number type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// ~ operator on number type var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.1.normal.js index 8a65ae1eb446..deda49a39d8a 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.1.normal.js @@ -1,6 +1,6 @@ //// [bitwiseNotOperatorWithStringType.ts] -// ~ operator on string type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// ~ operator on string type var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js b/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js index dad66c52a690..0de3b6902d02 100644 --- a/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js @@ -1,10 +1,10 @@ //// [callChainWithSuper.ts] -// GH#34952 import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// GH#34952 var Base = /*#__PURE__*/ function() { "use strict"; function Base() { diff --git a/crates/swc/tests/tsc-references/callGenericFunctionWithIncorrectNumberOfTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/callGenericFunctionWithIncorrectNumberOfTypeArguments.1.normal.js index 50833b7e5b49..d0b6b3c63092 100644 --- a/crates/swc/tests/tsc-references/callGenericFunctionWithIncorrectNumberOfTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/callGenericFunctionWithIncorrectNumberOfTypeArguments.1.normal.js @@ -1,7 +1,7 @@ //// [callGenericFunctionWithIncorrectNumberOfTypeArguments.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // type parameter lists must exactly match type argument lists // all of these invocations are errors -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f(x, y) { return null; } diff --git a/crates/swc/tests/tsc-references/callGenericFunctionWithZeroTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/callGenericFunctionWithZeroTypeArguments.1.normal.js index 4ddb4f4f3755..6e0816909357 100644 --- a/crates/swc/tests/tsc-references/callGenericFunctionWithZeroTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/callGenericFunctionWithZeroTypeArguments.1.normal.js @@ -1,6 +1,6 @@ //// [callGenericFunctionWithZeroTypeArguments.ts] -// valid invocations of generic functions with no explicit type arguments provided import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// valid invocations of generic functions with no explicit type arguments provided function f(x) { return null; } diff --git a/crates/swc/tests/tsc-references/callNonGenericFunctionWithTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/callNonGenericFunctionWithTypeArguments.1.normal.js index 78bb9d9423a2..b9497ec90651 100644 --- a/crates/swc/tests/tsc-references/callNonGenericFunctionWithTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/callNonGenericFunctionWithTypeArguments.1.normal.js @@ -1,7 +1,7 @@ //// [callNonGenericFunctionWithTypeArguments.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // it is always illegal to provide type arguments to a non-generic function // all invocations here are illegal -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f(x) { return null; } diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance2.1.normal.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance2.1.normal.js index 80c807a73d5c..4db99f177283 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance2.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance2.1.normal.js @@ -1,8 +1,8 @@ //// [callSignatureAssignabilityInInheritance2.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.1.normal.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.1.normal.js index 51497dd3baa9..919703bd91f4 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.1.normal.js @@ -1,9 +1,9 @@ //// [callSignatureAssignabilityInInheritance3.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation -// error cases import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation +// error cases (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance4.1.normal.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance4.1.normal.js index 5292451dc3ea..f9023e783a1d 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance4.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance4.1.normal.js @@ -1,8 +1,8 @@ //// [callSignatureAssignabilityInInheritance4.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance5.1.normal.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance5.1.normal.js index 7c6bd7a45cea..07eb9918a3e7 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance5.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance5.1.normal.js @@ -1,9 +1,9 @@ //// [callSignatureAssignabilityInInheritance5.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation -// same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance6.1.normal.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance6.1.normal.js index b11804a0b4f0..25219398ce31 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance6.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance6.1.normal.js @@ -1,10 +1,10 @@ //// [callSignatureAssignabilityInInheritance6.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation -// same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures -// all are errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures +// all are errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.1.normal.js b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.1.normal.js index 5376140bfba6..64546d9c2b96 100644 --- a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.1.normal.js @@ -1,8 +1,8 @@ //// [callSignatureWithoutReturnTypeAnnotationInference.ts] -// Call signatures without a return type should infer one from the function body (if present) -// Simple types import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; +// Call signatures without a return type should infer one from the function body (if present) +// Simple types function foo(x) { return 1; } diff --git a/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.1.normal.js index 832c9bc0f2bb..7b3310b452f2 100644 --- a/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.1.normal.js @@ -1,6 +1,6 @@ //// [callSignaturesWithOptionalParameters.ts] -// Optional parameters should be valid in all the below casts import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Optional parameters should be valid in all the below casts function foo(x) {} var f = function foo(x) {}; var f2 = function(x, y) {}; diff --git a/crates/swc/tests/tsc-references/callWithMissingVoid.1.normal.js b/crates/swc/tests/tsc-references/callWithMissingVoid.1.normal.js index 9397add1380b..090c8e7c90d4 100644 --- a/crates/swc/tests/tsc-references/callWithMissingVoid.1.normal.js +++ b/crates/swc/tests/tsc-references/callWithMissingVoid.1.normal.js @@ -1,6 +1,6 @@ //// [callWithMissingVoid.ts] -// From #4260 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// From #4260 var X = /*#__PURE__*/ function() { "use strict"; function X() { diff --git a/crates/swc/tests/tsc-references/callbackTag2.1.normal.js b/crates/swc/tests/tsc-references/callbackTag2.1.normal.js index ca3541a504a9..ab4dbce184d6 100644 --- a/crates/swc/tests/tsc-references/callbackTag2.1.normal.js +++ b/crates/swc/tests/tsc-references/callbackTag2.1.normal.js @@ -1,10 +1,10 @@ //// [cb.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** @template T * @callback Id * @param {T} t * @returns {T} Maybe just return 120 and cast it? - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var x = 1; + */ var x = 1; /** @type {Id} I actually wanted to write `const "120"` */ var one_twenty = function(s) { return "120"; }; diff --git a/crates/swc/tests/tsc-references/checkJsdocTypeTag7.1.normal.js b/crates/swc/tests/tsc-references/checkJsdocTypeTag7.1.normal.js index e8bd3ffab2a5..3c50f0bf6845 100644 --- a/crates/swc/tests/tsc-references/checkJsdocTypeTag7.1.normal.js +++ b/crates/swc/tests/tsc-references/checkJsdocTypeTag7.1.normal.js @@ -1,8 +1,8 @@ //// [test.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @typedef {(a: string, b: number) => void} Foo - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var C = /*#__PURE__*/ function() { + */ var C = /*#__PURE__*/ function() { "use strict"; function C() { _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty1.1.normal.js b/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty1.1.normal.js index 206142a1f5a7..f8b98095b708 100644 --- a/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty1.1.normal.js +++ b/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty1.1.normal.js @@ -1,7 +1,7 @@ //// [checkJsdocTypeTagOnObjectProperty1.ts] //// [0.js] -// @ts-check import { _ as _define_property } from "@swc/helpers/_/_define_property"; +// @ts-check var lol = "hello Lol"; var _obj; var obj = (_obj = { diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js b/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js index 088120f993e2..99d08ea8cde7 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js @@ -1,8 +1,8 @@ //// [checkJsxChildrenCanBeTupleType.tsx] -/// import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +/// import React from 'react'; var ResizablePanel = /*#__PURE__*/ function(_React_Component) { "use strict"; diff --git a/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js b/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js index 683071714fe9..d0574305c599 100644 --- a/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js +++ b/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js @@ -1,10 +1,10 @@ //// [checkJsxSubtleSkipContextSensitiveBug.tsx] -/// import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; +/// import * as React from "react"; var AsyncLoader = /*#__PURE__*/ function(_React_Component) { "use strict"; diff --git a/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js b/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js index edd79fab1b3d..6ad513f26891 100644 --- a/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js +++ b/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js @@ -1,8 +1,8 @@ //// [circularImportAlias.ts] -// expected no error import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// expected no error (function(B) { B.a = A; var D = /*#__PURE__*/ function(_B_a_C) { diff --git a/crates/swc/tests/tsc-references/classAbstractInstantiations1.1.normal.js b/crates/swc/tests/tsc-references/classAbstractInstantiations1.1.normal.js index 8175fac00738..6a0a94f908fa 100644 --- a/crates/swc/tests/tsc-references/classAbstractInstantiations1.1.normal.js +++ b/crates/swc/tests/tsc-references/classAbstractInstantiations1.1.normal.js @@ -1,10 +1,10 @@ //// [classAbstractInstantiations1.ts] -// -// Calling new with (non)abstract classes. -// import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// +// Calling new with (non)abstract classes. +// var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction.1.normal.js b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction.1.normal.js index c346a75b441a..2ec34f0321ca 100644 --- a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction.1.normal.js +++ b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction.1.normal.js @@ -1,13 +1,13 @@ //// [first.js] -/** - * @constructor - * @param {number} numberOxen - */ import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -function Wagon(numberOxen) { +/** + * @constructor + * @param {number} numberOxen + */ function Wagon(numberOxen) { this.numberOxen = numberOxen; } /** @param {Wagon[]=} wagons */ Wagon.circle = function(wagons) { @@ -61,12 +61,12 @@ var Drakkhen = /*#__PURE__*/ function(Dragon1) { return Drakkhen; }(Dragon); //// [second.ts] -/** - * @constructor - */ import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; -function Dragon(numberEaten) { +/** + * @constructor + */ function Dragon(numberEaten) { this.numberEaten = numberEaten; } // error! @@ -102,13 +102,13 @@ var c = new Conestoga(true); c.drunkOO; c.numberOxen; //// [generic.js] +import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; /** * @template T * @param {T} flavour - */ import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; -function Soup(flavour) { + */ function Soup(flavour) { this.flavour = flavour; } /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ var Chowder = /*#__PURE__*/ function(Soup) { diff --git a/crates/swc/tests/tsc-references/classStaticBlock27.1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock27.1.normal.js index 17eb39c2a251..477e2a9633b7 100644 --- a/crates/swc/tests/tsc-references/classStaticBlock27.1.normal.js +++ b/crates/swc/tests/tsc-references/classStaticBlock27.1.normal.js @@ -1,7 +1,7 @@ //// [classStaticBlock27.ts] -// https://github.com/microsoft/TypeScript/issues/44872 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var _Foo; +// https://github.com/microsoft/TypeScript/issues/44872 void (_Foo = function Foo() { "use strict"; _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface.1.normal.js b/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface.1.normal.js index 9109e476d6eb..c38ac867a09f 100644 --- a/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface.1.normal.js @@ -1,7 +1,7 @@ //// [classWithOnlyPublicMembersEquivalentToInterface.ts] -// no errors expected import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; +// no errors expected var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface2.1.normal.js b/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface2.1.normal.js index a5c7ad3da958..4bbb38ee1ab5 100644 --- a/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface2.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithOnlyPublicMembersEquivalentToInterface2.1.normal.js @@ -1,7 +1,7 @@ //// [classWithOnlyPublicMembersEquivalentToInterface2.ts] -// no errors expected import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; +// no errors expected var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/classWithOptionalParameter.1.normal.js b/crates/swc/tests/tsc-references/classWithOptionalParameter.1.normal.js index 66f559d08d70..f5dbbe8f50f1 100644 --- a/crates/swc/tests/tsc-references/classWithOptionalParameter.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithOptionalParameter.1.normal.js @@ -1,6 +1,6 @@ //// [classWithOptionalParameter.ts] -// classes do not permit optional parameters, these are errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// classes do not permit optional parameters, these are errors var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/classWithPrivateProperty.1.normal.js b/crates/swc/tests/tsc-references/classWithPrivateProperty.1.normal.js index 35b2546fc9a6..3acfcbbb50d6 100644 --- a/crates/swc/tests/tsc-references/classWithPrivateProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithPrivateProperty.1.normal.js @@ -1,6 +1,6 @@ //// [classWithPrivateProperty.ts] -// accessing any private outside the class is an error import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// accessing any private outside the class is an error var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/classWithProtectedProperty.1.normal.js b/crates/swc/tests/tsc-references/classWithProtectedProperty.1.normal.js index 040a000fb89d..8a16c3da644a 100644 --- a/crates/swc/tests/tsc-references/classWithProtectedProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithProtectedProperty.1.normal.js @@ -1,8 +1,8 @@ //// [classWithProtectedProperty.ts] -// accessing any protected outside the class is an error import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// accessing any protected outside the class is an error var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es2015).1.normal.js index ecdc949e6bae..d3bc37d35df4 100644 --- a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [classWithStaticFieldInParameterBindingPattern.2.ts] -// https://github.com/microsoft/TypeScript/issues/36295 var _class, _class1; +// https://github.com/microsoft/TypeScript/issues/36295 class C { } (({ [(_class = class extends C { diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es5).1.normal.js index 1d32423d4838..dbc14cecc69a 100644 --- a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=es5).1.normal.js @@ -1,9 +1,9 @@ //// [classWithStaticFieldInParameterBindingPattern.2.ts] -// https://github.com/microsoft/TypeScript/issues/36295 import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; var _class, _class1; +// https://github.com/microsoft/TypeScript/issues/36295 var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es2015).1.normal.js index 8082aa8df171..0c59eaf0390b 100644 --- a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [classWithStaticFieldInParameterInitializer.2.ts] -// https://github.com/microsoft/TypeScript/issues/36295 var _class, _class1; +// https://github.com/microsoft/TypeScript/issues/36295 class C { } ((b = (_class = class extends C { diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es5).1.normal.js index 205ee2361d88..567d6fcbd59b 100644 --- a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=es5).1.normal.js @@ -1,9 +1,9 @@ //// [classWithStaticFieldInParameterInitializer.2.ts] -// https://github.com/microsoft/TypeScript/issues/36295 import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; var _class, _class1; +// https://github.com/microsoft/TypeScript/issues/36295 var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/conditionalOperatorConditoinIsStringType.1.normal.js b/crates/swc/tests/tsc-references/conditionalOperatorConditoinIsStringType.1.normal.js index 0a6c35083dc9..7440d1ea6bb0 100644 --- a/crates/swc/tests/tsc-references/conditionalOperatorConditoinIsStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/conditionalOperatorConditoinIsStringType.1.normal.js @@ -1,6 +1,6 @@ //// [conditionalOperatorConditoinIsStringType.ts] -//Cond ? Expr1 : Expr2, Cond is of string type, Expr1 and Expr2 have the same type import { _ as _type_of } from "@swc/helpers/_/_type_of"; +//Cond ? Expr1 : Expr2, Cond is of string type, Expr1 and Expr2 have the same type var condString; var exprAny1; var exprBoolean1; diff --git a/crates/swc/tests/tsc-references/conditionalOperatorWithIdenticalBCT.1.normal.js b/crates/swc/tests/tsc-references/conditionalOperatorWithIdenticalBCT.1.normal.js index 2e17ed9d15a9..48b7d20ed035 100644 --- a/crates/swc/tests/tsc-references/conditionalOperatorWithIdenticalBCT.1.normal.js +++ b/crates/swc/tests/tsc-references/conditionalOperatorWithIdenticalBCT.1.normal.js @@ -1,8 +1,8 @@ //// [conditionalOperatorWithIdenticalBCT.ts] -//Cond ? Expr1 : Expr2, Expr1 and Expr2 have identical best common type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +//Cond ? Expr1 : Expr2, Expr1 and Expr2 have identical best common type var X = function X() { "use strict"; _class_call_check(this, X); diff --git a/crates/swc/tests/tsc-references/conditionalOperatorWithoutIdenticalBCT.1.normal.js b/crates/swc/tests/tsc-references/conditionalOperatorWithoutIdenticalBCT.1.normal.js index ca17cf55996e..499c01c70544 100644 --- a/crates/swc/tests/tsc-references/conditionalOperatorWithoutIdenticalBCT.1.normal.js +++ b/crates/swc/tests/tsc-references/conditionalOperatorWithoutIdenticalBCT.1.normal.js @@ -1,8 +1,8 @@ //// [conditionalOperatorWithoutIdenticalBCT.ts] -//Cond ? Expr1 : Expr2, Expr1 and Expr2 have no identical best common type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +//Cond ? Expr1 : Expr2, Expr1 and Expr2 have no identical best common type var X = function X() { "use strict"; _class_call_check(this, X); diff --git a/crates/swc/tests/tsc-references/constraintSatisfactionWithAny.1.normal.js b/crates/swc/tests/tsc-references/constraintSatisfactionWithAny.1.normal.js index 3378722e59e8..932c31b34a75 100644 --- a/crates/swc/tests/tsc-references/constraintSatisfactionWithAny.1.normal.js +++ b/crates/swc/tests/tsc-references/constraintSatisfactionWithAny.1.normal.js @@ -1,6 +1,6 @@ //// [constraintSatisfactionWithAny.ts] -// any is not a valid type argument unless there is no constraint, or the constraint is any import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// any is not a valid type argument unless there is no constraint, or the constraint is any function foo(x) { return null; } diff --git a/crates/swc/tests/tsc-references/constraintSatisfactionWithEmptyObject.1.normal.js b/crates/swc/tests/tsc-references/constraintSatisfactionWithEmptyObject.1.normal.js index 6a75695f09fe..6fcda10af1f3 100644 --- a/crates/swc/tests/tsc-references/constraintSatisfactionWithEmptyObject.1.normal.js +++ b/crates/swc/tests/tsc-references/constraintSatisfactionWithEmptyObject.1.normal.js @@ -1,7 +1,7 @@ //// [constraintSatisfactionWithEmptyObject.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // valid uses of a basic object constraint, no errors expected // Object constraint -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function foo(x) {} var r = foo({}); var a = {}; diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance2.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance2.1.normal.js index 820cbc6b4bf9..2a70a7388ad9 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance2.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance2.1.normal.js @@ -1,8 +1,8 @@ //// [constructSignatureAssignabilityInInheritance2.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.1.normal.js index ad2c6aae5d64..f2ea1db07a96 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.1.normal.js @@ -1,9 +1,9 @@ //// [constructSignatureAssignabilityInInheritance3.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation -// error cases import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation +// error cases (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance4.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance4.1.normal.js index 213e2b882cd4..f8ff22967183 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance4.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance4.1.normal.js @@ -1,8 +1,8 @@ //// [constructSignatureAssignabilityInInheritance4.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance5.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance5.1.normal.js index 10eb75d08443..73ee163f27b2 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance5.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance5.1.normal.js @@ -1,9 +1,9 @@ //// [constructSignatureAssignabilityInInheritance5.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation -// same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance6.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance6.1.normal.js index 0390cea6609e..b2f35634832f 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance6.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance6.1.normal.js @@ -1,10 +1,10 @@ //// [constructSignatureAssignabilityInInheritance6.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation -// same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures -// all are errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures +// all are errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/constructSignaturesWithIdenticalOverloads.1.normal.js b/crates/swc/tests/tsc-references/constructSignaturesWithIdenticalOverloads.1.normal.js index 9e31c81b18a9..cc5192c5c023 100644 --- a/crates/swc/tests/tsc-references/constructSignaturesWithIdenticalOverloads.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignaturesWithIdenticalOverloads.1.normal.js @@ -1,6 +1,6 @@ //// [constructSignaturesWithIdenticalOverloads.ts] -// Duplicate overloads of construct signatures should generate errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Duplicate overloads of construct signatures should generate errors var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/constructSignaturesWithOverloads.1.normal.js b/crates/swc/tests/tsc-references/constructSignaturesWithOverloads.1.normal.js index 5f12c8abceb0..bb07fd0d3297 100644 --- a/crates/swc/tests/tsc-references/constructSignaturesWithOverloads.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignaturesWithOverloads.1.normal.js @@ -1,6 +1,6 @@ //// [constructSignaturesWithOverloads.ts] -// No errors expected for basic overloads of construct signatures import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// No errors expected for basic overloads of construct signatures var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/constructSignaturesWithOverloads2.1.normal.js b/crates/swc/tests/tsc-references/constructSignaturesWithOverloads2.1.normal.js index ab7cf4a9177b..d683cbf25662 100644 --- a/crates/swc/tests/tsc-references/constructSignaturesWithOverloads2.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignaturesWithOverloads2.1.normal.js @@ -1,7 +1,7 @@ //// [constructSignaturesWithOverloads2.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // No errors expected for basic overloads of construct signatures with merged declarations // clodules -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.1.normal.js b/crates/swc/tests/tsc-references/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.1.normal.js index f5836c143293..25616e1852a8 100644 --- a/crates/swc/tests/tsc-references/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.1.normal.js +++ b/crates/swc/tests/tsc-references/constructSignaturesWithOverloadsThatDifferOnlyByReturnType.1.normal.js @@ -1,6 +1,6 @@ //// [constructSignaturesWithOverloadsThatDifferOnlyByReturnType.ts] -// Error for construct signature overloads to differ only by return type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Error for construct signature overloads to differ only by return type var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/constructorFunctionTypeIsAssignableToBaseType2.1.normal.js b/crates/swc/tests/tsc-references/constructorFunctionTypeIsAssignableToBaseType2.1.normal.js index 665d37e93647..a1444de52073 100644 --- a/crates/swc/tests/tsc-references/constructorFunctionTypeIsAssignableToBaseType2.1.normal.js +++ b/crates/swc/tests/tsc-references/constructorFunctionTypeIsAssignableToBaseType2.1.normal.js @@ -1,9 +1,9 @@ //// [constructorFunctionTypeIsAssignableToBaseType2.ts] -// the constructor function itself does not need to be a subtype of the base type constructor function import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _possible_constructor_return } from "@swc/helpers/_/_possible_constructor_return"; +// the constructor function itself does not need to be a subtype of the base type constructor function var Base = function Base(x) { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/constructorFunctionsStrict.1.normal.js b/crates/swc/tests/tsc-references/constructorFunctionsStrict.1.normal.js index 5b30cf206d4f..bb3c5ec00901 100644 --- a/crates/swc/tests/tsc-references/constructorFunctionsStrict.1.normal.js +++ b/crates/swc/tests/tsc-references/constructorFunctionsStrict.1.normal.js @@ -1,6 +1,6 @@ //// [a.js] -/** @param {number} x */ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; -function C(x) { +import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; +/** @param {number} x */ function C(x) { this.x = x; } C.prototype.m = function() { diff --git a/crates/swc/tests/tsc-references/constructorParameterShadowsOuterScopes.1.normal.js b/crates/swc/tests/tsc-references/constructorParameterShadowsOuterScopes.1.normal.js index 7b3a66c0bf51..146e0c0d6e65 100644 --- a/crates/swc/tests/tsc-references/constructorParameterShadowsOuterScopes.1.normal.js +++ b/crates/swc/tests/tsc-references/constructorParameterShadowsOuterScopes.1.normal.js @@ -1,9 +1,9 @@ //// [constructorParameterShadowsOuterScopes.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Initializer expressions for instance member variables are evaluated in the scope of the class constructor // body but are not permitted to reference parameters or local variables of the constructor. // This effectively means that entities from outer scopes by the same name as a constructor parameter or // local variable are inaccessible in initializer expressions for instance member variables -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var x = 1; var C = function C(x1) { "use strict"; diff --git a/crates/swc/tests/tsc-references/constructorWithAssignableReturnExpression.1.normal.js b/crates/swc/tests/tsc-references/constructorWithAssignableReturnExpression.1.normal.js index e6da795f8f1b..3eb8220f41f7 100644 --- a/crates/swc/tests/tsc-references/constructorWithAssignableReturnExpression.1.normal.js +++ b/crates/swc/tests/tsc-references/constructorWithAssignableReturnExpression.1.normal.js @@ -1,6 +1,6 @@ //// [constructorWithAssignableReturnExpression.ts] -// a class constructor may return an expression, it must be assignable to the class instance type to be valid import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// a class constructor may return an expression, it must be assignable to the class instance type to be valid var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/contextualTypeWithTuple.1.normal.js b/crates/swc/tests/tsc-references/contextualTypeWithTuple.1.normal.js index 9ee8fe0ed07b..2c68697d7b2c 100644 --- a/crates/swc/tests/tsc-references/contextualTypeWithTuple.1.normal.js +++ b/crates/swc/tests/tsc-references/contextualTypeWithTuple.1.normal.js @@ -1,6 +1,6 @@ //// [contextualTypeWithTuple.ts] -// no error import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// no error var numStrTuple = [ 5, "hello" diff --git a/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment.1.normal.js b/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment.1.normal.js index 88f37990bbec..044fd0e2aa42 100644 --- a/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment.1.normal.js +++ b/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment.1.normal.js @@ -1,9 +1,9 @@ //// [test.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** @typedef {{ status: 'done' m(n: number): void }} DoneStatus */ // property assignment -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var ns = {}; /** @type {DoneStatus} */ ns.x = { status: 'done', diff --git a/crates/swc/tests/tsc-references/controlFlowAliasing.1.normal.js b/crates/swc/tests/tsc-references/controlFlowAliasing.1.normal.js index c84fe48859fa..79ce021bf964 100644 --- a/crates/swc/tests/tsc-references/controlFlowAliasing.1.normal.js +++ b/crates/swc/tests/tsc-references/controlFlowAliasing.1.normal.js @@ -1,6 +1,6 @@ //// [controlFlowAliasing.ts] -// Narrowing by aliased conditional expressions import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Narrowing by aliased conditional expressions function f10(x) { var isString = typeof x === "string"; if (isString) { diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4.1.normal.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4.1.normal.js index 4406730a28a0..d46eef5955c2 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4.1.normal.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4.1.normal.js @@ -1,9 +1,9 @@ //// [correctlyMarkAliasAsReferences4.tsx] //// [declaration.d.ts] //// [0.tsx] -/// import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; +/// import * as cx from 'classnames'; import * as React from "react"; let buttonProps; diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.1.normal.js index 9bc2c4986e12..d2f063e5fcf6 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.1.normal.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.1.normal.js @@ -1,6 +1,6 @@ //// [decrementOperatorWithAnyOtherType.ts] -// -- operator on any type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// -- operator on any type var ANY; var ANY1; var ANY2 = [ diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.1.normal.js index 89dcb453ff78..1a9ea0a52160 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [decrementOperatorWithNumberType.ts] -// -- operator on number type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// -- operator on number type var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/derivedClassConstructorWithoutSuperCall.1.normal.js b/crates/swc/tests/tsc-references/derivedClassConstructorWithoutSuperCall.1.normal.js index 04124cf84b27..d28d16fa048e 100644 --- a/crates/swc/tests/tsc-references/derivedClassConstructorWithoutSuperCall.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassConstructorWithoutSuperCall.1.normal.js @@ -1,9 +1,9 @@ //// [derivedClassConstructorWithoutSuperCall.ts] -// derived class constructors must contain a super call import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized"; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// derived class constructors must contain a super call var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/derivedClassTransitivity.1.normal.js b/crates/swc/tests/tsc-references/derivedClassTransitivity.1.normal.js index 06a0788abac1..e482c0caa0d2 100644 --- a/crates/swc/tests/tsc-references/derivedClassTransitivity.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassTransitivity.1.normal.js @@ -1,8 +1,8 @@ //// [derivedClassTransitivity.ts] -// subclassing is not transitive when you can remove required parameters and add optional parameters import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// subclassing is not transitive when you can remove required parameters and add optional parameters var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/derivedClassTransitivity2.1.normal.js b/crates/swc/tests/tsc-references/derivedClassTransitivity2.1.normal.js index 06d58ea86f11..d5f4d54c27f0 100644 --- a/crates/swc/tests/tsc-references/derivedClassTransitivity2.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassTransitivity2.1.normal.js @@ -1,8 +1,8 @@ //// [derivedClassTransitivity2.ts] -// subclassing is not transitive when you can remove required parameters and add optional parameters import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// subclassing is not transitive when you can remove required parameters and add optional parameters var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/derivedClassTransitivity3.1.normal.js b/crates/swc/tests/tsc-references/derivedClassTransitivity3.1.normal.js index 737006bb7b29..489fc92b0ced 100644 --- a/crates/swc/tests/tsc-references/derivedClassTransitivity3.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassTransitivity3.1.normal.js @@ -1,8 +1,8 @@ //// [derivedClassTransitivity3.ts] -// subclassing is not transitive when you can remove required parameters and add optional parameters import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// subclassing is not transitive when you can remove required parameters and add optional parameters var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/derivedClassTransitivity4.1.normal.js b/crates/swc/tests/tsc-references/derivedClassTransitivity4.1.normal.js index 91015d8f7751..146b5b077e01 100644 --- a/crates/swc/tests/tsc-references/derivedClassTransitivity4.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassTransitivity4.1.normal.js @@ -1,8 +1,8 @@ //// [derivedClassTransitivity4.ts] -// subclassing is not transitive when you can remove required parameters and add optional parameters on protected members import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// subclassing is not transitive when you can remove required parameters and add optional parameters on protected members var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/derivedClassWithoutExplicitConstructor3.1.normal.js b/crates/swc/tests/tsc-references/derivedClassWithoutExplicitConstructor3.1.normal.js index 4ba3169cb726..fd6f4e8b43cb 100644 --- a/crates/swc/tests/tsc-references/derivedClassWithoutExplicitConstructor3.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassWithoutExplicitConstructor3.1.normal.js @@ -1,8 +1,8 @@ //// [derivedClassWithoutExplicitConstructor3.ts] -// automatic constructors with a class hieararchy of depth > 2 import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// automatic constructors with a class hieararchy of depth > 2 var Base = function Base(x) { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js index a39c2cc368a2..7da484ac29f0 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js @@ -1,4 +1,7 @@ //// [destructuringArrayBindingPatternAndAssignment1ES5.ts] +import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; +import { _ as _to_array } from "@swc/helpers/_/_to_array"; +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; /* AssignmentPattern: * ObjectAssignmentPattern * ArrayAssignmentPattern @@ -18,9 +21,6 @@ // An expression of type S is considered assignable to an assignment target V if one of the following is true // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, // S is the type Any, or -import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; -import { _ as _to_array } from "@swc/helpers/_/_to_array"; -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var _undefined = _sliced_to_array(undefined, 2), a0 = _undefined[0], a1 = _undefined[1]; var _undefined1 = _sliced_to_array(undefined, 2), tmp = _undefined1[0], a2 = tmp === void 0 ? false : tmp, tmp1 = _undefined1[1], a3 = tmp1 === void 0 ? 1 : tmp1; // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js index 1db628053533..5bde4093dcd2 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js @@ -1,4 +1,7 @@ //// [destructuringArrayBindingPatternAndAssignment1ES5iterable.ts] +import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; +import { _ as _to_array } from "@swc/helpers/_/_to_array"; +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; /* AssignmentPattern: * ObjectAssignmentPattern * ArrayAssignmentPattern @@ -18,9 +21,6 @@ // An expression of type S is considered assignable to an assignment target V if one of the following is true // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, // S is the type Any, or -import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; -import { _ as _to_array } from "@swc/helpers/_/_to_array"; -import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var _undefined = _sliced_to_array(undefined, 2), a0 = _undefined[0], a1 = _undefined[1]; var _undefined1 = _sliced_to_array(undefined, 2), tmp = _undefined1[0], a2 = tmp === void 0 ? false : tmp, tmp1 = _undefined1[1], a3 = tmp1 === void 0 ? 1 : tmp1; // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js index 824e5a8c710f..8a1f95404ee1 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js @@ -1,8 +1,8 @@ //// [destructuringArrayBindingPatternAndAssignment2.ts] -// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, -// S is the type Any, or import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; +// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, +// S is the type Any, or var _ref // Error = [], _ref_ = _sliced_to_array(_ref[0], 1), a0 = _ref_[0], _ref_1 = _sliced_to_array(_ref[1], 1), _ref__ = _sliced_to_array(_ref_1[0], 1), a1 = _ref__[0]; var _undefined // Error diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment5SiblingInitializer.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment5SiblingInitializer.1.normal.js index 8351bf4e3639..b9607eb1755a 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment5SiblingInitializer.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment5SiblingInitializer.1.normal.js @@ -1,6 +1,6 @@ //// [destructuringArrayBindingPatternAndAssignment5SiblingInitializer.ts] -// To be inferred as `number` import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; +// To be inferred as `number` function f1() { var _ref = [ 1 diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js index 5ff9c35c35f1..2d0aa1ad5eff 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js @@ -1,9 +1,9 @@ //// [destructuringEvaluationOrder.ts] -// https://github.com/microsoft/TypeScript/issues/39205 import { _ as _extends } from "@swc/helpers/_/_extends"; import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; import { _ as _to_property_key } from "@swc/helpers/_/_to_property_key"; +// https://github.com/microsoft/TypeScript/issues/39205 let trace = []; let order = (n)=>trace.push(n); // order(0) should evaluate before order(1) because the first element is undefined diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js index 888e86ee4b00..3efaaf4f32dd 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js @@ -1,10 +1,10 @@ //// [destructuringEvaluationOrder.ts] -// https://github.com/microsoft/TypeScript/issues/39205 import { _ as _extends } from "@swc/helpers/_/_extends"; import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_property_key } from "@swc/helpers/_/_to_property_key"; +// https://github.com/microsoft/TypeScript/issues/39205 var trace = []; var order = function(n) { return trace.push(n); diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js index f42f0532cffd..f43de7496101 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js @@ -1,8 +1,8 @@ //// [destructuringVariableDeclaration1ES5.ts] -// The type T associated with a destructuring variable declaration is determined as follows: -// If the declaration includes a type annotation, T is that type. import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; +// The type T associated with a destructuring variable declaration is determined as follows: +// If the declaration includes a type annotation, T is that type. var _ref = { a1: 10, a2: "world" diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js index 02cc5b2d4d28..529505721758 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js @@ -1,8 +1,8 @@ //// [destructuringVariableDeclaration1ES5iterable.ts] -// The type T associated with a destructuring variable declaration is determined as follows: -// If the declaration includes a type annotation, T is that type. import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; +// The type T associated with a destructuring variable declaration is determined as follows: +// If the declaration includes a type annotation, T is that type. var _ref = { a1: 10, a2: "world" diff --git a/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js b/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js index 3e82477eb478..33ff197d3121 100644 --- a/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js @@ -1,6 +1,6 @@ //// [destructuringWithLiteralInitializers.ts] -// (arg: { x: any, y: any }) => void import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; +// (arg: { x: any, y: any }) => void function f1(param) { var x = param.x, y = param.y; } diff --git a/crates/swc/tests/tsc-references/duplicateStringIndexers.1.normal.js b/crates/swc/tests/tsc-references/duplicateStringIndexers.1.normal.js index 14df11193195..28839a407b75 100644 --- a/crates/swc/tests/tsc-references/duplicateStringIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/duplicateStringIndexers.1.normal.js @@ -1,6 +1,6 @@ //// [duplicateStringIndexers.ts] -// it is an error to have duplicate index signatures of the same kind in a type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// it is an error to have duplicate index signatures of the same kind in a type (function(test) { var C = function C() { "use strict"; diff --git a/crates/swc/tests/tsc-references/emitter.forAwait(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/emitter.forAwait(target=es2015).1.normal.js index 05287885cb3a..20ab754bf31e 100644 --- a/crates/swc/tests/tsc-references/emitter.forAwait(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.forAwait(target=es2015).1.normal.js @@ -121,9 +121,9 @@ function f4() { })(); } //// [file5.ts] -// https://github.com/Microsoft/TypeScript/issues/21363 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; +// https://github.com/Microsoft/TypeScript/issues/21363 function f5() { return _async_to_generator(function*() { let y; @@ -153,10 +153,10 @@ function f5() { })(); } //// [file6.ts] -// https://github.com/Microsoft/TypeScript/issues/21363 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator"; import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; +// https://github.com/Microsoft/TypeScript/issues/21363 function f6() { return _wrap_async_generator(function*() { let y; @@ -186,10 +186,10 @@ function f6() { })(); } //// [file7.ts] -// https://github.com/microsoft/TypeScript/issues/36166 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator"; import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; +// https://github.com/microsoft/TypeScript/issues/36166 function f7() { return _wrap_async_generator(function*() { let y; diff --git a/crates/swc/tests/tsc-references/emitter.forAwait(target=es5).1.normal.js b/crates/swc/tests/tsc-references/emitter.forAwait(target=es5).1.normal.js index a5b40e73a3d9..97d91e814869 100644 --- a/crates/swc/tests/tsc-references/emitter.forAwait(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.forAwait(target=es5).1.normal.js @@ -381,10 +381,10 @@ function f4() { })(); } //// [file5.ts] -// https://github.com/Microsoft/TypeScript/issues/21363 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; +// https://github.com/Microsoft/TypeScript/issues/21363 function f5() { return _async_to_generator(function() { var y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x, err; @@ -478,11 +478,11 @@ function f5() { })(); } //// [file6.ts] -// https://github.com/Microsoft/TypeScript/issues/21363 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator"; import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; +// https://github.com/Microsoft/TypeScript/issues/21363 function f6() { return _wrap_async_generator(function() { var y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x, err; @@ -576,11 +576,11 @@ function f6() { })(); } //// [file7.ts] -// https://github.com/microsoft/TypeScript/issues/36166 import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator"; import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator"; import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; +// https://github.com/microsoft/TypeScript/issues/36166 function f7() { return _wrap_async_generator(function() { var y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x, err; diff --git a/crates/swc/tests/tsc-references/enumAssignability.1.normal.js b/crates/swc/tests/tsc-references/enumAssignability.1.normal.js index 64c760107ab6..6e08bc22e319 100644 --- a/crates/swc/tests/tsc-references/enumAssignability.1.normal.js +++ b/crates/swc/tests/tsc-references/enumAssignability.1.normal.js @@ -1,6 +1,6 @@ //// [enumAssignability.ts] -// enums assignable to number, any, Object, errors unless otherwise noted import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// enums assignable to number, any, Object, errors unless otherwise noted var E = /*#__PURE__*/ function(E) { E[E["A"] = 0] = "A"; return E; diff --git a/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.1.normal.js b/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.1.normal.js index 812a64607905..976e5bcc20f0 100644 --- a/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.1.normal.js +++ b/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.1.normal.js @@ -1,6 +1,6 @@ //// [enumAssignabilityInInheritance.ts] -// enum is only a subtype of number, no types are subtypes of enum, all of these except the first are errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// enum is only a subtype of number, no types are subtypes of enum, all of these except the first are errors var E = /*#__PURE__*/ function(E) { E[E["A"] = 0] = "A"; return E; diff --git a/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.1.normal.js b/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.1.normal.js index 5465d602de8f..46f5d1a277d3 100644 --- a/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.1.normal.js +++ b/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.1.normal.js @@ -1,6 +1,6 @@ //// [enumIsNotASubtypeOfAnythingButNumber.ts] -// enums are only subtypes of number, any and no other types import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// enums are only subtypes of number, any and no other types var E = /*#__PURE__*/ function(E) { E[E["A"] = 0] = "A"; return E; diff --git a/crates/swc/tests/tsc-references/errorOnFunctionReturnType.1.normal.js b/crates/swc/tests/tsc-references/errorOnFunctionReturnType.1.normal.js index 13ad1552f797..9fc6aa194330 100644 --- a/crates/swc/tests/tsc-references/errorOnFunctionReturnType.1.normal.js +++ b/crates/swc/tests/tsc-references/errorOnFunctionReturnType.1.normal.js @@ -1,10 +1,10 @@ //// [foo.js] +import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; +import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; /** * @callback FunctionReturningPromise * @returns {Promise} - */ /** @type {FunctionReturningPromise} */ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; -import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; -function testPromise1() { + */ /** @type {FunctionReturningPromise} */ function testPromise1() { console.log("Nope"); } /** @type {FunctionReturningPromise} */ function testPromise2() { diff --git a/crates/swc/tests/tsc-references/errorSuperPropertyAccess.1.normal.js b/crates/swc/tests/tsc-references/errorSuperPropertyAccess.1.normal.js index 3092573067dc..e854895ea0c2 100644 --- a/crates/swc/tests/tsc-references/errorSuperPropertyAccess.1.normal.js +++ b/crates/swc/tests/tsc-references/errorSuperPropertyAccess.1.normal.js @@ -1,7 +1,4 @@ //// [errorSuperPropertyAccess.ts] -//super property access in constructor of class with no base type -//super property access in instance member function of class with no base type -//super property access in instance member accessor(get and set) of class with no base type import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized"; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; @@ -10,6 +7,9 @@ import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _set } from "@swc/helpers/_/_set"; +//super property access in constructor of class with no base type +//super property access in instance member function of class with no base type +//super property access in instance member accessor(get and set) of class with no base type var NoBase = /*#__PURE__*/ function() { "use strict"; function NoBase() { diff --git a/crates/swc/tests/tsc-references/exportCodeGen.1.normal.js b/crates/swc/tests/tsc-references/exportCodeGen.1.normal.js index fc5c62da0044..ce998ccbfe5d 100644 --- a/crates/swc/tests/tsc-references/exportCodeGen.1.normal.js +++ b/crates/swc/tests/tsc-references/exportCodeGen.1.normal.js @@ -1,7 +1,7 @@ //// [exportCodeGen.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // should replace all refs to 'x' in the body, // with fully qualified -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(A) { A.x = 12; function lt12() { diff --git a/crates/swc/tests/tsc-references/exportImportAlias.1.normal.js b/crates/swc/tests/tsc-references/exportImportAlias.1.normal.js index 119c80ebbd49..d23a534f25d1 100644 --- a/crates/swc/tests/tsc-references/exportImportAlias.1.normal.js +++ b/crates/swc/tests/tsc-references/exportImportAlias.1.normal.js @@ -1,6 +1,6 @@ //// [exportImportAlias.ts] -// expect no errors here import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// expect no errors here (function(A) { A.x = 'hello world'; var Point = function Point(x, y) { diff --git a/crates/swc/tests/tsc-references/extendsTag1.1.normal.js b/crates/swc/tests/tsc-references/extendsTag1.1.normal.js index 715db9d752ad..1087dfb9ea1f 100644 --- a/crates/swc/tests/tsc-references/extendsTag1.1.normal.js +++ b/crates/swc/tests/tsc-references/extendsTag1.1.normal.js @@ -1,12 +1,12 @@ //// [bug25101.js] -/** - * @template T - * @extends {Set} Should prefer this Set, not the Set in the heritage clause - */ import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _wrap_native_super } from "@swc/helpers/_/_wrap_native_super"; -var My = /*#__PURE__*/ function(Set1) { +/** + * @template T + * @extends {Set} Should prefer this Set, not the Set in the heritage clause + */ var My = /*#__PURE__*/ function(Set1) { "use strict"; _inherits(My, Set1); function My() { diff --git a/crates/swc/tests/tsc-references/extendsTag5.1.normal.js b/crates/swc/tests/tsc-references/extendsTag5.1.normal.js index 1e4c6efc9558..dbf625ea8038 100644 --- a/crates/swc/tests/tsc-references/extendsTag5.1.normal.js +++ b/crates/swc/tests/tsc-references/extendsTag5.1.normal.js @@ -1,4 +1,7 @@ //// [/a.js] +import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; /** * @typedef {{ * a: number | string; @@ -6,10 +9,7 @@ * }} Foo */ /** * @template {Foo} T -*/ import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; -var A = function A(a) { +*/ var A = function A(a) { "use strict"; _class_call_check(this, A); return a; diff --git a/crates/swc/tests/tsc-references/functionConstraintSatisfaction.1.normal.js b/crates/swc/tests/tsc-references/functionConstraintSatisfaction.1.normal.js index b365d4762764..1208ef225ab0 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction.1.normal.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction.1.normal.js @@ -1,6 +1,6 @@ //// [functionConstraintSatisfaction.ts] -// satisfaction of a constraint to Function, no errors expected import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// satisfaction of a constraint to Function, no errors expected function foo(x) { return x; } diff --git a/crates/swc/tests/tsc-references/functionConstraintSatisfaction2.1.normal.js b/crates/swc/tests/tsc-references/functionConstraintSatisfaction2.1.normal.js index c8512dd36c48..ebd6dc65fb2b 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction2.1.normal.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction2.1.normal.js @@ -1,6 +1,6 @@ //// [functionConstraintSatisfaction2.ts] -// satisfaction of a constraint to Function, all of these invocations are errors unless otherwise noted import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// satisfaction of a constraint to Function, all of these invocations are errors unless otherwise noted function foo(x) { return x; } diff --git a/crates/swc/tests/tsc-references/functionConstraintSatisfaction3.1.normal.js b/crates/swc/tests/tsc-references/functionConstraintSatisfaction3.1.normal.js index e05c098623e7..ab6445f0b880 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction3.1.normal.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction3.1.normal.js @@ -1,6 +1,6 @@ //// [functionConstraintSatisfaction3.ts] -// satisfaction of a constraint to Function, no errors expected import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// satisfaction of a constraint to Function, no errors expected function foo(x) { return x; } diff --git a/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.1.normal.js b/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.1.normal.js index 1c905a3555cd..54aab6c4ecbf 100644 --- a/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.1.normal.js +++ b/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.1.normal.js @@ -1,7 +1,7 @@ //// [functionExpressionContextualTyping1.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // When a function expression with no type parameters and no parameter type annotations // is contextually typed (section 4.19) by a type T and a contextual signature S can be extracted from T -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var E = /*#__PURE__*/ function(E) { E[E["red"] = 0] = "red"; E[E["blue"] = 1] = "blue"; diff --git a/crates/swc/tests/tsc-references/functionImplementationErrors.1.normal.js b/crates/swc/tests/tsc-references/functionImplementationErrors.1.normal.js index 433693246a50..900830f6fb35 100644 --- a/crates/swc/tests/tsc-references/functionImplementationErrors.1.normal.js +++ b/crates/swc/tests/tsc-references/functionImplementationErrors.1.normal.js @@ -1,8 +1,8 @@ //// [functionImplementationErrors.ts] -// FunctionExpression with no return type annotation with multiple return statements with unrelated types import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// FunctionExpression with no return type annotation with multiple return statements with unrelated types var f1 = function f1() { return ''; return 3; diff --git a/crates/swc/tests/tsc-references/functionImplementations.1.normal.js b/crates/swc/tests/tsc-references/functionImplementations.1.normal.js index 822ba8ee8f16..b15726d1d948 100644 --- a/crates/swc/tests/tsc-references/functionImplementations.1.normal.js +++ b/crates/swc/tests/tsc-references/functionImplementations.1.normal.js @@ -1,8 +1,8 @@ //// [functionImplementations.ts] -// FunctionExpression with no return type annotation and no return statement returns void import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// FunctionExpression with no return type annotation and no return statement returns void var v = function() {}(); // FunctionExpression f with no return type annotation and directly references f in its body returns any var a = function f() { diff --git a/crates/swc/tests/tsc-references/functionLiteralForOverloads2.1.normal.js b/crates/swc/tests/tsc-references/functionLiteralForOverloads2.1.normal.js index 8205887926fc..3d71417e44e8 100644 --- a/crates/swc/tests/tsc-references/functionLiteralForOverloads2.1.normal.js +++ b/crates/swc/tests/tsc-references/functionLiteralForOverloads2.1.normal.js @@ -1,6 +1,6 @@ //// [functionLiteralForOverloads2.ts] -// basic uses of function literals with constructor overloads import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// basic uses of function literals with constructor overloads var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/functionParameterObjectRestAndInitializers.1.normal.js b/crates/swc/tests/tsc-references/functionParameterObjectRestAndInitializers.1.normal.js index c45ab010a0f0..2811a1867b77 100644 --- a/crates/swc/tests/tsc-references/functionParameterObjectRestAndInitializers.1.normal.js +++ b/crates/swc/tests/tsc-references/functionParameterObjectRestAndInitializers.1.normal.js @@ -1,6 +1,6 @@ //// [functionParameterObjectRestAndInitializers.ts] -// https://github.com/microsoft/TypeScript/issues/47079 import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; +// https://github.com/microsoft/TypeScript/issues/47079 function f(_param, b = a) { var { a } = _param, x = _object_without_properties(_param, [ "a" diff --git a/crates/swc/tests/tsc-references/genericCallTypeArgumentInference.1.normal.js b/crates/swc/tests/tsc-references/genericCallTypeArgumentInference.1.normal.js index c9659372163e..e8a9f8e1a213 100644 --- a/crates/swc/tests/tsc-references/genericCallTypeArgumentInference.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallTypeArgumentInference.1.normal.js @@ -1,6 +1,6 @@ //// [genericCallTypeArgumentInference.ts] -// Basic type inference with generic calls, no errors expected import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Basic type inference with generic calls, no errors expected function foo(t) { return t; } diff --git a/crates/swc/tests/tsc-references/genericCallWithConstraintsTypeArgumentInference.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithConstraintsTypeArgumentInference.1.normal.js index 47967bb5ae14..5a5ba6115f59 100644 --- a/crates/swc/tests/tsc-references/genericCallWithConstraintsTypeArgumentInference.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithConstraintsTypeArgumentInference.1.normal.js @@ -1,8 +1,8 @@ //// [genericCallWithConstraintsTypeArgumentInference.ts] -// Basic type inference with generic calls and constraints, no errors expected import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// Basic type inference with generic calls and constraints, no errors expected var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/genericCallWithFunctionTypedArguments4.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithFunctionTypedArguments4.1.normal.js index 5f2c9c277830..ec4f1d79cd9a 100644 --- a/crates/swc/tests/tsc-references/genericCallWithFunctionTypedArguments4.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithFunctionTypedArguments4.1.normal.js @@ -1,6 +1,6 @@ //// [genericCallWithFunctionTypedArguments4.ts] -// No inference is made from function typed arguments which have multiple call signatures import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// No inference is made from function typed arguments which have multiple call signatures var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints.1.normal.js index 62b280e019b2..0a30d30ab28f 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints.1.normal.js @@ -1,7 +1,7 @@ //// [genericCallWithObjectTypeArgsAndConstraints.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Generic call with constraints infering type parameter from object member properties // No errors expected -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints2.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints2.1.normal.js index 4c8eb9026f51..6b73d627f31d 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints2.1.normal.js @@ -1,9 +1,9 @@ //// [genericCallWithObjectTypeArgsAndConstraints2.ts] -// Generic call with constraints infering type parameter from object member properties -// No errors expected import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// Generic call with constraints infering type parameter from object member properties +// No errors expected var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.1.normal.js index 60b7457924c2..ec600bea741a 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints3.1.normal.js @@ -1,8 +1,8 @@ //// [genericCallWithObjectTypeArgsAndConstraints3.ts] -// Generic call with constraints infering type parameter from object member properties import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// Generic call with constraints infering type parameter from object member properties var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints4.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints4.1.normal.js index 5697aa14bf13..abfd9d662e3b 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints4.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints4.1.normal.js @@ -1,6 +1,6 @@ //// [genericCallWithObjectTypeArgsAndConstraints4.ts] -// Generic call with constraints infering type parameter from object member properties import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Generic call with constraints infering type parameter from object member properties var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints5.1.normal.js b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints5.1.normal.js index c9cc4f579c2f..ecba338f3342 100644 --- a/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints5.1.normal.js +++ b/crates/swc/tests/tsc-references/genericCallWithObjectTypeArgsAndConstraints5.1.normal.js @@ -1,6 +1,6 @@ //// [genericCallWithObjectTypeArgsAndConstraints5.ts] -// Generic call with constraints infering type parameter from object member properties import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Generic call with constraints infering type parameter from object member properties var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.1.normal.js b/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.1.normal.js index 3a61ab1a47ef..c1e4bdb8476f 100644 --- a/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.1.normal.js @@ -1,7 +1,7 @@ //// [genericClassWithFunctionTypedMemberArguments.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Generic functions used as arguments for function typed parameters are not used to make inferences from // Using function arguments, no errors expected -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(ImmediatelyFix) { var C = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.1.normal.js b/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.1.normal.js index dd30ddb257ff..57f400e3c567 100644 --- a/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.1.normal.js @@ -1,7 +1,7 @@ //// [genericClassWithObjectTypeArgsAndConstraints.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Generic call with constraints infering type parameter from object member properties // No errors expected -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/getSetAccessorContextualTyping.1.normal.js b/crates/swc/tests/tsc-references/getSetAccessorContextualTyping.1.normal.js index 8513f2f55f58..b184bf64e3ba 100644 --- a/crates/swc/tests/tsc-references/getSetAccessorContextualTyping.1.normal.js +++ b/crates/swc/tests/tsc-references/getSetAccessorContextualTyping.1.normal.js @@ -1,9 +1,9 @@ //// [getSetAccessorContextualTyping.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _create_class } from "@swc/helpers/_/_create_class"; // In the body of a get accessor with no return type annotation, // if a matching set accessor exists and that set accessor has a parameter type annotation, // return expressions are contextually typed by the type given in the set accessor's parameter type annotation. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _create_class } from "@swc/helpers/_/_create_class"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.1.normal.js b/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.1.normal.js index fe0bc8d10b16..c368ae04dc39 100644 --- a/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.1.normal.js +++ b/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.1.normal.js @@ -1,8 +1,8 @@ //// [heterogeneousArrayLiterals.ts] -// type of an array is the best common type of its elements (plus its contextual type if it exists) import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// type of an array is the best common type of its elements (plus its contextual type if it exists) var a = [ 1, '' diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS3.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS3.1.normal.js index bba99bb94603..ba278fe5f076 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS3.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS3.1.normal.js @@ -15,12 +15,12 @@ class B { } } //// [2.ts] -// We use Promise for now as there is no way to specify shape of module object "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"); +// We use Promise for now as there is no way to specify shape of module object function foo(x) { x.then((value)=>{ let b = new value.B(); diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.1.normal.js index fcdf63c773cb..a9ccae443b4f 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.1.normal.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.1.normal.js @@ -1,6 +1,6 @@ //// [incrementOperatorWithAnyOtherType.ts] -// ++ operator on any type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// ++ operator on any type var ANY; var ANY1; var ANY2 = [ diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.1.normal.js index 711f576d69f1..bf567ff18e70 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [incrementOperatorWithNumberType.ts] -// ++ operator on number type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// ++ operator on number type var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/initializerReferencingConstructorLocals.1.normal.js b/crates/swc/tests/tsc-references/initializerReferencingConstructorLocals.1.normal.js index 336a125364f4..c70ffb9167ac 100644 --- a/crates/swc/tests/tsc-references/initializerReferencingConstructorLocals.1.normal.js +++ b/crates/swc/tests/tsc-references/initializerReferencingConstructorLocals.1.normal.js @@ -1,6 +1,6 @@ //// [initializerReferencingConstructorLocals.ts] -// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. var C = function C(x) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/initializerReferencingConstructorParameters.1.normal.js b/crates/swc/tests/tsc-references/initializerReferencingConstructorParameters.1.normal.js index 28c5f74e4691..f10031bdd360 100644 --- a/crates/swc/tests/tsc-references/initializerReferencingConstructorParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/initializerReferencingConstructorParameters.1.normal.js @@ -1,6 +1,6 @@ //// [initializerReferencingConstructorParameters.ts] -// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. var C = function C(x1) { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes.1.normal.js index 697c9599d539..e859ea6f0525 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes.1.normal.js @@ -3,10 +3,10 @@ export { }; //// [renderer2.d.ts] export { }; //// [component.tsx] -/** @jsx predom */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; var _this = this; -import { predom } from "./renderer2"; +/** @jsx predom */ import { predom } from "./renderer2"; export var MySFC = function(props) { return /*#__PURE__*/ predom.apply(void 0, [ "p", @@ -50,9 +50,9 @@ export var tree = /*#__PURE__*/ predom(MySFC, { })); export default /*#__PURE__*/ predom("h", null); //// [index.tsx] -/** @jsx dom */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; -import { dom } from "./renderer"; +/** @jsx dom */ import { dom } from "./renderer"; import prerendered, { MySFC, MyClass, tree } from "./component"; var elem = prerendered; elem = /*#__PURE__*/ dom("h", null); // Expect assignability error here diff --git a/crates/swc/tests/tsc-references/innerTypeParameterShadowingOuterOne2.1.normal.js b/crates/swc/tests/tsc-references/innerTypeParameterShadowingOuterOne2.1.normal.js index 7c969fe1dd54..cd13f6360d7d 100644 --- a/crates/swc/tests/tsc-references/innerTypeParameterShadowingOuterOne2.1.normal.js +++ b/crates/swc/tests/tsc-references/innerTypeParameterShadowingOuterOne2.1.normal.js @@ -1,7 +1,7 @@ //// [innerTypeParameterShadowingOuterOne2.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // inner type parameters shadow outer ones of the same name // no errors expected -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/instantiateGenericClassWithWrongNumberOfTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/instantiateGenericClassWithWrongNumberOfTypeArguments.1.normal.js index 97089411db71..1ad69b182087 100644 --- a/crates/swc/tests/tsc-references/instantiateGenericClassWithWrongNumberOfTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/instantiateGenericClassWithWrongNumberOfTypeArguments.1.normal.js @@ -1,7 +1,7 @@ //// [instantiateGenericClassWithWrongNumberOfTypeArguments.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // it is always an error to provide a type argument list whose count does not match the type parameter list // both of these attempts to construct a type is an error -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/instantiateGenericClassWithZeroTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/instantiateGenericClassWithZeroTypeArguments.1.normal.js index 386af28050ba..426c53d010d1 100644 --- a/crates/swc/tests/tsc-references/instantiateGenericClassWithZeroTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/instantiateGenericClassWithZeroTypeArguments.1.normal.js @@ -1,6 +1,6 @@ //// [instantiateGenericClassWithZeroTypeArguments.ts] -// no errors expected when instantiating a generic type with no type arguments provided import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// no errors expected when instantiating a generic type with no type arguments provided var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments.1.normal.js index da7bfad969d5..761cdd7c5c46 100644 --- a/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments.1.normal.js @@ -1,7 +1,7 @@ //// [instantiateNonGenericTypeWithTypeArguments.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // it is an error to provide type arguments to a non-generic call // all of these are errors -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/instantiatedModule.1.normal.js b/crates/swc/tests/tsc-references/instantiatedModule.1.normal.js index 2aee6961f696..b0d9becf68e2 100644 --- a/crates/swc/tests/tsc-references/instantiatedModule.1.normal.js +++ b/crates/swc/tests/tsc-references/instantiatedModule.1.normal.js @@ -1,6 +1,6 @@ //// [instantiatedModule.ts] -// adding the var makes this an instantiated module import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// adding the var makes this an instantiated module (function(M) { M.Point = 1; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.1.normal.js b/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.1.normal.js index 047cc3c2cbaf..9dc61f7ecd8d 100644 --- a/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.1.normal.js +++ b/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.1.normal.js @@ -1,6 +1,6 @@ //// [invalidImportAliasIdentifiers.ts] -// none of these should work, since non are actually modules import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// none of these should work, since non are actually modules var V = 12; var C = function C() { "use strict"; diff --git a/crates/swc/tests/tsc-references/invalidReturnStatements.1.normal.js b/crates/swc/tests/tsc-references/invalidReturnStatements.1.normal.js index 5e3e49cee3a5..0e26b36624a1 100644 --- a/crates/swc/tests/tsc-references/invalidReturnStatements.1.normal.js +++ b/crates/swc/tests/tsc-references/invalidReturnStatements.1.normal.js @@ -1,8 +1,8 @@ //// [invalidReturnStatements.ts] -// all the following should be error import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// all the following should be error function fn1() {} function fn2() {} function fn3() {} diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization.1.normal.js index 1aa0d378e736..3e854cb1c5a1 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization.1.normal.js @@ -1,11 +1,11 @@ //// [interface.ts] export { }; //// [lib.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @template T * @implements {IEncoder} - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -export var Encoder = /*#__PURE__*/ function() { + */ export var Encoder = /*#__PURE__*/ function() { "use strict"; function Encoder() { _class_call_check(this, Encoder); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassesErr.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsClassesErr.1.normal.js index d5387505a86d..545b325e5d82 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassesErr.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassesErr.1.normal.js @@ -1,9 +1,9 @@ //// [index.js] -// Pretty much all of this should be an error, (since index signatures and generics are forbidden in js), -// but we should be able to synthesize declarations from the symbols regardless import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// Pretty much all of this should be an error, (since index signatures and generics are forbidden in js), +// but we should be able to synthesize declarations from the symbols regardless export var M = function M() { "use strict"; _class_call_check(this, M); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr.1.normal.js index 8a21371f0650..a6741f7a016e 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr.1.normal.js @@ -1,6 +1,6 @@ //// [index1.js] -// merge type alias and alias (should error, see #32367) import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// merge type alias and alias (should error, see #32367) var Cls = function Cls() { "use strict"; _class_call_check(this, Cls); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment.1.normal.js index 69c50516d810..a570dfbbe33a 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment.1.normal.js @@ -15,6 +15,7 @@ module.exports = Timer; } module.exports = Hook; //// [context.js] +import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; /** * Imports * @@ -38,8 +39,7 @@ module.exports = Hook; * * @class * @param {Input} input - */ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; -function Context(input) { + */ function Context(input) { if (!_instanceof(this, Context)) { return new Context(input); } diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionJSDoc.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionJSDoc.1.normal.js index 8914f397b005..abd76872a754 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionJSDoc.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionJSDoc.1.normal.js @@ -1,10 +1,10 @@ //// [source.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * Foos a bar together using an `a` and a `b` * @param {number} a * @param {string} b - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -export function foo(a, b) {} + */ export function foo(a, b) {} /** * Legacy - DO NOT USE */ export var Aleph = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses.1.normal.js index bc703289228d..cf20dc5ebbd8 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses.1.normal.js @@ -1,9 +1,9 @@ //// [source.js] +import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; /** * @param {number} x * @param {number} y - */ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; -export function Point(x, y) { + */ export function Point(x, y) { if (!_instanceof(this, Point)) { return new Point(x, y); } diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2.1.normal.js index 8ca319848c22..321a37d4d35e 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2.1.normal.js @@ -1,8 +1,8 @@ //// [source.js] +import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; /** * @param {number} len - */ import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; -export function Vec(len) { + */ export function Vec(len) { /** * @type {number[]} */ this.storage = new Array(len); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace.1.normal.js index d19e09349c64..7108dbca89ad 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace.1.normal.js @@ -1,9 +1,5 @@ //// [file.js] -/** - * @namespace myTypes - * @global - * @type {Object} - */ "use strict"; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -13,7 +9,11 @@ Object.defineProperty(exports, "myTypes", { return myTypes; } }); -const myTypes = { +/** + * @namespace myTypes + * @global + * @type {Object} + */ const myTypes = { }; //// [file2.js] "use strict"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs.1.normal.js index 3d34e50415d1..c31357a7d62e 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs.1.normal.js @@ -1,10 +1,10 @@ //// [file.js] +"use strict"; /** * @namespace myTypes * @global * @type {Object} - */ "use strict"; -const myTypes = { + */ const myTypes = { }; /** @typedef {string|RegExp|Array} myTypes.typeA */ /** * @typedef myTypes.typeB diff --git a/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.1.normal.js index c98209153411..2f0e831e819e 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsModuleReferenceHasEmit.1.normal.js @@ -1,8 +1,8 @@ //// [index.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @module A - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var A = function A() { + */ var A = function A() { "use strict"; _class_call_check(this, A); }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js index 90bda97fc170..b200e01af162 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js @@ -1,8 +1,8 @@ //// [lib.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @param {string} a - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -function bar(a) { + */ function bar(a) { return a + a; } var SomeClass = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.1.normal.js index a2dd20450e49..0706c0563537 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases.1.normal.js @@ -20,13 +20,13 @@ export { }; // flag file as module * @returns {T} */ //// [mixed.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType */ /** * @param {number} x * @returns {SomeType} - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -function doTheThing(x) { + */ function doTheThing(x) { return { x: "" + x }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.1.normal.js index 54ae7e2cf3fe..54d65e55b776 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes.1.normal.js @@ -1,8 +1,8 @@ //// [conn.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @typedef {string | number} Whatever - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var Conn = /*#__PURE__*/ function() { + */ var Conn = /*#__PURE__*/ function() { "use strict"; function Conn() { _class_call_check(this, Conn); @@ -14,10 +14,10 @@ var Conn = /*#__PURE__*/ function() { }(); module.exports = Conn; //// [usage.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @typedef {import("./conn")} Conn - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var Wrap = function Wrap(c) { + */ var Wrap = function Wrap(c) { "use strict"; _class_call_check(this, Wrap); this.connItem = c.item; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndLatebound.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndLatebound.1.normal.js index dfe65e3d4001..9a55644108c4 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndLatebound.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndLatebound.1.normal.js @@ -5,11 +5,11 @@ var LazySet = require("./LazySet"); /** @type {LazySet} */ var stringSet = undefined; stringSet.addAll(stringSet); //// [LazySet.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Comment out this JSDoc, and note that the errors index.js go away. /** * @typedef {Object} SomeObject - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var LazySet = /*#__PURE__*/ function() { + */ var LazySet = /*#__PURE__*/ function() { "use strict"; function LazySet() { _class_call_check(this, LazySet); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren.1.normal.js index 3e386f35b7aa..a0fad2f36272 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren.1.normal.js @@ -1,7 +1,7 @@ //// [jsxJsxsCjsTransformChildren.tsx] -/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +/// var a = /*#__PURE__*/ React.createElement("div", null, "text"); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport.1.normal.js index fcf1cf1d5766..6d8caf72453a 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport.1.normal.js @@ -1,9 +1,9 @@ //// [jsxJsxsCjsTransformCustomImport.tsx] -/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +/// var a = /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("p", null), "text", /*#__PURE__*/ React.createElement("div", { className: "foo" })); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma.1.normal.js index a061d0ee193d..1fe7efb661c3 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma.1.normal.js @@ -1,11 +1,11 @@ //// [preact.tsx] -/// -/* @jsxImportSource preact */ "use strict"; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _jsxruntime = require("preact/jsx-runtime"); -var a = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, { +/// +/* @jsxImportSource preact */ var a = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, { children: [ /*#__PURE__*/ (0, _jsxruntime.jsx)("p", {}), "text", diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp.1.normal.js index defbd9dd1cf6..c35a6087e816 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp.1.normal.js @@ -1,11 +1,11 @@ //// [jsxJsxsCjsTransformKeyProp.tsx] -/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _object_spread = require("@swc/helpers/_/_object_spread"); var _object_spread_props = require("@swc/helpers/_/_object_spread_props"); +/// var props = { answer: 42 }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport.1.normal.js index ed92477f6a90..aff83ba3c2db 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport.1.normal.js @@ -1,11 +1,11 @@ //// [jsxJsxsCjsTransformKeyPropCustomImport.tsx] -/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _object_spread = require("@swc/helpers/_/_object_spread"); var _object_spread_props = require("@swc/helpers/_/_object_spread_props"); +/// var props = { answer: 42 }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma.1.normal.js index 999afa429200..8ccd61ff9f17 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma.1.normal.js @@ -1,6 +1,5 @@ //// [preact.tsx] -/// -/* @jsxImportSource preact */ "use strict"; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -8,7 +7,8 @@ var _object_spread = require("@swc/helpers/_/_object_spread"); var _object_spread_props = require("@swc/helpers/_/_object_spread_props"); var _jsxruntime = require("preact/jsx-runtime"); var _preact = require("preact"); -var props = { +/// +/* @jsxImportSource preact */ var props = { answer: 42 }; var a = /*#__PURE__*/ (0, _jsxruntime.jsx)("div", _object_spread_props._(_object_spread._({}, props), { diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames.1.normal.js index 985cbe32c5f8..4a1d561c74f1 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames.1.normal.js @@ -1,7 +1,7 @@ //// [jsxJsxsCjsTransformSubstitutesNames.tsx] -/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +/// var a = /*#__PURE__*/ React.createElement("div", null); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment.1.normal.js index 30ad05fc9741..e8903ec4b876 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment.1.normal.js @@ -1,7 +1,7 @@ //// [jsxJsxsCjsTransformSubstitutesNamesFragment.tsx] -/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +/// var a = /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("p", null), "text", /*#__PURE__*/ React.createElement("div", null)); diff --git a/crates/swc/tests/tsc-references/literalTypeWidening.1.normal.js b/crates/swc/tests/tsc-references/literalTypeWidening.1.normal.js index 06323ad5364a..16ebeb11d0e2 100644 --- a/crates/swc/tests/tsc-references/literalTypeWidening.1.normal.js +++ b/crates/swc/tests/tsc-references/literalTypeWidening.1.normal.js @@ -1,7 +1,7 @@ //// [literalTypeWidening.ts] -// Widening vs. non-widening literal types import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; +// Widening vs. non-widening literal types function f1() { var c1 = "hello"; // Widening type "hello" var v1 = c1; // Type string diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.1.normal.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.1.normal.js index aaa9c42d9c10..721103b98e23 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.1.normal.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.1.normal.js @@ -1,6 +1,6 @@ //// [logicalNotOperatorWithAnyOtherType.ts] -// ! operator on any type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// ! operator on any type var ANY; var ANY1; var ANY2 = [ diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.1.normal.js index 4e00b81aef6e..272878e062ba 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.1.normal.js @@ -1,6 +1,6 @@ //// [logicalNotOperatorWithBooleanType.ts] -// ! operator on boolean type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// ! operator on boolean type var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.1.normal.js index 1a193ed1a9cc..51a546a237be 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [logicalNotOperatorWithNumberType.ts] -// ! operator on number type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// ! operator on number type var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.1.normal.js index f990833611da..8f2856cac56e 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.1.normal.js @@ -1,6 +1,6 @@ //// [logicalNotOperatorWithStringType.ts] -// ! operator on string type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// ! operator on string type var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.1.normal.js b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.1.normal.js index 6a4a4e4053c5..67efa98137f2 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.1.normal.js @@ -1,7 +1,7 @@ //// [mergedInterfacesWithMultipleBases.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // merged interfaces behave as if all extends clauses from each declaration are merged together // no errors expected -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.1.normal.js b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.1.normal.js index 7e01dfc25ec2..64b14967d413 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.1.normal.js @@ -1,7 +1,7 @@ //// [mergedInterfacesWithMultipleBases2.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // merged interfaces behave as if all extends clauses from each declaration are merged together // no errors expected -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases3.1.normal.js b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases3.1.normal.js index da25fdc18246..9b414e8d059b 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases3.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases3.1.normal.js @@ -1,7 +1,7 @@ //// [mergedInterfacesWithMultipleBases3.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // merged interfaces behave as if all extends clauses from each declaration are merged together // no errors expected -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases4.1.normal.js b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases4.1.normal.js index 1348dcc53f4a..99b82d170fa4 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases4.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases4.1.normal.js @@ -1,6 +1,6 @@ //// [mergedInterfacesWithMultipleBases4.ts] -// merged interfaces behave as if all extends clauses from each declaration are merged together import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// merged interfaces behave as if all extends clauses from each declaration are merged together var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js b/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js index a585317c3e6b..775e6bcf636a 100644 --- a/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js +++ b/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js @@ -1,6 +1,6 @@ //// [missingAndExcessProperties.ts] -// Missing properties import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty"; +// Missing properties function f1() { var _ref = {}, x = _ref.x, y = _ref.y; var _ref1 = {}, _ref_x = _ref1.x, x = _ref_x === void 0 ? 1 : _ref_x, y = _ref1.y; diff --git a/crates/swc/tests/tsc-references/moduleExportAlias3.1.normal.js b/crates/swc/tests/tsc-references/moduleExportAlias3.1.normal.js index 168523302e95..fd26fff73916 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias3.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias3.1.normal.js @@ -1,6 +1,6 @@ //// [bug24062.js] -// #24062 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// #24062 var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/moduleExportAlias4.1.normal.js b/crates/swc/tests/tsc-references/moduleExportAlias4.1.normal.js index a21799773c78..dcc8cf9a7e0a 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias4.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias4.1.normal.js @@ -1,6 +1,6 @@ //// [bug24024.js] -// #24024 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// #24024 var wat = require('./bug24024'); module.exports = function C() { "use strict"; diff --git a/crates/swc/tests/tsc-references/multipleNumericIndexers.1.normal.js b/crates/swc/tests/tsc-references/multipleNumericIndexers.1.normal.js index 5dadb2697ce3..723c775d833d 100644 --- a/crates/swc/tests/tsc-references/multipleNumericIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleNumericIndexers.1.normal.js @@ -1,6 +1,6 @@ //// [multipleNumericIndexers.ts] -// Multiple indexers of the same type are an error import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Multiple indexers of the same type are an error var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/multipleStringIndexers.1.normal.js b/crates/swc/tests/tsc-references/multipleStringIndexers.1.normal.js index 751b60c3d289..e49c750e6556 100644 --- a/crates/swc/tests/tsc-references/multipleStringIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleStringIndexers.1.normal.js @@ -1,6 +1,6 @@ //// [multipleStringIndexers.ts] -// Multiple indexers of the same type are an error import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Multiple indexers of the same type are an error var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/narrowingConstrainedTypeVariable.1.normal.js b/crates/swc/tests/tsc-references/narrowingConstrainedTypeVariable.1.normal.js index 68f2440d7624..f357e83d3939 100644 --- a/crates/swc/tests/tsc-references/narrowingConstrainedTypeVariable.1.normal.js +++ b/crates/swc/tests/tsc-references/narrowingConstrainedTypeVariable.1.normal.js @@ -1,7 +1,7 @@ //// [narrowingConstrainedTypeVariable.ts] -// Repro from #20138 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; +// Repro from #20138 var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.1.normal.js index 5132a0dec33b..b755ba2a1d24 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.1.normal.js @@ -1,6 +1,6 @@ //// [negateOperatorWithBooleanType.ts] -// - operator on boolean type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// - operator on boolean type var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/negateOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/negateOperatorWithNumberType.1.normal.js index bd30d7b9b19e..bc9bf8e7be81 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [negateOperatorWithNumberType.ts] -// - operator on number type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// - operator on number type var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/negateOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/negateOperatorWithStringType.1.normal.js index 5d51e8c0c2fd..d2946e8c286f 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithStringType.1.normal.js @@ -1,6 +1,6 @@ //// [negateOperatorWithStringType.ts] -// - operator on string type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// - operator on string type var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.1.normal.js b/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.1.normal.js index b7bc9d479840..73f61fc6b4f0 100644 --- a/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.1.normal.js +++ b/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.1.normal.js @@ -1,6 +1,6 @@ //// [nonGenericTypeReferenceWithTypeArguments.ts] -// Check that errors are reported for non-generic types with type arguments import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Check that errors are reported for non-generic types with type arguments var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.1.normal.js b/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.1.normal.js index 0ee1c0a49f2d..a3deeaa66926 100644 --- a/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.1.normal.js +++ b/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.1.normal.js @@ -1,6 +1,6 @@ //// [nullIsSubtypeOfEverythingButUndefined.ts] -// null is a subtype of any other types except undefined import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// null is a subtype of any other types except undefined var r0 = true ? null : null; var r0 = true ? null : null; var u; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js index 223ea00694b1..fc5c9173bcfc 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [nullishCoalescingOperatorInAsyncGenerator.ts] -// https://github.com/microsoft/TypeScript/issues/37686 import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; +// https://github.com/microsoft/TypeScript/issues/37686 function f(a) { return _wrap_async_generator(function*() { var _a_b; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js index baa5619b5401..8d00d3b80c07 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js @@ -1,7 +1,7 @@ //// [nullishCoalescingOperatorInAsyncGenerator.ts] -// https://github.com/microsoft/TypeScript/issues/37686 import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; +// https://github.com/microsoft/TypeScript/issues/37686 function f(a) { return _wrap_async_generator(function() { var _a_b, c; diff --git a/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations2.1.normal.js b/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations2.1.normal.js index c160a8aa696f..66f552b23726 100644 --- a/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations2.1.normal.js +++ b/crates/swc/tests/tsc-references/numericIndexerConstrainsPropertyDeclarations2.1.normal.js @@ -1,8 +1,8 @@ //// [numericIndexerConstrainsPropertyDeclarations2.ts] -// String indexer providing a constraint of a user defined type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// String indexer providing a constraint of a user defined type var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectLiteralNormalization.1.normal.js b/crates/swc/tests/tsc-references/objectLiteralNormalization.1.normal.js index 8bcf1beadfc7..ddeb8047e09c 100644 --- a/crates/swc/tests/tsc-references/objectLiteralNormalization.1.normal.js +++ b/crates/swc/tests/tsc-references/objectLiteralNormalization.1.normal.js @@ -1,7 +1,7 @@ //// [objectLiteralNormalization.ts] -// Object literals in unions are normalized upon widening import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; +// Object literals in unions are normalized upon widening var a1 = [ { a: 0 diff --git a/crates/swc/tests/tsc-references/objectSpreadComputedProperty.1.normal.js b/crates/swc/tests/tsc-references/objectSpreadComputedProperty.1.normal.js index a83d5928d60f..432f80e6d125 100644 --- a/crates/swc/tests/tsc-references/objectSpreadComputedProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/objectSpreadComputedProperty.1.normal.js @@ -1,8 +1,8 @@ //// [objectSpreadComputedProperty.ts] -// fixes #12200 import { _ as _define_property } from "@swc/helpers/_/_define_property"; import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; +// fixes #12200 function f() { var n = 12; var m = 13; diff --git a/crates/swc/tests/tsc-references/objectTypeHidingMembersOfObject.1.normal.js b/crates/swc/tests/tsc-references/objectTypeHidingMembersOfObject.1.normal.js index 005ad2efa0ec..79954bafa956 100644 --- a/crates/swc/tests/tsc-references/objectTypeHidingMembersOfObject.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeHidingMembersOfObject.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypeHidingMembersOfObject.ts] -// all of these valueOf calls should return the type shown in the overriding signatures here import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// all of these valueOf calls should return the type shown in the overriding signatures here var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/objectTypePropertyAccess.1.normal.js b/crates/swc/tests/tsc-references/objectTypePropertyAccess.1.normal.js index 99d6bb1cc05c..c9174e6363f8 100644 --- a/crates/swc/tests/tsc-references/objectTypePropertyAccess.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypePropertyAccess.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypePropertyAccess.ts] -// Index notation should resolve to the type of a declared property with that same name import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Index notation should resolve to the type of a declared property with that same name var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/objectTypeWithNumericProperty.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithNumericProperty.1.normal.js index ef249963c995..6ab21b9f1b1a 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithNumericProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithNumericProperty.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypeWithNumericProperty.ts] -// no errors here import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// no errors here var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty.1.normal.js index 5649c5efae3e..9f8900874db7 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypeWithRecursiveWrappedProperty.ts] -// Basic recursive type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Basic recursive type var List = function List() { "use strict"; _class_call_check(this, List); diff --git a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty2.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty2.1.normal.js index 981898c8e09b..0b6a422c5863 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedProperty2.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypeWithRecursiveWrappedProperty2.ts] -// Basic recursive type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Basic recursive type var List = function List() { "use strict"; _class_call_check(this, List); diff --git a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedPropertyCheckedNominally.1.normal.js b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedPropertyCheckedNominally.1.normal.js index 643e1647e929..e8ebb49bb630 100644 --- a/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedPropertyCheckedNominally.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypeWithRecursiveWrappedPropertyCheckedNominally.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts] -// Types with infinitely expanding recursive types are type checked nominally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Types with infinitely expanding recursive types are type checked nominally var List = function List() { "use strict"; _class_call_check(this, List); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentity.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentity.1.normal.js index 0af7c0453b18..4e6a30a7d5d8 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentity.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentity.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentity.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentity2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentity2.1.normal.js index c13945138333..775d25c56d85 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentity2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentity2.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentity2.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures.1.normal.js index 67c0ee8efaae..5606a9a4b058 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithCallSignatures.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures2.1.normal.js index cffcd6ce2d58..9c54a4fd9b2c 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignatures2.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithCallSignatures2.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts.1.normal.js index 07f592a955e0..4864c8534034 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesDifferingParamCounts.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithCallSignaturesDifferingParamCounts.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesWithOverloads.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesWithOverloads.1.normal.js index 46fe15f6d99e..c2926245d4d1 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesWithOverloads.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithCallSignaturesWithOverloads.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithCallSignaturesWithOverloads.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures.1.normal.js index 070a57f7448a..e7797e3fe83d 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithConstructSignatures.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = function A(x) { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures2.1.normal.js index eac41bc29cfe..b83e560d12be 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignatures2.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithConstructSignatures2.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.1.normal.js index 9dc8194cb428..c29bcee8b4df 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithConstructSignaturesDifferingParamCounts.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var B = function B(x, y) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures.1.normal.js index 16b97105ca6d..17d728b73d59 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericCallSignatures.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures2.1.normal.js index 9d5726ece42f..6032ff0041c9 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignatures2.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericCallSignatures2.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.1.normal.js index 12cdab9f562a..f9c1f3d008a2 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.1.normal.js index 80eac15703e1..9adaae423879 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.1.normal.js index 872f3d5ab27b..7953c1b7acd0 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var One = function One() { "use strict"; _class_call_check(this, One); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.1.normal.js index 1ad81760cca9..266f42ed1280 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.1.normal.js index 770b08bd3d2d..499715e73ecf 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.1.normal.js index ac44e7d9a7b0..6bb15a53135f 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.1.normal.js index 4a8f6d0ea24d..1bfa3a153b75 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams.1.normal.js index 1864e11f42a1..6259db5029a6 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesOptionalParams.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.1.normal.js index 25c4cb790940..00bbe032f463 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesOptionalParams2.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.1.normal.js index a13f7ec180e8..06f0e829bcd9 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericCallSignaturesOptionalParams3.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.1.normal.js index 0d4099ecc9e0..edd74eb20e0c 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.1.normal.js index a3b0e33d5093..ff6200df0cce 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x, y) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.1.normal.js index e59c0415339b..d4656ea1c208 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var One = function One() { "use strict"; _class_call_check(this, One); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.1.normal.js index 7b8d068c19b1..f8ddf5c69eb3 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.1.normal.js index 53c87401fc6b..3917c0ecad4b 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.1.normal.js index 8f89fc06e9e5..6ca283b221b8 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.1.normal.js index e739d00dd12a..4ecb75d7bb4b 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var B = function B(x) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.1.normal.js index 89552cf978f3..1e7a85b792eb 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesOptionalParams.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x, y) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.1.normal.js index 115760300134..4c867b3ec3cf 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x, y) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.1.normal.js index add1b2bd6904..37ab79c5e8dd 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Two call or construct signatures are considered identical when they have the same number of type parameters and, considering those // parameters pairwise identical, have identical type parameter constraints, identical number of parameters with identical kind(required, // optional or rest) and types, and identical return types. -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var B = function B(x, y) { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers1.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers1.1.normal.js index 3fc8a22c978a..f90b7fe5c925 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers1.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers1.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithNumericIndexers1.ts] -// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers2.1.normal.js index cb79788d5bca..0e8bc3d97952 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithNumericIndexers2.ts] -// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// object types are identical structurally var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers3.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers3.1.normal.js index cb92e4008351..0ace9a6cdc3c 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers3.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithNumericIndexers3.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithNumericIndexers3.ts] -// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithOptionality.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithOptionality.1.normal.js index f3fa7d989930..5c03518f7519 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithOptionality.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithOptionality.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithOptionality.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates.1.normal.js index 2873f7696e86..902967efa38f 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithPrivates.ts] -// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates2.1.normal.js index 7c56af366a65..53406f9a4849 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithPrivates2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithPrivates2.ts] -// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// object types are identical structurally var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithPublics.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithPublics.1.normal.js index b622486d0aa0..ba604a6efc58 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithPublics.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithPublics.1.normal.js @@ -1,6 +1,6 @@ //// [objectTypesIdentityWithPublics.ts] -// object types are identical structurally import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers.1.normal.js index 6921e60d6620..d8d17d46325a 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithStringIndexers.ts] -// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// object types are identical structurally var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers2.1.normal.js b/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers2.1.normal.js index d77643d8f74c..3e7c7e2b922b 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers2.1.normal.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentityWithStringIndexers2.1.normal.js @@ -1,8 +1,8 @@ //// [objectTypesIdentityWithStringIndexers2.ts] -// object types are identical structurally import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// object types are identical structurally var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js index 3d28a98050e1..38fd3f843dd3 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js @@ -1,5 +1,5 @@ //// [optionalChainingInParameterBindingPattern.ts] -// https://github.com/microsoft/TypeScript/issues/36295 var _a; +// https://github.com/microsoft/TypeScript/issues/36295 const a = ()=>undefined; (({ [(_a = a()) === null || _a === void 0 ? void 0 : _a.d]: c = "" })=>{})(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js index 9b8528b50e00..49521c0823f2 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js @@ -1,6 +1,6 @@ //// [optionalChainingInParameterBindingPattern.ts] -// https://github.com/microsoft/TypeScript/issues/36295 var _a; +// https://github.com/microsoft/TypeScript/issues/36295 var a = function() { return undefined; }; diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js index 23ddcb34eb48..a38f5dccabea 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [optionalChainingInParameterBindingPattern.2.ts] -// https://github.com/microsoft/TypeScript/issues/36295 var _a, _a1; +// https://github.com/microsoft/TypeScript/issues/36295 const a = ()=>undefined; (({ [(_a = a()) === null || _a === void 0 ? void 0 : _a.d]: c = "" })=>{ var a1; diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js index f1e790c9b056..a5e4ff7a9945 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js @@ -1,6 +1,6 @@ //// [optionalChainingInParameterBindingPattern.2.ts] -// https://github.com/microsoft/TypeScript/issues/36295 var _a, _a1; +// https://github.com/microsoft/TypeScript/issues/36295 var a = function() { return undefined; }; diff --git a/crates/swc/tests/tsc-references/overloadTag3.1.normal.js b/crates/swc/tests/tsc-references/overloadTag3.1.normal.js index 89497aec20f3..1cf859da67ab 100644 --- a/crates/swc/tests/tsc-references/overloadTag3.1.normal.js +++ b/crates/swc/tests/tsc-references/overloadTag3.1.normal.js @@ -1,8 +1,8 @@ //// [/a.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @template T - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -export var Foo = /*#__PURE__*/ function() { + */ export var Foo = /*#__PURE__*/ function() { "use strict"; function Foo() { _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es2015).1.normal.js index 273e67f9d735..54ffcf21340e 100644 --- a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [parameterInitializersForwardReferencing.2.ts] -// https://github.com/microsoft/TypeScript/issues/36295 import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; +// https://github.com/microsoft/TypeScript/issues/36295 function a() {} function b(_param = a()) { var { b: b1 = a() } = _param, x = _object_without_properties(_param, [ diff --git a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js index f997315e6740..104ce02276b4 100644 --- a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js @@ -1,6 +1,6 @@ //// [parameterInitializersForwardReferencing.2.ts] -// https://github.com/microsoft/TypeScript/issues/36295 import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; +// https://github.com/microsoft/TypeScript/issues/36295 function a() {} function b() { var _param = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a(); diff --git a/crates/swc/tests/tsc-references/parserForInStatement8.1.normal.js b/crates/swc/tests/tsc-references/parserForInStatement8.1.normal.js index 9925a11ea329..8be8569cf68f 100644 --- a/crates/swc/tests/tsc-references/parserForInStatement8.1.normal.js +++ b/crates/swc/tests/tsc-references/parserForInStatement8.1.normal.js @@ -1,6 +1,6 @@ //// [parserForInStatement8.ts] -// repro from https://github.com/microsoft/TypeScript/issues/54769 import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; +// repro from https://github.com/microsoft/TypeScript/issues/54769 for(var ref in { '': 0 }){ diff --git a/crates/swc/tests/tsc-references/parserRealSource1.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource1.1.normal.js index 7ba24e612998..71147fc13f55 100644 --- a/crates/swc/tests/tsc-references/parserRealSource1.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource1.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource1.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { (function(CompilerDiagnostics) { CompilerDiagnostics.debug = false; diff --git a/crates/swc/tests/tsc-references/parserRealSource12.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource12.1.normal.js index 73758de7251c..74b20694d0e8 100644 --- a/crates/swc/tests/tsc-references/parserRealSource12.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource12.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource12.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { var AstWalkOptions = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/parserRealSource14.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource14.1.normal.js index 52788e494c14..bd5b9773b35f 100644 --- a/crates/swc/tests/tsc-references/parserRealSource14.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource14.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource14.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { function lastOf(items) { return items === null || items.length === 0 ? null : items[items.length - 1]; diff --git a/crates/swc/tests/tsc-references/parserRealSource5.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource5.1.normal.js index 1dea7b5db57b..8b00713819fc 100644 --- a/crates/swc/tests/tsc-references/parserRealSource5.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource5.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource5.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { var PrintContext = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/parserRealSource6.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource6.1.normal.js index c0e25a830b36..511f1a59a143 100644 --- a/crates/swc/tests/tsc-references/parserRealSource6.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource6.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource6.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { var TypeCollectionContext = function TypeCollectionContext(scopeChain, checker) { "use strict"; diff --git a/crates/swc/tests/tsc-references/parserRealSource8.1.normal.js b/crates/swc/tests/tsc-references/parserRealSource8.1.normal.js index 3624652fa724..8ba6af091373 100644 --- a/crates/swc/tests/tsc-references/parserRealSource8.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRealSource8.1.normal.js @@ -1,8 +1,8 @@ //// [parserRealSource8.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. /// -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(TypeScript) { var AssignScopeContext = function AssignScopeContext(scopeChain, typeFlow, modDeclChain) { "use strict"; diff --git a/crates/swc/tests/tsc-references/parserindenter.1.normal.js b/crates/swc/tests/tsc-references/parserindenter.1.normal.js index 2f040dd85da0..6f36a33fb4c7 100644 --- a/crates/swc/tests/tsc-references/parserindenter.1.normal.js +++ b/crates/swc/tests/tsc-references/parserindenter.1.normal.js @@ -1,4 +1,5 @@ //// [parserindenter.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // // Copyright (c) Microsoft Corporation. All rights reserved. // @@ -14,7 +15,6 @@ // limitations under the License. // /// -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function(Formatting) { var Indenter = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.1.normal.js index 12f967f65c09..fe2707f44df2 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.1.normal.js @@ -1,6 +1,6 @@ //// [plusOperatorWithBooleanType.ts] -// + operator on boolean type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// + operator on boolean type var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/plusOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/plusOperatorWithNumberType.1.normal.js index 9af13bb201d9..cc6978c20d8c 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [plusOperatorWithNumberType.ts] -// + operator on number type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// + operator on number type var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/plusOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/plusOperatorWithStringType.1.normal.js index 0cdb7cacb1c5..0bae4f085bc5 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithStringType.1.normal.js @@ -1,6 +1,6 @@ //// [plusOperatorWithStringType.ts] -// + operator on string type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// + operator on string type var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinClass.1.normal.js b/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinClass.1.normal.js index c26f17a72b40..c98609cd9a4f 100644 --- a/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinClass.1.normal.js +++ b/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinClass.1.normal.js @@ -1,7 +1,7 @@ //// [privateClassPropertyAccessibleWithinClass.ts] -// no errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; +// no errors var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinNestedClass.1.normal.js b/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinNestedClass.1.normal.js index 4bffec5dd791..2c196d245658 100644 --- a/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinNestedClass.1.normal.js +++ b/crates/swc/tests/tsc-references/privateClassPropertyAccessibleWithinNestedClass.1.normal.js @@ -1,7 +1,7 @@ //// [privateClassPropertyAccessibleWithinNestedClass.ts] -// no errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; +// no errors var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=es2015).1.normal.js index 5d7f9d137859..fa75b5e73c5c 100644 --- a/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=es2015).1.normal.js @@ -1,6 +1,6 @@ //// [privateNameComputedPropertyName4.ts] -// https://github.com/microsoft/TypeScript/issues/44113 import { _ as _define_property } from "@swc/helpers/_/_define_property"; +// https://github.com/microsoft/TypeScript/issues/44113 class C1 { ["bar"]() {} } diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-5.1.normal.js b/crates/swc/tests/tsc-references/privateNamesUnique-5.1.normal.js index 85000afdc760..771fe96f7c43 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-5.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-5.1.normal.js @@ -1,7 +1,7 @@ //// [privateNamesUnique-5.ts] -// same as privateNamesUnique-1, but with an interface import { _ as _class_private_field_init } from "@swc/helpers/_/_class_private_field_init"; var _foo = /*#__PURE__*/ new WeakMap(); +// same as privateNamesUnique-1, but with an interface class A { constructor(){ _class_private_field_init(this, _foo, { diff --git a/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule.1.normal.js b/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule.1.normal.js index 72b10a0fe54b..e38c3ee1f13c 100644 --- a/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule.1.normal.js +++ b/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule.1.normal.js @@ -1,6 +1,6 @@ //// [privateStaticNotAccessibleInClodule.ts] -// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule2.1.normal.js b/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule2.1.normal.js index 9a29f0a91cc6..aefd473241db 100644 --- a/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule2.1.normal.js +++ b/crates/swc/tests/tsc-references/privateStaticNotAccessibleInClodule2.1.normal.js @@ -1,8 +1,8 @@ //// [privateStaticNotAccessibleInClodule2.ts] -// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/propertiesOfGenericConstructorFunctions.1.normal.js b/crates/swc/tests/tsc-references/propertiesOfGenericConstructorFunctions.1.normal.js index 360b653e1ee9..dfc2a695a9c6 100644 --- a/crates/swc/tests/tsc-references/propertiesOfGenericConstructorFunctions.1.normal.js +++ b/crates/swc/tests/tsc-references/propertiesOfGenericConstructorFunctions.1.normal.js @@ -1,11 +1,11 @@ //// [propertiesOfGenericConstructorFunctions.js] +import { _ as _define_property } from "@swc/helpers/_/_define_property"; /** * @template {string} K * @template V * @param {string} ik * @param {V} iv - */ import { _ as _define_property } from "@swc/helpers/_/_define_property"; -function Multimap(ik, iv) { + */ function Multimap(ik, iv) { /** @type {{ [s: string]: V }} */ this._map = {}; // without type annotation this._map2 = _define_property({}, ik, iv); diff --git a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints.1.normal.js b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints.1.normal.js index dc020650080a..af464620cd88 100644 --- a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints.1.normal.js @@ -1,7 +1,7 @@ //// [propertyAccessOnTypeParameterWithConstraints.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // generic types should behave as if they have properties of their constraint type // no errors expected -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints2.1.normal.js b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints2.1.normal.js index bfede069144a..1462bdbb665b 100644 --- a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints2.1.normal.js @@ -1,8 +1,8 @@ //// [propertyAccessOnTypeParameterWithConstraints2.ts] -// generic types should behave as if they have properties of their constraint type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// generic types should behave as if they have properties of their constraint type var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints3.1.normal.js b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints3.1.normal.js index 34524214bc76..d37765dcb323 100644 --- a/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints3.1.normal.js +++ b/crates/swc/tests/tsc-references/propertyAccessOnTypeParameterWithConstraints3.1.normal.js @@ -1,8 +1,8 @@ //// [propertyAccessOnTypeParameterWithConstraints3.ts] -// generic types should behave as if they have properties of their constraint type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// generic types should behave as if they have properties of their constraint type var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinClass.1.normal.js b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinClass.1.normal.js index f09b3df9d141..ea3841ab3c43 100644 --- a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinClass.1.normal.js +++ b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinClass.1.normal.js @@ -1,7 +1,7 @@ //// [protectedClassPropertyAccessibleWithinClass.ts] -// no errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; +// no errors var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinNestedClass.1.normal.js b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinNestedClass.1.normal.js index e3aa8f728744..4631d0236e4f 100644 --- a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinNestedClass.1.normal.js +++ b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinNestedClass.1.normal.js @@ -1,7 +1,7 @@ //// [protectedClassPropertyAccessibleWithinNestedClass.ts] -// no errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; +// no errors var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinSubclass.1.normal.js b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinSubclass.1.normal.js index 963bb810c56c..b99ebcf93df7 100644 --- a/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinSubclass.1.normal.js +++ b/crates/swc/tests/tsc-references/protectedClassPropertyAccessibleWithinSubclass.1.normal.js @@ -1,9 +1,9 @@ //// [protectedClassPropertyAccessibleWithinSubclass.ts] -// no errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// no errors var B = function B() { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/protectedStaticNotAccessibleInClodule.1.normal.js b/crates/swc/tests/tsc-references/protectedStaticNotAccessibleInClodule.1.normal.js index 1d0fbad01c04..c50e0c1ae7cc 100644 --- a/crates/swc/tests/tsc-references/protectedStaticNotAccessibleInClodule.1.normal.js +++ b/crates/swc/tests/tsc-references/protectedStaticNotAccessibleInClodule.1.normal.js @@ -1,6 +1,6 @@ //// [protectedStaticNotAccessibleInClodule.ts] -// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/readonlyConstructorAssignment.1.normal.js b/crates/swc/tests/tsc-references/readonlyConstructorAssignment.1.normal.js index a8042199c868..082e25ac465c 100644 --- a/crates/swc/tests/tsc-references/readonlyConstructorAssignment.1.normal.js +++ b/crates/swc/tests/tsc-references/readonlyConstructorAssignment.1.normal.js @@ -1,8 +1,8 @@ //// [readonlyConstructorAssignment.ts] -// Tests that readonly parameter properties behave like regular readonly properties import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// Tests that readonly parameter properties behave like regular readonly properties var A = function A(x) { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/restParameterInDownlevelGenerator.1.normal.js b/crates/swc/tests/tsc-references/restParameterInDownlevelGenerator.1.normal.js index 2b3495806177..21026e65a515 100644 --- a/crates/swc/tests/tsc-references/restParameterInDownlevelGenerator.1.normal.js +++ b/crates/swc/tests/tsc-references/restParameterInDownlevelGenerator.1.normal.js @@ -1,6 +1,6 @@ //// [restParameterInDownlevelGenerator.ts] -// https://github.com/Microsoft/TypeScript/issues/30653 import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; +// https://github.com/Microsoft/TypeScript/issues/30653 function mergeStringLists() { var _len, strings, _key, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, str; var _arguments = arguments; diff --git a/crates/swc/tests/tsc-references/returnStatements.1.normal.js b/crates/swc/tests/tsc-references/returnStatements.1.normal.js index e4a0d48b0b2d..5a03aedf0ae5 100644 --- a/crates/swc/tests/tsc-references/returnStatements.1.normal.js +++ b/crates/swc/tests/tsc-references/returnStatements.1.normal.js @@ -1,8 +1,8 @@ //// [returnStatements.ts] -// all the following should be valid import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// all the following should be valid function fn1() { return 1; } diff --git a/crates/swc/tests/tsc-references/scannertest1.1.normal.js b/crates/swc/tests/tsc-references/scannertest1.1.normal.js index 29db31b9c3ba..55d53c0bd057 100644 --- a/crates/swc/tests/tsc-references/scannertest1.1.normal.js +++ b/crates/swc/tests/tsc-references/scannertest1.1.normal.js @@ -1,6 +1,6 @@ //// [scannertest1.ts] -/// import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +/// var CharacterInfo = /*#__PURE__*/ function() { "use strict"; function CharacterInfo() { diff --git a/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.1.normal.js b/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.1.normal.js index 1ffe4aaf1523..1ca5f033e088 100644 --- a/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.1.normal.js +++ b/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.1.normal.js @@ -1,6 +1,6 @@ //// [scopeResolutionIdentifiers.ts] -// EveryType used in a nested scope of a different EveryType with the same name, type of the identifier is the one defined in the inner scope import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// EveryType used in a nested scope of a different EveryType with the same name, type of the identifier is the one defined in the inner scope var s; (function(M1) { var n = M1.s; diff --git a/crates/swc/tests/tsc-references/staticIndexers.1.normal.js b/crates/swc/tests/tsc-references/staticIndexers.1.normal.js index 15b767591a9c..f98188b8bfbc 100644 --- a/crates/swc/tests/tsc-references/staticIndexers.1.normal.js +++ b/crates/swc/tests/tsc-references/staticIndexers.1.normal.js @@ -1,6 +1,6 @@ //// [staticIndexers.ts] -// static indexers not allowed import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// static indexers not allowed var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/staticMembersUsingClassTypeParameter.1.normal.js b/crates/swc/tests/tsc-references/staticMembersUsingClassTypeParameter.1.normal.js index acf9dfcd1864..f2f069305bc4 100644 --- a/crates/swc/tests/tsc-references/staticMembersUsingClassTypeParameter.1.normal.js +++ b/crates/swc/tests/tsc-references/staticMembersUsingClassTypeParameter.1.normal.js @@ -1,6 +1,6 @@ //// [staticMembersUsingClassTypeParameter.ts] -// BUG 745747 import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// BUG 745747 var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/strictPropertyInitialization.1.normal.js b/crates/swc/tests/tsc-references/strictPropertyInitialization.1.normal.js index 5014c8b041cd..4d46d0f54190 100644 --- a/crates/swc/tests/tsc-references/strictPropertyInitialization.1.normal.js +++ b/crates/swc/tests/tsc-references/strictPropertyInitialization.1.normal.js @@ -1,9 +1,9 @@ //// [strictPropertyInitialization.ts] -// Properties with non-undefined types require initialization import { _ as _class_private_field_get } from "@swc/helpers/_/_class_private_field_get"; import { _ as _class_private_field_init } from "@swc/helpers/_/_class_private_field_init"; import { _ as _class_private_field_set } from "@swc/helpers/_/_class_private_field_set"; var _f = /*#__PURE__*/ new WeakMap(), _g = /*#__PURE__*/ new WeakMap(), _h = /*#__PURE__*/ new WeakMap(), _i = /*#__PURE__*/ new WeakMap(); +// Properties with non-undefined types require initialization class C1 { constructor(){ _class_private_field_init(this, _f, { diff --git a/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations2.1.normal.js b/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations2.1.normal.js index d327b922c960..f32f8f906268 100644 --- a/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations2.1.normal.js +++ b/crates/swc/tests/tsc-references/stringIndexerConstrainsPropertyDeclarations2.1.normal.js @@ -1,8 +1,8 @@ //// [stringIndexerConstrainsPropertyDeclarations2.ts] -// String indexer providing a constraint of a user defined type import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// String indexer providing a constraint of a user defined type var A = /*#__PURE__*/ function() { "use strict"; function A() { diff --git a/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures.1.normal.js b/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures.1.normal.js index ecd808934274..9e6410c37255 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypesInImplementationSignatures.1.normal.js @@ -1,6 +1,6 @@ //// [stringLiteralTypesInImplementationSignatures.ts] -// String literal types are only valid in overload signatures import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// String literal types are only valid in overload signatures function foo(x) {} var f = function foo(x) {}; var f2 = function(x, y) {}; diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameter.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameter.1.normal.js index 34cb7ad41e12..930e2564df93 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameter.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameter.1.normal.js @@ -1,8 +1,8 @@ //// [subtypesOfTypeParameter.ts] -// checking whether other types are subtypes of type parameters import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking whether other types are subtypes of type parameters var C3 = function C3() { "use strict"; _class_call_check(this, C3); diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints.1.normal.js index 9363b72fb07c..9bccd8518e66 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints.1.normal.js @@ -1,8 +1,8 @@ //// [subtypesOfTypeParameterWithConstraints.ts] -// checking whether other types are subtypes of type parameters with constraints import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking whether other types are subtypes of type parameters with constraints var C3 = function C3() { "use strict"; _class_call_check(this, C3); diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.1.normal.js index 20a80a386063..2d617e2c6140 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.1.normal.js @@ -1,6 +1,6 @@ //// [subtypesOfTypeParameterWithConstraints2.ts] -// checking whether other types are subtypes of type parameters with constraints import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// checking whether other types are subtypes of type parameters with constraints function f1(x, y) { var r = true ? x : y; var r = true ? y : x; diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints4.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints4.1.normal.js index d16c38996409..ccc51b0c264c 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints4.1.normal.js @@ -1,8 +1,8 @@ //// [subtypesOfTypeParameterWithConstraints4.ts] -// checking whether other types are subtypes of type parameters with constraints import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking whether other types are subtypes of type parameters with constraints var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.1.normal.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.1.normal.js index 09917977a1d7..f318c7a449fa 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.1.normal.js @@ -1,8 +1,8 @@ //// [subtypesOfTypeParameterWithRecursiveConstraints.ts] -// checking whether other types are subtypes of type parameters with constraints import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking whether other types are subtypes of type parameters with constraints var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/subtypingWithCallSignatures2.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithCallSignatures2.1.normal.js index f98b576580f7..f47f46b598ab 100644 --- a/crates/swc/tests/tsc-references/subtypingWithCallSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithCallSignatures2.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithCallSignatures2.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.1.normal.js index 5c710b14b022..41265e2b06c1 100644 --- a/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.1.normal.js @@ -1,9 +1,9 @@ //// [subtypingWithCallSignatures3.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation -// error cases, so function calls will all result in 'any' import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation +// error cases, so function calls will all result in 'any' (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/subtypingWithCallSignatures4.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithCallSignatures4.1.normal.js index c2971efc546a..bb82a38772c9 100644 --- a/crates/swc/tests/tsc-references/subtypingWithCallSignatures4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithCallSignatures4.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithCallSignatures4.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures2.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures2.1.normal.js index 5c86a050ecfb..d41f938338da 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures2.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures2.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithConstructSignatures2.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.1.normal.js index 89161253577f..39e783eceb5d 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.1.normal.js @@ -1,9 +1,9 @@ //// [subtypingWithConstructSignatures3.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation -// error cases, so function calls will all result in 'any' import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation +// error cases, so function calls will all result in 'any' (function(Errors) { var Base = function Base() { "use strict"; diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures4.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures4.1.normal.js index 43ec80a76a4d..1fa9da33f9fb 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures4.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithConstructSignatures4.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures5.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures5.1.normal.js index d974921a94c1..6d0b5fdc8abb 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures5.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures5.1.normal.js @@ -1,9 +1,9 @@ //// [subtypingWithConstructSignatures5.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation -// same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures6.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures6.1.normal.js index 24eb1bcf877b..8c454953aa6f 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures6.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures6.1.normal.js @@ -1,10 +1,10 @@ //// [subtypingWithConstructSignatures6.ts] -// checking subtype relations for function types as it relates to contextual signature instantiation -// same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures -// all are errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// checking subtype relations for function types as it relates to contextual signature instantiation +// same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures +// all are errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembers4.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembers4.1.normal.js index 7c767810c7b8..ce22bf54ee9d 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembers4.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembers4.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithObjectMembers4.ts] -// subtyping when property names do not match import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// subtyping when property names do not match var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility.1.normal.js index 1ebf62d85107..9c6d3385454b 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithObjectMembersAccessibility.ts] -// Derived member is private, base member is not causes errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// Derived member is private, base member is not causes errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.1.normal.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.1.normal.js index 1c56c5101219..a9dbcf7a2e87 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.1.normal.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.1.normal.js @@ -1,8 +1,8 @@ //// [subtypingWithObjectMembersAccessibility2.ts] -// Derived member is private, base member is not causes errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// Derived member is private, base member is not causes errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/superPropertyAccessNoError.1.normal.js b/crates/swc/tests/tsc-references/superPropertyAccessNoError.1.normal.js index 0220643506d0..806789fff08f 100644 --- a/crates/swc/tests/tsc-references/superPropertyAccessNoError.1.normal.js +++ b/crates/swc/tests/tsc-references/superPropertyAccessNoError.1.normal.js @@ -1,10 +1,4 @@ //// [superPropertyAccessNoError.ts] -//super.publicInstanceMemberFunction in constructor of derived class -//super.publicInstanceMemberFunction in instance member function of derived class -//super.publicInstanceMemberFunction in instance member accessor(get and set) of derived class -//super.publicInstanceMemberFunction in lambda in member function -//super.publicStaticMemberFunction in static member function of derived class -//super.publicStaticMemberFunction in static member accessor(get and set) of derived class import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized"; import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; @@ -12,6 +6,12 @@ import { _ as _create_class } from "@swc/helpers/_/_create_class"; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +//super.publicInstanceMemberFunction in constructor of derived class +//super.publicInstanceMemberFunction in instance member function of derived class +//super.publicInstanceMemberFunction in instance member accessor(get and set) of derived class +//super.publicInstanceMemberFunction in lambda in member function +//super.publicStaticMemberFunction in static member function of derived class +//super.publicStaticMemberFunction in static member accessor(get and set) of derived class var SomeBaseClass = /*#__PURE__*/ function() { "use strict"; function SomeBaseClass() { diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js index a84081b66df4..47e781b605c7 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference.1.normal.js @@ -1,5 +1,4 @@ //// [taggedTemplateStringsTypeArgumentInference.ts] -// Generic tag with one parameter import { _ as _tagged_template_literal } from "@swc/helpers/_/_tagged_template_literal"; function _templateObject() { var data = _tagged_template_literal([ @@ -309,6 +308,7 @@ function _templateObject27() { }; return data; } +// Generic tag with one parameter function noParams(n) {} noParams(_templateObject()); // Generic tag with parameter which does not use type parameter diff --git a/crates/swc/tests/tsc-references/templateInsideCallback.1.normal.js b/crates/swc/tests/tsc-references/templateInsideCallback.1.normal.js index 5089e3c7c1c4..36fc7f59ef02 100644 --- a/crates/swc/tests/tsc-references/templateInsideCallback.1.normal.js +++ b/crates/swc/tests/tsc-references/templateInsideCallback.1.normal.js @@ -1,4 +1,5 @@ //// [templateInsideCallback.js] +import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; /** * @typedef Oops * @template T @@ -12,8 +13,7 @@ */ /** * @template T * @type {Call} - */ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; -var identity = function(x) { + */ var identity = function(x) { return x; }; /** diff --git a/crates/swc/tests/tsc-references/thisTag3.1.normal.js b/crates/swc/tests/tsc-references/thisTag3.1.normal.js index 0fc60ebb150e..9a96d264d3eb 100644 --- a/crates/swc/tests/tsc-references/thisTag3.1.normal.js +++ b/crates/swc/tests/tsc-references/thisTag3.1.normal.js @@ -1,8 +1,8 @@ //// [/a.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; /** * @typedef {{fn(a: string): void}} T - */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var C = function C() { + */ var C = function C() { "use strict"; var _this = this; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/thisTypeInFunctions.1.normal.js b/crates/swc/tests/tsc-references/thisTypeInFunctions.1.normal.js index 1e9f203059a0..f500eb7d6f67 100644 --- a/crates/swc/tests/tsc-references/thisTypeInFunctions.1.normal.js +++ b/crates/swc/tests/tsc-references/thisTypeInFunctions.1.normal.js @@ -1,9 +1,9 @@ //// [thisTypeInFunctions.ts] -// body checking import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; var _this = this; +// body checking var B = function B() { "use strict"; _class_call_check(this, B); diff --git a/crates/swc/tests/tsc-references/topLevelAmbientModule.1.normal.js b/crates/swc/tests/tsc-references/topLevelAmbientModule.1.normal.js index 464acddbd614..a08bfe0da712 100644 --- a/crates/swc/tests/tsc-references/topLevelAmbientModule.1.normal.js +++ b/crates/swc/tests/tsc-references/topLevelAmbientModule.1.normal.js @@ -1,10 +1,10 @@ //// [foo_0.ts] "use strict"; //// [foo_1.ts] -/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +/// var foo = require("foo"); var z = foo.x + 10; diff --git a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile.1.normal.js b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile.1.normal.js index 8df8d12cd55c..e9ce80afa4af 100644 --- a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile.1.normal.js +++ b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile.1.normal.js @@ -13,11 +13,11 @@ var x = 42; //// [foo_1.ts] "use strict"; //// [foo_2.ts] -/// "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +/// var foo = require("vs/foo_0"); var z1 = foo.x + 10; // Should error, as declaration should win var z2 = foo.y() + 10; // Should resolve diff --git a/crates/swc/tests/tsc-references/tsNoCheckForTypescript.1.normal.js b/crates/swc/tests/tsc-references/tsNoCheckForTypescript.1.normal.js index 25aabd23e158..e0b1e6eda6bc 100644 --- a/crates/swc/tests/tsc-references/tsNoCheckForTypescript.1.normal.js +++ b/crates/swc/tests/tsc-references/tsNoCheckForTypescript.1.normal.js @@ -1,6 +1,6 @@ //// [file.ts] -// @ts-nocheck import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// @ts-nocheck export var a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment export var Bet = function Bet() { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments1.1.normal.js b/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments1.1.normal.js index 8f685024ddd6..6d9b2371b1c4 100644 --- a/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments1.1.normal.js +++ b/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments1.1.normal.js @@ -1,6 +1,6 @@ //// [file.ts] -// @ts-nocheck additional comments import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// @ts-nocheck additional comments export var a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment export var Bet = function Bet() { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments2.1.normal.js b/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments2.1.normal.js index 2ba4e38033df..eead981337da 100644 --- a/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments2.1.normal.js +++ b/crates/swc/tests/tsc-references/tsNoCheckForTypescriptComments2.1.normal.js @@ -1,6 +1,6 @@ //// [file.ts] -// @ts-nocheck: additional comments import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// @ts-nocheck: additional comments export var a = 1 + {}; // This is an error, ofc, `Operator '+' cannot be applied to types '1' and '{}'`, which will be suppressed by the `nocheck` comment export var Bet = function Bet() { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsxTypeErrors.1.normal.js b/crates/swc/tests/tsc-references/tsxTypeErrors.1.normal.js index 83b096809626..87b3724600e3 100644 --- a/crates/swc/tests/tsc-references/tsxTypeErrors.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxTypeErrors.1.normal.js @@ -1,6 +1,6 @@ //// [tsxTypeErrors.tsx] -// A built-in element (OK) import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// A built-in element (OK) var a1 = /*#__PURE__*/ React.createElement("div", { id: "foo" }); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment28.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment28.1.normal.js index 09442c6b7e30..bf02e66ecac2 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment28.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment28.1.normal.js @@ -1,6 +1,6 @@ //// [a.js] -// mixed prototype-assignment+class declaration import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// mixed prototype-assignment+class declaration var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment35.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment35.1.normal.js index e2867dd0f30a..f7bee3adc22c 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment35.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment35.1.normal.js @@ -1,7 +1,7 @@ //// [typeFromPropertyAssignment35.ts] //// [bug26877.js] -/** @param {Emu.D} x */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -function ollKorrect(x) { +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +/** @param {Emu.D} x */ function ollKorrect(x) { x._model; var y = new Emu.D(); var z = Emu.D._wrapperInstance; diff --git a/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOf.1.normal.js b/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOf.1.normal.js index 4079dd33bb16..71a900d1ecb3 100644 --- a/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOf.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardOfFormInstanceOf.1.normal.js @@ -1,13 +1,13 @@ //// [typeGuardOfFormInstanceOf.ts] +import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; // 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. -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; -import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; var C1 = function C1() { "use strict"; _class_call_check(this, C1); diff --git a/crates/swc/tests/tsc-references/typeGuardsInClassAccessors.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsInClassAccessors.1.normal.js index 6b2cda0a44e0..07ce0748080c 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInClassAccessors.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsInClassAccessors.1.normal.js @@ -1,9 +1,9 @@ //// [typeGuardsInClassAccessors.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _create_class } from "@swc/helpers/_/_create_class"; // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. // variables in global -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _create_class } from "@swc/helpers/_/_create_class"; var num; var strOrNum; var var1; diff --git a/crates/swc/tests/tsc-references/typeGuardsInClassMethods.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsInClassMethods.1.normal.js index 38676ea83685..e8dd5d5dd789 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInClassMethods.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsInClassMethods.1.normal.js @@ -1,8 +1,8 @@ //// [typeGuardsInClassMethods.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. // variables in global -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var num; var var1; var C1 = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/typeGuardsInExternalModule.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsInExternalModule.1.normal.js index cc0928fd81cb..53b944048a5b 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInExternalModule.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsInExternalModule.1.normal.js @@ -1,7 +1,4 @@ //// [typeGuardsInExternalModule.ts] -// Note that type guards affect types of variables and parameters only and -// have no effect on members of objects such as properties. -// local variable in external module "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -12,6 +9,9 @@ Object.defineProperty(exports, "var2", { return var2; } }); +// Note that type guards affect types of variables and parameters only and +// have no effect on members of objects such as properties. +// local variable in external module var num; var var1; if (typeof var1 === "string") { diff --git a/crates/swc/tests/tsc-references/typeGuardsInProperties.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsInProperties.1.normal.js index aef0763720e1..52fdcf211ac7 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInProperties.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsInProperties.1.normal.js @@ -1,8 +1,8 @@ //// [typeGuardsInProperties.ts] -// Note that type guards affect types of variables and parameters only and -// have no effect on members of objects such as properties. import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; +// Note that type guards affect types of variables and parameters only and +// have no effect on members of objects such as properties. var num; var strOrNum; var C1 = /*#__PURE__*/ function() { diff --git a/crates/swc/tests/tsc-references/typeGuardsOnClassProperty.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsOnClassProperty.1.normal.js index 0ced8289a895..0c2de9f9eb2c 100644 --- a/crates/swc/tests/tsc-references/typeGuardsOnClassProperty.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsOnClassProperty.1.normal.js @@ -1,9 +1,9 @@ //// [typeGuardsOnClassProperty.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Note that type guards affect types of variables and parameters only and // have no effect on members of objects such as properties. // Note that the class's property must be copied to a local variable for // the type guard to have an effect -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var D = /*#__PURE__*/ function() { "use strict"; function D() { diff --git a/crates/swc/tests/tsc-references/typeGuardsTypeParameters.1.normal.js b/crates/swc/tests/tsc-references/typeGuardsTypeParameters.1.normal.js index 45d849e75f2d..861b4dd87f77 100644 --- a/crates/swc/tests/tsc-references/typeGuardsTypeParameters.1.normal.js +++ b/crates/swc/tests/tsc-references/typeGuardsTypeParameters.1.normal.js @@ -1,7 +1,7 @@ //// [typeGuardsTypeParameters.ts] -// Type guards involving type parameters produce intersection types import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; +// Type guards involving type parameters produce intersection types var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/typeOfThisInConstructorParamList.1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInConstructorParamList.1.normal.js index 2fe66db3d454..33cc9c34102c 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInConstructorParamList.1.normal.js +++ b/crates/swc/tests/tsc-references/typeOfThisInConstructorParamList.1.normal.js @@ -1,6 +1,6 @@ //// [typeOfThisInConstructorParamList.ts] -//type of 'this' in constructor param list is the class instance type (error) import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +//type of 'this' in constructor param list is the class instance type (error) var ErrClass = function ErrClass() { "use strict"; var f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this; diff --git a/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.1.normal.js index 7fbabdc8ee0d..36de7e600694 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.1.normal.js +++ b/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.1.normal.js @@ -1,6 +1,6 @@ //// [typeOfThisInFunctionExpression.ts] -// type of 'this' in FunctionExpression is Any import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// type of 'this' in FunctionExpression is Any function fn() { var p = this; var p; diff --git a/crates/swc/tests/tsc-references/typeParameterAsBaseType.1.normal.js b/crates/swc/tests/tsc-references/typeParameterAsBaseType.1.normal.js index 1db4c5c82a26..7309645472f9 100644 --- a/crates/swc/tests/tsc-references/typeParameterAsBaseType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterAsBaseType.1.normal.js @@ -1,9 +1,9 @@ //// [typeParameterAsBaseType.ts] -// type parameters cannot be used as base types -// these are all errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// type parameters cannot be used as base types +// these are all errors var C = /*#__PURE__*/ function(T1) { "use strict"; _inherits(C, T1); diff --git a/crates/swc/tests/tsc-references/typeParameterAsTypeArgument.1.normal.js b/crates/swc/tests/tsc-references/typeParameterAsTypeArgument.1.normal.js index 67885c4cc3b5..346b3786cc43 100644 --- a/crates/swc/tests/tsc-references/typeParameterAsTypeArgument.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterAsTypeArgument.1.normal.js @@ -1,6 +1,6 @@ //// [typeParameterAsTypeArgument.ts] -// These are all errors because type parameters cannot reference other type parameters from the same list import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// These are all errors because type parameters cannot reference other type parameters from the same list function foo(x, y) { foo(y, y); return new C(); diff --git a/crates/swc/tests/tsc-references/typeParameterAssignability3.1.normal.js b/crates/swc/tests/tsc-references/typeParameterAssignability3.1.normal.js index a9dec1462f25..7af6f12629fd 100644 --- a/crates/swc/tests/tsc-references/typeParameterAssignability3.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterAssignability3.1.normal.js @@ -1,6 +1,6 @@ //// [typeParameterAssignability3.ts] -// type parameters are not assignable to one another unless directly or indirectly constrained to one another import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// type parameters are not assignable to one another unless directly or indirectly constrained to one another var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/typeParameterDirectlyConstrainedToItself.1.normal.js b/crates/swc/tests/tsc-references/typeParameterDirectlyConstrainedToItself.1.normal.js index f0a8f65050f9..1169ef145634 100644 --- a/crates/swc/tests/tsc-references/typeParameterDirectlyConstrainedToItself.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterDirectlyConstrainedToItself.1.normal.js @@ -1,6 +1,6 @@ //// [typeParameterDirectlyConstrainedToItself.ts] -// all of the below should be errors import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// all of the below should be errors var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/typeParameterUsedAsTypeParameterConstraint4.1.normal.js b/crates/swc/tests/tsc-references/typeParameterUsedAsTypeParameterConstraint4.1.normal.js index 5c8e69643c40..40ce42181c92 100644 --- a/crates/swc/tests/tsc-references/typeParameterUsedAsTypeParameterConstraint4.1.normal.js +++ b/crates/swc/tests/tsc-references/typeParameterUsedAsTypeParameterConstraint4.1.normal.js @@ -1,7 +1,7 @@ //// [typeParameterUsedAsTypeParameterConstraint4.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // Type parameters are in scope in their own and other type parameter lists // Some negative cases -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/typedefCrossModule2.1.normal.js b/crates/swc/tests/tsc-references/typedefCrossModule2.1.normal.js index 760800aa52ee..43f9cb3dcccb 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule2.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule2.1.normal.js @@ -1,7 +1,7 @@ //// [mod1.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; // error -/** @typedef {number} Foo */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var Foo = function Foo() { +/** @typedef {number} Foo */ var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); } // should error diff --git a/crates/swc/tests/tsc-references/typedefCrossModule3.1.normal.js b/crates/swc/tests/tsc-references/typedefCrossModule3.1.normal.js index d93af613ccc7..ddfc755e1977 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule3.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule3.1.normal.js @@ -1,6 +1,6 @@ //// [mod2.js] -/** @typedef {number} Foo */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var ns = {}; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +/** @typedef {number} Foo */ var ns = {}; ns.Foo = function _class() { "use strict"; _class_call_check(this, _class); diff --git a/crates/swc/tests/tsc-references/typedefCrossModule4.1.normal.js b/crates/swc/tests/tsc-references/typedefCrossModule4.1.normal.js index 11e7a388363e..ae6266bdf7a3 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule4.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule4.1.normal.js @@ -1,6 +1,6 @@ //// [mod3.js] -/** @typedef {number} Foo */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var Bar = function Bar() { +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +/** @typedef {number} Foo */ var Bar = function Bar() { "use strict"; _class_call_check(this, Bar); }; diff --git a/crates/swc/tests/tsc-references/typedefCrossModule5.1.normal.js b/crates/swc/tests/tsc-references/typedefCrossModule5.1.normal.js index 733d0bc711fd..d31a2a6a7951 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule5.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule5.1.normal.js @@ -1,6 +1,6 @@ //// [mod1.js] -/** @typedef {number} Foo */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var Bar = function Bar() { +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +/** @typedef {number} Foo */ var Bar = function Bar() { "use strict"; _class_call_check(this, Bar); }; diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.1.normal.js b/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.1.normal.js index a26bf594507b..975d668ed3ea 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.1.normal.js @@ -1,7 +1,7 @@ //// [typeofOperatorWithAnyOtherType.ts] -// typeof operator on any type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; +// typeof operator on any type var ANY; var ANY1; var ANY2 = [ diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.1.normal.js index 535acefeb15e..b090c375c6d3 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.1.normal.js @@ -1,7 +1,7 @@ //// [typeofOperatorWithBooleanType.ts] -// typeof operator on boolean type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; +// typeof operator on boolean type var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.1.normal.js b/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.1.normal.js index 0754976ac8b0..ad4fb37a6a38 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.1.normal.js @@ -1,6 +1,6 @@ //// [typeofOperatorWithEnumType.ts] -// typeof operator on enum type import { _ as _type_of } from "@swc/helpers/_/_type_of"; +// typeof operator on enum type var ENUM = /*#__PURE__*/ function(ENUM) { return ENUM; }(ENUM || {}); diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.1.normal.js index 69f37acb8a90..0183e56f32bf 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.1.normal.js @@ -1,7 +1,7 @@ //// [typeofOperatorWithNumberType.ts] -// typeof operator on number type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; +// typeof operator on number type var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/typeofOperatorWithStringType.1.normal.js index 265011992ca3..a7afee43df9c 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithStringType.1.normal.js @@ -1,7 +1,7 @@ //// [typeofOperatorWithStringType.ts] -// typeof operator on string type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; +// typeof operator on string type var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/typesWithPublicConstructor.1.normal.js b/crates/swc/tests/tsc-references/typesWithPublicConstructor.1.normal.js index 6d8a06334fa5..d3c08cde5a8f 100644 --- a/crates/swc/tests/tsc-references/typesWithPublicConstructor.1.normal.js +++ b/crates/swc/tests/tsc-references/typesWithPublicConstructor.1.normal.js @@ -1,6 +1,6 @@ //// [typesWithPublicConstructor.ts] -// public is allowed on a constructor but is not meaningful import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// public is allowed on a constructor but is not meaningful var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/typesWithSpecializedCallSignatures.1.normal.js b/crates/swc/tests/tsc-references/typesWithSpecializedCallSignatures.1.normal.js index 33d39cefbca4..b34a3cc5d670 100644 --- a/crates/swc/tests/tsc-references/typesWithSpecializedCallSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/typesWithSpecializedCallSignatures.1.normal.js @@ -1,8 +1,8 @@ //// [typesWithSpecializedCallSignatures.ts] -// basic uses of specialized signatures without errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// basic uses of specialized signatures without errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/typesWithSpecializedConstructSignatures.1.normal.js b/crates/swc/tests/tsc-references/typesWithSpecializedConstructSignatures.1.normal.js index 72cde8843d1b..be897c7a11e4 100644 --- a/crates/swc/tests/tsc-references/typesWithSpecializedConstructSignatures.1.normal.js +++ b/crates/swc/tests/tsc-references/typesWithSpecializedConstructSignatures.1.normal.js @@ -1,8 +1,8 @@ //// [typesWithSpecializedConstructSignatures.ts] -// basic uses of specialized signatures without errors import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// basic uses of specialized signatures without errors var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.1.normal.js b/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.1.normal.js index c47f98012763..303537e2d88b 100644 --- a/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.1.normal.js +++ b/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.1.normal.js @@ -1,8 +1,8 @@ //// [undefinedIsSubtypeOfEverything.ts] -// undefined is a subtype of every other types, no errors expected below import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// undefined is a subtype of every other types, no errors expected below var Base = function Base() { "use strict"; _class_call_check(this, Base); diff --git a/crates/swc/tests/tsc-references/unionTypeEquivalence.1.normal.js b/crates/swc/tests/tsc-references/unionTypeEquivalence.1.normal.js index f2891af7f0a6..48e9278db163 100644 --- a/crates/swc/tests/tsc-references/unionTypeEquivalence.1.normal.js +++ b/crates/swc/tests/tsc-references/unionTypeEquivalence.1.normal.js @@ -1,8 +1,8 @@ //// [unionTypeEquivalence.ts] -// A | B is equivalent to A if B is a subtype of A import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; +// A | B is equivalent to A if B is a subtype of A var C = function C() { "use strict"; _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/unionTypeFromArrayLiteral.1.normal.js b/crates/swc/tests/tsc-references/unionTypeFromArrayLiteral.1.normal.js index ad460ccc3cbe..c96c06cf38e4 100644 --- a/crates/swc/tests/tsc-references/unionTypeFromArrayLiteral.1.normal.js +++ b/crates/swc/tests/tsc-references/unionTypeFromArrayLiteral.1.normal.js @@ -1,11 +1,11 @@ //// [unionTypeFromArrayLiteral.ts] +import { _ as _call_super } from "@swc/helpers/_/_call_super"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; // The resulting type an array literal expression is determined as follows: // If the array literal is empty, the resulting type is an array type with the element type Undefined. // Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions. // Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. -import { _ as _call_super } from "@swc/helpers/_/_call_super"; -import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -import { _ as _inherits } from "@swc/helpers/_/_inherits"; var arr1 = [ 1, 2 diff --git a/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.1.normal.js b/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.1.normal.js index c091a716ace3..a9978e0c1c80 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.1.normal.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.1.normal.js @@ -1,6 +1,6 @@ //// [voidOperatorWithAnyOtherType.ts] -// void operator on any type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// void operator on any type var ANY; var ANY1; var ANY2 = [ diff --git a/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.1.normal.js b/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.1.normal.js index 272d12b8a01c..0cd2d94873be 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.1.normal.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.1.normal.js @@ -1,6 +1,6 @@ //// [voidOperatorWithBooleanType.ts] -// void operator on boolean type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// void operator on boolean type var BOOLEAN; function foo() { return true; diff --git a/crates/swc/tests/tsc-references/voidOperatorWithNumberType.1.normal.js b/crates/swc/tests/tsc-references/voidOperatorWithNumberType.1.normal.js index ffbc7a4a23e8..9024efe26568 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithNumberType.1.normal.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithNumberType.1.normal.js @@ -1,6 +1,6 @@ //// [voidOperatorWithNumberType.ts] -// void operator on number type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// void operator on number type var NUMBER; var NUMBER1 = [ 1, diff --git a/crates/swc/tests/tsc-references/voidOperatorWithStringType.1.normal.js b/crates/swc/tests/tsc-references/voidOperatorWithStringType.1.normal.js index 0ca7fdabbca9..7eda370760e1 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithStringType.1.normal.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithStringType.1.normal.js @@ -1,6 +1,6 @@ //// [voidOperatorWithStringType.ts] -// void operator on string type import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// void operator on string type var STRING; var STRING1 = [ "", diff --git a/crates/swc/tests/tsc-references/witness.1.normal.js b/crates/swc/tests/tsc-references/witness.1.normal.js index b947374e26c9..96db76824025 100644 --- a/crates/swc/tests/tsc-references/witness.1.normal.js +++ b/crates/swc/tests/tsc-references/witness.1.normal.js @@ -1,6 +1,6 @@ //// [witness.ts] -// Initializers import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// Initializers var varInit = varInit; // any var pInit; function fn() { diff --git a/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints.1.normal.js b/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints.1.normal.js index 3f93b015131e..22f9743face0 100644 --- a/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints.1.normal.js +++ b/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints.1.normal.js @@ -1,6 +1,6 @@ //// [wrappedAndRecursiveConstraints.ts] -// no errors expected import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// no errors expected var C = /*#__PURE__*/ function() { "use strict"; function C(data) { diff --git a/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints3.1.normal.js b/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints3.1.normal.js index d419671882ea..7e8a38acc2e8 100644 --- a/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints3.1.normal.js +++ b/crates/swc/tests/tsc-references/wrappedAndRecursiveConstraints3.1.normal.js @@ -1,6 +1,6 @@ //// [wrappedAndRecursiveConstraints3.ts] -// no errors expected import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +// no errors expected var C = /*#__PURE__*/ function() { "use strict"; function C(x) { diff --git a/crates/swc/tests/tsc-references/yieldExpressionInControlFlow.1.normal.js b/crates/swc/tests/tsc-references/yieldExpressionInControlFlow.1.normal.js index e80ad3923cf7..269f5021c236 100644 --- a/crates/swc/tests/tsc-references/yieldExpressionInControlFlow.1.normal.js +++ b/crates/swc/tests/tsc-references/yieldExpressionInControlFlow.1.normal.js @@ -27,9 +27,9 @@ function f() { }); } //// [alsoFails.ts] -// fails in Typescript too import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; import { _ as _ts_values } from "@swc/helpers/_/_ts_values"; +// fails in Typescript too function g() { var o; return _ts_generator(this, function(_state) { diff --git a/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js b/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js index 04534538bfd6..b745d7476a29 100644 --- a/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js +++ b/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js @@ -1,13 +1,13 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; -import { groupBy } from '../../../base/common/arrays.js'; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ import { groupBy } from '../../../base/common/arrays.js'; import { dispose } from '../../../base/common/lifecycle.js'; import { getLeadingWhitespace } from '../../../base/common/strings.js'; import './snippetSession.css'; From 1d4b0632f14d2ab0b342b5e1e878c9653cd104b8 Mon Sep 17 00:00:00 2001 From: DongYun Kang Date: Wed, 19 Nov 2025 16:30:45 -0500 Subject: [PATCH 7/8] Update test refs --- .../tests/benches-full/lodash.js | 9 ++++++++- .../tests/benches-full/moment.js | 5 +++++ .../tests/fixture/issues/10054/for/output.js | 1 + .../tests/fixture/issues/10054/if/output.js | 1 + .../tests/fixture/issues/10539/output.js | 1 + .../tests/fixture/issues/3256/2/output.js | 1 + .../fixture/issues/emotion/react/2/output.js | 2 +- .../tests/fixture/member_expr/string/output.js | 1 + .../tests/projects/output/yui-3.12.0.js | 15 ++++++++++++++- 9 files changed, 33 insertions(+), 3 deletions(-) diff --git a/crates/swc_ecma_minifier/tests/benches-full/lodash.js b/crates/swc_ecma_minifier/tests/benches-full/lodash.js index a7fe496e3b5d..8adbfc500bd5 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/lodash.js +++ b/crates/swc_ecma_minifier/tests/benches-full/lodash.js @@ -1,4 +1,11 @@ -(function() { +/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ (function() { /** Error message constants. */ var undefined, FUNC_ERROR_TEXT = 'Expected a function', HASH_UNDEFINED = '__lodash_hash_undefined__', PLACEHOLDER = '__lodash_placeholder__', INFINITY = 1 / 0, NAN = 0 / 0, wrapFlags = [ [ 'ary', diff --git a/crates/swc_ecma_minifier/tests/benches-full/moment.js b/crates/swc_ecma_minifier/tests/benches-full/moment.js index 77e38dbdc3c4..b7ee1362ffcd 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/moment.js +++ b/crates/swc_ecma_minifier/tests/benches-full/moment.js @@ -1,3 +1,8 @@ +//! moment.js +//! version : 2.29.1 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com !function(global, factory) { 'object' == typeof exports && 'undefined' != typeof module ? module.exports = factory() : 'function' == typeof define && define.amd ? define(factory) : global.moment = factory(); }(this, function() { diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/10054/for/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/10054/for/output.js index 03add9e136f1..f56109e68e95 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/10054/for/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/10054/for/output.js @@ -1,3 +1,4 @@ +// Input: window.a = [ function() { for(var l = 0; i < 10; l++); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/10054/if/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/10054/if/output.js index 97d6b73ba25c..2be6daaec961 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/10054/if/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/10054/if/output.js @@ -1,3 +1,4 @@ +// Input: window.a = [ function() { if (void 0 !== navigator.userAgentData) throw Error(); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/10539/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/10539/output.js index 9668116d4114..d63e501f0a34 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/10539/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/10539/output.js @@ -1,3 +1,4 @@ +// class def completely disappears // class def disappears, leaving only `new DoesntWorkClass()` as output (class DoesntWorkClass { static prop = new DoesntWorkClass(); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/3256/2/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/3256/2/output.js index cfe08c349d6e..432be310b2b8 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/3256/2/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/3256/2/output.js @@ -1,3 +1,4 @@ +// real life example taken from https://github.com/nodeca/pako/blob/master/lib/zlib/adler32.js#L26 export default ((adler, buf, len, pos)=>{ let s1 = 0xffff & adler, s2 = adler >>> 16 & 0xffff, n = 0; for(; 0 !== len;){ diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/2/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/2/output.js index 281a38f765fe..975819e75050 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/2/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/2/output.js @@ -1,4 +1,4 @@ -var fn, cache, cursor, hyphenateRegex = /[A-Z]|^ms/g, animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g, unitless_browser_esm = { +/* harmony default export */ var fn, cache, cursor, hyphenateRegex = /[A-Z]|^ms/g, animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g, unitless_browser_esm = { animationIterationCount: 1, borderImageOutset: 1, borderImageSlice: 1, diff --git a/crates/swc_ecma_minifier/tests/fixture/member_expr/string/output.js b/crates/swc_ecma_minifier/tests/fixture/member_expr/string/output.js index 739cb408a995..282868dfc938 100644 --- a/crates/swc_ecma_minifier/tests/fixture/member_expr/string/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/member_expr/string/output.js @@ -1,2 +1,3 @@ +// Invalid // Object symbols ''.constructor, ''.__proto__, ''.__defineGetter__, ''.__defineSetter__, ''.__lookupGetter__, ''.__lookupSetter__, ''.hasOwnProperty, ''.isPrototypeOf, ''.propertyIsEnumerable, ''.toLocaleString, ''.toString, ''.valueOf, ''.anchor, ''.at, ''.big, ''.blink, ''.bold, ''.charAt, ''.charCodeAt, ''.codePointAt, ''.concat, ''.endsWith, ''.fixed, ''.fontcolor, ''.fontsize, ''.includes, ''.indexOf, ''.isWellFormed, ''.italics, ''.lastIndexOf, ''.link, ''.localeCompare, ''.match, ''.matchAll, ''.normalize, ''.padEnd, ''.padStart, ''.repeat, ''.replace, ''.replaceAll, ''.search, ''.slice, ''.small, ''.split, ''.startsWith, ''.strike, ''.sub, ''.substr, ''.substring, ''.sup, ''.toLocaleLowerCase, ''.toLocaleUpperCase, ''.toLowerCase, ''.toUpperCase, ''.toWellFormed, ''.trim, ''.trimEnd, ''.trimStart; diff --git a/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js b/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js index 263fd157bf4e..1b5ab8cce716 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js +++ b/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js @@ -1,4 +1,17 @@ -void 0 !== YUI && (YUI._YUI = YUI); +/* +YUI 3.12.0 (build 8655935) +Copyright 2013 Yahoo! Inc. All rights reserved. +Licensed under the BSD License. +http://yuilibrary.com/license/ +*/ /** +The YUI module contains the components required for building the YUI seed file. +This includes the script loading mechanism, a simple queue, and the core +utilities for the library. + +@module yui +@main yui +@submodule yui-base +**/ /*jshint eqeqeq: false*/ void 0 !== YUI && (YUI._YUI = YUI); /** The YUI global namespace object. This is the constructor for all YUI instances. From 02981bcf1349402eb703110b5e58d8e2988bca92 Mon Sep 17 00:00:00 2001 From: DongYun Kang Date: Wed, 19 Nov 2025 16:32:20 -0500 Subject: [PATCH 8/8] Update test refs --- .../fixture/common/amd-triple-slash-directive/1/output.amd.ts | 2 +- .../fixture/common/amd-triple-slash-directive/1/output.umd.ts | 2 +- .../fixture/common/amd-triple-slash-directive/2/output.amd.ts | 4 ++-- .../fixture/common/amd-triple-slash-directive/2/output.umd.ts | 4 ++-- .../fixture/common/amd-triple-slash-directive/3/output.amd.ts | 2 +- .../fixture/common/amd-triple-slash-directive/3/output.umd.ts | 2 +- .../fixture/common/amd-triple-slash-directive/4/output.amd.ts | 4 ++-- .../fixture/common/amd-triple-slash-directive/4/output.umd.ts | 4 ++-- .../fixture/common/interop-node/export-all/output.amd.js | 3 +++ .../tests/fixture/common/interop-node/export-all/output.cjs | 3 +++ .../fixture/common/interop-node/export-all/output.umd.js | 3 +++ .../tests/fixture/common/interop/export-all/output.amd.js | 3 +++ .../tests/fixture/common/interop/export-all/output.cjs | 3 +++ .../tests/fixture/common/interop/export-all/output.umd.js | 3 +++ .../tests/fixture/common/issue-3732/output.amd.js | 1 + .../tests/fixture/common/issue-3732/output.cjs | 1 + .../tests/fixture/common/issue-3732/output.umd.js | 1 + .../tests/fixture/common/issue-7315/output.amd.js | 2 +- .../tests/fixture/common/issue-7315/output.umd.js | 2 +- crates/swc_typescript/tests/fixture/symbol-getter-setter.snap | 2 ++ .../tests/oxc_fixture/non-exported-binding-elements.snap | 1 + crates/swc_typescript/tests/oxc_fixture/strip-internal.snap | 4 +++- 22 files changed, 41 insertions(+), 15 deletions(-) diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/1/output.amd.ts b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/1/output.amd.ts index 36f7565073d3..79e854a5762c 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/1/output.amd.ts +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/1/output.amd.ts @@ -1,8 +1,8 @@ +/// define("NamedModule", [ "require" ], function(require) { "use strict"; - /// class Foo { x; constructor(){ diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/1/output.umd.ts b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/1/output.umd.ts index 29792c2f1708..4298ce2ab7b5 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/1/output.umd.ts +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/1/output.umd.ts @@ -1,10 +1,10 @@ +/// (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(); else if (typeof define === "function" && define.amd) define([], factory); else if (global = typeof globalThis !== "undefined" ? globalThis : global || self) factory(); })(this, function() { "use strict"; - /// class Foo { x; constructor(){ diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/2/output.amd.ts b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/2/output.amd.ts index 96aafcac4912..71a2d747bb6d 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/2/output.amd.ts +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/2/output.amd.ts @@ -1,9 +1,9 @@ +/// +/// define("SecondModuleName", [ "require" ], function(require) { "use strict"; - /// - /// class Foo { x; constructor(){ diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/2/output.umd.ts b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/2/output.umd.ts index ba1d81582529..12b46996a430 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/2/output.umd.ts +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/2/output.umd.ts @@ -1,11 +1,11 @@ +/// +/// (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(); else if (typeof define === "function" && define.amd) define([], factory); else if (global = typeof globalThis !== "undefined" ? globalThis : global || self) factory(); })(this, function() { "use strict"; - /// - /// class Foo { x; constructor(){ diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/3/output.amd.ts b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/3/output.amd.ts index 2aa6a35a7113..6540aa88dbd9 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/3/output.amd.ts +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/3/output.amd.ts @@ -1,8 +1,8 @@ +/// define("NamedModule", [ "require" ], function(require) { "use strict"; - /// class Foo { x; constructor(){ diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/3/output.umd.ts b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/3/output.umd.ts index 8a5d17feff2f..432a7737c98c 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/3/output.umd.ts +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/3/output.umd.ts @@ -1,10 +1,10 @@ +/// (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(); else if (typeof define === "function" && define.amd) define([], factory); else if (global = typeof globalThis !== "undefined" ? globalThis : global || self) factory(); })(this, function() { "use strict"; - /// class Foo { x; constructor(){ diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/4/output.amd.ts b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/4/output.amd.ts index f8bdf3485022..0b9663da8bec 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/4/output.amd.ts +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/4/output.amd.ts @@ -1,8 +1,8 @@ -define([ +/*/ */ define([ "require" ], function(require) { "use strict"; - /*/ */ class Foo { + class Foo { x; constructor(){ this.x = 5; diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/4/output.umd.ts b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/4/output.umd.ts index 8d8842a892d0..df69b0a6f956 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/4/output.umd.ts +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/amd-triple-slash-directive/4/output.umd.ts @@ -1,10 +1,10 @@ -(function(global, factory) { +/*/ */ (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(); else if (typeof define === "function" && define.amd) define([], factory); else if (global = typeof globalThis !== "undefined" ? globalThis : global || self) factory(); })(this, function() { "use strict"; - /*/ */ class Foo { + class Foo { x; constructor(){ this.x = 5; diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.amd.js b/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.amd.js index 989af835f5d0..975247161ce4 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.amd.js +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.amd.js @@ -1,3 +1,6 @@ +// The fact that this exports both a normal default, and all of the names via +// re-export is an edge case that is important not to miss. See +// https://github.com/babel/babel/issues/8306 as an example. define([ "require", "exports", diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.cjs b/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.cjs index 2b9784149772..a182aabfe5f4 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.cjs +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.cjs @@ -1,3 +1,6 @@ +// The fact that this exports both a normal default, and all of the names via +// re-export is an edge case that is important not to miss. See +// https://github.com/babel/babel/issues/8306 as an example. "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.umd.js b/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.umd.js index d9c218744eee..f6e8769e62fe 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.umd.js +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/interop-node/export-all/output.umd.js @@ -1,3 +1,6 @@ +// The fact that this exports both a normal default, and all of the names via +// re-export is an edge case that is important not to miss. See +// https://github.com/babel/babel/issues/8306 as an example. (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(exports, require("react")); else if (typeof define === "function" && define.amd) define([ diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.amd.js b/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.amd.js index a5c77652ebcd..c8786eb736e4 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.amd.js +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.amd.js @@ -1,3 +1,6 @@ +// The fact that this exports both a normal default, and all of the names via +// re-export is an edge case that is important not to miss. See +// https://github.com/babel/babel/issues/8306 as an example. define([ "require", "exports", diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.cjs b/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.cjs index 2414682bddf8..81ea12f189ce 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.cjs +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.cjs @@ -1,3 +1,6 @@ +// The fact that this exports both a normal default, and all of the names via +// re-export is an edge case that is important not to miss. See +// https://github.com/babel/babel/issues/8306 as an example. "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.umd.js b/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.umd.js index b7659e1dd2fa..b751da6870e1 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.umd.js +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/interop/export-all/output.umd.js @@ -1,3 +1,6 @@ +// The fact that this exports both a normal default, and all of the names via +// re-export is an edge case that is important not to miss. See +// https://github.com/babel/babel/issues/8306 as an example. (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(exports, require("react")); else if (typeof define === "function" && define.amd) define([ diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.amd.js b/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.amd.js index af4685b98189..27a7d82b1aa0 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.amd.js +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.amd.js @@ -1,3 +1,4 @@ +// index.ts define([ "require", "exports", diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.cjs b/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.cjs index 3be78a2fbca0..f756252eca8e 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.cjs +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.cjs @@ -1,3 +1,4 @@ +// index.ts "use strict"; Object.defineProperty(exports, "__esModule", { value: true diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.umd.js b/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.umd.js index 830f4299863d..25a982b752db 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.umd.js +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/issue-3732/output.umd.js @@ -1,3 +1,4 @@ +// index.ts (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(exports, require("./get")); else if (typeof define === "function" && define.amd) define([ diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/issue-7315/output.amd.js b/crates/swc_ecma_transforms_module/tests/fixture/common/issue-7315/output.amd.js index 224e7c877c72..b826cb60eee5 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/issue-7315/output.amd.js +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/issue-7315/output.amd.js @@ -1,8 +1,8 @@ +// input.ts define([ "require", "exports" ], function(require, exports) { - // input.ts "use client"; "use strict"; Object.defineProperty(exports, "__esModule", { diff --git a/crates/swc_ecma_transforms_module/tests/fixture/common/issue-7315/output.umd.js b/crates/swc_ecma_transforms_module/tests/fixture/common/issue-7315/output.umd.js index 2513c7dca8a3..69d0b73bbe37 100644 --- a/crates/swc_ecma_transforms_module/tests/fixture/common/issue-7315/output.umd.js +++ b/crates/swc_ecma_transforms_module/tests/fixture/common/issue-7315/output.umd.js @@ -1,3 +1,4 @@ +// input.ts (function(global, factory) { if (typeof module === "object" && typeof module.exports === "object") factory(exports); else if (typeof define === "function" && define.amd) define([ @@ -5,7 +6,6 @@ ], factory); else if (global = typeof globalThis !== "undefined" ? globalThis : global || self) factory(global.input = {}); })(this, function(exports) { - // input.ts "use client"; "use strict"; Object.defineProperty(exports, "__esModule", { diff --git a/crates/swc_typescript/tests/fixture/symbol-getter-setter.snap b/crates/swc_typescript/tests/fixture/symbol-getter-setter.snap index 2ff0f67da208..4c50435beeec 100644 --- a/crates/swc_typescript/tests/fixture/symbol-getter-setter.snap +++ b/crates/swc_typescript/tests/fixture/symbol-getter-setter.snap @@ -1,5 +1,7 @@ ```==================== .D.TS ==================== +// @isolatedDeclarations: true +// @emitDeclarationOnly: true export declare const foo: { [Symbol.toStringTag]: string; }; diff --git a/crates/swc_typescript/tests/oxc_fixture/non-exported-binding-elements.snap b/crates/swc_typescript/tests/oxc_fixture/non-exported-binding-elements.snap index c27008d2b9f6..606b3594e4a5 100644 --- a/crates/swc_typescript/tests/oxc_fixture/non-exported-binding-elements.snap +++ b/crates/swc_typescript/tests/oxc_fixture/non-exported-binding-elements.snap @@ -1,5 +1,6 @@ ```==================== .D.TS ==================== +// Correct export declare function foo(): number; export { c, d, e }; export declare const { f, g } = { diff --git a/crates/swc_typescript/tests/oxc_fixture/strip-internal.snap b/crates/swc_typescript/tests/oxc_fixture/strip-internal.snap index e539063fd4c1..09a75f739548 100644 --- a/crates/swc_typescript/tests/oxc_fixture/strip-internal.snap +++ b/crates/swc_typescript/tests/oxc_fixture/strip-internal.snap @@ -1,6 +1,8 @@ ```==================== .D.TS ==================== -declare class StripInternalClassFields { +/* +@internal +*/ declare class StripInternalClassFields { } export { stripInternalFunction, StripInternalClass, StripInternalClassFields }; export interface StripInternalInterfaceSignatures {