Skip to content

Tutorials: Rename Tutorial.run to start - #4010

Merged
alex-aprm merged 1 commit into
masterfrom
claude/tutorials-run-collision
Aug 28, 2026
Merged

Tutorials: Rename Tutorial.run to start#4010
alex-aprm merged 1 commit into
masterfrom
claude/tutorials-run-collision

Conversation

@alex-aprm

Copy link
Copy Markdown
Collaborator

The failure

Tutorials is one of four packages still failing to build in the nightly:

libraries/tutorials/src/tutorial.ts(127,9)
TS2416: Property 'run' in type 'Tutorial' is not assignable to the
        same property in base type 'Widget<any>'

The u2 refactor added a scope helper to the Component base:

// js-api/src/u2core/component.ts
run<T>(fn: () => T): T { return Scope.runWith(this.scope, fn); }

Tutorial extends DG.Widget, and Widget → Control → Component, so it now inherits run(fn) — which its own async run(): Promise<void> no longer matches.

Why renaming is the only option here

No signature satisfies both. A subclass may drop parameters, but it cannot return Promise<void> where the base returns T. Unlike the name accessor case (#4005), there is no override shape that works — the member has to be called something else.

Why this side, and why start

Renaming the u2 helper would be the alternative, but it has ~38 call sites across libraries/u2, not all of which are Component.run, in a library under active development. Renaming Tutorial.run is far smaller and contained:

  • start is free on Component, Control and Widget — checked, so this does not trade one collision for another
  • subclasses are untouched: they implement the protected _run() hook, which does not collide; only the base declares the public entry point
  • 3 call sites, and one of them sits directly under the 'Start' button that launches the next tutorial, so the name reads correctly

Verification

Compiled tutorial.ts against the current js-api sources:

TS2416
before (origin/master) 1 — tutorial.ts(127,9)
after 0

No new errors introduced.

Compute and DevTools fail on the same collision via FunctionView.run in libraries/compute-utils; that is a separate change and not included here.

Generated with Claude Code

The u2 refactor put a run<T>(fn) helper on the Component base, which
Widget now inherits, so Tutorial's own run(): Promise<void> stopped
matching the base signature and the package build died:

  TS2416: Property 'run' in type 'Tutorial' is not assignable to the
  same property in base type 'Widget<any>'

No signature satisfies both. A subclass may drop parameters, but it
cannot return Promise<void> where the base returns T, so the method has
to be named something else.

start() is free on Component, Control and Widget, and it reads correctly
next to the "Start" button that launches the next tutorial. Subclasses
are untouched: they implement the protected _run() hook, which does not
collide, and only the base declares the public entry point. Three call
sites move with it.

Verified against the current js-api sources: TS2416 at tutorial.ts:127
before, none after.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@alex-aprm alex-aprm added the claude Pull request created by claude label Aug 28, 2026
@alex-aprm
alex-aprm merged commit 38c3f9c into master Aug 28, 2026
15 of 16 checks passed
@alex-aprm
alex-aprm deleted the claude/tutorials-run-collision branch August 28, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude Pull request created by claude

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant