Closed pokey closed 9 months ago
In the following code:
test_type.py
from talon import Module mod = Module() @mod.action_class class Actions: def foo_bar(baz: str | int): """foo bar""" print(baz)
test_type.talon
test type: user.foo_bar("baz")
Saying "test type" results in the following error:
"test type"
2023-10-05 11:45:03.468 ERROR TalonScript TypeError in: /Users/pokey/.talon/user/pokey_talon/test_type.talon:1 2023-10-05 11:45:03.469 ERROR Line 1: user.foo_bar(baz: str | int) 2023-10-05 11:45:03.469 ERROR Line 1: parameter 1 (baz) expects type str | int, got <class 'str'>
Note that if the type signature is changed to Union[str, int], there is no error raised.
Union[str, int]
Fwiw, this style of union type was introduced in Python 3.10; see PEP 604 for more info.
Possibly related: https://github.com/talonvoice/talon/issues/415
fixed in next beta
In the following code:
test_type.py
test_type.talon
Saying
"test type"
results in the following error:Note that if the type signature is changed to
Union[str, int]
, there is no error raised.Fwiw, this style of union type was introduced in Python 3.10; see PEP 604 for more info.
Possibly related: https://github.com/talonvoice/talon/issues/415