Skip to content

Commit

Permalink
use IntentionalAny.ts in a11y feature mixins, phetsims/tasks#1096
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Feb 10, 2022
1 parent 19eb62f commit 46d890e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion js/accessibility/AccessibleNumberSpinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import validate from '../../../axon/js/validate.js';
import assertHasProperties from '../../../phet-core/js/assertHasProperties.js';
import Constructor from '../../../phet-core/js/Constructor.js';
import inheritance from '../../../phet-core/js/inheritance.js';
import IntentionalAny from '../../../phet-core/js/IntentionalAny.js';
import optionize from '../../../phet-core/js/optionize.js';
import Orientation from '../../../phet-core/js/Orientation.js';
import { IInputListener, KeyboardUtils, Node, SceneryEvent, SceneryListenerFunction } from '../../../scenery/js/imports.js';
Expand Down Expand Up @@ -64,7 +65,7 @@ const AccessibleNumberSpinner = <SuperType extends Constructor>( Type: SuperType

_disposeAccessibleNumberSpinner: () => void;

constructor( ...args: any[] ) {
constructor( ...args: IntentionalAny[] ) {

const providedOptions = args[ optionsArgPosition ] as AccessibleValueHandlerOptions;

Expand Down
3 changes: 2 additions & 1 deletion js/accessibility/AccessibleSlider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import assertHasProperties from '../../../phet-core/js/assertHasProperties.js';
import Constructor from '../../../phet-core/js/Constructor.js';
import inheritance from '../../../phet-core/js/inheritance.js';
import IntentionalAny from '../../../phet-core/js/IntentionalAny.js';
import optionize from '../../../phet-core/js/optionize.js';
import { Node, SceneryListenerFunction } from '../../../scenery/js/imports.js';
import sun from '../sun.js';
Expand Down Expand Up @@ -47,7 +48,7 @@ const AccessibleSlider = <SuperType extends Constructor>( Type: SuperType, optio
return class extends AccessibleValueHandler( Type, optionsArgPosition ) {
_disposeAccessibleSlider: () => void;

constructor( ...args: any[] ) {
constructor( ...args: IntentionalAny[] ) {

const providedOptions = args[ optionsArgPosition ] as AccessibleSliderOptions;

Expand Down
13 changes: 7 additions & 6 deletions js/accessibility/AccessibleValueHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ import Multilink from '../../../axon/js/Multilink.js';
import UtteranceQueue from '../../../utterance-queue/js/UtteranceQueue.js';
import IProperty from '../../../axon/js/IProperty.js';
import Constructor from '../../../phet-core/js/Constructor.js';
import IntentionalAny from '../../../phet-core/js/IntentionalAny.js';

// constants
const DEFAULT_TAG_NAME = 'input';
const toString = ( v: any ) => `${v}`;
const toString = ( v: IntentionalAny ) => `${v}`;

type CreateTextFunction = {

Expand Down Expand Up @@ -168,7 +169,7 @@ type AccessibleValueHandlerSelfOptions = {
* List the dependencies this Node's PDOM descriptions have. This should not include the valueProperty, but
* should list any Properties whose change should trigger a description update for this Node.
*/
a11yDependencies?: Property<any>[];
a11yDependencies?: Property<IntentionalAny>[];

// Returning null signifies that there is no response
voicingCreateObjectResponse?: ( () => null | string ) | null;
Expand Down Expand Up @@ -240,7 +241,7 @@ const AccessibleValueHandler = <SuperType extends Constructor>( Type: SuperType,
_rangeKeysDown: { [ key: string ]: boolean };
_a11yMapPDOMValue: ( ( value: number ) => number );
_a11yCreateAriaValueText: CreateTextFunction;
_dependenciesMultilink: Multilink<any[]> | null;
_dependenciesMultilink: Multilink<IntentionalAny[]> | null;
_a11yRepeatEqualValueText: boolean;

// When context responses are supported, this counter is used to determine a mutable delay between hearing the
Expand All @@ -251,7 +252,7 @@ const AccessibleValueHandler = <SuperType extends Constructor>( Type: SuperType,
_voicingCreateObjectResponse: ( () => null | string ) | null;
_disposeAccessibleValueHandler: () => void;

constructor( ...args: any[] ) {
constructor( ...args: IntentionalAny[] ) {

const providedOptions = args[ optionsArgPosition ] as AccessibleValueHandlerOptions;

Expand Down Expand Up @@ -405,7 +406,7 @@ const AccessibleValueHandler = <SuperType extends Constructor>( Type: SuperType,
* changes. Use this method to set the dependency Properties for this value handler. This will blow away the
* previous list (like Node.children).
*/
setA11yDependencies( dependencies: IProperty<any>[] ) {
setA11yDependencies( dependencies: IProperty<IntentionalAny>[] ) {
assert && assert( Array.isArray( dependencies ) );
assert && assert( dependencies.indexOf( this._valueProperty ) === -1,
'The value Property is already a dependency, and does not need to be added to this list' );
Expand All @@ -416,7 +417,7 @@ const AccessibleValueHandler = <SuperType extends Constructor>( Type: SuperType,
// dispose the previous multilink, there is only one set of dependencies, though they can be overwritten.
this._dependenciesMultilink && this._dependenciesMultilink.dispose();

this._dependenciesMultilink = Property.multilink<any[]>( dependencies.concat( [ this._valueProperty ] ), () => {
this._dependenciesMultilink = Property.multilink<IntentionalAny[]>( dependencies.concat( [ this._valueProperty ] ), () => {

this._updateAriaValueText( this._oldValue );

Expand Down

0 comments on commit 46d890e

Please sign in to comment.