From eda18319ac565d507432e4df02d63799b5331008 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Fri, 23 Jun 2017 10:54:05 +0100 Subject: [PATCH] Forward compatible updates for TS 2.4 --- src/loader.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/loader.ts b/src/loader.ts index 707d900..9c25093 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -305,14 +305,19 @@ declare const Packages: {} | undefined; // shim API if (config.shim) { Object.keys(config.shim).forEach((moduleId) => { - let moduleDef: ModuleShim = (config.shim || {})[ moduleId ]; + // guards currently get reset in callbacks: https://github.com/Microsoft/TypeScript/issues/11498 + const value = config.shim![moduleId]; + let moduleDef: ModuleShim; // using shorthand module syntax, convert to full syntax - if (Array.isArray(moduleDef)) { + if (Array.isArray(value)) { moduleDef = { - deps: moduleDef + deps: value }; } + else { + moduleDef = value; + } define(moduleId, moduleDef.deps || [], function (...dependencies) { let root: any;