You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python keywords as property names produce invalid Python; rest and optional tuples become fixed-length tuples #50
Object types whose property names are Python keywords (such as from, class, in, def, or None) are emitted using classTypedDict syntax that fails to parse in Python and Pyright, and tuple types with rest (...T[]) or optional (T?) elements are emitted as fixed-length Tuple[...] types.
In src/isValidPythonIdentifier.ts, isValidPythonIdentifier only checks /^[a-zA-Z_][\w]*$/ without excluding Python reserved keywords (keyword.kwlist, including None/True/False and lambda), so parseTypeDefinition does not use the functional TypedDict fallback added in #21; in src/parseInlineType.ts, isTupleType maps typechecker.getTypeArguments(type) directly into Tuple[...] without checking (type as ts.TupleTypeReference).target.elementFlags for rest/variadic or optional elements.
Tested on typescript2python@2.2.0 (npm latest) and main (bb2fa60f) with Node.js v26.13.0, Python 3.11.2, and Pyright 1.1.414.
Activity