Enable Typescript noImplicitAny (#33322)

Enable `noImplicitAny` and fix all issues.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind
2025-01-22 08:11:51 +01:00
committed by GitHub
parent 6fe4d1c038
commit c7f4ca2653
63 changed files with 326 additions and 270 deletions

View File

@ -3,6 +3,7 @@ export async function renderAsciicast() {
if (!els.length) return;
const [player] = await Promise.all([
// @ts-expect-error: module exports no types
import(/* webpackChunkName: "asciinema-player" */'asciinema-player'),
import(/* webpackChunkName: "asciinema-player" */'asciinema-player/dist/bundle/asciinema-player.css'),
]);

View File

@ -1,7 +1,9 @@
import {htmlEscape} from 'escape-goat';
type Processor = (el: HTMLElement) => string | HTMLElement | void;
type Processors = {
[tagName: string]: (el: HTMLElement) => string | HTMLElement | void;
[tagName: string]: Processor;
}
type ProcessorContext = {
@ -11,7 +13,7 @@ type ProcessorContext = {
}
function prepareProcessors(ctx:ProcessorContext): Processors {
const processors = {
const processors: Processors = {
H1(el: HTMLElement) {
const level = parseInt(el.tagName.slice(1));
el.textContent = `${'#'.repeat(level)} ${el.textContent.trim()}`;