@@ -744,10 +744,10 @@ export function ToTemporalDateTimeRoundingIncrement(
744
744
smallestUnit : keyof TemporalDateTimeRoundingMaximumIncrements
745
745
) {
746
746
const maximumIncrements : TemporalDateTimeRoundingMaximumIncrements = {
747
- year : undefined as number | undefined ,
748
- month : undefined as number | undefined ,
749
- week : undefined as number | undefined ,
750
- day : undefined as number | undefined ,
747
+ year : undefined ,
748
+ month : undefined ,
749
+ week : undefined ,
750
+ day : undefined ,
751
751
hour : 24 ,
752
752
minute : 60 ,
753
753
second : 60 ,
@@ -782,7 +782,7 @@ export function ToSecondsStringPrecision(options: Temporal.ToStringPrecisionOpti
782
782
if ( typeof digits !== 'number' ) {
783
783
const stringDigits = ToString ( digits ) ;
784
784
if ( stringDigits === 'auto' ) return { precision : 'auto' , unit : 'nanosecond' , increment : 1 } ;
785
- throw new RangeError ( `fractionalSecondDigits must be 'auto' or 0 through 9, not ${ digits } ` ) ;
785
+ throw new RangeError ( `fractionalSecondDigits must be 'auto' or 0 through 9, not ${ stringDigits } ` ) ;
786
786
}
787
787
if ( NumberIsNaN ( digits ) || digits < 0 || digits > 9 ) {
788
788
throw new RangeError ( `fractionalSecondDigits must be 'auto' or 0 through 9, not ${ digits } ` ) ;
@@ -808,6 +808,21 @@ export function ToSecondsStringPrecision(options: Temporal.ToStringPrecisionOpti
808
808
}
809
809
}
810
810
811
+ export function ToLargestTemporalUnit < Allowed extends Temporal . DateTimeUnit , Disallowed extends Temporal . DateTimeUnit > (
812
+ options : { largestUnit ?: Temporal . LargestUnitOption < Allowed > } ,
813
+ fallback : Allowed | 'auto' ,
814
+ disallowedStrings ?: ReadonlyArray < Disallowed >
815
+ ) : Allowed | 'auto' ;
816
+ export function ToLargestTemporalUnit <
817
+ Allowed extends Temporal . DateTimeUnit ,
818
+ Disallowed extends Temporal . DateTimeUnit ,
819
+ IfAuto extends Allowed | undefined = Allowed
820
+ > (
821
+ options : { largestUnit ?: Temporal . LargestUnitOption < Allowed > } ,
822
+ fallback : Allowed | 'auto' ,
823
+ disallowedStrings : ReadonlyArray < Disallowed > ,
824
+ autoValue ?: IfAuto
825
+ ) : Allowed ;
811
826
export function ToLargestTemporalUnit <
812
827
Allowed extends Temporal . DateTimeUnit ,
813
828
Disallowed extends Temporal . DateTimeUnit ,
@@ -880,7 +895,8 @@ export function ToRelativeTemporalObject(options: {
880
895
| undefined ;
881
896
} ) : Temporal . ZonedDateTime | Temporal . PlainDateTime | undefined {
882
897
const relativeTo = options . relativeTo ;
883
- // TODO: file a bug against TypeScript because `as undefined` below should not be needed.
898
+ // TODO: `as undefined` below should not be needed. Verify that it can be
899
+ // removed after strictNullChecks is enabled.
884
900
if ( relativeTo === undefined ) return relativeTo as undefined ;
885
901
886
902
let offsetBehaviour : OffsetBehaviour = 'option' ;
0 commit comments