#Typescript Training
This sample project focuses on the Typescript external module writing. It shows how typescript module is transpiled to javascript (ES3). See the typescript handbook for more information.
In typescript the internal module must to be combine with the consumer, so I think it is less interesting than external module. The typescript transpiler knows how to wrap your module in 4 differents format (commonjs
, amd
, umd
, system
).
-
app
folder contains typescript source files -
/gen*
folders contains tranpiled javascript in different module formats:commonjs
,amd
,umd
,system
-
You can execute the test with nodejs. Obviously only the
commonjs
andumd
format are compatible with the nodejs module loader
node genCommonjs/Main
node genUmd/Main
##Quick link to the result
M2.ts orginal
which requiresM3
and export the classCls2
and the objectInst2
M2
incommonjs
format: no need to declare dependencies ahead.M2
inumd
: favorite format to publish opensource library which compatible with bothamd
andcommonjs
loaders (see alsoumdjs
).M2
inamd
format: need to declare all dependencies ahead.
##See also