Tutorials: Rename Tutorial.run to start - #4010
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The failure
Tutorialsis one of four packages still failing to build in the nightly:The u2 refactor added a scope helper to the
Componentbase:Tutorial extends DG.Widget, andWidget → Control → Component, so it now inheritsrun(fn)— which its ownasync 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 returnsT. Unlike thenameaccessor case (#4005), there is no override shape that works — the member has to be called something else.Why this side, and why
startRenaming the u2 helper would be the alternative, but it has ~38 call sites across
libraries/u2, not all of which areComponent.run, in a library under active development. RenamingTutorial.runis far smaller and contained:startis free onComponent,ControlandWidget— checked, so this does not trade one collision for another_run()hook, which does not collide; only the base declares the public entry point'Start'button that launches the next tutorial, so the name reads correctlyVerification
Compiled
tutorial.tsagainst the current js-api sources:tutorial.ts(127,9)No new errors introduced.
ComputeandDevToolsfail on the same collision viaFunctionView.runinlibraries/compute-utils; that is a separate change and not included here.Generated with Claude Code