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;