@@ -5,9 +5,9 @@ use itertools::Itertools;
55
66use crate :: {
77 AsyncState , DbIndex , LuaAliasCallType , LuaConditionalType , LuaFunctionType , LuaGenericType ,
8- LuaIntersectionType , LuaMemberKey , LuaMemberOwner , LuaObjectType , LuaSignatureId ,
9- LuaStringTplType , LuaTupleType , LuaType , LuaTypeDeclId , LuaUnionType , TypeSubstitutor ,
10- VariadicType ,
8+ LuaIntersectionType , LuaMappedType , LuaMemberKey , LuaMemberOwner , LuaObjectType ,
9+ LuaSignatureId , LuaStringTplType , LuaTupleType , LuaType , LuaTypeDeclId , LuaUnionType ,
10+ TypeSubstitutor , VariadicType ,
1111} ;
1212
1313use super :: { LuaAliasCallKind , LuaMultiLineUnion } ;
@@ -217,9 +217,9 @@ impl<'a> TypeHumanizer<'a> {
217217 }
218218 LuaType :: Language ( s) => w. write_str ( s) ,
219219 LuaType :: Conditional ( c) => self . write_conditional_type ( c, w) ,
220+ LuaType :: Mapped ( mapped) => self . write_mapped_type ( mapped, w) ,
220221 LuaType :: Never => w. write_str ( "never" ) ,
221222 LuaType :: ModuleRef ( file_id) => self . write_module_ref ( * file_id, w) ,
222- _ => w. write_str ( "unknown" ) ,
223223 }
224224 }
225225
@@ -1082,6 +1082,36 @@ impl<'a> TypeHumanizer<'a> {
10821082 Ok ( ( ) )
10831083 }
10841084
1085+ // ─── Mapped ─────────────────────────────────────────────────────
1086+
1087+ fn write_mapped_type < W : Write > ( & mut self , mapped : & LuaMappedType , w : & mut W ) -> fmt:: Result {
1088+ w. write_str ( "{ " ) ?;
1089+ if mapped. is_readonly {
1090+ w. write_str ( "readonly " ) ?;
1091+ }
1092+
1093+ w. write_char ( '[' ) ?;
1094+ w. write_str ( mapped. param . 1 . name . as_str ( ) ) ?;
1095+ w. write_str ( " in " ) ?;
1096+
1097+ let saved = self . level ;
1098+ self . level = self . child_level ( ) ;
1099+ if let Some ( constraint) = & mapped. param . 1 . constraint {
1100+ self . write_type ( constraint, w) ?;
1101+ } else {
1102+ w. write_str ( "unknown" ) ?;
1103+ }
1104+ w. write_char ( ']' ) ?;
1105+ if mapped. is_optional {
1106+ w. write_char ( '?' ) ?;
1107+ }
1108+ w. write_str ( ": " ) ?;
1109+ self . write_type ( & mapped. value , w) ?;
1110+ self . level = saved;
1111+
1112+ w. write_str ( "; }" )
1113+ }
1114+
10851115 // ─── ModuleRef ──────────────────────────────────────────────────
10861116
10871117 fn write_module_ref < W : Write > ( & mut self , file_id : crate :: FileId , w : & mut W ) -> fmt:: Result {
0 commit comments