pyrsistent icon indicating copy to clipboard operation
pyrsistent copied to clipboard

Expected type arguments for generic class "PRecord" (pylance/pyright)

Open khusmann opened this issue 3 years ago • 2 comments

When trying the example with pylance/pyright in vscode, I get an "PylancereportMissingTypeArgument" type hint error:

e.g.:

class ARecord(PRecord):
    x = field()

PRecord is flagged with 'Expected type arguments for generic class "PRecord"'. Is this fixable somehow?

khusmann avatar Feb 04 '22 22:02 khusmann

Getting this from mypy in strict mode.

error: Missing type parameters for generic type "PRecord"  [type-arg]

Example record

from pyrsistent import PRecord, field

class PointPR(PRecord):
    latitude = field(type=float)
    longitude = field(type=float)

slott56 avatar Feb 14 '22 19:02 slott56

Thanks for reporting this. I'll have to take a deeper look at this as I haven't been to involved in the work around typing. I don't know what's wrong off the top of my head.

tobgu avatar Feb 23 '22 21:02 tobgu