4

Most OS X applications (particularly the ones written by Apple) are scriptable using either AppleScript or JavaScript. The API each application supports is described by an SDEF file. (See e.g. sdef /Applications/Safari.app.)

Is there any way to automatically generate .d.ts files from .sdef files, and thus create ambient typings suitable for use with TypeScript?

mjs
  • 63,493
  • 27
  • 91
  • 122
  • No, and that's not how Apple event IPC works anyway: it's RPC plus simple first-class relational queries, _not_ OOP. All its stuff about 'classes' is just a convenient fiction for documentation purposes and bears no relation to how class-based OO actually works. Trying to hammer Apple events' peg into an OO hole just breaks features and app compatibility (see OS X's crippled Scripting Bridge), and JXA is crippled and defective enough as it is so hardly needs the help. – foo Jul 28 '16 at 09:15
  • @foo You're saying it's not possible to reliably generate `.d.ts` from `.sdef`? Do you have any examples of the problems that result? Scripting via JS does seem to work. – mjs Jul 28 '16 at 14:02

0 Answers0