types/text-buffer/README.md
TypeScript type definitions for TextBuffer, which is published as "text-buffer" on NPM.
This module has a single entity as its export: the TextBuffer class. The require syntax is typically used to import modules like this.
import TextBuffer = require("text-buffer");
Both the Point class and the Range class are anchored onto the TextBuffer class as static properties, allowing construction of both despite TextBuffer being the singular export.
import TextBuffer = require("text-buffer");
let point = new TextBuffer.Point(0, 0);
let range = new TextBuffer.Range([0, 0], [1, 4]);
The three primary classes of TextBuffer are Point, Range, and TextBuffer, yet there are many other types passed around and used by it. Many of the types used by TextBuffer can be referenced from the TextBuffer namespace.
function example(marker: TextBuffer.Marker) {}
Declaration Merging can be used to augment any of the types used within Text Buffer. As an example, if we wanted to reveal the private emitDidStopChangingEvent method within the TextBuffer class, then we would create a file with the following contents:
// <<filename>>.d.ts
declare namespace TextBuffer {
interface TextBuffer {
emitDidStopChangingEvent(): void;
}
}
Once this file is either referenced or included within your project, then this new member function would be freely usable on instances of the TextBuffer class without TypeScript reporting errors.