Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Daniel Ferreira Monteiro Alves danfma

🏠
Working from home
View GitHub Profile
@danfma
danfma / problem-with-ts-conditional-types-and-generics.ts
Last active Aug 21, 2019
Problem with TypeScript conditional types and generics.
View problem-with-ts-conditional-types-and-generics.ts
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;
}
View gist:f2b7e44cfde3ddf30b4adb5519fe1301
### 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: