Skip to content

Instantly share code, notes, and snippets.

View thorbrink's full-sized avatar

Thor Brink thorbrink

View GitHub Profile
@joerter
joerter / stub.ts
Last active January 20, 2023 04:33
A simple function that creates an object of the specified type and sets all properties to undefined. Useful for creating stubs in Typescript tests
export function stub<T>(partial?: Partial<T>): T {
return partial != null ? (partial as T) : ({} as T);
}