Solución
solution.tsTypeScript
from typing import Protocol
# Define aqui el Protocol Printable con el metodo __str__
class Printable(Protocol):
def to_string(self, datos) -> str:
for _ in datos:
if type(datos[_]) is str:
return datos[_]
def format_printable(data: dict) -> str:
# Crea un objeto con __str__ y retorna str(objeto)
return Printable.to_string(None, data)
0respuestas