Skip to content

NewTypes with base float do not inherit operators correctly #2077

@ncollins-vs

Description

@ncollins-vs

Summary

Ty does not support many operators on NewTypes with base float:

from typing import NewType

Test = NewType("Test", float)
x = Test(5)
y = Test(10)
print(x > y) #  Unsupported `>` operation

This same snippet works if the base type is int

Playground: https://play.ty.dev/dee694b0-c39c-4402-afd0-6bdb2b24dbaa

Version

ty 0.0.3 (fadfe09 2025-12-17)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions