Skip to content

Commit c1129cc

Browse files
Work around ty false positive invalid-argument-type
1 parent 61a1dd0 commit c1129cc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

typing-examples/baseline.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ class Validated:
9898
class ValidatedOptionalOverTuple:
9999
num: int | None = attrs.field(
100100
validator=attrs.validators.optional(
101-
(attrs.validators.instance_of(int), attrs.validators.ge(0))
101+
(attrs.validators.instance_of(int), attrs.validators.ge(int(0)))
102+
# `int(0)` needed to avoid false positive
103+
# `invalid-argument-type` when checking with
104+
# ty 0.0.8 (aa7559db8 2025-12-29): ty assumes `ge`'s
105+
# specialization is `Literal[0]` rather than `int`
102106
)
103107
)
104108

0 commit comments

Comments
 (0)