AdobeXD/typings

A couple type problems

Opened this issue · 2 comments

Hi, thanks for making the typings for XD, it's a big help. Here are a couple problems I've come across:

  1. If I type selection as XDSelection and I try to then access, selection.items[0].text I get an error, "Property 'text' does not exist on 'SceneNode'"
  2. If I type foo (ex. a Group) as SceneNode and I try to access foo.sharedPluginData.getAll() I get an error, "Property 'sharedPluginData' does not exist on type 'SceneNode'."

I also tried (selection.items[0] as Text).text which gives me, "Property 'text' does not exist on type 'Text'."

Since I'm currently dealing with an ear infection, just a very quick, undetailed answer (in the hopes that it still helps):

  1. That's to be expected as at this point, it is not established that it is, in fact, a Text node. Please take a look at the sample.js file. You can use instanceof to check the type and use its properties 🙂
  2. We're currently in the process of integrating the new APIs (including sharedPluginData) into the types. Cf. #77. When it's merged, sharedPluginData will be available 🙂 .