LibCST icon indicating copy to clipboard operation
LibCST copied to clipboard

CSTNode.with_deep_changes type annotation is incomplete

Open kit1980 opened this issue 2 years ago • 2 comments

For example, I want to replace all args of a Call:

node.with_deep_changes(
    old_node=cst.ensure_type(node.value, cst.Call).args, value=[input_arg]
)

The code works fine, but the type checker complains: error: Argument "old_node" to "with_deep_changes" of "CSTNode" has incompatible type "Sequence[Arg]"; expected "CSTNode"

kit1980 avatar Jul 03 '23 22:07 kit1980

Last time I checked, it wasn't possible to correctly type annotate this function, unfortunately.

zsol avatar Jul 08 '23 15:07 zsol

Might be possible using ParamSpec

Viicos avatar Dec 24 '23 15:12 Viicos