Skip to content

doc: update Deviation's key (string) → path (array)#19

Merged
JakobJingleheimer merged 2 commits into
mainfrom
doc/deviation-key-to-path
Jun 11, 2026
Merged

doc: update Deviation's key (string) → path (array)#19
JakobJingleheimer merged 2 commits into
mainfrom
doc/deviation-key-to-path

Conversation

@JakobJingleheimer

Copy link
Copy Markdown
Member

This was a change we decided on a long time ago; it somehow got missed in all the updates since.

@gibson042 gibson042 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with fixing this ahead of #15, but we should nail down the path element type (string | symbol vs. number | string | symbol) and the iteration result schema.

Comment thread README.md Outdated
Comment thread README.md
Comment on lines 215 to 217
type Deviations = Iterator<
string, // "foo['bar-qux']['zed']"
(number | string | Symbol)[], // ['foo', 1, Symbol('zed')]
{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript defines the parameters of Iterator as <T, TReturn = any, TNext = any>, so this is expressing an iterator that always yields an array of primitives and returns an { actual, expected, reason } object. I think we actually want IterableIterator<Deviation>, where Deviation is { path, actual, expected, … } as in #15.

Comment thread README.md
Comment on lines 440 to +441
Iterator => Iterable(2) {
"foo['bar']" => {
['foo', 'bar'] => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concretely, what are the fat arrows in Iterable(2) { ['foo', 'bar'] => {…}, ['foo', 'bar', 'qux'] => {…} } expressing? Are you envisioning each iteration result being a two-element array in which the first element [path] is itself an array? That seems less useful to me than having the result be a Deviation object with a property named "path".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fat-arrow is just how V8 represents a key-value pair in a Map. Since this is Map-like and I couldn't find a better example for a generic Iterator, I copied the Map representation.

@gibson042 gibson042 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Progress!

@JakobJingleheimer JakobJingleheimer merged commit 5790057 into main Jun 11, 2026
2 checks passed
@JakobJingleheimer JakobJingleheimer deleted the doc/deviation-key-to-path branch June 11, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants