Skip to content

Conversation

@frantic1048
Copy link

Labeled tuple is introduced in TypeScript 4.0, which was released in 2020. Compatibility should be fine.

References:

  • Official documentation for labeled tuple: link
  • Example Range type with labeled tuple on TypeScript Playground: link

Copy link
Owner

@eemeli eemeli left a comment

Choose a reason for hiding this comment

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

Sounds like a good idea in general, though the current compatibility is with TS 3.9 and later:

yaml/README.md

Lines 17 to 19 in 92821f2

The minimum supported TypeScript version of the included typings is 3.9;
for use in earlier versions you may need to set `skipLibCheck: true` in your config.
This requirement may be updated between minor versions of the library.

Note the last line there; this can change in a minor release. So I'm tempted to accept this, provided that the readme and the CI tests are also updated, but hold off on putting out a release that includes this for a short bit, in case I do actually start properly working on the 3.0 release -- if that advances, introducing this sort-of-breaking-ish change into 2.x is not worthwhile.

@frantic1048 frantic1048 force-pushed the dev/labeled-tuple-for-range-type branch from d1e2f02 to 7873591 Compare December 23, 2025 07:43
@frantic1048
Copy link
Author

I understand your concern, especially considering that typescript@3.9 still has ~2M downloads/week (as of Dec 2025). Since this is a subtle change that doesn't affect the core usage of the library, it is reasonable to prioritize compatibility over these enhancements for now.

I just updated the branch to match the current TypeScript tests and ensure CI passes. Feel free to pick this change whenever you feel the time is right :)

Copy link
Owner

@eemeli eemeli left a comment

Choose a reason for hiding this comment

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

The main branch now contains other breaking changes, including an update to depending on TS 5.9 or later, so this fix can and should be merged.

See inline for a small remaining fix though, as the code comment is now unnecessary.

@@ -43,7 +43,7 @@ export type ParsedNode =
| YAMLSeq.Parsed

/** `[start, value-end, node-end]` */
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
/** `[start, value-end, node-end]` */

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.

2 participants