I think it should be:
/**
* @const
* @type {jQuery}
*/
var $ = jQuery;
Look at other extern files for similar usage.
-Alex
On 4/20/16, 11:36 PM, "Harbs" <[email protected]> wrote:
>Yes. I was looking in asjs instead of falcon…
>
>I’ve never done typdefs before. Does this look right?
>
>/**
> * @const
> * @typedef {jQuery}
> */
>var $ = jQuery;
>
>It’s currently:
>/**
> * @const
> */
>var $ = jQuery;
>
>On Apr 21, 2016, at 9:25 AM, OmPrakash Muppirala <[email protected]>
>wrote:
>
>> I think this is what you are looking for?
>> : flex-falcon\externs\jquery\externs\jquery-1.9.js
>>
>> Thanks,
>> Om
>>
>> On Wed, Apr 20, 2016 at 11:21 PM, Harbs <[email protected]> wrote:
>>
>>> I’m looking for where the jQuery definitions are and I can’t seem to
>>>find
>>> it.
>>>
>>> On Apr 21, 2016, at 3:17 AM, Alex Harui <[email protected]> wrote:
>>>
>>>> Looks like the externs file doesn't have an @type for the $ constant.
>>> You
>>>> can try adding it in the build script or see if Google will accept a
>>> patch
>>>> for it.
>>>>
>>>> -Alex
>>>>
>>>> On 4/20/16, 4:13 PM, "Harbs" <[email protected]> wrote:
>>>>
>>>>> Replacing “$” with “jQuery” makes the warnings go away. Why would
>>>>>“$” be
>>>>> different than “jQuery”? It sounds to me like a bug in the
>>>>>definitions.
>>>>>
>>>>> jQuery always returns a JQuery object which has many defined methods.
>>> One
>>>>> of those is attr.
>>>>>
>>>>> On Apr 21, 2016, at 1:50 AM, Alex Harui <[email protected]> wrote:
>>>>>
>>>>>> IMO, this is why Jquery is painful for strong typing.
>>>>>>
>>>>>> I think you may need to do casting:
>>>>>>
>>>>>> ($("#topcoat") as Whatever).attr(..)
>>>>>>
>>>>>> Where Whatever is a "type" that has an attr function.
>>>>>>
>>>>>> And you may need to use @flexjsignorecoercion or other compiler
>>>>>>options
>>>>>> to
>>>>>> not actually do the "as" test in the JS output.
>>>>>>
>>>>>> Good luck,
>>>>>> -Alex
>>>>>>
>>>>>>
>>>>>> On 4/20/16, 3:46 PM, "Harbs" <[email protected]> wrote:
>>>>>>
>>>>>>> Here’s an example:
>>>>>>> $("#topcoat").attr("href",
>>>>>>>"css/topcoat-desktop-lightlight.min.css");
>>>>>>>
>>>>>>> It looks like “$” is defined as an object.
>>>>>>>
>>>>>>> Here’s the exact warnings I’m getting:
>>>>>>>
>>>>>>> Could not resolve variable (may be a dynamic member) 'attr' at
>>>>>>>line 43
>>>>>>> column 19. ThemeManager.as /MyExtension/src/com/unhurdle Unknown
>>> Flash
>>>>>>> Problem
>>>>>>> Maybe invoking a non function. Found
>>>>>>>
>>>>>>>$("#topcoat").attr("href","css/topcoat-desktop-lightlight.min.css");
>>> at
>>>>>>> line 43 column
>>>>>>> 5. ThemeManager.as /MyExtension/src/com/unhurdle Unknown Flash
>>> Problem
>>>>>>>
>>>>>>> And yes, js/libs/jquery.swc is included. If I remove it, I get an
>>> error
>>>>>>> that “$” is not defined instead of a warning.
>>>>>>>
>>>>>>> On Apr 21, 2016, at 1:39 AM, Alex Harui <[email protected]> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 4/20/16, 3:34 PM, "Harbs" <[email protected]> wrote:
>>>>>>>>
>>>>>>>>> Does anyone know if there’s a way to get FDT to not flag JQuery
>>>>>>>>> expressions with “could not resolve variable” and "Maybe invoke a
>>> non
>>>>>>>>> function” warnings?
>>>>>>>>
>>>>>>>> What kind of expressions result in this output? Are you sure you
>>> have
>>>>>>>> the
>>>>>>>> jquery.swc from the externs on the -external-library-path?
>>>>>>>>
>>>>>>>> -Alex
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>