File: app.ts

package info (click to toggle)
node-ts-loader 9.4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,940 kB
  • sloc: javascript: 7,230; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 851 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import a = require('./a');
import b = require('./b');
// modules c and d won't actually be emitted as "require" calls here
// since they are not used directly. Instead, they are only referenced
// with "typeof". At this point, these statements are only for the
// benefit of the TypeScript type system.
import c = require('./c');
import d = require('./d');

console.log(a);
console.log(b);
require.ensure(['./c', './d'], function(require) {
	// These require calls are emitted (note these are NOT TypeScript
	// `import ... require` statements). `require.ensure` is defined in
	// require.d.ts. Webpack sees this and automatically puts c and d
	// into a separate chunk. 
	var cModule = <typeof c>require('./c');
	var dModule = <typeof d>require('./d');
	
	// cModule and dModule will typed as strings
	console.log(cModule);
	console.log(dModule);
});