Closed samreid closed 1 year ago
If I try splitting up the deserialization options, to say it either has fromStateObject or something else (but not both), at the moment I mark fromStateObject?:never
in the bottom part, it thinks the entire options object is never:
// If it is serializable, then it is optionally deserializable via one of these methods
type DeserializationOptions<T, StateType> = {
fromStateObject: ( s: StateType ) => T;
stateToArgsForConstructor?: never;
applyState?: never;
defaultDeserializationMethod?: DeserializationType;
addChildElement?: never;
} | {
fromStateObject?: never; // <--- HERE
stateToArgsForConstructor?: ( s: StateType ) => unknown[];
applyState?: ( t: T, state: StateType ) => void;
defaultDeserializationMethod?: DeserializationType;
addChildElement?: AddChildElement;
};
I feel the long-term antidote for this problem is https://github.com/phetsims/tandem/issues/275. Not sure if any of its ideas can be backpropagated to improve our short-term solution. My recommendation is to close this issue and wait until we can work on https://github.com/phetsims/tandem/issues/275. I'll check in with @zepumph first.
Yes, this seems like a duplicate at this point. Closing
Related to https://github.com/phetsims/tandem/issues/263 and https://github.com/phetsims/tandem/issues/273, we should improve the serialization features for IO Type.