-
Notifications
You must be signed in to change notification settings - Fork 159
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
TypeScript signatures in the documentation #1607
Comments
The current index.d.ts of the polyfill does this and defines them like so: proposal-temporal/polyfill/index.d.ts Lines 1318 to 1332 in 51310e4
TS offers the ability to derive types, so a |
Thanks for the report! To be honest, I've always considered the types in the documentation to be "TypeScript-ish", rather than correct TypeScript, in the sense that the docs use a fairly well-known syntax to indicate the types, but the text clarifies things that would otherwise be verbose to express in the type syntax. So, you're correct that it is a bit sloppy. This we probably wouldn't fix, because the documentation is migrating to MDN (see #1449) and they don't use this TypeScript-ish notation anyway. I believe the discrepancy with strings is a bug, see #1422. The instance names are probably a holdover from when the types were named Temporal.DateTime etc. Pull requests to fix this are welcome. |
Going to close this; to me it seems like a matter of taste whether the names of the Anyone should still feel free to reopen this and submit a PR to the docs if they feel like doing the work; it's just that I'm not intending to do it. |
This seems to be the most common pattern for “like” objects:
Occasionally, parameter names and/or types diverge from this pattern:
I’d prefer a more precise type because that makes the concept of “likeness” completely clear. But that may be too verbose for this documentation:
This is a nitpick, but the instance names are derived differently:
Temporal.ZonedDateTime
→zonedDateTime.year
Temporal.PlainDateTime
→datetime.year
Temporal.PlainYearMonth
→yearMonth.year
The text was updated successfully, but these errors were encountered: