From fab66387be55ffdc9877232f72a8bfa0b685f849 Mon Sep 17 00:00:00 2001 From: tyfkda Date: Wed, 2 Oct 2024 15:38:34 +0900 Subject: [PATCH] Use 'default as' import --- package-lock.json | 8 ++++++++ package.json | 1 + src/@types/stats-js.d.ts | 21 +++++++++++++++++++++ src/app/key_config_wnd.ts | 3 +-- src/app/other_wnd.ts | 3 +-- 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 src/@types/stats-js.d.ts diff --git a/package-lock.json b/package-lock.json index f193e2b..fc76130 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "@babel/core": "~7.23.2", "@babel/preset-env": "~7.23.2", "@babel/register": "~7.22.15", + "@types/escape-html": "~1.0.4", "@types/fscreen": "~1.0.3", "@types/jest": "~29.5.1", "@types/md5": "~2.3.4", @@ -2885,6 +2886,13 @@ "@types/node": "*" } }, + "node_modules/@types/escape-html": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/escape-html/-/escape-html-1.0.4.tgz", + "integrity": "sha512-qZ72SFTgUAZ5a7Tj6kf2SHLetiH5S6f8G5frB2SPQ3EyF02kxdyBFf4Tz4banE3xCgGnKgWLt//a6VuYHKYJTg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", diff --git a/package.json b/package.json index 80052dc..2bc67dc 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@babel/core": "~7.23.2", "@babel/preset-env": "~7.23.2", "@babel/register": "~7.22.15", + "@types/escape-html": "~1.0.4", "@types/fscreen": "~1.0.3", "@types/jest": "~29.5.1", "@types/md5": "~2.3.4", diff --git a/src/@types/stats-js.d.ts b/src/@types/stats-js.d.ts new file mode 100644 index 0000000..7eea419 --- /dev/null +++ b/src/@types/stats-js.d.ts @@ -0,0 +1,21 @@ +// Type definitions for Stats.js 0.16.0 +// Project: http://github.com/mrdoob/stats.js +// Definitions by: Gregory Dalton , Harm Berntsen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// declare class Stats { +// REVISION: number; +// dom: HTMLDivElement; + +// /** +// * @param value 0:fps, 1: ms, 2: mb, 3+: custom +// */ +// showPanel(value: number): void; +// begin(): void; +// end(): number; +// update(): void; +// } + +declare module "stats-js" { + export = any; //Stats; +} diff --git a/src/app/key_config_wnd.ts b/src/app/key_config_wnd.ts index 305c442..923556d 100644 --- a/src/app/key_config_wnd.ts +++ b/src/app/key_config_wnd.ts @@ -7,8 +7,7 @@ import {WindowManager} from '../wnd/window_manager' import {Wnd} from '../wnd/wnd' import {WndEvent} from '../wnd/types' -// import * as escape from 'escape-html' -const escape = require('escape-html') // eslint-disable-line @typescript-eslint/no-var-requires +import {default as escape} from 'escape-html' interface GamepadButtonOption { width?: number diff --git a/src/app/other_wnd.ts b/src/app/other_wnd.ts index 06b0977..4c7143d 100644 --- a/src/app/other_wnd.ts +++ b/src/app/other_wnd.ts @@ -14,8 +14,7 @@ import {AppEvent} from './app_event' import {Util} from '../util/util' import * as Pubsub from '../util/pubsub' -// import * as Stats from 'stats-js' -const Stats = require('stats-js') // eslint-disable-line @typescript-eslint/no-var-requires +import {default as Stats} from 'stats-js' import aboutHtmlContent from '../res/about.html'