GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Incorrect codegen with __TS__UsingAsync · Issue #1730 · TypeScriptToLua/TypeScriptToLua

Incorrect codegen with __TS__UsingAsync #1730

New issue
Copy link
New issue
Copy link
Closed
#1738
Closed
Incorrect codegen with __TS__UsingAsync#1730
#1738
Copy link

Description

@TooManyLimits
TooManyLimits
opened on Jul 6, 2026
Issue body actions
class Thing implements Disposable {
    x: number = 5;
    constructor() {}
    [Symbol.dispose]() {}
}

(async () => {
    using thing = new Thing();
    thing.x = 10;
})();

generates the lua code:

(function()
    return __TS__AsyncAwaiter(function(____awaiter_resolve)
        return ____awaiter_resolve(
            nil,
            __TS__Await(__TS__UsingAsync(
                nil,
                function(thing)
                    return __TS__AsyncAwaiter(function(____awaiter_resolve)
                        thing.x = 10
                    end)
                end,
                __TS__New(Thing)
            ))
        )
    end)
end)(nil)

However, in the definition of __TS__UsingAsync, cb is called with nil as the first parameter. This causes an error at runtime, since thing is nil.

Activity

  1. Perryvw
    closed this as completedin #1738on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.