Skip to content

add Bun.YAML.parse to types - #22129

Merged
alii merged 2 commits into
mainfrom
dylan/yaml-types
Aug 26, 2025
Merged

alii merged 2 commits into
mainfrom
dylan/yaml-types

Conversation

@dylan-conway

Copy link
Copy Markdown
Member

What does this PR do?

How did you verify your code works?

@dylan-conway
dylan-conway requested a review from alii August 25, 2025 18:30
@robobun

robobun commented Aug 25, 2025 •

Copy link
Copy Markdown
Collaborator

@kravetsone

Copy link
Copy Markdown

What about generic

@alii

alii commented Aug 25, 2025

Copy link
Copy Markdown
Member

@kravetsone We're going with unknown for now, for two reasons:

  • Familiarity with JSON.parse (not exactly, but developers often do JSON.parse(val) as MyType, which would be the same here.
  • Gives us the option to change it in the future with minimal breakages to existing consumers

We considered the generic approach of parse<T = unknown>(value: string): T but it's basically the same as casting but a less familiar API, while being equally-unsafe.

@kravetsone

Copy link
Copy Markdown

@kravetsone We're going with unknown for now, for two reasons:

  • Familiarity with JSON.parse (not exactly, but developers often do JSON.parse(val) as MyType, which would be the same here.
  • Gives us the option to change it in the future with minimal breakages to existing consumers

We considered the generic approach of parse<T = unknown>(value: string): T but it's basically the same as casting but a less familiar API, while being equally-unsafe.

Thanks! Yea I guess as approach is good enough for this

@alii
alii merged commit b99bbe7 into main Aug 26, 2025
58 of 62 checks passed
@alii
alii deleted the dylan/yaml-types branch August 26, 2025 00:03
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.

4 participants