feat: add @drift-labs/posthog-types package#327
Merged
ChesterSim merged 4 commits intomasterfrom Mar 26, 2026
Merged
Conversation
Shared PostHog event type definitions for web and mobile. Maps every event name to its typed properties via PostHogEventMap. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
trade_order_params_requested.user_account_pubkey accepts PublicKey. trade_oracle_mark_divergence: market accepts MarketKey, add orderType, swiftEnabled optional. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
@drift-labs/posthog-typespackage that provides shared, strongly-typed PostHog event definitions for use across web and mobile clients. This ensures consistent event naming and property shapes across platforms, catching analytics drift at compile time.Changes
posthog-types/with build tooling (package.json,tsconfig.json)collateral— deposit, withdrawal, borrow, transfer, funxyz eventstrade— order placement, orderbook crossed, order params, swap, close position, TP/SL, predictionsvault— deposit, withdrawal, view/inspect eventsifStaking— stake, unstake, cancel, withdraw eventsearn— navigation CTA events (IF stake, vaults, dSOL, amplify)amplify— deposit CTA and success eventsonboarding— wallet connect, magic auth, signless setup, referral, privy errorssurvey— PostHog-reserved survey lifecycle events (survey shown/dismissed/sent)pnl— action performed, history export eventssystem— unmatched/unhandled errors, performance snapshots, RPC healthPostHogEventMap— union type mapping every event name to its typed propertiesNoProperties,PostHogEvent,CaptureEvent<K>,ExtendEventMap<Extra>StaticSuperProperties(platform, env) andDynamicSuperProperties(wallet state)Test plan
cd posthog-types && yarn buildcompiles without errorslib/output contains.jsand.d.tsfiles for all modulesPostHogEventMapin a consumer and confirm autocomplete works for event names and propertiesCaptureEvent<'trade_placed'>resolves to the correct property type