Skip to content

Commit

Permalink
UnionType import fix
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Nov 24, 2024
1 parent f2f38e9 commit 5f08593
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/viser/infra/_typescript_interface_gen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dataclasses
import types
from collections import defaultdict
from types import UnionType
from typing import Any, Type, Union, cast

import numpy as np
Expand Down Expand Up @@ -49,6 +49,7 @@ def _get_ts_type(typ: Type[Any]) -> str:
origin_typ = args[0]

# Automatic Python => TypeScript conversion.
UnionType = getattr(types, "UnionType", Union)
if origin_typ is tuple:
args = get_args(typ)
if len(args) == 2 and args[1] == ...:
Expand Down

0 comments on commit 5f08593

Please sign in to comment.