From 37c62c53e9c7725e3b4cbb6459ff89a10a5d381d Mon Sep 17 00:00:00 2001 From: nanaya Date: Thu, 19 Dec 2024 18:49:14 +0900 Subject: [PATCH] Explicit typescript types and rename webpack define const --- resources/js/globals.d.ts | 12 ++---------- resources/js/legacy-api-key/form.tsx | 2 +- resources/js/oauth/new-client.tsx | 2 +- tsconfig.json | 7 +++++++ webpack.config.js | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/resources/js/globals.d.ts b/resources/js/globals.d.ts index 5af77fe4d0d..8dd779546cc 100644 --- a/resources/js/globals.d.ts +++ b/resources/js/globals.d.ts @@ -35,16 +35,8 @@ interface Window { } // #endregion -// #region interfaces for using process.env -interface Process { - env: ProcessEnv; -} - -interface ProcessEnv { - [key: string]: string | undefined; -} - -declare const process: Process; +// #region defined through webpack DefinePlugin +declare const docsUrl: string; // #endregion // our helpers diff --git a/resources/js/legacy-api-key/form.tsx b/resources/js/legacy-api-key/form.tsx index f9c561d7694..9173cef1114 100644 --- a/resources/js/legacy-api-key/form.tsx +++ b/resources/js/legacy-api-key/form.tsx @@ -72,7 +72,7 @@ export default class Form extends React.Component {
+ {trans('oauth.new_client.terms_of_use.link')} ) }} diff --git a/resources/js/oauth/new-client.tsx b/resources/js/oauth/new-client.tsx index a06df20f383..628098e9f96 100644 --- a/resources/js/oauth/new-client.tsx +++ b/resources/js/oauth/new-client.tsx @@ -82,7 +82,7 @@ export class NewClient extends React.Component {
+ {trans('oauth.new_client.terms_of_use.link')} ) }} diff --git a/tsconfig.json b/tsconfig.json index 30a6635ec83..8529796a5c6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,6 +14,13 @@ "strictNullChecks": true, "strictPropertyInitialization": true, "target": "es2015", + "types": [ + "cloudflare-turnstile", + "jquery.fileupload", + "jquery.scrollto", + "jqueryui", + "timeago" + ], "useDefineForClassFields": true }, "include": [ diff --git a/webpack.config.js b/webpack.config.js index 7d6c8874b82..5c9593eb7bf 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -94,7 +94,7 @@ const plugins = [ ReactDOM: 'react-dom', }), new webpack.DefinePlugin({ - 'process.env.DOCS_URL': JSON.stringify(process.env.DOCS_URL || 'https://docs.ppy.sh'), + docsUrl: JSON.stringify(process.env.DOCS_URL ?? 'https://docs.ppy.sh'), }), new webpack.IgnorePlugin({ // don't add moment locales to bundle.