Skip to content

Commit 53ce46b

Browse files
committed
build: fix compile errors
1 parent 68b8085 commit 53ce46b

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

.vscode/tasks.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "watch",
7+
"group": "build",
8+
"problemMatcher": ["$tsc-watch"],
9+
"label": "npm: watch",
10+
"detail": "tsc -p . -w",
11+
"runOptions": {
12+
"runOn": "folderOpen",
13+
},
14+
},
15+
],
16+
}

src/codeEditor.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { BehaviorSubject } from 'rxjs'
22
import * as sinon from 'sinon'
33
import * as sourcegraph from 'sourcegraph'
4-
import { assertTypeIsCompatible } from './util'
4+
import { subTypeOf } from './util'
55

66
export const createStubCodeEditor = ({
77
document,
88
selections = [],
99
}: Pick<sourcegraph.CodeEditor, 'document'> & Partial<Pick<sourcegraph.CodeEditor, 'selections'>>) => {
10-
const codeEditor = {
10+
const codeEditor = subTypeOf<sourcegraph.CodeEditor>()({
1111
type: 'CodeEditor' as const,
1212
document,
1313
get selections(): sourcegraph.Selection[] {
@@ -23,7 +23,6 @@ export const createStubCodeEditor = ({
2323
decorations: sourcegraph.TextDocumentDecoration[]
2424
): void => undefined
2525
),
26-
}
27-
assertTypeIsCompatible<sourcegraph.CodeEditor>(codeEditor)
26+
})
2827
return codeEditor
2928
}

src/textDocument.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as sinon from 'sinon'
22
import * as sourcegraph from 'sourcegraph'
3-
import { assertTypeIsCompatible, notImplemented } from './util'
3+
import { notImplemented, subTypeOf } from './util'
44

55
/**
66
* Creates a stub TextDocument.
77
*
88
*/
99
export const createStubTextDocument = (init: Pick<sourcegraph.TextDocument, 'languageId' | 'text' | 'uri'>) => {
10-
const textDocument = {
10+
const textDocument = subTypeOf<sourcegraph.TextDocument>()({
1111
...init,
1212
// TODO share the implementation of these methods with the real implementations
1313
getWordRangeAtPosition: sinon.spy<(position: sourcegraph.Position) => sourcegraph.Range | undefined>(
@@ -17,7 +17,6 @@ export const createStubTextDocument = (init: Pick<sourcegraph.TextDocument, 'lan
1717
offsetAt: sinon.spy<(position: sourcegraph.Position) => number>(notImplemented),
1818
positionAt: sinon.spy<(offset: number) => sourcegraph.Position>(notImplemented),
1919
validateRange: sinon.spy<(range: sourcegraph.Range) => sourcegraph.Range>(notImplemented),
20-
}
21-
assertTypeIsCompatible<sourcegraph.TextDocument>(textDocument)
20+
})
2221
return textDocument
2322
}

0 commit comments

Comments
 (0)