---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TC007 [*] Add quotes to type alias
  --> TC007.py:15:16
   |
13 | a: TypeAlias = int  # OK
14 | b: TypeAlias = Dict  # OK
15 | c: TypeAlias = Foo   # TC007
   |                ^^^
16 | d: TypeAlias = Foo | None  # TC007
17 | e: TypeAlias = OptStr   # TC007
   |
help: Add quotes
   |
14 | b: TypeAlias = Dict  # OK
   - c: TypeAlias = Foo   # TC007
15 + c: TypeAlias = "Foo"   # TC007
16 | d: TypeAlias = Foo | None  # TC007
   |
note: This is an unsafe fix and may change runtime behavior

TC007 [*] Add quotes to type alias
  --> TC007.py:16:16
   |
14 | b: TypeAlias = Dict  # OK
15 | c: TypeAlias = Foo   # TC007
16 | d: TypeAlias = Foo | None  # TC007
   |                ^^^
17 | e: TypeAlias = OptStr   # TC007
18 | f: TypeAlias = Bar   # TC007
   |
help: Add quotes
   |
15 | c: TypeAlias = Foo   # TC007
   - d: TypeAlias = Foo | None  # TC007
16 + d: TypeAlias = "Foo | None"  # TC007
17 | e: TypeAlias = OptStr   # TC007
   |
note: This is an unsafe fix and may change runtime behavior

TC007 [*] Add quotes to type alias
  --> TC007.py:17:16
   |
15 | c: TypeAlias = Foo   # TC007
16 | d: TypeAlias = Foo | None  # TC007
17 | e: TypeAlias = OptStr   # TC007
   |                ^^^^^^
18 | f: TypeAlias = Bar   # TC007
19 | g: TypeAlias = Foo | Bar  # TC007 x2
   |
help: Add quotes
   |
16 | d: TypeAlias = Foo | None  # TC007
   - e: TypeAlias = OptStr   # TC007
17 + e: TypeAlias = "OptStr"   # TC007
18 | f: TypeAlias = Bar   # TC007
   |
note: This is an unsafe fix and may change runtime behavior

TC007 [*] Add quotes to type alias
  --> TC007.py:18:16
   |
16 | d: TypeAlias = Foo | None  # TC007
17 | e: TypeAlias = OptStr   # TC007
18 | f: TypeAlias = Bar   # TC007
   |                ^^^
19 | g: TypeAlias = Foo | Bar  # TC007 x2
20 | h: TypeAlias = Foo[str]  # TC007
   |
help: Add quotes
   |
17 | e: TypeAlias = OptStr   # TC007
   - f: TypeAlias = Bar   # TC007
18 + f: TypeAlias = "Bar"   # TC007
19 | g: TypeAlias = Foo | Bar  # TC007 x2
   |
note: This is an unsafe fix and may change runtime behavior

TC007 [*] Add quotes to type alias
  --> TC007.py:19:16
   |
17 | e: TypeAlias = OptStr   # TC007
18 | f: TypeAlias = Bar   # TC007
19 | g: TypeAlias = Foo | Bar  # TC007 x2
   |                ^^^
20 | h: TypeAlias = Foo[str]  # TC007
21 | i: TypeAlias = (Foo |  # TC007 x2 (fix removes comment currently)
   |
help: Add quotes
   |
18 | f: TypeAlias = Bar   # TC007
   - g: TypeAlias = Foo | Bar  # TC007 x2
19 + g: TypeAlias = "Foo | Bar"  # TC007 x2
20 | h: TypeAlias = Foo[str]  # TC007
   |
note: This is an unsafe fix and may change runtime behavior

TC007 [*] Add quotes to type alias
  --> TC007.py:19:22
   |
17 | e: TypeAlias = OptStr   # TC007
18 | f: TypeAlias = Bar   # TC007
19 | g: TypeAlias = Foo | Bar  # TC007 x2
   |                      ^^^
20 | h: TypeAlias = Foo[str]  # TC007
21 | i: TypeAlias = (Foo |  # TC007 x2 (fix removes comment currently)
   |
help: Add quotes
   |
18 | f: TypeAlias = Bar   # TC007
   - g: TypeAlias = Foo | Bar  # TC007 x2
19 + g: TypeAlias = "Foo | Bar"  # TC007 x2
20 | h: TypeAlias = Foo[str]  # TC007
   |
note: This is an unsafe fix and may change runtime behavior

TC007 [*] Add quotes to type alias
  --> TC007.py:20:16
   |
18 | f: TypeAlias = Bar   # TC007
19 | g: TypeAlias = Foo | Bar  # TC007 x2
20 | h: TypeAlias = Foo[str]  # TC007
   |                ^^^
21 | i: TypeAlias = (Foo |  # TC007 x2 (fix removes comment currently)
22 |     Bar)
   |
help: Add quotes
   |
19 | g: TypeAlias = Foo | Bar  # TC007 x2
   - h: TypeAlias = Foo[str]  # TC007
20 + h: TypeAlias = "Foo[str]"  # TC007
21 | i: TypeAlias = (Foo |  # TC007 x2 (fix removes comment currently)
   |
note: This is an unsafe fix and may change runtime behavior

TC007 [*] Add quotes to type alias
  --> TC007.py:21:17
   |
19 | g: TypeAlias = Foo | Bar  # TC007 x2
20 | h: TypeAlias = Foo[str]  # TC007
21 | i: TypeAlias = (Foo |  # TC007 x2 (fix removes comment currently)
   |                 ^^^
22 |     Bar)
   |
help: Add quotes
   |
20 | h: TypeAlias = Foo[str]  # TC007
   - i: TypeAlias = (Foo |  # TC007 x2 (fix removes comment currently)
   -     Bar)
21 + i: TypeAlias = ("Foo | Bar")
22 |
   |
note: This is an unsafe fix and may change runtime behavior

TC007 [*] Add quotes to type alias
  --> TC007.py:22:5
   |
20 | h: TypeAlias = Foo[str]  # TC007
21 | i: TypeAlias = (Foo |  # TC007 x2 (fix removes comment currently)
22 |     Bar)
   |     ^^^
23 |
24 | type C = Foo   # OK
   |
help: Add quotes
   |
20 | h: TypeAlias = Foo[str]  # TC007
   - i: TypeAlias = (Foo |  # TC007 x2 (fix removes comment currently)
   -     Bar)
21 + i: TypeAlias = ("Foo | Bar")
22 |
   |
note: This is an unsafe fix and may change runtime behavior
