From 787b2bd117f6fa03cc473cfc4dd215fbc6792e24 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 31 Jan 2018 23:55:43 -0500 Subject: [PATCH] Updates typescript --- package-lock.json | 6 +++--- package.json | 2 +- src/annotations/annotationProvider.ts | 2 +- src/annotations/blameAnnotationProvider.ts | 2 +- src/codeLensController.ts | 2 +- src/currentLineController.ts | 7 ++++--- src/git/formatters/formatter.ts | 4 ++-- src/git/models/branch.ts | 3 +++ src/gitCodeLensProvider.ts | 2 +- src/quickPicks/branches.ts | 2 +- src/quickPicks/branchesAndTags.ts | 2 +- src/quickPicks/common.ts | 4 ++-- src/quickPicks/repositories.ts | 2 +- src/system/searchTree.ts | 8 ++++---- src/trackers/documentTracker.ts | 3 ++- src/trackers/lineTracker.ts | 3 ++- src/trackers/trackedDocument.ts | 4 ++-- 17 files changed, 32 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4208557..f51b7f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6479,9 +6479,9 @@ "dev": true }, "typescript": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.2.tgz", - "integrity": "sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q=", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.1.tgz", + "integrity": "sha512-bqB1yS6o9TNA9ZC/MJxM0FZzPnZdtHj0xWK/IZ5khzVqdpGul/R/EIiHRgFXlwTD7PSIaYVnGKq1QgMCu2mnqw==", "dev": true }, "uglify-es": { diff --git a/package.json b/package.json index 71a43f4..f3d1045 100644 --- a/package.json +++ b/package.json @@ -3339,7 +3339,7 @@ "husky": "0.14.3", "ts-loader": "3.4.0", "tslint": "5.9.1", - "typescript": "2.6.2", + "typescript": "2.7.1", "uglify-es": "3.3.9", "uglifyjs-webpack-plugin": "1.1.8", "vscode": "1.1.10", diff --git a/src/annotations/annotationProvider.ts b/src/annotations/annotationProvider.ts index 3eb4bcd..2b3130b 100644 --- a/src/annotations/annotationProvider.ts +++ b/src/annotations/annotationProvider.ts @@ -19,7 +19,7 @@ export abstract class AnnotationProviderBase extends Disposable { return editor !== undefined ? (editor as any).id : ''; } - annotationType: FileAnnotationType; + annotationType: FileAnnotationType | undefined; correlationKey: TextEditorCorrelationKey; document: TextDocument; status: AnnotationStatus | undefined; diff --git a/src/annotations/blameAnnotationProvider.ts b/src/annotations/blameAnnotationProvider.ts index 98866ee..56b099e 100644 --- a/src/annotations/blameAnnotationProvider.ts +++ b/src/annotations/blameAnnotationProvider.ts @@ -12,7 +12,7 @@ import { GitBlame, GitCommit, GitUri } from '../gitService'; export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase { protected _blame: Promise; - protected _hoverProviderDisposable: Disposable; + protected _hoverProviderDisposable: Disposable | undefined; protected readonly _uri: GitUri; constructor( diff --git a/src/codeLensController.ts b/src/codeLensController.ts index 931fb2c..a4a4205 100644 --- a/src/codeLensController.ts +++ b/src/codeLensController.ts @@ -9,7 +9,7 @@ import { Logger } from './logger'; export class CodeLensController extends Disposable { - private _canToggle: boolean; + private _canToggle: boolean = false; private _disposable: Disposable | undefined; private _provider: GitCodeLensProvider | undefined; private _providerDisposable: Disposable | undefined; diff --git a/src/currentLineController.ts b/src/currentLineController.ts index 547576d..f01b5d4 100644 --- a/src/currentLineController.ts +++ b/src/currentLineController.ts @@ -391,7 +391,8 @@ export class CurrentLineController extends Disposable { }; } - private _updateBlameDebounced: ((line: number, editor: TextEditor, trackedDocument: TrackedDocument) => void) & IDeferrable; + private _updateBlameDebounced: (((line: number, editor: TextEditor, trackedDocument: TrackedDocument) => void) & IDeferrable) | undefined; + private async refresh(editor: TextEditor | undefined, options: { full?: boolean, trackedDocument?: TrackedDocument } = {}) { if (editor === undefined && this._editor === undefined) return; @@ -462,7 +463,7 @@ export class CurrentLineController extends Disposable { this._lineTracker.reset(); // Make sure we are still on the same line and not pending - if (this._lineTracker.line !== line || this._updateBlameDebounced.pending!()) return; + if (this._lineTracker.line !== line || (this._updateBlameDebounced && this._updateBlameDebounced.pending!())) return; const blameLine = editor.document.isDirty ? await Container.git.getBlameForLineContents(trackedDocument.uri, line, editor.document.getText()) @@ -472,7 +473,7 @@ export class CurrentLineController extends Disposable { let commitLine; // Make sure we are still on the same line, blameable, and not pending, after the await - if (this._lineTracker.line === line && trackedDocument.isBlameable && !this._updateBlameDebounced.pending!()) { + if (this._lineTracker.line === line && trackedDocument.isBlameable && !(this._updateBlameDebounced && this._updateBlameDebounced.pending!())) { const state = this.getBlameAnnotationState(); if (state.enabled) { commitLine = blameLine === undefined ? undefined : blameLine.line; diff --git a/src/git/formatters/formatter.ts b/src/git/formatters/formatter.ts index 336122b..bb3de2a 100644 --- a/src/git/formatters/formatter.ts +++ b/src/git/formatters/formatter.ts @@ -10,8 +10,8 @@ type Constructor = new (...args: any[]) => T; export abstract class Formatter { - protected _item: TItem; - protected _options: TOptions; + protected _item!: TItem; + protected _options!: TOptions; constructor(item: TItem, options?: TOptions) { this.reset(item, options); diff --git a/src/git/models/branch.ts b/src/git/models/branch.ts index a12e94c..c20bf7c 100644 --- a/src/git/models/branch.ts +++ b/src/git/models/branch.ts @@ -23,6 +23,9 @@ export class GitBranch { branch = branch.substring(8); this.remote = true; } + else { + this.remote = false; + } this.current = current; this.name = branch; diff --git a/src/gitCodeLensProvider.ts b/src/gitCodeLensProvider.ts index e96fef0..50b0985 100644 --- a/src/gitCodeLensProvider.ts +++ b/src/gitCodeLensProvider.ts @@ -56,7 +56,7 @@ export class GitCodeLensProvider implements CodeLensProvider { static selector: DocumentSelector = [{ scheme: DocumentSchemes.File }, { scheme: DocumentSchemes.Git }, { scheme: DocumentSchemes.GitLensGit }]; - private _debug: boolean; + private _debug: boolean = false; constructor( context: ExtensionContext, diff --git a/src/quickPicks/branches.ts b/src/quickPicks/branches.ts index fa4c92c..5a05122 100644 --- a/src/quickPicks/branches.ts +++ b/src/quickPicks/branches.ts @@ -8,7 +8,7 @@ export class BranchQuickPickItem implements QuickPickItem { label: string; description: string; - detail: string; + detail: string | undefined; constructor( public readonly branch: GitBranch diff --git a/src/quickPicks/branchesAndTags.ts b/src/quickPicks/branchesAndTags.ts index e540b99..e4a695f 100644 --- a/src/quickPicks/branchesAndTags.ts +++ b/src/quickPicks/branchesAndTags.ts @@ -10,7 +10,7 @@ export class BranchOrTagQuickPickItem implements QuickPickItem { label: string; description: string; - detail: string; + detail: string | undefined; constructor( public readonly branchOrTag: GitBranch | GitTag diff --git a/src/quickPicks/common.ts b/src/quickPicks/common.ts index 6a74787..d3abccd 100644 --- a/src/quickPicks/common.ts +++ b/src/quickPicks/common.ts @@ -53,8 +53,8 @@ export interface QuickPickItem extends QuickPickItem { export class CommandQuickPickItem implements QuickPickItem { - label: string; - description: string; + label!: string; + description!: string; detail?: string | undefined; protected command: Commands | undefined; protected args: any[] | undefined; diff --git a/src/quickPicks/repositories.ts b/src/quickPicks/repositories.ts index 32f55f0..e06eb6f 100644 --- a/src/quickPicks/repositories.ts +++ b/src/quickPicks/repositories.ts @@ -9,7 +9,7 @@ export class RepositoryQuickPickItem implements QuickPickItem { label: string; description: string; - detail: string; + detail: string | undefined; constructor( public readonly repository: Repository diff --git a/src/system/searchTree.ts b/src/system/searchTree.ts index 2080bf1..4c47614 100644 --- a/src/system/searchTree.ts +++ b/src/system/searchTree.ts @@ -53,9 +53,9 @@ export class PathIterator implements IKeyIterator { private static readonly _fwd = '/'.charCodeAt(0); private static readonly _bwd = '\\'.charCodeAt(0); - private _value: string; - private _from: number; - private _to: number; + private _value!: string; + private _from!: number; + private _to!: number; reset(key: string): this { this._value = key.replace(/\\$|\/$/, ''); @@ -121,7 +121,7 @@ export class PathIterator implements IKeyIterator { } class TernarySearchTreeNode { - str: string; + str!: string; element: E | undefined; left: TernarySearchTreeNode | undefined; mid: TernarySearchTreeNode | undefined; diff --git a/src/trackers/documentTracker.ts b/src/trackers/documentTracker.ts index f64ed16..1e6fe21 100644 --- a/src/trackers/documentTracker.ts +++ b/src/trackers/documentTracker.ts @@ -38,7 +38,7 @@ export class DocumentTracker extends Disposable { return this._onDidTriggerDirtyIdle.event; } - private _dirtyIdleTriggerDelay: number; + private _dirtyIdleTriggerDelay!: number; private readonly _disposable: Disposable | undefined; private readonly _documentMap: Map> = new Map(); @@ -334,6 +334,7 @@ class MissingRevisionTextDocument implements TextDocument { this.isClosed = false; this.isDirty = false; this.isUntitled = false; + this.languageId = ''; this.lineCount = 0; this.version = 0; } diff --git a/src/trackers/lineTracker.ts b/src/trackers/lineTracker.ts index fbe37b1..916e669 100644 --- a/src/trackers/lineTracker.ts +++ b/src/trackers/lineTracker.ts @@ -91,7 +91,8 @@ export class LineTracker extends Disposable { this._disposable = undefined; } - private _lineChangedDebounced: ((e: LineChangeEvent) => void) & IDeferrable; + private _lineChangedDebounced: (((e: LineChangeEvent) => void) & IDeferrable) | undefined; + private fireLineChanged(e: LineChangeEvent) { if (e.line === undefined) { setImmediate(() => { diff --git a/src/trackers/trackedDocument.ts b/src/trackers/trackedDocument.ts index 8a9ca91..ea5218a 100644 --- a/src/trackers/trackedDocument.ts +++ b/src/trackers/trackedDocument.ts @@ -21,10 +21,10 @@ export class TrackedDocument extends Disposable { state: T | undefined; - private _disposable: Disposable; + private _disposable: Disposable | undefined; private _disposed: boolean = false; private _repo: (Repository | undefined) | Promise; - private _uri: GitUri; + private _uri!: GitUri; constructor( private readonly _document: TextDocument,