@@ -116,6 +116,7 @@ pub fn check_binding_identifier(ident: &BindingIdentifier, ctx: &SemanticBuilder
116116 // declare function f(eval: number, arguments: number): number; // OK
117117 // declare function f(...eval): number; // OK
118118 // declare function f(...arguments): number; // OK
119+ // type K = (arguments: any[]) => void; // OK
119120 // declare function g({eval, arguments}: {eval: number, arguments: number}): number; // Error
120121 // declare function h([eval, arguments]: [number, number]): number; // Error
121122 let is_declare_function = |kind : & AstKind | {
@@ -126,7 +127,14 @@ pub fn check_binding_identifier(ident: &BindingIdentifier, ctx: &SemanticBuilder
126127 let parent = ctx. nodes . parent_node ( ctx. current_node_id ) ;
127128 let is_ok = match parent. kind ( ) {
128129 AstKind :: Function ( func) => matches ! ( func. r#type, FunctionType :: TSDeclareFunction ) ,
129- AstKind :: FormalParameter ( _) => is_declare_function ( & ctx. nodes . parent_kind ( parent. id ( ) ) ) ,
130+ AstKind :: FormalParameter ( _) => {
131+ is_declare_function ( & ctx. nodes . parent_kind ( parent. id ( ) ) )
132+ || ctx
133+ . nodes
134+ . ancestor_kinds ( parent. id ( ) )
135+ . nth ( 1 )
136+ . is_some_and ( |node| matches ! ( node, AstKind :: TSFunctionType ( _) ) )
137+ }
130138 AstKind :: BindingRestElement ( _) => {
131139 let grand_parent = ctx. nodes . parent_node ( parent. id ( ) ) ;
132140 matches ! ( grand_parent. kind( ) , AstKind :: FormalParameters ( _) )
0 commit comments