My Success Story with a Loosely-Typed TypeScript

TypeScript is a godsend. It’s no wonder why it’s ranked as one of the world’s top programming languages. However, it can sometimes be cumbersome to work with especially when trying to mimic types from 3rd party packages.

For example, take this function from one of my recent projects:

function concatenateString<O extends ObservableInput<any>, R>(...observables: (O | ((...values: ObservedValueOf<O>[]) => R) | SchedulerLike)[] | a: string, b: string): Maybe<string> {
return a + b;


After hours of trying to get the return type just right, I settled with this:

const fullName: any = concatenateString(firstName + ' ', lastName);

I felt…

Kyle Getrost

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store