Are you using the jquery.swc from the externs file, or are you using the dts2as tool to create one from a definitely typed definition file?
I think I remember seeing the one from our externs code work fine with the $ call. Thanks, Om On Wed, Apr 20, 2016 at 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 > >>> > >> > > > >
