@@ -704,6 +704,27 @@ impl<'a> Visit<'a> for ExplicitTypesChecker<'a, '_> {
704704
705705 self . ctx . diagnostic ( func_missing_argument_type ( it. span ) ) ;
706706 }
707+
708+ fn visit_ts_as_expression ( & mut self , it : & TSAsExpression < ' a > ) {
709+ if is_wrapped_function_expression ( & it. expression ) {
710+ return ;
711+ }
712+ walk:: walk_ts_as_expression ( self , it) ;
713+ }
714+
715+ fn visit_ts_satisfies_expression ( & mut self , it : & TSSatisfiesExpression < ' a > ) {
716+ if is_wrapped_function_expression ( & it. expression ) {
717+ return ;
718+ }
719+ walk:: walk_ts_satisfies_expression ( self , it) ;
720+ }
721+
722+ fn visit_ts_type_assertion ( & mut self , it : & TSTypeAssertion < ' a > ) {
723+ if is_wrapped_function_expression ( & it. expression ) {
724+ return ;
725+ }
726+ walk:: walk_ts_type_assertion ( self , it) ;
727+ }
707728}
708729
709730/// like [`Expression::get_inner_expression`], but does not skip over most ts syntax
@@ -715,6 +736,13 @@ fn get_typed_inner_expression<'a, 'e>(expr: &'e Expression<'a>) -> &'e Expressio
715736 }
716737}
717738
739+ fn is_wrapped_function_expression ( expr : & Expression < ' _ > ) -> bool {
740+ matches ! (
741+ get_typed_inner_expression( expr) ,
742+ Expression :: ArrowFunctionExpression ( _) | Expression :: FunctionExpression ( _)
743+ )
744+ }
745+
718746#[ cfg( test) ]
719747mod test {
720748 use super :: { ExplicitModuleBoundaryTypes , ExplicitModuleBoundaryTypesConfig } ;
@@ -924,10 +952,6 @@ mod test {
924952 "const x = (() => {}) as Foo;" ,
925953 Some ( json!( [ { "allowTypedFunctionExpressions" : true } ] ) ) ,
926954 ) ,
927- (
928- "type F = (x: number) => number; export const f = (x => x) satisfies F;" ,
929- None ,
930- ) ,
931955 (
932956 "
933957 export const x = {
@@ -1562,6 +1586,30 @@ mod test {
15621586 " ,
15631587 None ,
15641588 ) ,
1589+ (
1590+ "type F = (x: number) => number; export const f = (x => x) satisfies F;" ,
1591+ None ,
1592+ ) ,
1593+ (
1594+ "
1595+ type F = () => number;
1596+
1597+ export const OBJ = {
1598+ f: (() => 42) satisfies F,
1599+ };
1600+ " ,
1601+ None ,
1602+ ) ,
1603+ (
1604+ "
1605+ type F = () => number;
1606+
1607+ export class Class {
1608+ g = (() => 42) satisfies F;
1609+ }
1610+ " ,
1611+ None ,
1612+ ) ,
15651613 ] ;
15661614
15671615 let fail = vec ! [
0 commit comments