Skip to content

[Audit] LOW: TypeScript import path warnings (noEmit errors) #9

@NickCalabs

Description

@NickCalabs

Severity: LOW

Description

Running tsc --noEmit produces 40 errors about import paths ending with .ts extensions. While this doesn't break runtime (Node.js handles it), it indicates the tsconfig may need adjustment.

Sample Errors

src/agents.ts(4,23): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.
src/daemon.ts(4,83): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.

Root Cause

Imports like:

import { getDb } from "./state.ts";

TypeScript expects either:

  1. No extension: import { getDb } from "./state";
  2. Or with "allowImportingTsExtensions": true in tsconfig

Current State

  • Project uses "type": "module" in package.json
  • Imports have .ts extensions for ESM compatibility
  • Node.js with --experimental-strip-types handles this correctly at runtime
  • But TypeScript compiler complains

Impact

  • IDE errors/warnings (depending on editor)
  • tsc --noEmit returns non-zero exit code
  • Could break CI if type checking is added
  • Confusing for contributors

Recommendation

Add to tsconfig.json:

{
  "compilerOptions": {
    "allowImportingTsExtensions": true,
    "noEmit": true,
    // ... existing options
  }
}

This tells TypeScript to allow .ts extensions in imports when noEmit is true (since we're using runtime stripping, not tsc for compilation).

Alternative

If you want tsc to compile (not just check), remove .ts extensions and use:

{
  "compilerOptions": {
    "module": "node16" or "nodenext",
    "moduleResolution": "node16" or "nodenext"
  }
}

Then imports would be from "./state.js" (note .js not .ts).

Related Files

All imports in:

  • src/agents.ts
  • src/daemon.ts
  • src/index.ts
  • src/ollama.ts
  • src/runner.ts
  • src/scheduler.ts
  • src/server.ts
  • src/state.ts
  • src/tools/discovery.ts
  • src/tools/registry.ts
  • src/traces.ts
  • All test files

Created by security audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions