-
Notifications
You must be signed in to change notification settings - Fork 35
RFC: Fix null-check stuff #103
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ tsc-out/ | |
.vscode/* | ||
!.vscode/launch.json | ||
*.tgz | ||
.DS_STORE | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { DEBUG } from './debug'; | ||
import * as ES from './ecmascript'; | ||
import { GetIntrinsic, MakeIntrinsicClass, DefineIntrinsic } from './intrinsicclass'; | ||
import { MakeIntrinsicClass, DefineIntrinsic } from './intrinsicclass'; | ||
import { | ||
CALENDAR_ID, | ||
ISO_YEAR, | ||
|
@@ -28,6 +28,7 @@ import type { | |
CalendarReturn as Return, | ||
FieldRecord | ||
} from './internaltypes'; | ||
import { Duration } from './duration'; | ||
|
||
const ArrayIncludes = Array.prototype.includes; | ||
const ArrayPrototypePush = Array.prototype.push; | ||
|
@@ -117,7 +118,7 @@ export class Calendar implements Temporal.Calendar { | |
return ES.ToString(this); | ||
} | ||
dateFromFields( | ||
fields: Params['dateFromFields'][0], | ||
fields?: Params['dateFromFields'][0], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Also, if |
||
optionsParam: Params['dateFromFields'][1] = undefined | ||
): Return['dateFromFields'] { | ||
if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver'); | ||
|
@@ -178,7 +179,7 @@ export class Calendar implements Temporal.Calendar { | |
if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver'); | ||
const date = ES.ToTemporalDate(dateParam); | ||
const duration = ES.ToTemporalDuration(durationParam); | ||
const options = ES.GetOptionsObject(optionsParam); | ||
const options = ES.GetOptionsObject<Temporal.ArithmeticOptions>(optionsParam); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this explicit type parameter needed? Can't the type be inferred by TS from the type of |
||
const overflow = ES.ToTemporalOverflow(options); | ||
const { days } = ES.BalanceDuration( | ||
GetSlot(duration, DAYS), | ||
|
@@ -216,7 +217,6 @@ export class Calendar implements Temporal.Calendar { | |
'day' | ||
); | ||
const { years, months, weeks, days } = impl[GetSlot(this, CALENDAR_ID)].dateUntil(one, two, largestUnit); | ||
const Duration = GetIntrinsic('%Temporal.Duration%'); | ||
return new Duration(years, months, weeks, days, 0, 0, 0, 0, 0, 0); | ||
} | ||
year(dateParam: Params['year'][0]): Return['year'] { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a newline at the end of this line. I think
npm run fix
should automatically add it. If it doesn't, then you might want to tweak thenpm run fix
command line args. 😄