---
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`
  |
2 | from typing import TypeVar
3 + from typing_extensions import Self
4 |
5 | T = TypeVar("T", bound="_NiceReprEnum")
6 |
7 | class C:
  - 	def __new__(cls: type[T]) -> T:
8 + 	def __new__(cls) -> Self:
9 |               return cls
  |
