Start moving html ext to strict mode compile

Moves the html extension's client code to strict mode and also updates some of the server code. The rest of this migration will requires changes to the *.d.ts files that the server consumes
This commit is contained in:
Matt Bierner
2017-11-06 15:19:34 -08:00
parent e5b9b820ef
commit 62aa6cb900
9 changed files with 31 additions and 36 deletions

View File

@@ -32,7 +32,7 @@ export function activate(context: ExtensionContext) {
let toDispose = context.subscriptions;
let packageInfo = getPackageInfo(context);
let telemetryReporter: TelemetryReporter = packageInfo && new TelemetryReporter(packageInfo.name, packageInfo.version, packageInfo.aiKey);
let telemetryReporter: TelemetryReporter | null = packageInfo && new TelemetryReporter(packageInfo.name, packageInfo.version, packageInfo.aiKey);
if (telemetryReporter) {
toDispose.push(telemetryReporter);
}
@@ -166,7 +166,7 @@ export function activate(context: ExtensionContext) {
});
}
function getPackageInfo(context: ExtensionContext): IPackageInfo {
function getPackageInfo(context: ExtensionContext): IPackageInfo | null {
let extensionPackage = require(context.asAbsolutePath('./package.json'));
if (extensionPackage) {
return {

View File

@@ -15,7 +15,7 @@ export function activateTagClosing(tagProvider: (document: TextDocument, positio
updateEnabledState();
window.onDidChangeActiveTextEditor(updateEnabledState, null, disposables);
let timeout: NodeJS.Timer = void 0;
let timeout: NodeJS.Timer | undefined = void 0;
function updateEnabledState() {
isEnabled = false;
@@ -56,13 +56,15 @@ export function activateTagClosing(tagProvider: (document: TextDocument, positio
tagProvider(document, position).then(text => {
if (text && isEnabled) {
let activeEditor = window.activeTextEditor;
let activeDocument = activeEditor && activeEditor.document;
if (document === activeDocument && activeDocument.version === version) {
let selections = activeEditor.selections;
if (selections.length && selections.some(s => s.active.isEqual(position))) {
activeEditor.insertSnippet(new SnippetString(text), selections.map(s => s.active));
} else {
activeEditor.insertSnippet(new SnippetString(text), position);
if (activeEditor) {
let activeDocument = activeEditor.document;
if (document === activeDocument && activeDocument.version === version) {
let selections = activeEditor.selections;
if (selections.length && selections.some(s => s.active.isEqual(position))) {
activeEditor.insertSnippet(new SnippetString(text), selections.map(s => s.active));
} else {
activeEditor.insertSnippet(new SnippetString(text), position);
}
}
}
}

View File

@@ -1,11 +0,0 @@
declare module "color-convert" {
module convert {
module rgb {
function hex(r: number, g: number, b: number);
function hsl(r: number, g: number, b: number);
function hvs(r: number, g: number, b: number);
}
}
export = convert;
}