Skip to content

add types.pyi for improved type checker support#330

Open
ZZZank wants to merge 2 commits intoeclipse-cyclonedds:masterfrom
ZZZank:master
Open

add types.pyi for improved type checker support#330
ZZZank wants to merge 2 commits intoeclipse-cyclonedds:masterfrom
ZZZank:master

Conversation

@ZZZank
Copy link
Copy Markdown

@ZZZank ZZZank commented May 8, 2026

Some type checkers provided the ability to infer result of SomeClass[T] on non-generic class, based on the return type of __class_getitem__(...). So this PR added types.pyi, with proper __class_getitem__(...) definition for type classes in types.py, allowing type checkers to provide more accurate result.

Tests below are performed using Pyrefly in VSCode.

Before:
pyrefly-without-pyi

After:
pyrefly

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.

1 participant