TypeScript types

Last updated:

PostHog supports TypeScript apps natively, without you having to compile the TypeScript yourself (although you can also do that).

To build a TypeScript app, you'll probably need some types, so read on.


To use the types in your app, you can install them as follows:

# if using yarn
yarn add --dev @posthog/plugin-scaffold
# if using npm
npm install --save-dev @posthog/plugin-scaffold

Then, in your apps, you can use them like so:

import { PluginEvent, PluginMeta } from '@posthog/plugin-scaffold'
export function processEvent(event: PluginEvent, meta: PluginMeta) {
if (event.properties) {
event.properties['hello'] = 'world'
return event


Was this page useful?

Next article

Self-host PostHog

If you're a large company looking for a proof-of-concept, or an engineer looking to use the open-source version in a funky non-production way, then you're in the right place! Our Docker compose deployment let's you spin up a fresh PostHog instance in minutes. Want more reliability? The easiest way to get started with PostHog is to use PostHog Cloud . Requirements You have deployed a Linux Ubuntu Virtual Machine. We highly recommend an instance with at least 4GB of RAM to handle any surges in…

Read next article