I have the following code in an app which uses Node.js:
var cr:* = require('crypto');
var decipher:Decipher = cr.createDecipher('aes-256-ctr',KEY);
(The reason cr is untyped is because crypto.createDecipher is not recognized in
the typedefs.)
This used to work fine, but it currently gets compiled as:
var /** @type {*} */ cr = require('crypto');
var /** @type {crypto.Decipher} */ decipher = /* implicit cast */
org.apache.royale.utils.Language.as(cr["createDecipher"]('aes-256-ctr',
com.printui.utils.PrefUtils.KEY), crypto.Decipher, true);
The Language.as cast fails because the rightOperand.constructor is undefined.
Constructors for typedefs will **always** be undefined because they don’t exist
at runtime, so implicit casts on typedef types like this will always fail.
Presumably, I can use:
var decipher:Decipher = cr.createDecipher('aes-256-ctr',KEY) as Decipher; and
it’ll work as long as I ignore as coercions as a compiler option, but this
feels like a step backwards.
Thoughts?
Harbs