TS1148 ~ How to “import” with --module: “none” and typescript 2.x

后端 未结 4 2150
一生所求
一生所求 2021-02-14 19:02

I\'m currently working on a project with some legacy javascript. The application does not include a module loader, it just puts everything as a global into the window object. To

4条回答
  •  春和景丽
    2021-02-14 19:25

    Create a global declaration for Rx which is the type of the RxJS exports, like so:

    import * as RxJS from "rxjs";
    
    declare global {
        const Rx: typeof RxJS;
    }
    
    export {};
    

    Save it to a file (e.g. global.d.ts) and then add that to the include array of tsconfig.json.

提交回复
热议问题