Fix type errors in bolt-selftest.ts
This commit is contained in:
parent
be2ba1023d
commit
d12ffa1de5
1 changed files with 3 additions and 5 deletions
|
@ -9,9 +9,7 @@ import path from "path";
|
||||||
import yargs from "yargs";
|
import yargs from "yargs";
|
||||||
import { Checker } from "../checker";
|
import { Checker } from "../checker";
|
||||||
import { TextFile } from "../cst";
|
import { TextFile } from "../cst";
|
||||||
import { Parser } from "../parser";
|
import { ConsoleDiagnostics } from "../diagnostics";
|
||||||
import { Punctuator, Scanner } from "../scanner";
|
|
||||||
import { ConsoleDiagnostics, DiagnosticStore } from "../diagnostics";
|
|
||||||
import { parseSourceFile } from "..";
|
import { parseSourceFile } from "..";
|
||||||
|
|
||||||
const projectDir = path.resolve(__dirname, '..', '..');
|
const projectDir = path.resolve(__dirname, '..', '..');
|
||||||
|
@ -40,12 +38,12 @@ yargs
|
||||||
async function* loadTests(): AsyncIterable<Test> {
|
async function* loadTests(): AsyncIterable<Test> {
|
||||||
for (const filename of globSync(path.join(projectDir, 'src', 'test', '**', '*.md'))) {
|
for (const filename of globSync(path.join(projectDir, 'src', 'test', '**', '*.md'))) {
|
||||||
const text = await fs.promises.readFile(filename, 'utf-8');
|
const text = await fs.promises.readFile(filename, 'utf-8');
|
||||||
const reader = commonmark.Parser();
|
const reader = new commonmark.Parser();
|
||||||
const root = reader.parse(text);
|
const root = reader.parse(text);
|
||||||
let child = root.firstChild;
|
let child = root.firstChild;
|
||||||
while (child !== null) {
|
while (child !== null) {
|
||||||
if (child.type === 'code_block') {
|
if (child.type === 'code_block') {
|
||||||
yield { code: child.literal };
|
yield { code: child.literal! };
|
||||||
}
|
}
|
||||||
child = child.next;
|
child = child.next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue