type a promise
/*The generic type of the Promise should correspond to the
non-error return-type of the function. The error is implicitly
of type any and is not specified in the Promise generic type. */
function test(arg: string): Promise<number> {
return new Promise<number>((resolve, reject) => {
if (arg === "a") {
resolve(1);
} else {
reject("1");
}
});
}
Also in JavaScript:
- javascript array vs object
- how to clone an object in javascript
- javascript toisostring without milliseconds
- .keys() array
- knex referenced column 'id' in foreign key constraint 'ponto_items_pt_id_foreign' are incompatible.
- jQuery - Get Content and Attributes
- how to handle ajax calls in selenium
- jquery on
- javascript group by key
- javascript detect escape key pressed
- Material-ui disabled icon
- error vuejs from chokidar enospc
- output event angular
- What is the correct JavaScript syntax for opening a new window called "w2" ?
- javascript filter
- how to find the key of an value in an object
- append css file with javascript
- angular material checkbox
- search bar in react js example
- javascript generate random array
- get file extension of path extendscript
- quill js server side delta
- crypto.randombytes(4).tostring('hex')
- js remove last character