Skip to content

Commit

Permalink
Forward compatible updates for TS 2.4 (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk authored Jun 28, 2017
1 parent 51d1126 commit 905199f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: <string[]> moduleDef
deps: value
};
}
else {
moduleDef = value;
}

define(moduleId, moduleDef.deps || [], function (...dependencies) {
let root: any;
Expand Down

0 comments on commit 905199f

Please sign in to comment.