:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
// HogQL results arrive untyped; ClickHouse returns booleans as 0/1 and numbers
// possibly stringified. Coerce numerically so a stringified "0" can never read
// as truthy.
export const asNumber = (value: unknown): number => Number(value) || 0
/** String columns arrive null when the property is missing — normalize those to an empty string. */
export const asString = (value: unknown): string => (typeof value === 'string' ? value.trim() : '')