Enable strict

This commit is contained in:
Will Scullin 2023-08-06 12:47:43 -07:00
parent 88bd7836bc
commit 0216e75e7f
4 changed files with 462 additions and 624 deletions

View File

@ -22,8 +22,8 @@ import type { byte } from './types';
*/
export class TextPage {
_page: ImageData;
_context: CanvasRenderingContext2D;
_page: ImageData | undefined;
_context: CanvasRenderingContext2D | undefined;
_buffer: byte[][] = [];
_greenMode = false;
@ -98,6 +98,9 @@ export class TextPage {
this.refresh();
}
writeAt(row: byte, col: byte, val: byte): void {
if (!this._page) {
return;
}
this._buffer[row][col] = val;
const data = this._page.data;
let color;
@ -169,6 +172,9 @@ export class TextPage {
this.refresh();
}
blit() {
if (!this._page || !this._context) {
return;
}
if (this._dirty) {
this._context.putImageData(
this._page,

File diff suppressed because it is too large Load Diff

View File

@ -214,19 +214,17 @@ export class KeyBoard {
return span;
}
const _mouseup = (
event: MouseEvent & {
currentTarget: HTMLElement;
const _mouseup = (event: Event) => {
if (!(event.currentTarget instanceof HTMLElement)) {
return;
}
) => {
event.currentTarget.classList.remove('pressed');
};
const _mousedown = (
event: MouseEvent & {
currentTarget: HTMLElement;
const _mousedown = (event: Event) => {
if (!(event.currentTarget instanceof HTMLElement)) {
return;
}
) => {
event.currentTarget.classList.add('pressed');
let key = event.currentTarget.dataset[this.shifted ? 'key2' : 'key1'];
if (!key) {
@ -262,7 +260,7 @@ export class KeyBoard {
case 'SHIFT':
this.shifted = !this.shifted;
this.kb
.querySelectorAll('.key-SHIFT')
.querySelectorAll<HTMLElement>('.key-SHIFT')
.forEach(function (el: HTMLElement) {
el.classList.toggle('active');
});

View File

@ -8,15 +8,13 @@
"allowSyntheticDefaultImports": true,
"target": "es6",
"lib": ["DOM", "ES6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"exactOptionalPropertyTypes": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"sourceMap": true,
"strictNullChecks": true,
"outDir": "dist",
"baseUrl": ".",
"allowJs": true,