Skip to content

Instantly share code, notes, and snippets.

@scriptex
Last active January 14, 2021 21:53
Show Gist options
  • Save scriptex/ee5df515d73db6e0c3b042d2e451b122 to your computer and use it in GitHub Desktop.
Save scriptex/ee5df515d73db6e0c3b042d2e451b122 to your computer and use it in GitHub Desktop.
Overwrite Swagger' fetch in React Native
type Constructor<T> = new (...args: any[]) => T;
function OverwriteFetch<T extends Constructor<{}>>(Base: T): Constructor<any> {
return class extends Base {
constructor(...args: any[]) {
super(...[...args, fetch]);
}
};
}
@OverwriteFetch
export class ExtendedClass extends BaseClass {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment