Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSTNode.with_deep_changes type annotation is incomplete #963

Open
kit1980 opened this issue Jul 3, 2023 · 2 comments
Open

CSTNode.with_deep_changes type annotation is incomplete #963

kit1980 opened this issue Jul 3, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@kit1980
Copy link
Contributor

kit1980 commented Jul 3, 2023

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"

@zsol zsol added the enhancement New feature or request label Jul 8, 2023
@zsol
Copy link
Member

zsol commented Jul 8, 2023

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

@Viicos
Copy link

Viicos commented Dec 24, 2023

Might be possible using ParamSpec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants