How I Cut the Development Time of a TypeScript Project in Half with WhateverScript

My Success Story with a Loosely-Typed TypeScript

Kyle Getrost
2 min readApr 1, 2021

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;
}

Yikes!

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

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

I felt accomplished for the day, and was ready to head out for Happy Hour. But wait! My linter yelled at me before I could say, “One pint of Guinness, please.”

Oh, well. Back to the drawing board… or so I thought!

WhateverScript is a loosely-typed companion for TypeScript. It has Superpowers. No, seriously, it does.

Fortunately, I found WhateverScript. And since I found it, I use it for all of my TypeScript projects. WhateverScript is a loosely-typed companion for TypeScript. It has Superpowers. No, seriously, it does.

Before, a custom type in my types.ts file might look something like this:

export type Customer = {
firstName: string;
lastName: string;
birthDate?: Date;
preferredContactMethod: ContactMethod;
favoriteColors: Color[];
}

But with WhateverScript, I can now save time by writing my code to look like this:

import Whatever from 'whateverscript';export type Customer = {
firstName: Whatever;
lastName: Whatever;
birthDate?: Whatever;
preferredContactMethod: Whatever;
favoriteColors: Whatever;
}

I have easily cut the development time of my TypeScript projects in half with WhateverScript.

If you’re not using it already, try WhateverScript in your next TypeScript project. You won’t be disappointed!

--

--