definitelytyped-firefox-webext-browser icon indicating copy to clipboard operation
definitelytyped-firefox-webext-browser copied to clipboard

Fix converting array of a union type

Open msmolens opened this issue 5 years ago • 1 comments

The following property, defined in the browser.menus schema, represents an array of either integers or strings:

"menuIds": {
  "description": "A list of IDs of the menu items that were shown.",
  "type": "array",
  "items": {
    "choices": [
      { "type": "integer" },
      { "type": "string" }
    ]
  }
}

This commit changes the generated type from:

interface _OnShownInfo {
    /** A list of IDs of the menu items that were shown. */
    menuIds: number | string[];
    ...
}

to:

interface _OnShownInfo {
    /** A list of IDs of the menu items that were shown. */
    menuIds: Array<number | string>;
    ...
}

msmolens avatar Aug 16 '20 21:08 msmolens

I've totally missed this PR. Apologies for that. I don't have time right now but I'll make sure to take a look soon. Thanks for the PR :D

jsmnbom avatar Nov 09 '20 18:11 jsmnbom

Thanks!, sorry it took me so unbelievable long to get around to merging.

jsmnbom avatar Jan 13 '23 11:01 jsmnbom