MBCHC/ambient.d.ts
Mute 16308eccf1 105.13.0 semver; settings migration
[lots of internal change]
I'm determined to clean this mess up after all.
Instead of a total rewrite (which didn't work), I'll migrate the
code to JSDoc piece by piece. This is the first piece, setting up
some basic framework and testing out this and that.
Until I figure out how test this thing, I'll just ask peeps to import
the module from testing branch I guess.
Probably not gonna deal with anything new until I can turn "strict" on.
2024-07-13 21:55:45 +00:00

63 lines
2.1 KiB
TypeScript

interface ServerChatRoomMessage {
MBCHC_ID?: number
}
declare namespace MBCHC {
type WGT = Window & typeof globalThis
interface Root extends WGT {
MBCHC?: any
bcModSdk?: import('bondage-club-mod-sdk').ModSDKGlobalAPI
bce_ActivityTriggers?: any
bce_EventExpressions?: any
}
namespace Settings {
type V0 = PlayerOnlineSettings & {MBCHC: {timezones?: Record<number, number>}} // V0 is the whole onlinesettings
interface V1 { // V1 is specifically MBCHC inside extensionsettings
TZ: Record<number, number>
}
interface Methods {
migrate_0_1(v0: V0): true
save(cb?: (v1: V1) => unknown): true
replace(new_v1: V1): true
'purge!'(): true
get v1(): V1
}
}
interface Interval {
proxy: object // eslint-disable-line @typescript-eslint/ban-types
min: number
max: number
mini: boolean
maxi: boolean
upd(min: number, max: number, min_inclusive?: boolean, max_inclusive?: boolean): undefined
has(_: unknown, x: string): boolean
}
interface Utils {
interval: Interval
cid(character: Character): number | undefined
dn(character: Character): string
current(): string
with<V, R>(value: V, cb: (value: V) => R): R // A silly helper to kinda curry values
true<F extends (...args: unknown[]) => unknown>(cb: F): true // Useful for type-safe chaining
mutate<T>(value: T, cb: (v: T) => unknown): T // A silly helper for chaining
rm<T>(object: T, property: keyof T): T
mrg<T extends Record<string, unknown>>(target: T, ...source: T[]): T // Shorter, also less confusing with types
style<T>(query: string, cb: (s: CSSStyleDeclaration) => T): T | undefined
range(min: number, max: number, min_inclusive?: boolean, max_inclusive?: boolean): Proxy
assert<T>(error: string, value: T, cb?: (value: T) => boolean): T | never
each<T extends Record<string, unknown>>(object: T, cb: (key: string, value: unknown) => unknown): true
}
interface TZ_Cache {
map: Map<number, number>
RE: RegExp
for(character: Character): number | undefined
memo(member_number: number, description?: string | undefined): number | undefined
parse(description: string | undefined): number | undefined
}
}