toStateObject: ( resistor: Resistor ): ResistorState => {
const stateObject = CircuitElement.CircuitElementIO.toStateObject( resistor );
// @ts-ignore stateObject has type CircuitElement, which does not have field resistorType
stateObject.resistorType = EnumerationIO( ResistorType ).toStateObject( resistor.resistorType );
// @ts-ignore stateObject has type CircuitElement
return stateObject;
},
https://github.com/phetsims/circuit-construction-kit-common/commit/d52735d70ed7d9211eae16c5f078d6ab0127b99c for https://github.com/phetsims/tandem/issues/278 exposed a problem with ResistorIO
toStateObject
. I added some@ts-ignore
comments that need to be addressed at some point. Here's the relevant code in Resistor.ts: