Skip to content

[ty] Document the @Todo type - #26324

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

[ty] Document the @Todo type#26324
charliermarsh merged 2 commits into
mainfrom
charlie/document-todo-type

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Jun 24, 2026

Copy link
Copy Markdown
Member

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.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Jun 24, 2026
@charliermarsh charliermarsh changed the title [ty] Document the @Todo type [ty] Document the @Todo type Jun 24, 2026
@charliermarsh charliermarsh added the documentation Improvements or additions to documentation label Jun 24, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 94.37%. The percentage of expected errors that received a diagnostic held steady at 89.00%. The number of fully passing files held steady at 94/134.

@astral-sh-bot

astral-sh-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.

Full report with detailed diff (timing results)

@charliermarsh
charliermarsh marked this pull request as ready for review June 24, 2026 12:38
@charliermarsh
charliermarsh requested review from a team as code owners June 24, 2026 12:38
@astral-sh-bot
astral-sh-bot Bot requested a review from dcreager June 24, 2026 12:38
Comment on lines +117 to +128
### Todo type

`Todo` exists only as a documentation and navigation target for ty's internal `@Todo` type. It
cannot be used in annotations.

```py
from ty_extensions import Todo

# error: [invalid-type-form]
value: Todo
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

an admirable attempt at TDD from codex here, but I don't think this test is really necessary or adds anything 😆


Like `Any` and `Unknown`, `@Todo` is a dynamic type, so ty allows any operation on it. Unlike `Any`,
it is not explicitly provided in an annotation; unlike `Unknown`, it specifically indicates a
limitation in ty. Any message shown in parentheses identifies the missing feature.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we could omit the mention of a message shown in parentheses. We still only retain those messages in debug mode, which most users won't ever use

@charliermarsh
charliermarsh force-pushed the charlie/document-todo-type branch from 9f67773 to f3076ad Compare June 24, 2026 13:50
@charliermarsh
charliermarsh enabled auto-merge (squash) June 24, 2026 13:50
charliermarsh added a commit to astral-sh/ty that referenced this pull request Jun 24, 2026
## 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 merged commit 32a9b4a into main Jun 24, 2026
62 checks passed
@charliermarsh
charliermarsh deleted the charlie/document-todo-type branch June 24, 2026 13:57
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 ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@Todo is not documented

2 participants