Importing module from javascript into typescript

hi,
I am exporting a class from a js file like this :
var Game = cc.Class({

});

module.exports = Game;

I am storing the file called ws.js in the same folder as my typescript file and want to import Game into typescript.
I tried:
import Game = require ("./Game");

the above statement went on top of my ts file.
I am getting the error : cannot find module ‘./Game’
I want to know how I can import the js class into typescript and how to instantiate an object of the class and call a function of the class from typescript.
Thanks!

1 Like

maybe you need : import Game = require("./ws"); or rename ws.js to Game.js

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.