From 80487926fb764fcacddf8b560dfa551f2f2eb1e7 Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Tue, 21 Jun 2022 16:26:37 -0600 Subject: [PATCH] rename ToScientificNotationOptions, pick options instead of duplicating their definitions, https://github.com/phetsims/scenery-phet/issues/747 --- js/ScientificNotationNode.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/js/ScientificNotationNode.ts b/js/ScientificNotationNode.ts index aba8970d8..82a1b3cb7 100644 --- a/js/ScientificNotationNode.ts +++ b/js/ScientificNotationNode.ts @@ -42,12 +42,9 @@ type SelfOptions = { export type ScientificNotationNodeOptions = SelfOptions & StrictOmit; // options for toScientificNotation -export type ScientificNotationOptions = { - mantissaDecimalPlaces: number; - exponent: number | null; // specific exponent to use -}; +export type ToScientificNotationOptions = Pick; -// type returned by toScientificNotation +// return type of toScientificNotation export type ScientificNotation = { mantissa: string; exponent: string; @@ -77,7 +74,7 @@ export default class ScientificNotationNode extends Node { // SelfOptions fill: 'black', font: new PhetFont( 20 ), - exponent: null, + exponent: null, // exponent will be computed mantissaDecimalPlaces: 1, exponentScale: 0.75, showIntegersAsMantissaOnly: false, @@ -128,11 +125,11 @@ export default class ScientificNotationNode extends Node { * Converts a number to scientific-notation format, consisting of a mantissa and exponent, * such that the values is equal to (mantissa * Math.pow(10, exponent)).] */ - public static toScientificNotation( value: number, providedOptions?: ScientificNotationOptions ): ScientificNotation { + public static toScientificNotation( value: number, providedOptions?: ToScientificNotationOptions ): ScientificNotation { - const options = optionize()( { + const options = optionize()( { mantissaDecimalPlaces: 1, - exponent: null // specific exponent to use + exponent: null // exponent will be computed }, providedOptions ); let mantissa: number;