-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
astral-sh/ruff
#22672Labels
dataclassesIssues relating to dataclasses and dataclass_transformIssues relating to dataclasses and dataclass_transformtypeddict
Description
This should be an error, since using the resulting class like a dataclass will always fail at runtime. It would also be a useful diagnostic to have because it can happen (and has to me a couple times) while refactoring a dataclass to a TypedDict, but forgetting to remove the decorator. Maybe could be extended to all decorators? Unsure, but dataclass would be the most useful.
https://play.ty.dev/2ddb5461-df08-43fc-88d6-8be63319220b
from typing import TypedDict
from dataclasses import dataclass
@dataclass
class Foo(TypedDict):
x: int
print(Foo(1)) # No error because ty thinks it is a dataclass, but fails at runtimeReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
dataclassesIssues relating to dataclasses and dataclass_transformIssues relating to dataclasses and dataclass_transformtypeddict