diff --git a/crates/oxc_transformer/src/decorator/legacy/metadata.rs b/crates/oxc_transformer/src/decorator/legacy/metadata.rs index eb62e3c32178c..d8a0bee50ea71 100644 --- a/crates/oxc_transformer/src/decorator/legacy/metadata.rs +++ b/crates/oxc_transformer/src/decorator/legacy/metadata.rs @@ -548,7 +548,7 @@ impl<'a> LegacyDecoratorMetadata<'a, '_> { right: Expression<'a>, ctx: &TraverseCtx<'a>, ) -> Expression<'a> { - let operator = BinaryOperator::StrictEquality; + let operator = BinaryOperator::StrictInequality; let undefined = ctx.ast.expression_string_literal(SPAN, "undefined", None); let typeof_left = ctx.ast.expression_unary(SPAN, UnaryOperator::Typeof, left); let left_check = ctx.ast.expression_binary(SPAN, typeof_left, operator, undefined); diff --git a/tasks/transform_conformance/snapshots/oxc.snap.md b/tasks/transform_conformance/snapshots/oxc.snap.md index 80edf67bf70b6..ed14af5a0d7bb 100644 --- a/tasks/transform_conformance/snapshots/oxc.snap.md +++ b/tasks/transform_conformance/snapshots/oxc.snap.md @@ -1,6 +1,6 @@ commit: 578ac4df -Passed: 137/221 +Passed: 137/223 # All Passed: * babel-plugin-transform-class-static-block @@ -319,7 +319,29 @@ x Output mismatch x Output mismatch -# legacy-decorators (2/64) +# legacy-decorators (2/66) +* oxc/metadata/bound-type-reference/input.ts +Symbol reference IDs mismatch for "BoundTypeReference": +after transform: SymbolId(0): [ReferenceId(1), ReferenceId(3), ReferenceId(4), ReferenceId(5), ReferenceId(6)] +rebuilt : SymbolId(0): [ReferenceId(1), ReferenceId(6), ReferenceId(7)] +Symbol span mismatch for "Example": +after transform: SymbolId(1): Span { start: 87, end: 94 } +rebuilt : SymbolId(2): Span { start: 0, end: 0 } +Symbol span mismatch for "Example": +after transform: SymbolId(4): Span { start: 0, end: 0 } +rebuilt : SymbolId(3): Span { start: 87, end: 94 } + +* oxc/metadata/unbound-type-reference/input.ts +Symbol span mismatch for "Example": +after transform: SymbolId(0): Span { start: 6, end: 13 } +rebuilt : SymbolId(1): Span { start: 0, end: 0 } +Symbol span mismatch for "Example": +after transform: SymbolId(3): Span { start: 0, end: 0 } +rebuilt : SymbolId(2): Span { start: 6, end: 13 } +Unresolved reference IDs mismatch for "UnboundTypeReference": +after transform: [ReferenceId(1), ReferenceId(2), ReferenceId(3)] +rebuilt : [ReferenceId(4), ReferenceId(5)] + * typescript/accessor/decoratorOnClassAccessor1/input.ts Scope children mismatch: after transform: ScopeId(0): [ScopeId(1), ScopeId(2)] diff --git a/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/bound-type-reference/input.ts b/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/bound-type-reference/input.ts new file mode 100644 index 0000000000000..4f64db3b604e9 --- /dev/null +++ b/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/bound-type-reference/input.ts @@ -0,0 +1,8 @@ +import { BoundTypeReference } from "./output"; + +console.log(BoundTypeReference) + +class Example { + constructor(@dce count: BoundTypeReference) {} + prop: BoundTypeReference.Value = 1; +} diff --git a/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/bound-type-reference/output.js b/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/bound-type-reference/output.js new file mode 100644 index 0000000000000..f20a0a7b730c9 --- /dev/null +++ b/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/bound-type-reference/output.js @@ -0,0 +1,24 @@ +import { BoundTypeReference } from "./output"; + +var _ref; + +console.log(BoundTypeReference); + +let Example = class Example { + constructor(count) { } + prop = 1; +}; + +Example = babelHelpers.decorate( + [ + babelHelpers.decorateMetadata("design:paramtypes", [ + typeof (_ref = + typeof BoundTypeReference !== "undefined" && BoundTypeReference) === + "function" + ? _ref + : Object, + ]), + babelHelpers.decorateParam(0, dce), + ], + Example, +); diff --git a/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/unbound-type-reference/input.ts b/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/unbound-type-reference/input.ts new file mode 100644 index 0000000000000..21632fc97f1dd --- /dev/null +++ b/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/unbound-type-reference/input.ts @@ -0,0 +1,4 @@ +class Example { + constructor(@dce count: UnboundTypeReference) {} +} + diff --git a/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/unbound-type-reference/output.js b/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/unbound-type-reference/output.js new file mode 100644 index 0000000000000..da52b61f7e615 --- /dev/null +++ b/tasks/transform_conformance/tests/legacy-decorators/test/fixtures/oxc/metadata/unbound-type-reference/output.js @@ -0,0 +1,18 @@ +var _ref; +let Example = class Example { + constructor(count) {} +}; + +Example = babelHelpers.decorate( + [ + babelHelpers.decorateMetadata("design:paramtypes", [ + typeof (_ref = + typeof UnboundTypeReference !== "undefined" && UnboundTypeReference) === + "function" + ? _ref + : Object, + ]), + babelHelpers.decorateParam(0, dce), + ], + Example, +);