Skip to content

Commit

Permalink
chore: adjustments for typing
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Feb 9, 2025
1 parent 05f75ed commit 65cde3b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
6 changes: 1 addition & 5 deletions packages/registry/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { compare, intersects } from 'semver'
import { Awaitable, defineProperty, Dict, Time } from 'cosmokit'
import { Awaitable, defineProperty, Dict, isNonNullable, Time } from 'cosmokit'
import { Registry, RemotePackage, SearchObject, SearchResult } from './types'
import { conclude } from './utils'
import pMap from 'p-map'
Expand Down Expand Up @@ -157,7 +157,3 @@ export default class Scanner {
return result.filter(isNonNullable)
}
}

function isNonNullable<T>(value: T): value is Exclude<T, null | undefined | void> {
return value !== null && value !== undefined
}
2 changes: 1 addition & 1 deletion plugins/config/src/shared/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export class ConfigWriter extends DataService<Context.Config> {
fork.parent = parentT.ctx
Object.setPrototypeOf(fork.ctx, parentT.ctx)
fork.ctx.emit('internal/fork', fork)
if (fork.runtime.using.some(name => parentS[name] !== parentT[name])) {
if (Object.keys(fork.runtime.inject).some(name => parentS[name] !== parentT[name])) {
fork.restart()
}
}
Expand Down
3 changes: 2 additions & 1 deletion plugins/console/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ interface HeartbeatConfig {
}

class NodeConsole extends Console {
static inject = ['server']
static inject = { required: ['server'], optional: ['console'] }
// static inject = ['server']

// workaround for edge case (collision with @koishijs/plugin-config)
private _config: NodeConsole.Config
Expand Down
2 changes: 1 addition & 1 deletion plugins/logger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export async function apply(ctx: Context, config: Config) {
record.meta ||= {}
const scope = record.meta[Context.current]?.scope
if (loader && scope) {
record.meta.paths = loader.paths(scope)
record.meta['paths'] = loader.paths(scope)
}
const date = new Date(record.timestamp).toISOString().slice(0, 10)
if (writer.date !== date) {
Expand Down
2 changes: 2 additions & 0 deletions plugins/notifier/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export namespace Notifier {
}

class NotifierService extends Service {
static inject = { optional: ['notifier'] }

public store: Notifier[] = []
public actions: Dict<() => void> = Object.create(null)
public entry?: Entry<NotifierService.Data>
Expand Down

0 comments on commit 65cde3b

Please sign in to comment.