Enable checkJS in media file

This commit is contained in:
Matt Bierner
2021-06-05 22:46:15 -07:00
parent 0abc928d87
commit 176869c1cd
2 changed files with 8 additions and 5 deletions

View File

@ -3,6 +3,8 @@
"module": "commonjs",
"target": "es2020",
"jsx": "preserve",
"checkJs": true,
"strict": true,
"strictFunctionTypes": true,
"lib": [
"dom"

View File

@ -1,18 +1,19 @@
// This script will be run within the webview itself
// It cannot access the main VS Code APIs directly.
(function () {
const vscode = acquireVsCodeApi();
const oldState = vscode.getState();
const oldState = /** @type {{ count: number} | undefined} */ (vscode.getState());
const counter = document.getElementById('lines-of-code-counter');
const counter = /** @type {HTMLElement} */ (document.getElementById('lines-of-code-counter'));
console.log('Initial state', oldState);
let currentCount = (oldState && oldState.count) || 0;
counter.textContent = currentCount;
counter.textContent = `${currentCount}`;
setInterval(() => {
counter.textContent = currentCount++;
counter.textContent = `${currentCount++} `;
// Update state
vscode.setState({ count: currentCount });
@ -33,7 +34,7 @@
switch (message.command) {
case 'refactor':
currentCount = Math.ceil(currentCount * 0.5);
counter.textContent = currentCount;
counter.textContent = `${currentCount}`;
break;
}
});