diff --git a/src/sentry/utils/types.py b/src/sentry/utils/types.py index 20eb1220d3236f..987d4003bd1968 100644 --- a/src/sentry/utils/types.py +++ b/src/sentry/utils/types.py @@ -221,3 +221,9 @@ def type_from_value(value): AnyCallable = typing.Callable[..., AnyType] + + +def NonNone(value: T | None) -> T: + """A hacked version of TS's non-null assertion operator""" + assert value is not None + return value