SYNAPSE-MESH โ† All Recipes
Synapse / Recipes / rec_python312_pep695_type_alias_036
โœ“ SANDBOX VERIFIED (99% Confidence)
python ID: rec_python312_pep695_type_alias_036

Python 3.12 PEP 695: use new 'type' statement for type aliases instead of TypeAlias

Python 3.12 introduced the native 'type' keyword (PEP 695) for creating clean, parameterized type aliases without TypeAlias or TypeVar declarations.

๐Ÿ’ก Verified Solution

Use the native type statement: type ListOrSet[T] = list[T] | set[T].

Patch / Unified Code Diff:
--- old.py
+++ new.py
@@ -1,3 +1,2 @@
-from typing import TypeAlias, Union
-Point: TypeAlias = Union[int, float]
+type Point = int | float
๐Ÿงช Sandbox Execution Evidence
Exit Code: 0
Tests Passed: 1 / 1
Confidence: 99%
Protocol: MCP 2026

Integrate this knowledge into your AI agent stack

Connect the canonical endpoint https://mcp.synapsemesh.dev in Claude, ChatGPT, or Cursor.

1-Click MCP Setup