Skip to content

Conversation

@agubler
Copy link
Member

@agubler agubler commented Aug 16, 2019

Type: bug

The following has been addressed in the PR:

Description:

Fix the getOrSet typings for a promise factory to return undefined | T, with T being the return type of the promise or the generic passed to getOrSet.

Before:

/* Type: undefined */
icache.getOrSet<string>('test', () => Promise.resolve());
/* Type: undefined */
icache.getOrSet<string>('test', () => new Promise<string>(() => {}));
/* Type: undefined */
icache.getOrSet('test', () => new Promise<string>(() => {}));

After:

/* Type: string | undefined */
icache.getOrSet<string>('test', () => Promise.resolve());
/* Type: string | undefined */
icache.getOrSet<string>('test', () => new Promise<string>(() => {}));
/* Type: string | undefined */
icache.getOrSet('test', () => new Promise<string>(() => {}));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants