Skip to content

Commit ad21a10

Browse files
author
Anthony Guo
committed
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(...)"
1 parent 304a251 commit ad21a10

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

codemirror/codemirror.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ declare function CodeMirror(host: HTMLElement, options?: CodeMirror.EditorConfig
77
declare function CodeMirror(callback: (host: HTMLElement) => void , options?: CodeMirror.EditorConfiguration): CodeMirror.Editor;
88

99
declare module CodeMirror {
10+
export var Doc : CodeMirror.Doc;
11+
export var Pos: CodeMirror.Position;
1012
export var Pass: any;
1113

1214
function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea;
@@ -387,8 +389,8 @@ declare module CodeMirror {
387389
getTextArea(): HTMLTextAreaElement;
388390
}
389391

390-
class Doc {
391-
constructor (text: string, mode?: any, firstLineNumber?: number);
392+
interface Doc {
393+
new (text: string, mode?: any, firstLineNumber?: number): Doc;
392394

393395
/** 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"). */
394396
getValue(seperator?: string): string;
@@ -616,6 +618,7 @@ declare module CodeMirror {
616618
}
617619

618620
interface Position {
621+
new (line: number, ch: number): Position;
619622
ch: number;
620623
line: number;
621624
}

0 commit comments

Comments
 (0)