Issue Bug Resolved

#111482Viewport.Loader is typed as a Loader instance instead of the Loader class

Benjamin Kott 11/17/26, 17:39 updated 11/18/26, 09:19

Description

Problem

The backend viewport (typo3/backend/viewport, also reachable as top.TYPO3.Backend) exposes the progress loader as Viewport.Loader@. TypeScript code that calls Viewport.Loader.start() or Viewport.Loader.finish() does not compile:

error TS2576: Property 'start' does not exist on type 'Loader'. Did you mean to access the static member 'Loader.start' instead?

At runtime the calls work, so callers have to cast around the declaration, e.g. (Viewport.Loader as unknown as typeof Loader).start().

Steps to reproduce

  1. In any TypeScript module below Build/Sources/TypeScript, import Viewport from ‘@typo3/backend/viewport’ and call Viewport.Loader.start().
  2. Run the TypeScript build: ./Build/Scripts/runTests.sh -s build
  3. tsc reports TS2576 for the call.

Cause

Build/Sources/TypeScript/backend/viewport.ts declares public readonly Loader: Loader = Loader;. Loader (viewport/loader.ts) only has static members (start(), finish()), and the property holds the class itself, not an instance. The annotation Loader means “an instance of Loader”, which has no members at all; the correct type is typeof Loader.

Suggested fix

--- a/Build/Sources/TypeScript/backend/viewport.ts
+++ b/Build/Sources/TypeScript/backend/viewport.ts
@@ class Viewport {
-  public readonly Loader: Loader = Loader;
+  public readonly Loader: typeof Loader = Loader;

Reviews 2

History 13

  1. Benjamin Kott commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-11-18T09:19:39+00:00" > 11/18/26, 09:19 </span>

    Applied in changeset commit:e4c038b1e6ea0ad3b7c23cc8a340a533e8898144.