Skip to content

Instantly share code, notes, and snippets.

@andrewabest
Created September 11, 2019 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewabest/8d2c52469cfe14c08086bf522095952e to your computer and use it in GitHub Desktop.
Save andrewabest/8d2c52469cfe14c08086bf522095952e to your computer and use it in GitHub Desktop.
Basic typescript stubs
export function stub<T>(): T {
const typeAssertion = {} as T;
for (const prop in typeAssertion) {
if (typeAssertion.hasOwnProperty(prop)) {
typeAssertion[prop] = undefined;
}
}
return typeAssertion;
}
import * from 'stub'
const amplifyStub = stub<AmplifyService>();
amplifyStub.authStateChange$ = Observable.create();
amplifyStub.auth = () => {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment