Skip to content

Document ty's @Todo type in the typing FAQ - #3847

Merged
charliermarsh merged 2 commits into
mainfrom
charlie/document-todo-faq
Jun 24, 2026
Merged

Document ty's @Todo type in the typing FAQ#3847
charliermarsh merged 2 commits into
mainfrom
charlie/document-todo-faq

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary

Add a new FAQ entry explaining what @Todo means in ty's type system, how it differs from Any and Unknown, where it can appear, and why it cannot be used in annotations.

This complements astral-sh/ruff#26324, which adds an editor navigation target for inferred @Todo types.

Part of: #3209.

@charliermarsh charliermarsh added the documentation Improvements or additions to documentation label Jun 24, 2026
@charliermarsh
charliermarsh marked this pull request as ready for review June 24, 2026 12:39
@charliermarsh charliermarsh changed the title Document ty's @Todo type in the typing FAQ Document ty's @Todo type in the typing FAQ Jun 24, 2026

@sharkdp sharkdp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

Comment thread docs/reference/typing-faq.md Outdated
Comment on lines +57 to +58
ty itself. It may appear in type hints, `reveal_type()` output, or diagnostics. When an explanation
appears in parentheses, such as `@Todo(TypeVarTuple)`, it identifies the missing feature.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That only works in debug mode, so users are unlikely to see this.

Suggested change
ty itself. It may appear in type hints, `reveal_type()` output, or diagnostics. When an explanation
appears in parentheses, such as `@Todo(TypeVarTuple)`, it identifies the missing feature.
ty itself. It may appear in type hints, `reveal_type()` output, or diagnostics.

@charliermarsh
charliermarsh enabled auto-merge (squash) June 24, 2026 13:54
@charliermarsh
charliermarsh merged commit 7bda89e into main Jun 24, 2026
16 checks passed
@charliermarsh
charliermarsh deleted the charlie/document-todo-faq branch June 24, 2026 13:57
charliermarsh added a commit to astral-sh/ruff that referenced this pull request Jun 24, 2026
## Summary

`@Todo` is a dynamic type that represents a known missing feature or
incomplete implementation in ty, but it previously had no user-facing
definition. As a result, go-to-type-definition on an inferred `@Todo`
type returned no target, and users had no editor-visible explanation of
what the type meant.

This adds a documented `Todo` symbol to `ty_extensions` and routes all
internal `@Todo` variants to that definition, following the existing
`Divergent` pattern. Users can now command-click an inferred `@Todo`
type to reach its documentation. `ty_extensions.Todo` remains an
internal navigation target and is rejected in annotations.

This complements astral-sh/ty#3847, which adds
an FAQ entry.

Closes astral-sh/ty#3209.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants