Skip to content

Commit e511b64

Browse files
lvcabralclaude
andauthored
fix(rsg): repair the release build broken by the findNode global check (#1099)
`sgRoot.mGlobal !== this` fails to compile: mGlobal is a `Global`, which TypeScript sees as having no overlap with the polymorphic `this`, so `tsc`/ts-loader raise TS2367 and the brs-scenegraph build fails. Widen to RoSGNode before comparing, the same way the earlier global-node check did. Only a clean build surfaces it — an incremental rebuild reuses the cached module and reports success, which is how it reached master. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent afc80d3 commit e511b64

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/extensions/scenegraph/components/RoSGNode.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,10 @@ export abstract class RoSGNode extends BrsComponent implements BrsValue, ISGNode
18051805
// node appended to m.global via m.global.findNode(). Skipping the self-search keeps
18061806
// that boundary — every other node's subtree is part of its ancestor's anyway, so
18071807
// searching it first is only a shortcut.
1808-
const searchSelf: boolean = sgRoot.mGlobal !== this;
1808+
// Widened to RoSGNode so the comparison type-checks: `sgRoot.mGlobal` is a `Global`,
1809+
// which TypeScript sees as having no overlap with the polymorphic `this`.
1810+
const globalNode: RoSGNode = sgRoot.mGlobal;
1811+
const searchSelf: boolean = globalNode !== this;
18091812
let node: RoSGNode | BrsInvalid = searchSelf ? this.findNodeById(this, id) : BrsInvalid.Instance;
18101813
if (node instanceof BrsInvalid) {
18111814
// if not found, search from root

0 commit comments

Comments
 (0)