Skip to content

Address gap in pydantic dataclass support #2044

@migeed-z

Description

@migeed-z

Describe the Bug

from pydantic.dataclasses import dataclass
@dataclass
class A:
    x: int
A(x='0')  # E: `Literal['0']` is not assignable to parameter `x` with type `int`

We should accept this because pydantic coerces '0' to 0 at runtime

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions