In AppleScript I often need to convert between files as POSIX paths and as AppleScript’s native file aliases.
The way to do it is via the POSIX File class in standard additions:
set aFile to POSIX file "/"
get aFile's POSIX path
How do I do these casts/conversions in JXA? I’ve tried
var app = Application.currentApplication();
app.includeStandardAdditions = true;
app.POSIXFile().make('/');
But I only get
Error on line 4: Error: POSIXFile is not a valid class for application «Appname»