delegateas / XrmDefinitelyTyped

Tool to generate TypeScript declaration files for Dynamics 365/CDS client-side coding.
http://delegateas.github.io/Delegate.XrmDefinitelyTyped/
MIT License
133 stars 53 forks source link

Uncaught (in promise) Error: XrmQuery: Unable to properly parse function: x => x.accounts #149

Open pagex opened 4 years ago

pagex commented 4 years ago

your own example does not work: XrmQuery.retrieveMultiple(x => x.accounts) // Tells XrmQuery to retrieve accounts .select(x => [x.accountnumber]) // Select which attributes to retrieve, in this case just accountnumber .filter(x => Filter.equals(x.name, "Contoso")) // Only get accounts which have a name equal to "Contoso" .execute(accounts => { // Do something with the retrieved accounts console.dir(accounts); }); dg.xrmquery.web.min.js?ver=1623372669:1 Uncaught (in promise) Error: XrmQuery: Unable to properly parse function: x => x.accounts at d (dg.xrmquery.web.min.js?ver=1623372669:1) at f (dg.xrmquery.web.min.js?ver=1623372669:1) at c (dg.xrmquery.web.min.js?ver=1623372669:1) at Function.e.Get (dg.xrmquery.web.min.js?ver=1623372669:1) at Object.t.retrieveMultiple (dg.xrmquery.web.min.js?ver=1623372669:1) at getRoleName (icams_common.js?ver=1623372669:54) at icams_common.js?ver=1623372669:92 at Generator.next () at icams_common.js?ver=1623372669:8 at new Promise ()

it tries to match x=>x.accounts to /function[^(](([a-zA-Z0-9_]+)[^{]{([\s\S]*)}$/m in function d(t) { var e = t.toString().match(H); if (!e) throw new Error("XrmQuery: Unable to properly parse function: " + t.toString()); return { arg: e[1], body: e[2] } }

mktange commented 4 years ago

Most likely a duplicate of #36.

pagex commented 4 years ago

yes, it is duplicate of #36 as it expects ES5 function keyword instead of ES6 arrow.

sowka1995 commented 4 years ago

Is support for ES6 planned in the future? I would like to use async/await feature and transpile to ES6 instead of ES5.

magesoe commented 4 years ago

Our time is limited, so I can not say when XDT supports ES6, but we would love a PR that adds support for it

ferodom commented 4 years ago

Our time is limited, so I can not say when XDT supports ES6, but we would love a PR that adds support for it

I'll like to take a stab at it, I have the stack trace based on the error. Do you have any gotchas before I get started?

misoeli commented 3 years ago

Fixed in 5.5.1.

sowka1995 commented 3 years ago

Fixed in 5.5.1.

Is it ES6 supported now?

misoeli commented 3 years ago

If only - only the arrow function was added. A bit too quick on closing here, srroy.