Closed pixelzoom closed 2 years ago
optionize3
apparently has a similar problem. Only 2 arguments in this example, and no TS error:
const options = optionize3<RealLightRaysForegroundNodeOptions, SelfOptions, RealLightRaysNodeOptions>()( {}, {
stroke: ( GOQueryParameters.debugRays ) ? 'red' : providedOptions.stroke
} );
And shouldn't combineOptions
require at least 2 arguments? Otherwise there's no combining happening. This example results in no TS error:
const arrowNodeOptions = combineOptions<ArrowNodeOptions>( GOConstants.ARROW_NODE_OPTIONS )
The reason I didn't is this case:
func( providedOptions? MyOptions ){
const options = combineOptions<MyOptions>( { hi: true }, providedOptions );
}
In this case, since providedOptions could be undefined, it is problematic to not support just a single arg.
Ah, right. I don't see a way around that. So closing.
Here's an error that I make a few times a day. I've forgotten the second argument (
providedOptions
) tooptionize
:This feels buggy, so I'll label it as such -- but I'm not sure. Is there a use-case for calling
optionize
with a single argument? If not, it would be nice if type-checking could catch this error.