Skip to content

Commit ac87ff9

Browse files
committed
Fixed small issue with wrapped dict types.
1 parent e68806c commit ac87ff9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/py2ts/generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _basic_to_ts(py_type: Type | UnionType) -> TypescriptType:
190190

191191
if origin in _wrapper_types():
192192
# If the type is just a wrapper type (e.g. sqlalchemy Mapped)
193-
return _basic_to_ts(get_args(py_type)[0])
193+
return _generate_ts(get_args(py_type)[0])
194194

195195
# Not Required
196196
if origin is NotRequired:

tests/test_record.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
),
2626
"Record<string, number>",
2727
),
28+
(
29+
dict[str, str],
30+
TSRecordType(
31+
TSPrimitiveType(TypescriptPrimitive.STRING),
32+
TSPrimitiveType(TypescriptPrimitive.STRING),
33+
),
34+
"Record<string, string>",
35+
),
2836
(
2937
Dict,
3038
TSRecordType(

0 commit comments

Comments
 (0)