I am pretty sure Language.string is behaving correctly. Here's a very simple example of what you get in flash player.
var something:* //undefined by default var str1:String = something; var str2:String = something as String; var str3:String = String(something); trace((str1===null),(str2===null),(str3==='undefined')) //true true true here is what the same code compiles to in Royale: var /** @type {*} */ something; var /** @type {string} */ str1 = org.apache.royale.utils.Language.string(something); var /** @type {string} */ str2 = org.apache.royale.utils.Language.as(something, String); var /** @type {string} */ str3 = String(something); And the results, when tested, are the same. Whether or not 'something as String' should be transpiled to Language.string instead of Language.as is 'something' that could perhaps be investigated, but I suspect the explicit use of that is quite rare in code, relative to the implicit coercions that take place. On Sun, Nov 14, 2021 at 8:23 AM Harbs <harbs.li...@gmail.com> wrote: > Of course and JS works the same way. But Language.string is used for > implicit coercions where it might have an initial value of undefined. In > that case, I don’t think you’d usually want to be using “undefined”. You > probably want “” instead. > > I don’t remember all the discussions we had around this in the past. > > If anyone remembers better, please jog my memory… > > Harbs > > > On Nov 12, 2021, at 8:08 PM, Edward Stangler <estang...@bradmark.com> > wrote: > > > > > > In Flex, both String(null) == "null" and ""+null == "null" (the string > > "null", not the null value). > > > > Don't know if that's the equivalent of Language.string(). > > > > > > On 11/12/2021 4:05 AM, Harbs wrote: > >> I wonder if Language.string() should return “” for undefined. It > currently returns null. I think “” would generally be a more expected > result. > > > >