tobgu / pyrsistent

Persistent/Immutable/Functional data structures for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

khusmann opened this issue · 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?

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)

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.