From ad21a10ba76af3ecca3cf733bafef8605eabb471 Mon Sep 17 00:00:00 2001 From: Anthony Guo Date: Tue, 7 Jul 2015 14:14:34 -0700 Subject: [PATCH] codemirror.d.ts: Changed the Doc class type to an interface, and exposed the CodeMirror.Pos constructor This allows the user to extend the definition for the CodeMirror.Doc interface over multiple files. It also allows for instantiating new CodeMirror.Position type objects using "new CodeMirror.Pos(...)" --- codemirror/codemirror.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 65692cf1c..8584b6a2b 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -7,6 +7,8 @@ declare function CodeMirror(host: HTMLElement, options?: CodeMirror.EditorConfig declare function CodeMirror(callback: (host: HTMLElement) => void , options?: CodeMirror.EditorConfiguration): CodeMirror.Editor; declare module CodeMirror { + export var Doc : CodeMirror.Doc; + export var Pos: CodeMirror.Position; export var Pass: any; function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea; @@ -387,8 +389,8 @@ declare module CodeMirror { getTextArea(): HTMLTextAreaElement; } - class Doc { - constructor (text: string, mode?: any, firstLineNumber?: number); + interface Doc { + new (text: string, mode?: any, firstLineNumber?: number): Doc; /** Get the current editor content. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n"). */ getValue(seperator?: string): string; @@ -616,6 +618,7 @@ declare module CodeMirror { } interface Position { + new (line: number, ch: number): Position; ch: number; line: number; }