summaryrefslogtreecommitdiff
path: root/tools/ts_library_builder/build_library.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2018-11-09 11:09:18 +1100
committerRyan Dahl <ry@tinyclouds.org>2018-11-09 08:39:49 -0800
commit34b6b86c76111396dd46e46015ad5536d6baa883 (patch)
tree6c668147aa01f2be031f10bc594100a392bb7531 /tools/ts_library_builder/build_library.ts
parent172f5a51332b24c1027ea0f22d7e71b516dcd7d5 (diff)
Ensure global type instances are available.
Diffstat (limited to 'tools/ts_library_builder/build_library.ts')
-rw-r--r--tools/ts_library_builder/build_library.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/ts_library_builder/build_library.ts b/tools/ts_library_builder/build_library.ts
index af3fb599d..e1a64215f 100644
--- a/tools/ts_library_builder/build_library.ts
+++ b/tools/ts_library_builder/build_library.ts
@@ -21,7 +21,8 @@ import {
loadFiles,
logDiagnostics,
namespaceSourceFile,
- normalizeSlashes
+ normalizeSlashes,
+ addTypeAlias
} from "./ast_util";
export interface BuildLibraryOptions {
@@ -216,6 +217,16 @@ export function mergeGlobal({
addInterfaceProperty(interfaceDeclaration, property, type);
}
+ // We need to copy over any type aliases
+ for (const typeAlias of sourceFile.getTypeAliases()) {
+ addTypeAlias(
+ targetSourceFile,
+ typeAlias.getName(),
+ typeAlias.getType().getText(sourceFile),
+ true
+ );
+ }
+
// We need to ensure that we only namespace each source file once, so we
// will use this map for tracking that.
const sourceFileMap = new Map<SourceFile, string>();