You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at https://tc39.es/proposal-temporal/docs/instant.html#from for example, i don't find the (thing: any) very helpful. I think we can do better here to help users understand what is being passed in. The example below shows only a string being used so why is thing's type not string? Well thats because you can also pass an Instant according to the type declaration.
So maybe we need to match the docs up with the type declarations more? like Temporal.Instant | string
The text was updated successfully, but these errors were encountered:
I guess the uncertainty here is due to the discrepancy between what the function technically accepts and what is recommended to pass. For example, you can pass a number (this actually works in Temporal.PlainDate.from(20210302)) or an object ({ valueOf() { return '2021-03-02T20:29Z'; }}) and they will get converted to strings. But, of course nobody should do this, so it's probably better to document the recommended usage.
…ters
Rename the parameters to dateLike, dateTimeLike, etc. Make clear that they
can be a string, property bag, or instance, but not other types like
number, bigint, etc.
Closes: #1394
ptomato
added a commit
to gibson042/proposal-temporal
that referenced
this issue
Sep 11, 2024
…ters
Rename the parameters to dateLike, dateTimeLike, etc. Make clear that they
can be a string, property bag, or instance, but not other types like
number, bigint, etc.
Closes: tc39#1394
…ters
Rename the parameters to "item" to match the spec text. Make clear that
they can be a string, property bag, or instance, but not other types like
number, bigint, etc.
Closes: #1394
Looking at https://tc39.es/proposal-temporal/docs/instant.html#from for example, i don't find the
(thing: any)
very helpful. I think we can do better here to help users understand what is being passed in. The example below shows only a string being used so why is thing's type notstring
? Well thats because you can also pass an Instant according to the type declaration.So maybe we need to match the docs up with the type declarations more? like
Temporal.Instant | string
The text was updated successfully, but these errors were encountered: