Jump to content
Search Community

louden

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by louden

  1. Hi! Yes I realise that, no blame on you guys, I love the library, the issue is actually with 3rd party type definitions written by the community for your library.

     

    I did post it here however because I thought it had a high chance of someone here having encountered the same issue, if anyone here is using typescript and GSAP.

  2. In case anyone stumbles on this post from google I figured out a solution, however it seems hacky.

     

    In typings.d.ts add the line:

    declare module 'gsap' { let exportAs: any; export = exportAs; }
    

    Then in your component import like:

    import * as T from 'gsap';
    

    And access like:

    T.TweenLite.to(......., T.Linear.easeNone);
    

    I'd still be interested in an explanation, is it just that the @types file has been poorly written? 

  3. Hi, this is a confusing one for me, I have an Angular 2 app using typescript, this project is using the angular CLI
     
    I have been having problems with the GSAP import, the import statement in my component is as follows
     

    import { TweenLite, Linear } from 'gsap'; 

     
    Now this works actually, I mean I can use the TweenLite object and do tween things and see the results on the page, however I was getting the build error through ng serve:
    ...@types/gsap/index.d.ts' is not a module.
     
    This is a problem because it prevents me from making a dist build. I noticed in the latest @types release the line

    export = TweenLite;
    

    was added to index.d.ts, I thought this might fix things so I updated it, but no, now I get the error @types/gsap/index"' resolves to a non-module entity and cannot be imported using this construct. 

     

    I'm confused and don't fully understand how types work really but every other library I use either works like this or I use import * as ... from 'some lib' syntax and it works, can anyone help me get rid of these compilation errors?

×
×
  • Create New...