Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

[TypeScript] this type as function parameter #5769

Closed

Description

@ficristo

The this in this: NodeDomain is highlighted correctly, but I think NodeDomain should be highlighted as a type.

class NodeDomain {
    private _load() {
        const connection = this.connection;
        return connection.loadDomains(this._domainPath, true)
            .done(function (this: NodeDomain) {
                this._domainLoaded = true;
                this._connectionPromise = null;

                const eventNames = Object.keys(connection.domainEvents[this._domainName]);
                eventNames.forEach(function (this: NodeDomain, domainEvent) {
                    const connectionEvent = this._domainName + ":" + domainEvent + EVENT_NAMESPACE;

                    (connection as unknown as EventDispatcher.DispatcherEvents).on(connectionEvent, function (this: NodeDomain) {
                        const params = Array.prototype.slice.call(arguments, 1);
                        EventDispatcher.triggerWithArray(this, domainEvent, params);
                    }.bind(this));
                }, this);
            }.bind(this))
            .fail(function (this: NodeDomain, err) {
                console.error("[NodeDomain] Error loading domain \"" + this._domainName + "\": " + err);
            }.bind(this));
    }
}

Activity

  1. ficristo commented on Feb 5, 2019

    @ficristo
    ContributorAuthor

    I tryed the snippet above on https://codemirror.net/mode/javascript/typescript.html and I don't see any changes. Do I need to wait? (From what I remember the changes are immediately available on the website)
    Nevermind some caching issue.
    Thank you!

  2. added a commit that references this issue on Jan 6, 2020
    22df45e
  3. added a commit that references this issue on Jan 21, 2020
    2e3f6d4
  4. added a commit that references this issue on Sep 5, 2024
    a0e1c6f
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