Skip to content

Derive SparkType union from const assertion #16

@UniquePixels

Description

@UniquePixels

Context

Audit ID: ARCH-3

The `SPARK_TYPES` set in `loader.ts` contains literal strings that must match the `SparkType` union. If a new spark type is added to the union but not the set, `isSpark()` will silently reject valid sparks.

Approach

Derive `SparkType` from a `const` assertion array, and build the Set from the same source of truth. This ensures the union and runtime set can never diverge.

Files

  • `src/core/sparks/loader.ts` (L55-60)
  • Type definition file for `SparkType`

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorCode refactoring and simplification

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions