Closed rorticus closed 7 years ago
@@ master #257 diff @@
==========================================
Files 33 33
Lines 1788 1796 +8
Methods 17 17
Messages 0 0
Branches 348 348
==========================================
+ Hits 1699 1709 +10
+ Misses 28 27 -1
+ Partials 61 60 -1
Powered by Codecov. Last update df944e2...7cdfe1c
It looks like the catch
signatures may need to be updated for Task as well.
import Task from 'dojo-core/async/Task';
// This one throws an error
// Type 'Task<void>' is not assignable to type 'Task<string>'. Type 'void' is not assignable to type 'string'.
export function returnString(): Task<string> {
return Task.resolve(undefined)
.then(() => 'hi')
.catch(error => {
// do nothing
});
}
// no errors because it throws
export function returnString2(): Task<string> {
return Task.resolve(undefined)
.then(() => 'hi')
.catch(error => {
throw error;
});
}
// no errors because it returns a string
export function returnString3(): Task<string> {
return Task.resolve(undefined)
.then(() => 'hi')
.catch(error => {
return 'bye';
});
}
@nicknisi I updated the catch
types for Task
as well.
Types are working better now! Thank you!
There were some issues with
ExtensiblePromise
andTask
not returning the right types fromthen
,resolve
, andall
.This hopefully fixes those problems :)