Fixing a few TS 2.7 errors

This commit is contained in:
Matt Bierner 2018-02-07 15:35:16 -08:00
parent e385fc3e3f
commit f66c6f9b3f
3 changed files with 9 additions and 9 deletions

View file

@ -30,8 +30,8 @@ function isString(value: any): value is string {
}
export class Logger {
private trace: Trace;
private _output: OutputChannel;
private trace?: Trace;
private _output?: OutputChannel;
constructor() {
this.updateConfiguration();

View file

@ -11,11 +11,11 @@ import { MarkdownIt, Token } from 'markdown-it';
const FrontMatterRegex = /^---\s*[^]*?(-{3}|\.{3})\s*/;
export class MarkdownEngine {
private md: MarkdownIt;
private md?: MarkdownIt;
private firstLine: number;
private firstLine?: number;
private currentDocument: vscode.Uri;
private currentDocument?: vscode.Uri;
private plugins: Array<(md: any) => any> = [];
@ -51,7 +51,7 @@ export class MarkdownEngine {
return `<pre class="hljs"><code><div>${hljs.highlight(lang, str, true).value}</div></code></pre>`;
} catch (error) { }
}
return `<pre class="hljs"><code><div>${this.md.utils.escapeHtml(str)}</div></code></pre>`;
return `<pre class="hljs"><code><div>${this.md!.utils.escapeHtml(str)}</div></code></pre>`;
}
}).use(mdnh, {
slugify: (header: string) => Slug.fromHeading(header).value
@ -141,12 +141,12 @@ export class MarkdownEngine {
// Assume it must be a file
const fragment = uri.fragment;
if (uri.path[0] === '/') {
const root = vscode.workspace.getWorkspaceFolder(this.currentDocument);
const root = vscode.workspace.getWorkspaceFolder(this.currentDocument!);
if (root) {
uri = vscode.Uri.file(path.join(root.uri.fsPath, uri.path));
}
} else {
uri = vscode.Uri.file(path.join(path.dirname(this.currentDocument.path), uri.path));
uri = vscode.Uri.file(path.join(path.dirname(this.currentDocument!.path), uri.path));
}
if (fragment) {

View file

@ -37,7 +37,7 @@ export interface TocEntry {
}
export class TableOfContentsProvider {
private toc: TocEntry[];
private toc?: TocEntry[];
public constructor(
private engine: MarkdownEngine,