从js文件访问变量到ts

嗨,我正在尝试将现有的角度应用程序从版本2更新到版本9,首先将其更新为角度4,然后再继续,之后,我能够更新需要更新的软件包,但是现在出现错误没有定义变量 这是应用程序结构

I have legend.component.js

var LegendSingleton=function(() {
               ...
               createInstance
               ...
               getInstance
               ...

main.component.js

var myExtObject = {
               ...
               legend : LegendSingleton.getInstance()
               ...

then in layoutindicateur.component.ts

              ...
var myExtObject = require('../../../assets/geoFunction/main.component.js');
some use of myExtObject 
              ...

also in angular-cli.json i declared those js files in scripts :

...
"assets/geoFunction/component/legend.component.js",
...
"assets/geoFunction/main.component.js"

I'm getting error Uncaught (in promise): ReferenceError: LegendSingleton is not defined I tried to import the legend js file in main js file using var LegendSingleton = require('../geoFunction/component/legend.component.js'); but got error of getInstance not a function