Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix typescript tests

Chocobozzzdb06d13c6747
diff --git a/.mocharc.cjs b/.mocharc.cjs
index 34c841811f..a9ed4037c2 100644
--- a/.mocharc.cjs
+++ b/.mocharc.cjs
@@ -2,7 +2,7 @@ process.env.TSX_TSCONFIG_PATH = './packages/tests/tsconfig.json'
module.exports = {
"node-option": [
- "loader=tsx",
+ "import=tsx",
"no-warnings",
"conditions=peertube:tsx"
],
diff --git a/package.json b/package.json
index 3214241775..f325800ef2 100644
--- a/package.json
+++ b/package.json
@@ -244,7 +244,7 @@
"swagger-cli": "^4.0.2",
"tsc-watch": "^6.0.0",
"tsx": "^4.7.1",
- "typescript": "~5.3.3"
+ "typescript": "~5.2"
},
"bundlewatch": {
"files": [
diff --git a/packages/server-commands/src/server/jobs.ts b/packages/server-commands/src/server/jobs.ts
index 32b09755d7..eca2a865aa 100644
--- a/packages/server-commands/src/server/jobs.ts
+++ b/packages/server-commands/src/server/jobs.ts
@@ -1,5 +1,5 @@
import { expect } from 'chai'
-import { wait } from '@peertube/peertube-core-utils'
+import { arrayify, wait } from '@peertube/peertube-core-utils'
import { JobState, JobType, RunnerJobState } from '@peertube/peertube-models'
import { PeerTubeServer } from './server.js'
@@ -16,10 +16,7 @@ async function waitJobs (
? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10)
: 250
- let servers: PeerTubeServer[]
-
- if (Array.isArray(serversArg) === false) servers = [ serversArg ]
- else servers = serversArg
+ const servers = arrayify(serversArg)
const states: JobState[] = [ 'waiting', 'active' ]
if (!skipDelayed) states.push('delayed')
diff --git a/server/core/helpers/markdown.ts b/server/core/helpers/markdown.ts
index a88cfd4a26..e88ff11d21 100644
--- a/server/core/helpers/markdown.ts
+++ b/server/core/helpers/markdown.ts
@@ -1,5 +1,7 @@
import MarkdownItClass from 'markdown-it'
-import markdownItEmoji from 'markdown-it-emoji/lib/light.mjs'
+// FIXME: use direct import: import markdownItEmoji from 'markdown-it-emoji/lib/light.mjs' if it improves perf'
+// when https://github.com/privatenumber/tsx/issues/334 is fixed
+import { light as markdownItEmoji } from 'markdown-it-emoji'
import sanitizeHtml from 'sanitize-html'
import { getDefaultSanitizeOptions, getTextOnlySanitizeOptions, TEXT_WITH_HTML_RULES } from '@peertube/peertube-core-utils'
diff --git a/server/core/middlewares/async.ts b/server/core/middlewares/async.ts
index d4dfa9b463..e1483ed091 100644
--- a/server/core/middlewares/async.ts
+++ b/server/core/middlewares/async.ts
@@ -15,7 +15,7 @@ function asyncMiddleware (fun: RequestPromiseHandler | RequestPromiseHandler[])
}
try {
- for (const f of fun) {
+ for (const f of (fun as RequestPromiseHandler[])) {
await new Promise<void>((resolve, reject) => {
return asyncMiddleware(f)(req, res, err => {
if (err) return reject(err)
diff --git a/yarn.lock b/yarn.lock
index 4a4ce77b6a..251aff9212 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10264,10 +10264,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
-typescript@~5.3.3:
- version "5.3.3"
- resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37"
- integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==
+typescript@~5.2:
+ version "5.2.2"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
+ integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
uc.micro@^2.0.0:
version "2.0.0"