Feature request: better support for JavaScript from compatibility mode 22.7
carey opened this issue · comments
Salesforce have added support for some useful ES6+ APIs that aren't supported by the Prophet extension. It would be helpful if these standard classes and functions could be supported:
ArrayBuffer
,DataView
and severalIntNArray
andUintNArray
classes, and corresponding methods ondw.util.Bytes
.Array.entries
,Array.fill
,Array.findIndex
,Array.from
,Array.includes
,Array.of
and probably some others we haven't tried to use.BigInt
, including literals like42n
.Number.isNaN
and some other less usefulisX
andparseX
functions.Object.values
,Object.entries
andObject.fromEntries
.String.startsWith
,String.endsWith
,String.includes
,String.padStart
,String.padEnd
,String.repeat
,String.raw
and a fewString.trim
methods.Symbol
.
I have also noticed an error in the definition of dw.util.Map.entrySet()
: it's declared as returning a dw.util.Set<V>
but it actually returns a dw.util.Set<dw.util.MapEntry<K,V>>
.
Hi @carey
Thank you for reporting/reminder
yes, I'll add new definition
types has been updated in v1.4.38
PS. Unfortunately, (as always), SFCC don't follow standards and IntNArray... has different implementation which don't allow use libs from npm... :(
Thanks, I've updated and the new type definitions are working. I've only noticed a couple of issues:
new ArrayBuffer()
gets an error'ArrayBuffer' only refers to a type
, but MDN and the Commerce Cloud documentation say that it has a constructor.- The
Bytes
constructor isn't accepting aUint8Array
as a parameter, although apparentlyUint8Array
is a view, and it works.
Hi @carey
Mentioned issues has been fixed in 1.4.40
Thanks. The new and updated types are working well for me now.