In Typescript, how can I use the functions defined in another TS file without putting them in a module?

I need to use the functions defined in the TS file, a file that I will call "library.ts". I need to use these functions in another "main.ts" file. However, for good non-technical reasons (education), I do not want the user to know about the modules.

For example, I just want them to be able to call ReadText / WriteText without worrying about the module. X.ReadText is not acceptable.

How can I call a function not defined inside the module in library.ts from a function in main.ts?

My VS project says I'm using Typescript 1.1 (TypeScriptToolsVersion)

+4
source share
1 answer

, .

Library.ts:

var globalVariable = 'Hello World';

function globalFunction() {
    alert(globalVariable);
}

app.ts:

/// <reference path="library.ts" />

globalFunction();
+2

All Articles