Skip to content

Instantly share code, notes, and snippets.

View pbroschwitz's full-sized avatar

Peter Broschwitz pbroschwitz

View GitHub Profile
@pbroschwitz
pbroschwitz / machine.js
Last active July 24, 2022 19:18
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@pbroschwitz
pbroschwitz / index.md
Last active May 25, 2022 13:43
Object literal may only specify known properties in TypeScript - ts(2345)

Problem

const someArray = ['foo', 'bar']
const someOtherArray = ['foobar', 'barfoos']

const config = [
    ...someArray,
    ...someOtherArray,
    {
@pbroschwitz
pbroschwitz / function-overloading-with-compose.ts
Created July 19, 2022 18:46
Master FUNCTION OVERLOADS with 'compose' - example from Matt Pocock
// See https://www.youtube.com/watch?v=D1a8OoBWi1g&list=PLIvujZeVDLMx040-j1W4WFs1BxuTGdI_b&index=10
function compose(...args: any[]) {
return {} as any;
}
const addOne = (a: number) => {
return a + 1;
}