Typescript v5 + eslint 8.57 WIP

This commit also improves some type handling in the project.
This commit is contained in:
John Livingston
2024-09-07 14:49:27 +02:00
parent 64a9c7be21
commit 7b3d93b290
41 changed files with 2652 additions and 3054 deletions

View File

@ -7,7 +7,7 @@ import { getProsodyDomain } from './domain'
import { getUserNameByChannelId } from '../../database/channel'
import { BotConfiguration } from '../../configuration/bot'
interface Affiliations { [jid: string]: 'outcast' | 'none' | 'member' | 'admin' | 'owner' }
type Affiliations = Record<string, 'outcast' | 'none' | 'member' | 'admin' | 'owner'>
async function _getCommonAffiliations (options: RegisterServerOptions, _prosodyDomain: string): Promise<Affiliations> {
const r: Affiliations = {}

View File

@ -97,7 +97,7 @@ abstract class ProsodyConfigBlock {
if (!this.entries.has(name)) {
this.entries.set(name, [])
}
let entry = this.entries.get(name) as ConfigEntryValue
let entry = this.entries.get(name) ?? []
if (!Array.isArray(entry)) {
entry = [entry]
}
@ -112,7 +112,7 @@ abstract class ProsodyConfigBlock {
if (!this.entries.has(name)) {
return
}
let entry = this.entries.get(name) as ConfigEntryValue
let entry = this.entries.get(name) ?? []
if (!Array.isArray(entry)) {
entry = [entry]
}