Skip to content

[bug] Timer handles typed as number can fail Deno checks on Windows with Node types present #18

Description

@lyrishark

Issue Draft: Timer handles typed as number can fail Deno checks on Windows

Repository: PsycherosAI/Psycheros

Suggested title:

[bug] Timer handles typed as number can fail Deno checks on Windows with Node types present

Summary

Some long-lived timer handles are typed as number | null, but in the local
Windows/Deno workspace with Node ambient types present, setInterval() resolves
to Timeout. That makes type checking fail with:

TS2322 [ERROR]: Type 'Timeout' is not assignable to type 'number'.

Affected areas observed locally

  • packages/psycheros/src/mcp-client/mod.ts
  • packages/psycheros/src/scheduler/scheduler.ts
  • packages/entity-core/src/consolidation/runner.ts

This also blocked unrelated focused checks while validating other patches.

Expected behavior

The code should type-check consistently across Deno environments even when
Node-compatible types influence the timer return type.

Proposed fix

Use ReturnType<typeof setInterval> | null for interval handles rather than
number | null.

Local patch shape:

private tickTimer: ReturnType<typeof setInterval> | null = null;
private pingTimer: ReturnType<typeof setInterval> | null = null;

Local verification

After patching the observed timer handles:

deno check packages/entity-core/src/server.ts packages/entity-core/src/tools/memory.ts packages/entity-core/src/consolidation/runner.ts
deno check packages/psycheros/src/entity/loop.ts packages/psycheros/src/mcp-client/mod.ts packages/psycheros/src/rag/conversation.ts packages/psycheros/src/entity/timestamp.ts packages/psycheros/tests/chat_rag_test.ts
deno task test

Root deno task test passed: 101 tests, 0 failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions