diff --git a/salt2type b/salt2type index 78a3516..7950fe9 100755 --- a/salt2type +++ b/salt2type @@ -60,7 +60,7 @@ class PropDef: """ Whether or not this is a rest parameter (None if unknown). """ is_static: Optional[bool] = None - """ Whether or not this method is static (None if unknown). """ + """ Whether or not this property is static (None if unknown). """ @dataclass @@ -628,6 +628,8 @@ def add_doc_info(defs: List[ClassDef], types: List[ClassDef]) -> None: curr_prop.typ = prop.typ curr_prop.desc = prop.desc curr_prop.is_rest = prop.is_rest + elif not prop.name.startswith("this["): + curr_class.props.append(PropDef(to_local_prop(prop.name), None, prop.typ, prop.desc, prop.is_rest, False)) curr_class.links.extend(typ.links) @@ -682,6 +684,16 @@ def copy_tpl(out_dir: str, asm_name: str, ns_name: str) -> None: copy_file(src_file, dst_file, asm_name, ns_name) +def to_local_prop(name: str) -> str: + """ + Converts a C# local property to a S# name + """ + if name[:1] == name[:1].lower(): + return "$" + name + + return name[:1].lower() + name[1:] + + def prop_to_string(prop: PropDef) -> str: """ Generates a stringified version of the property for typescript