-
Notifications
You must be signed in to change notification settings - Fork 9
/
typescript.js
38 lines (29 loc) · 838 Bytes
/
typescript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const meteorTS = Npm.require('meteor-typescript');
TypeScript = {
validateOptions(options) {
if (! options) return;
meteorTS.validateAndConvertOptions(options);
},
// Extra options are the same compiler options
// but passed in the compiler constructor.
validateExtraOptions(options) {
if (! options) return;
meteorTS.validateAndConvertOptions({
compilerOptions: options
});
},
getDefaultOptions: meteorTS.getDefaultOptions,
compile(source, options) {
options = options || meteorTS.getDefaultOptions();
return meteorTS.compile(source, options);
},
setCacheDir(cacheDir) {
meteorTS.setCacheDir(cacheDir);
},
isDeclarationFile(filePath) {
return /^.*\.d\.ts$/.test(filePath);
},
removeTsExt(path) {
return path && path.replace(/(\.tsx|\.ts)$/g, '');
}
};