facebook / facebook/pyrefly

Support for `ty_extensions`

Open
#2,243 1 comment 1 reaction 0 assignees View on GitHub
quansight typechecking
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

ty vendors a `ty_extensions` module ([src](https://github.com/astral-sh/ruff/blob/45acbd0b663b5a7ac71ed2b10fdd471948f30611/crates/ty_vendored/ty_extensions/ty_extensions.pyi)) containing very handy special-cased (by ty) types such as `Intersection`, `TypeOf`, `Not`, as well as the [optypean](https://github.com/jorenham/optype#just) `JustFloat` and `JustComplex` types.

Library maintainers (like myself) often support multiple multiple type-checkers, which in most cases limits them to whatever the typing spec allows. This means that most libraries won't be able to use `ty_extensions`, probably ever, which is a shame.

I think it would be pretty awesome if Pyrefly would have (some) support for `ty_extensions`, so that I'd be able to use it in the libraries I maintain that support only Pyrefly and ty. And because, in my experience, you're particularly open to new ideas, I thought I'd start here (i.e. before also proposing this at mypy and basedpyright).

And just to be clear; I'm not here to evangelize `ty` or something; I'm just trying to make life a bit easier, that's all :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.