r/typescript • • 2h ago

How do I circumvent referring to a block-scoped variable before declaration in this case?

1 Upvotes

I apologize that my title may be an XY problem. What I'm actually doing is I have basically a dialogue tree in a module. Each line is a separate variable and it should have inside itself a reference to the following line.

export type DialogLine = {
    text: string;
    responses: PlayerResponse[];
}

export type PlayerResponse = {
    text: string;
    nextLine: DialogLine;
}

I guess the solution could be as simple as having the order reversed: later dialogue lines go at the top, earlier ones - at the bottom. But I can't guarantee that it'll always work and there won't be some branching or looping.

Maybe using string aliases rather than the actual variables is the solution. I've got no idea. Could just hide the issue from the compiler.


r/typescript • • 18h ago

Executor is moving to Effect for writing apps

0 Upvotes

Executor is an open source router that lets you connect services like Gmail and GitHub once, so then agent harness can use them through a single connection.

Founder Rhys Sullivan said he originally built a custom framework for Executor apps, which are small Typescript programs. After dogfooding it for awhile, he decided it was simpler to let agents write Effect directly.

The change will help with things like handling errors, retrying a failed request, and refactoring apps over time.

Here's an authoring guide and code examples for the new Effect-based app feature

https://github.com/UsefulSoftwareCo/executor/blob/3cecd7141d0a84a485ef2ea5db8eebeabc8c4a53/packages/apps-next/skills/app-authoring/SKILL.md