Skip to content

Instantly share code, notes, and snippets.

View danfma's full-sized avatar
🏠
Working from home

Daniel Ferreira Monteiro Alves danfma

🏠
Working from home
  • Tech Lead at Upland.me
  • Goiânia - Goiás - Brazil
  • X @danfma
View GitHub Profile
@danfma
danfma / problem-with-ts-conditional-types-and-generics.ts
Last active August 21, 2019 17:10
Problem with TypeScript conditional types and generics.
type Task<T> = () => T | Promise<T>;
type Mapper<T, R> = (instance: LoadingInstance<T>) => R;
interface LoadingInstance<T> {
result: T | undefined;
loading: boolean;
loadingError: Error | null;
reload: () => void;
}
### Keybase proof
I hereby claim:
* I am danfma on github.
* I am danfma (https://keybase.io/danfma) on keybase.
* I have a public key ASBKKEWNYtwUqbbmnquouMg2s4otEOMVOEqDW_zOJwhQoQo
To claim this, I am signing this object: