diff --git a/typemallow2/__init__.py b/typemallow2/__init__.py index 24ba0a8..1c50c6b 100644 --- a/typemallow2/__init__.py +++ b/typemallow2/__init__.py @@ -106,7 +106,10 @@ def __get_ts_interface(schema): ts_fields = [] for key, value in schema._declared_fields.items(): if type(value) is fields.Nested: - ts_type = value.nested.__name__.replace('Schema', '') + if type(value.nested) is str: + ts_type = value.nested.replace('Schema', '') + else: + ts_type = value.nested.__name__.replace('Schema', '') if value.many: ts_type += '[]' elif type(value) is EnumField: