Skip to content

Conversation

@romantolkachyov
Copy link
Contributor

Removes warnings in some cases like

URLPattern({"pathname": url_pattern})

PyCharm can't infer TypedDict | str alias.

@romantolkachyov
Copy link
Contributor Author

This is how its look:

Screenshot 2026-01-26 at 01 30 51

@bangseongbeom
Copy link
Contributor

Thanks for attaching the screenshot! It made it easy for me to confirm that the same issue can be reproduced on my machine as well.

I suspect that PyCharm's built-in type checker is inferring the type incorrectly. The same issue does not occur in VS Code (Pyright).

In general, it's hard to justify changing the code just to work around a type checker's incorrect inference. However, PyCharm is a widely used IDE and there isn't a great alternative at the moment, so I agree that your proposed approach in this PR is the right direction.

I'll take a bit more time to look into similar cases and any other possible alternatives, and then merge it. Thanks again for your contribution!

@bangseongbeom
Copy link
Contributor

Related: PY-42126, PY-74438

@bangseongbeom bangseongbeom merged commit 38c8cb0 into urlpattern:main Jan 26, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants