Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/oxc_codegen/tests/integration/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ fn class() {
"export default class Foo { @x @y accessor #aDef = 1 }",
"export default class Foo {\n\t@x @y accessor #aDef = 1;\n}\n",
);
test(
"export class Test2 {\n@decorator\nproperty: ((arg: any) => any) | undefined;\n}",
"export class Test2 {\n\t@decorator property: ((arg: any) => any) | undefined;\n}\n",
);
test_minify("class { static [computed] }", "class{static[computed]}");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
declare const decorator: any;

export class Test1 {
/**
* This methond will trigger the feature highlight dialog load/show based on dialogId and analyticsId
*/
@decorator
property: (() => any) | undefined;
}

export class Test2 {
/**
* This methond will trigger the feature highlight dialog load/show based on dialogId and analyticsId
*/
@decorator
property: ((arg: any) => any) | undefined;
}

export class Test3 {
@decorator
property?: {
property?: (arg: any) => any;
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
source: crates/oxc_isolated_declarations/tests/mod.rs
input_file: crates/oxc_isolated_declarations/tests/fixtures/class-decorator.ts
---
```
==================== .D.TS ====================

export declare class Test1 {
/**
* This methond will trigger the feature highlight dialog load/show based on dialogId and analyticsId
*/
property: (() => any) | undefined;
}
export declare class Test2 {
/**
* This methond will trigger the feature highlight dialog load/show based on dialogId and analyticsId
*/
property: ((arg: any) => any) | undefined;
}
export declare class Test3 {
property?: {
property?: (arg: any) => any
};
}
2 changes: 1 addition & 1 deletion crates/oxc_parser/src/js/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ impl<'a> ParserImpl<'a> {
definite: bool,
modifiers: &Modifiers,
) -> ClassElement<'a> {
let type_annotation = if self.is_ts { self.parse_ts_type_annotation() } else { None };
let decorators = self.consume_decorators();
let type_annotation = if self.is_ts { self.parse_ts_type_annotation() } else { None };
// Initializer[+In, ?Yield, ?Await]opt
let initializer = self
.eat(Kind::Eq)
Expand Down
Loading