Fetching latest headlines…
# new stuff dropped in duckkit πŸ¦†
NORTH AMERICA
πŸ‡ΊπŸ‡Έ United Statesβ€’May 21, 2026

# new stuff dropped in duckkit πŸ¦†

6 views0 likes0 comments
Originally published byDev.to

new stuff dropped in duckkit πŸ¦†

typed event emitter. function composition. partial application.

here's what it looks like.

before

emitter.on('win', (amount) => {
  // amount is any 😬
})

emitter.emit('win', 'oops')  // no error
emitter.emit('wiiin', 500)   // typo. also no error.

after

const emitter = createEmitter<{
  win: number
  spin: void
  error: { code: number; message: string }
}>()

emitter.emit('win', 500)       // βœ…
emitter.emit('win', 'oops')    // ❌ TypeScript error
emitter.emit('wiiin', 500)     // ❌ TypeScript error
emitter.emit('win')            // ❌ payload missing

define the map once. TypeScript does the rest.

pipeline β€” reusable composed functions

const process = pipeline(
  (s: string) => s.trim(),
  s => s.toUpperCase(),
  s => s.split(' '),
)

process('  hello world  ')  // ["HELLO", "WORLD"]
process('  foo bar  ')      // ["FOO", "BAR"]

async steps work too β€” mix sync and async freely.

curry

const multiply = curry((factor: number, value: number) => value * factor)

[1, 2, 3].map(multiply(2))   // [2, 4, 6]
[1, 2, 3].map(multiply(10))  // [10, 20, 30]
npm install duckkit

npm Β· GitHub

do you use typed emitters? or just wing it with strings? πŸ‘‡

Comments (0)

Sign in to join the discussion

Be the first to comment!