Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation arguments, mainly changing "thing: any" #1394

Open
jasonwilliams opened this issue Feb 26, 2021 · 1 comment
Open

Improve documentation arguments, mainly changing "thing: any" #1394

jasonwilliams opened this issue Feb 26, 2021 · 1 comment
Assignees
Labels
documentation Additions to documentation
Milestone

Comments

@jasonwilliams
Copy link
Member

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

@ptomato
Copy link
Collaborator

ptomato commented Mar 2, 2021

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.

@ptomato ptomato added the documentation Additions to documentation label Mar 2, 2021
@ptomato ptomato added this to the Next milestone Mar 2, 2021
@ptomato ptomato modified the milestones: Next, Post Stage 4 Dec 8, 2022
@ptomato ptomato self-assigned this Sep 10, 2024
ptomato added a commit 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: #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
ptomato added a commit that referenced this issue Sep 19, 2024
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants