mwbot-ts - v1.2.7
    Preparing search index...

    Interface ParsedWikilinkStaticPrivate

    This interface defines the static members of the ParsedWikilink class. For instance members, see ParsedWikilink (defined separately due to TypeScript limitations).

    This class is exclusive to Wikitext.parseWikilinks. It represents a well-formed [[wikilink]] markup with a valid non-file title. For the class that represents a well-formed [[wikilink]] markup with a valid file title, see ParsedFileWikilinkStatic, and for the class that represents a malformed [[wikilink]] markup with an invalid title, see ParsedRawWikilinkStatic.

    This class differs from ParsedFileWikilink and ParsedRawWikilink in that:

    • It extends the Wikilink class.
    • (Compared to ParsedFileWikilink) its instances have methods related to the display text.
    • (Compared to ParsedRawWikilink) the title property is an instace of Title instead of a string.

    The constructor of this class is inaccessible, and instances can only be referenced in the result of parseTemplates.

    To check if an object is an instance of this class, use WikilinkStatic.is.

    Important:

    The instance properties of this class are pseudo-read-only, in the sense that altering them does not affect the behaviour of Wikitext.modifyWikilinks.

    interface ParsedWikilinkStatic {
        new ParsedWikilinkStatic(
            initializer: ParsedWikilinkInitializer,
        ): ParsedWikilink;
        is<T extends keyof WikilinkTypeMap>(
            obj: unknown,
            type: T,
        ): obj is WikilinkTypeMap[T];
    }

    Hierarchy

    Index

    Constructors

    Methods

    Constructors

    • Private

      Parameters

      • initializer: ParsedWikilinkInitializer

      Returns ParsedWikilink

    Methods

    • Checks if the given object is an instance of the specified wikilink-related class.

      This method is an alternative of the instanceof operator, which cannot be used for non-exported classes.

      Example:

      const [foo] = new mwbot.Wikitext('[[Foo]]').parseWikilinks();
      foo instanceof mwbot.Wikilink; // true
      mwbot.Wikilink.is(foo, 'ParsedWikilink'); // true
      foo instanceof mwbot.FileWikilink; // false
      mwbot.Wikilink.is(foo, 'ParsedFileWikilink'); // false
      foo instanceof mwbot.RawWikilink; // false
      mwbot.Wikilink.is(foo, 'ParsedRawWikilink'); // false

      Be noted about the hierarchies of the wikilink-related classes:

      Type Parameters

      • T extends keyof WikilinkTypeMap

        The type of wikilink to check for. Must be one of 'Wikilink', 'ParsedWikilink', 'FileWikilink', 'ParsedFileWikilink', 'RawWikilink', or 'ParsedRawWikilink'.

      Parameters

      • obj: unknown

        The object to check.

      • type: T

        The wikilink type to compare against.

      Returns obj is WikilinkTypeMap[T]

      true if obj is an instance of the specified wikilink class, otherwise false.

      If an invalid type is provided.