I'm looking at his repositories and I found one of the most stupid repositories apart form all the 'is-array' packages. He's created a library called 'strong-typed' which is supposed to what Typescript should have been. Each method is basically:
JavaScript:
// Simple form
function imTooStupidThatINeedANPMPackage(value, type) {
if (typeof value === type) {
return true;
}
throw new Error(`The ${value} is not a type of ${type}.`);
}
// This will throw an error
imTooStupidThatINeedANPMPackage(123, 'string');
I'm really not sure why this would be a good replacement for native type checking in Typescript and missing the whole point of catching errors early.
JavaScript:
function sayHello(name: string): string {
return `Hello ${name}!`;
}
// Will throw an error... or might not even compile.
sayHello(123);
Maybe I'm just being a autistic fag?