Type safe utility for defining static constants with automatic type narrowing and additional helper functions