Skip to content

Instantly share code, notes, and snippets.

View MartinHelmut's full-sized avatar
👨‍🚀

Martin Helmut Fieber MartinHelmut

👨‍🚀
View GitHub Profile
@MartinHelmut
MartinHelmut / ext.ts
Last active August 31, 2020 09:37
This is a not tested, opinionated, type guard API that extends built-in types using the companion pattern. This is not intended as use as a library but to copy into your project and apply changes as needed.
/**
* Not tested, opinionated, type guard API
*
* @example
* string.is('something'); // true
* string.from(133); // "123"
*/
type Primitive = boolean | number | string | object | Object;
interface PrimitiveCompanien<T> {