mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(linter) fix bug in fixer for prefer-function-type when interface is exported (#5122)
part of https://github.com/oxc-project/oxc/issues/5103
This commit is contained in:
parent
f7958c4cc2
commit
b7ba9c01a1
1 changed files with 9 additions and 2 deletions
|
|
@ -206,8 +206,10 @@ fn check_member(member: &TSSignature, node: &AstNode<'_>, ctx: &LintContext<'_>)
|
|||
|
||||
Fix::new(
|
||||
format!(
|
||||
"type {} = {};",
|
||||
&interface_decl.id.name, &suggestion
|
||||
"{} {} = {};",
|
||||
if is_parent_exported { "export type" } else { "type" },
|
||||
&interface_decl.id.name,
|
||||
&suggestion
|
||||
),
|
||||
Span::new(node_start, node_end),
|
||||
)
|
||||
|
|
@ -718,6 +720,11 @@ type X = {} & (() => void);
|
|||
",
|
||||
None,
|
||||
),
|
||||
(
|
||||
"export interface AnyFn { (...args: any[]): any }",
|
||||
"export type AnyFn = (...args: any[]) => any;",
|
||||
None,
|
||||
),
|
||||
];
|
||||
|
||||
Tester::new(PreferFunctionType::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
|
|
|
|||
Loading…
Reference in a new issue