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
6 changes: 6 additions & 0 deletions crates/oxc_ast/src/ast_impl/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,12 @@ impl MethodDefinitionKind {
}
}

impl MethodDefinitionType {
pub fn is_abstract(&self) -> bool {
matches!(self, Self::TSAbstractMethodDefinition)
}
}

impl<'a> PrivateIdentifier<'a> {
pub fn new(span: Span, name: Atom<'a>) -> Self {
Self { span, name }
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_isolated_declarations/src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl<'a> IsolatedDeclarations<'a> {
match element {
ClassElement::StaticBlock(_) => {}
ClassElement::MethodDefinition(ref method) => {
if method.value.body.is_none() {
if !method.r#type.is_abstract() && method.value.body.is_none() {
is_function_overloads = true;
} else if is_function_overloads {
// Skip implementation of function overloads
Expand Down
8 changes: 7 additions & 1 deletion crates/oxc_isolated_declarations/tests/fixtures/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ export class Bar {
public constructor(a: number = 0) {}
}

export class Zoo { foo<F>(f: F): F { return f } }
export class Zoo { foo<F>(f: F): F { return f } }

export abstract class Qux {
abstract foo(): void;
bar(): void {}
baz(): void {}
}
5 changes: 5 additions & 0 deletions crates/oxc_isolated_declarations/tests/snapshots/class.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ export declare class Bar {
export declare class Zoo {
foo<F>(f: F): F;
}
export declare abstract class Qux {
abstract foo(): void;
bar(): void;
baz(): void;
}