Skip to content

Instantly share code, notes, and snippets.


Gareth Jones G-Rath

View GitHub Profile
G-Rath / .npmrc
Created Jan 31, 2020
docker-compose error repo
View .npmrc
View gist:fce481c7a671f7d8689de2e303f75d3e
sudo apt uninstall nodejs
curl -sL | sudo -E bash -
sudo apt install node
npm i -g npm
npx @nodenv/nodenv-installer
View picomatch\index.d.ts
declare module 'picomatch' {
namespace picomatch {
type ExpandRangeFn = (start: string, end: string) => string;
type FormatFn = (str: string) => string;
type ResultHandler = (result: Result) => void;
interface Result {
glob: string;
regex: RegExp;
View mocked.ts
/// <reference types="jest" />
import { mocked as mockedCore } from 'ts-jest';
declare type MockableFunction = (...args: any[]) => any
declare type MethodKeysOf<T> = { [K in keyof T]: T[K] extends MockableFunction ? K : never }[keyof T]
declare type PropertyKeysOf<T> = { [K in keyof T]: T[K] extends MockableFunction ? never : K }[keyof T]
declare type ArgumentsOf<T> = T extends (...args: infer A) => any ? A : never
declare type ConstructorArgumentsOf<T> = T extends new (...args: infer A) => any ? A : never
interface MockWithArgs<T extends MockableFunction> extends jest.MockInstance<ReturnType<T>, ArgumentsOf<T>> {
G-Rath / definitions.ts
Last active May 6, 2019
useful typescript types & files
View definitions.ts
Lets you extract the properties of an interface that are of a specific type,
such as "this parameter takes the name of any propert of T that maps to a string value".
See "groupObjectsByProperty.ts" for an example.
// region ExtractPropertiesOfType
type FilterFlags<O, T> = { [K in keyof O]: O[K] extends T ? K : never };
type AllowedNames<O, T> = FilterFlags<O, T>[keyof O];
View react-trello-index.d.ts
declare class ReactTrelloBoard<CardMetaData> extends React.Component<ReactTrello.BoardProps<CardMetaData>> {
declare module ReactTrello {
* react-trello uses `React.cloneElement`, so these props
* will have to be added to `defaultProps`, otherwise
* TypeScript will (understandably) freak out.
interface NewCardTemplateProps<CardMetaData = object> {

Keybase proof

I hereby claim:

  • I am g-rath on github.
  • I am grath ( on keybase.
  • I have a public key ASB-tE9YcO957Lqd68Kg0TxYEBfSjO5xVVhhNcKh1mYgwgo

To claim this, I am signing this object: