You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeCPS<x>=Promise<x>// to use async/awaitfunctioncallcc<T>(f: (k: (v: T)=>CPS<any>)=>CPS<T>): CPS<T>{returnnewPromise((resolve,reject)=>{constresolve_packed: (v: T)=>CPS<any>=(v)=>{resolve(v)returnnewPromise((resolve,reject)=>{})}f(resolve_packed).then(resolve).catch(reject)})}functionnew_cps<T>(x: T): CPS<T>{returnPromise.resolve(x)}functionun_cps<T>(x: CPS<T>): T{letr: [true,T]|[false,any]|null=nullx.then((v)=>{r=[true,v];}).catch((e)=>{r=[false,e];})if(r===null){throw'ERR'}elseif(r[0]===true){returnr[1]}elseif(r[0]===false){throwString(r[1])}throw'ERR'}asyncfunctionf(): CPS<any>{// ...}
Expected behavior:
Actual behavior:
a.ts:26:21 - error TS1055: Type 'CPS' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
26 async function f(): CPS<any> {
~~~~~~~~
Found 1 error.
TypeScript Version: 3.5.3
Search Terms:
Code
Expected behavior:
Actual behavior:
Playground Link:
Related Issues:
#27987
The text was updated successfully, but these errors were encountered: