dgilland / pydash

The kitchen sink of Python utility libraries for doing "stuff" in a functional way. Based on the Lo-Dash Javascript library.
http://pydash.readthedocs.io
MIT License
1.3k stars 92 forks source link

Pyright complains type issues when use chain method #228

Closed Gnosnay closed 1 month ago

Gnosnay commented 1 month ago

pyright version: 1.1.370 pydash: 8.0.1

how to reproduce: demo.py is as follows:

from pydash import chain

chain([1, 2, 3, 4]).map(lambda x: x * 2).sum().value()

execute

pyright demo.py

message:

Type of "map" is partially unknown
    Type of "map" is "Overload[(iteratee: (int) -> T2@map_) -> Chain[List[T2@map_]], (iteratee: (int, int) -> T2@map_) -> Chain[List[T2@map_]], (iteratee: (int, int, List[int]) -> T2@map_) -> Chain[List[T2@map_]], (iteratee: int | str | List[Unknown] | Tuple[Unknown, ...] | Dict[Unknown, Unknown] | None = None) -> Chain[List[Unknown]]]" (reportUnknownMemberType)

May i know how to fix this problem?

DeviousStoat commented 1 month ago

Hey @Gnosnay thanks for the report. I linked a PR that should solve this :) Note that it seems that you are using pyright in strict mode which enables a lot of strict diagnostic rules and this library uses mypy so you might see other type issues like this one. However I am really willing to make it support strict pyright in an incremental fashion so don't hesitate to create other issues if you stumble upon other pyright complains.

Gnosnay commented 1 month ago

Hey @Gnosnay thanks for the report. I linked a PR that should solve this :) Note that it seems that you are using pyright in strict mode which enables a lot of strict diagnostic rules and this library uses mypy so you might see other type issues like this one. However I am really willing to make it support strict pyright in an incremental fashion so don't hesitate to create other issues if you stumble upon other pyright complains.

hi @DeviousStoat the PR looks good. thx for your help

dgilland commented 1 month ago

Fix for this has been release with v8.0.2.