Using the library types for an After Effects script, TypeScript will produce an error for array arguments to Property.setValue().
For example:
layer.position.setValue([100, 100]);
results in the error for each element in the array:
Type 'number' is not assignable to type 'never'.ts(2322)
This occurs when attempting to pass both [number, number] as well as [number, number, number]. Erroneously passing a string to setValue() in these cases actually gives a more insightful error:
Argument of type 'string' is not assignable to parameter of type 'never'.
The intersection 'TwoDPoint & ThreeDPoint' was reduced to 'never' because property 'length' has conflicting types in some constituents.ts(2345)
Thus, somewhere the union type TwoDProperty | ThreeDProperty results in an intersection with conflicting values for the property value type tuple length and cannot be satisfied.
This probably could be resolved with generics or type narrowing, if we were writing in TypeScript rather than ExtendScript.
Add /* @ts-ignore */ before any line calling setValue() on a tuple Property. Ignoring type checking defeats the purpose of using types. Note: // @ts-ignore does not work, because the AfterEffects script engine will complain.
Using the library types for an After Effects script, TypeScript will produce an error for array arguments to Property.setValue(). For example:
results in the error for each element in the array:
This occurs when attempting to pass both
[number, number]
as well as[number, number, number]
. Erroneously passing a string to setValue() in these cases actually gives a more insightful error:Thus, somewhere the union type
TwoDProperty | ThreeDProperty
results in an intersection with conflicting values for the property value type tuple length and cannot be satisfied.This probably could be resolved with generics or type narrowing, if we were writing in TypeScript rather than ExtendScript.
Environment
types-for-adobe@7.0.5 Types: types-for-adobe/AfterEffects/18.0 TypeScript: 4.7.3
Workaround
Add
/* @ts-ignore */
before any line calling setValue() on a tuple Property. Ignoring type checking defeats the purpose of using types. Note:// @ts-ignore
does not work, because the AfterEffects script engine will complain.