I'm getting this error:
Uncaught ReferenceError:
exports
is not defined
It seems like this question has been asked and answered several times. This is an example of this question being asked.
The only problem I'm having is that I can't find the tsconfig.ts file people keep mentioning in their answers. There's no such file in VS solution.
I'm using Visual Studio 2017 Enterprise Edition.
EDIT
I define all the common types in a file called CommonTypes.ts
class ddlData {
ctrId: string;
id: string;
}
interface ISelectedIdsObj {
facilityId: number;
AllCk: boolean;
AllSelected: boolean;
Ids: number[];
totalItems: number;
}
//More classes and intefaces here...
export { ddlData, ISelectedIdsObj, IPaginationData, IHeaderColumn, ISelectedListItem }
This is how I call it
/// <reference path="../typings/jquery/jquery.d.ts" />
//import { ddlData, ISelectedIdsObj, IPaginationData, IHeaderColumn, ISelectedListItem } from '../Commons/CommonTypes'
I'm getting the Uncaught ReferenceError: exports is not defined at line 3
.
EDIT 2
I've created 2 typescript files: test1
and test2
.
This is test2:
export const x = 1;
and this is test1:
/// <reference path="../typings/jquery/jquery.d.ts" />
import { x } from './Test2'
$(function () {
alert(x);
});
I'm still getting the same error: Uncaught ReferenceError: exports is not defined at Test1.js:3