Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Nameof operator

$
0
0

Does ReScript have the concept of a nameof operator? Example in F#: Nameof - F# | Microsoft Learn

Something that can print the current value or field name of a symbol.

I’m my code I need to do something like:

type order = {
  isProcessed: bool,
  contact: contactPerson,
  created: milliseconds,
  tickets: array<ticket>,
  food: foodCount,
}

await orderSnapshot->update_field("isProcessed", true)

To update a single value in my Firebase database, I need to pass the name of my field as a string.
It would be great if I could do something like await orderSnapshot->update_field(nameof(isProcessed), true)

Does something like this exist?


Viewing all articles
Browse latest Browse all 2592

Trending Articles