---
source: crates/ruff_linter/src/linter.rs
---
PYI019 [*] Use `Self` instead of custom TypeVar `T`
 --> <filename>:7:13
  |
6 | class C:
7 |     def __new__(cls: type[T]) -> T:
  |                ^^^^^^^^^^^^^^^^^^^
8 |               return cls
  |
help: Replace TypeVar `T` with `Self`
  |
1 |
  - from typing import TypeVar
2 + from typing import TypeVar, Self
3 |
4 | T = TypeVar("T", bound="_NiceReprEnum")
5 |
6 | class C:
  - 	def __new__(cls: type[T]) -> T:
7 + 	def __new__(cls) -> Self:
8 |               return cls
  |
