-
Notifications
You must be signed in to change notification settings - Fork 0
Pre Processing Macros
There are a few different preprocessing macros (Statements that are executed before the actual compilation.) that significantly speed up the TypeScript programming process and ease of use if used properly.
The @include file
macro allows very easy reference of a file and will include the script at the same time. You can also give a name to the file so that you can access it, @include "file":FriendlyName
, allows you to afterwards use FriendlyName.method();
@include "path/Helper.ts"
Would reference the file "Helper.ts" in the "path" folder and additionally include it at runtime. The output of the example file when pre-processed would look like:
/// <reference path="path/Helper.ts" />
var Helper = _typeinclude("path/Helper.ts");
Which would allow you to now access anything in Helper by simply calling Helper.method();
To simply reference a file in your script you can use the macro @reference <file>
.
@reference "path/File.ts"
Would reference the file "File.ts" in the "path" folder and additionally include it at runtime. The output of the example file when pre-processed would look like:
/// <reference path="path/File.ts" />