This issue has been created
There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-32c70acc-a304-4122-a908-68419ac277b5 XWIKI-25237 Open

Provide a single TypeScript declaration of the global XWiki object

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-3d5a72a5-eb36-4d65-95dd-d7a877f91f89 Manuel Leduc created this issue on 09/Oct/26 12:15
 
Summary: Provide a single TypeScript declaration of the global XWiki object
Issue Type: cid:jira-generated-image-avatar-32c70acc-a304-4122-a908-68419ac277b5 Task
Affects Versions: 18.8.0
Assignee: Unassigned
Components: Node
Created: 09/Oct/26 12:15
Priority: cid:jira-generated-image-static-major-2f2078c5-6d73-43cb-b359-64b8e002c553 Major
Reporter: Manuel Leduc
Description:

The TypeScript modules that read the global XWiki object each declare it on their own, with diverging types:

  • 7 modules (blocknote webjar, authentication-xwiki, autosave-xwiki, backend-xwiki, document-xwiki, model-reference-xwiki, model-remote-url-xwiki) copy the same declare global block pointing to XWikiGlobal from @xwiki/platform-xwiki-utils
  • the Flamingo design system webjar and the localization webjar declare their own partial types
  • livedata-xwiki declares it as any
  • livedata-ui reads it through an untyped JavaScript shim and silences the type checker with @ts-expect-error to use XWiki.widgets

As a result, a member of the global can be typed differently, or not at all, depending on the module, and every new module has to copy the declaration again.

Proposal

  • @xwiki/platform-xwiki-utils exposes a types-only ./global entry declaring const XWiki: XWikiGlobal, which modules opt into with /// <reference types="@xwiki/platform-xwiki-utils/global" />
  • XWikiGlobal gains the widgets member (Notification, ConfirmationBox) contributed by the core skin scripts, typed only as far as it is used
  • members contributed by extensions are added by the extension's own package through declaration merging on XWikiGlobal, so that they are only visible where the extension is loaded
  • all the modules above use the shared declaration; the web webjar, which assigns the global before xwiki.js is loaded, keeps its own write-side declaration
 
 

1 update

 
cid:jira-generated-image-avatar-3d5a72a5-eb36-4d65-95dd-d7a877f91f89 Changes by Manuel Leduc on 09/Oct/26 12:15
 
Fix Version: 18.9.0-rc-1