Closed powellnorma closed 2 weeks ago
Pyright is working correctly here, so this isn't a bug.
When you use dataclass_transform
, you must specify which functions and classes should be treated as fields specifiers. You have not specified this argument, so dataclasses.field
is not considered a field specifier.
If you change your code to the following, it works:
@dataclass_transform(field_specifiers=(field,))
def my_dataclass(c):
return dataclass(c)
Environment data
Code Snippet
Expected behavior
It should not say
Fields without default values cannot appear after fields with default values
for the field c. When using@dataclass
instead of@my_dataclass
, it works as expected.