Skip to content

ParseError when matching against a [string, {[string]: unknown}] #1445

Closed

Description

@gwennlbh

Report a bug

🔎 Search Terms

intersection of distinct morphs

🧩 Context

  • ArkType version: 2.1.20

  • TypeScript version (5.1+): I'm not sure, VSCode's? theres no type-level errors anyways

  • Other context you think may be relevant (JS flavor, OS, etc.): Plain JS (with JSDoc) file

  • System:

    • OS: Windows 11 10.0.22631
    • CPU: (12) x64 AMD Ryzen 5 1600 Six-Core Processor
    • Memory: 3.70 GB / 15.95 GB
  • Binaries:

    • Node: 22.15.0 - ~\AppData\Local\Volta\tools\image\node\22.15.0\node.EXE
    • npm: 11.3.0 - ~\AppData\Local\Volta\tools\image\npm\11.3.0\bin\npm.CMD
    • pnpm: 10.8.0 - C:\Program Files\Volta\pnpm.EXE
  • npmPackages:

    • @ark/schema: 0.46.0
    • @ark/util: 0.46.0
    • arktype: ^2.1.20 => 2.1.20
    • typescript: ^5.8.3 => 5.8.3

🧑‍💻 Repro

Playground Link: https://arktype.io/playground?code=import%2520%257B%2520type%252C%2520match%2520%257D%2520from%2520%2522arktype%2522%250A%250Aconst%2520Dir%2520%253D%2520type%28%257B%27%255Bstring%255D%27%253A%2520%27string%27%257D%29%250Aconst%2520out%2520%253D%2520match.case%28%255B%27string%27%252C%2520%27string%27%255D%252C%2520%28%29%2520%253D%253E%2520-1%29.case%28%255B%27string%27%252C%2520Dir%2520%255D%252C%2520%28%29%2520%253D%253E%25201%29.default%28%28%29%2520%253D%253E%25200%29%28%250A%2520%2520%2520%2520%255B%27hello%27%252C%2520%257Btest%253A%2520%2522yikes%2522%257D%255D%250A%29%250A%250A

import { type, match } from "arktype";

const Dir = type({ '[string]': 'unknown' });

out = [{Cropped: ['Allacma fusca_1.JPEG']}, 'analysis.json'].sort((a, b) =>
	match
		// Sort directories before files
		.case(['string', Dir], () => -1)
		.case([Dir, 'string'], () => 1)
		.case(['string', 'string'], ([a, b]) => a.localeCompare(b))
		.case([Dir, Dir], ([a, b]) => {
			const aName = Object.keys(a)[0];
			const bName = Object.keys(b)[0];
			return aName.localeCompare(bName);
		})
		.default(() => 0)([a, b])
);

Activity

  1. added 3 commits that reference this issue on Oct 13, 2026
    9987af9
    0ef47b2
    b8f064f
  2. ssalbdivad commented on Nov 18, 2026

    @ssalbdivad
    Member

    Fixed in 3.0.0-beta.0 (#1728). Try it with npm i arktype@next.

  3. moved this from To do to Done (merged or closed) in arktypeioon Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

  • Status
    Done (merged or closed)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions