Modal example from Plugin Dev Docs won't run

I’ve just started to look at developing my own plugins and I’m running into a bit of trouble. I’ve tried to implement this user input modal example from here: Modals - Developer Documentation. But using the code as-is directly from the page results in…

Plugin failure: example-plugin TypeError: l is not a constructor
at e. (app.js:1:2046249)
at app.js:1:237544
at Object.next (app.js:1:237649)
at a (app.js:1:236367)

What’s actually the problem here? This is the part of the compiled JavaScript file it’s having trouble with but I can’t really make heads or tails of it…

            function s(s) {
                return function(l) {
                    return function(s) {
                        if (n)
                            throw new TypeError("Generator is already executing.");
                        for (; o && (o = 0,
                        s[0] && (a = 0)),
                        a; )
                            try {
                                if (n = 1,
                                i && (r = 2 & s[0] ? i.return : s[0] ? i.throw || ((r = i.return) && r.call(i),
                                0) : i.next) && !(r = r.call(i, s[1])).done)
                                    return r;
                                switch (i = 0,
                                r && (s = [2 & s[0], r.value]),
                                s[0]) {
                                case 0:
                                case 1:
                                    r = s;
                                    break;
                                case 4:
                                    return a.label++,
                                    {
                                        value: s[1],
                                        done: !1
                                    };
                                case 5:
                                    a.label++,
                                    i = s[1],
                                    s = [0];
                                    continue;
                                case 7:
                                    s = a.ops.pop(),
                                    a.trys.pop();
                                    continue;
                                default:
                                    if (!(r = a.trys,
                                    (r = r.length > 0 && r[r.length - 1]) || 6 !== s[0] && 2 !== s[0])) {
                                        a = 0;
                                        continue
                                    }
                                    if (3 === s[0] && (!r || s[1] > r[0] && s[1] < r[3])) {
                                        a.label = s[1];
                                        break
                                    }
                                    if (6 === s[0] && a.label < r[1]) {
                                        a.label = r[1],
                                        r = s;
                                        break
                                    }
                                    if (r && a.label < r[2]) {
                                        a.label = r[2],
                                        a.ops.push(s);
                                        break
                                    }
                                    r[2] && a.ops.pop(),
                                    a.trys.pop();
                                    continue
                                }
                                s = t.call(e, a)
                            } catch (e) {
                                s = [6, e],
                                i = 0
                            } finally {
                                n = r = 0
                            }
                        if (5 & s[0])
                            throw s[1];
                        return {
                            value: s[0] ? s[1] : void 0,
                            done: !0
                        }
                    }([s, l])
                }
            }
        }

What is your TypeScript code?

The exact code from the doc section I linked:

import { App, Modal, Setting } from "obsidian";

export class ExampleModal extends Modal {
  result: string;
  onSubmit: (result: string) => void;

  constructor(app: App, onSubmit: (result: string) => void) {
    super(app);
    this.onSubmit = onSubmit;
  }

  onOpen() {
    const { contentEl } = this;

    contentEl.createEl("h1", { text: "What's your name?" });

    new Setting(contentEl)
      .setName("Name")
      .addText((text) =>
        text.onChange((value) => {
          this.result = value
        }));

    new Setting(contentEl)
      .addButton((btn) =>
        btn
          .setButtonText("Submit")
          .setCta()
          .onClick(() => {
            this.close();
            this.onSubmit(this.result);
          }));
  }

  onClose() {
    let { contentEl } = this;
    contentEl.empty();
  }

Do you have a GitHub repo with the complete plugin?
There is nothing wrong with that example, it should just work.