-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Under the new type checker (which should, in theory, be reported by the old type checker, but isn't), useTween reports a TypeError if start and info are missing:
TypeError: Table type '{ target: number }' not compatible with type 'TweenProperties<number>' because the former is missing fields 'start', and 'info'
The implementation of the function implies that these fields can be left blank, but the TweenProperties<T> type requires the properties to be non-nil. The documentation also agrees with this, requiring start and info. I've never used these two properties; instead, I only specify target, so I don't have to pass in the current state of the tween. This has worked in the past when I was using the old type checker, since it didn't pick this up.
The current implementation is:
start = function(subProps: Tween.TweenProperties<T>, immediate: boolean?)
assert(typeof(subProps) == "table", "useTween expects a table of properties")
tween.props.info = subProps.info or tween.props.info
tween.props.start = subProps.start or binding:getValue()
tween.props.target = subProps.target or tween.props.target
tween.props.startImmediate = subProps.startImmediate or tween.props.startImmediate
tween.props.delay = subProps.delay or tween.props.delay
tween:Play(subProps.start or binding:getValue(), immediate)
endThe documentation should either be updated to specify that all the properties are required (as per the type) or the type should be revised to not require properties like info, start, target, startImmediate, and delay.