no-shallow-record-type-guard
Do not promise a local record's contract from a container-only check.
Why
An empty dict or tuple passes a container-only check while lacking a TypedDict's required key or a NamedTuple's named attributes and record API. A guard annotation makes callers trust that missing contract.
Fix
Validate the required record shape and field contracts, or keep an honest container return type. For a NamedTuple, checking its actual class can establish nominal membership; tuple membership alone cannot.
Examples
from typing import TypedDict, TypeGuard
class Payload(TypedDict): text: str
def is_payload(value: object) -> TypeGuard[Payload]: return isinstance(value, dict)from typing import TypedDict, TypeGuard
class Payload(TypedDict): text: str
def is_payload(value: object) -> TypeGuard[dict[object, object]]: return isinstance(value, dict)from typing import NamedTuple, TypeGuard
class Payload(NamedTuple): text: str
def is_payload(value: object) -> TypeGuard[Payload]: return isinstance(value, tuple)from typing import NamedTuple, TypeGuard
class Payload(NamedTuple): text: str
def is_payload(value: object) -> TypeGuard[Payload]: return isinstance(value, Payload)