Skip to content

Commit

Permalink
Renaming IEnumeration for TEnumeration, see phetsims/chipper#1287
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinVallejo committed Aug 9, 2022
1 parent 4c00e2a commit 54e6002
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions js/Enumeration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/

import phetCore from './phetCore.js';
import IEnumeration from './IEnumeration.js';
import TEnumeration from './TEnumeration.js';
import EnumerationValue from './EnumerationValue.js';
import inheritance from './inheritance.js';
import Constructor from './types/Constructor.js';
Expand All @@ -37,7 +37,7 @@ export type EnumerationOptions<T extends EnumerationValue> = {
instanceType?: Constructor<T>;
};

class Enumeration<T extends EnumerationValue> implements IEnumeration<T> {
class Enumeration<T extends EnumerationValue> implements TEnumeration<T> {
public readonly values: T[]; // in the order that static instances are defined
public readonly keys: string[];
public readonly Enumeration: Constructor<T> & Record<string, T>;
Expand Down
10 changes: 5 additions & 5 deletions js/EnumerationMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import phetCore from './phetCore.js';

type IEnumeration<T> = {
type TEnumeration<T> = {
enumeration: {
values: T[];
};
Expand All @@ -17,15 +17,15 @@ type IEnumeration<T> = {
// T = enumeration value type
// U = mapped value type
class EnumerationMap<T, U> {
private readonly _enumeration: IEnumeration<T>;
private readonly _enumeration: TEnumeration<T>;
private _map = new Map<T, U>();
private _values: T[];

/**
* @param enumeration
* @param factory - function( {IEnumeration.*} ) => {*}, maps an enumeration value to any value.
* @param factory - function( {TEnumeration.*} ) => {*}, maps an enumeration value to any value.
*/
public constructor( enumeration: IEnumeration<T>, factory: ( t: T ) => U ) {
public constructor( enumeration: TEnumeration<T>, factory: ( t: T ) => U ) {

this._enumeration = enumeration;

Expand Down Expand Up @@ -56,7 +56,7 @@ class EnumerationMap<T, U> {
/**
* Returns a new EnumerationMap with mapped values.
*
* @param mapFunction - function( {*}, {IEnumeration.*} ): {*}
* @param mapFunction - function( {*}, {TEnumeration.*} ): {*}
* @returns With the mapped values
*/
public map( mapFunction: ( u: U, t: T ) => U ): EnumerationMap<T, U> {
Expand Down
6 changes: 3 additions & 3 deletions js/IEnumeration.ts → js/TEnumeration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import EnumerationValue from './EnumerationValue.js';
*
* @author Sam Reid (PhET Interactive Simulations)
*/
type IEnumeration<T extends EnumerationValue> = {
type TEnumeration<T extends EnumerationValue> = {

// The possible keys for the enumeration
readonly keys: string[];
Expand All @@ -29,8 +29,8 @@ type IEnumeration<T extends EnumerationValue> = {
};

type EnumerationContainer<T extends EnumerationValue> = {
enumeration: IEnumeration<T>;
enumeration: TEnumeration<T>;
};

export type { EnumerationContainer };
export default IEnumeration;
export default TEnumeration;

0 comments on commit 54e6002

Please sign in to comment.