Enable strict mode for many samples

This commit is contained in:
Matt Bierner
2019-05-10 14:34:54 -07:00
parent 9974850d29
commit 03cf5fa9f1
40 changed files with 155 additions and 96 deletions

View File

@ -17,7 +17,7 @@ export function activate(context: ExtensionContext) {
context.subscriptions.push(workspace.onDidChangeWorkspaceFolders(e => updateStatus(status)));
// Update status bar item based on events for configuration
context.subscriptions.push(workspace.onDidChangeConfiguration(e => this.updateStatus(status)));
context.subscriptions.push(workspace.onDidChangeConfiguration(e => updateStatus(status)));
// Update status bar item based on events around the active editor
context.subscriptions.push(window.onDidChangeActiveTextEditor(e => updateStatus(status)));
@ -30,9 +30,9 @@ export function activate(context: ExtensionContext) {
function updateStatus(status: StatusBarItem): void {
const info = getEditorInfo();
status.text = info ? info.text : void 0;
status.tooltip = info ? info.tooltip : void 0;
status.color = info ? info.color : void 0;
status.text = info ? info.text || '' : '';
status.tooltip = info ? info.tooltip : undefined;
status.color = info ? info.color : undefined;
if (info) {
status.show();
@ -41,7 +41,7 @@ function updateStatus(status: StatusBarItem): void {
}
}
function getEditorInfo(): { text: string; tooltip: string; color: string; } {
function getEditorInfo(): { text?: string; tooltip?: string; color?: string; } | null {
const editor = window.activeTextEditor;
// If no workspace is opened or just a single folder, we return without any status label
@ -50,9 +50,9 @@ function getEditorInfo(): { text: string; tooltip: string; color: string; } {
return null;
}
let text: string;
let tooltip: string;
let color: string;
let text: string | undefined;
let tooltip: string | undefined;
let color: string | undefined;
// If we have a file:// resource we resolve the WorkspaceFolder this file is from and update
// the status accordingly.

View File

@ -5,7 +5,8 @@
"outDir": "out",
"lib": ["es6"],
"sourceMap": true,
"rootDir": "."
"rootDir": ".",
"strict": true
},
"exclude": ["node_modules", ".vscode-test"]
}