Skip to content

Commit

Permalink
update to typescript latest
Browse files Browse the repository at this point in the history
- TypeScript latest now ships with fetch defs so delete that
- TypeScript latest now uses Node map so fix typescriptDir.ts
  • Loading branch information
Basarat Ali Syed committed Feb 8, 2017
1 parent 654d70f commit e058b91
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 203 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -44,7 +44,7 @@
"homepage": "https://github.com/alm-tools/alm#readme",
"dependencies": {
"basic-auth-connect": "^1.0.0",
"byots": "2.2.0-dev.20170115.0.19",
"byots": "2.2.0-dev.20170207.2.12",
"chalk": "^1.1.3",
"chokidar": "1.6.1",
"cookie-parser": "^1.3.5",
Expand Down Expand Up @@ -73,7 +73,7 @@
"ts-loader": "2.0.0",
"ts-node": "2.0.0",
"tslint": "4.3.0-dev.0",
"typescript": "2.2.0-dev.20170116",
"typescript": "2.2.0-dev.20170207",
"update-notifier": "1.0.2",
"webpack": "^1.11.0"
},
Expand Down
6 changes: 3 additions & 3 deletions src/server/workers/external/npmService.ts
Expand Up @@ -34,11 +34,11 @@ export function npmInfo(args: { packageName: string }): Promise<string> {
return npmCmd('npm', 'info', args.packageName);
}

import * as fetch from "node-fetch";
const _fetch:typeof fetch = require("node-fetch");
export function npmLatest({pack}: { pack: string }): Promise<{ description?: string, version?: string }> {
const queryUrl = 'http://registry.npmjs.org:80/' + encodeURIComponent(pack) + '/latest';

return fetch(queryUrl)
return (_fetch(queryUrl)
.then(function(response) {
return response.json()
})
Expand All @@ -54,7 +54,7 @@ export function npmLatest({pack}: { pack: string }): Promise<{ description?: str
result.version = obj.version;
}
return result;
})
}) as any)
.catch((error) => {
return {description: `Failed to query info for ${pack}`};
});
Expand Down
7 changes: 5 additions & 2 deletions src/server/workers/lang/core/typeScriptDir.ts
Expand Up @@ -25,8 +25,11 @@ export const getDefaultLibFilePaths = (options: ts.CompilerOptions): string[] =>
return [];
}
if (options.lib) {
/** Note: this might need to be more fancy at some point. E.g. user types `es6.array` but we need to get `es2015.array` */
return options.lib.map((lib) => fileFromLibFolder(libToFileNameMap[lib]));
/**
* Note: this might need to be more fancy at some point.
* E.g. user types `es6.array` but we need to get `es2015.array`
*/
return options.lib.map((lib) => fileFromLibFolder(libToFileNameMap.get(lib)));
}
return [fileFromLibFolder(ts.getDefaultLibFileName(options))];
}
3 changes: 1 addition & 2 deletions src/typings.json
Expand Up @@ -20,7 +20,6 @@
"react-dom": "github:DefinitelyTyped/DefinitelyTyped/react/react-dom.d.ts#bdaf2f0eb19edee26248c80bab4947e9b70e4217",
"redux": "github:DefinitelyTyped/DefinitelyTyped/redux/redux.d.ts#273a567b0a0bcc34cbf2a2470b2febc95796b644",
"serve-static": "github:DefinitelyTyped/DefinitelyTyped/serve-static/serve-static.d.ts#e95958ac847d9a343bdc8d7cbc796a5f6da29f71",
"toastr": "github:DefinitelyTyped/DefinitelyTyped/toastr/toastr.d.ts#62eedc3121a5e28c50473d2e4a9cefbcb9c3957f",
"whatwg-fetch": "registry:dt/whatwg-fetch#0.0.0+20160524142046"
"toastr": "github:DefinitelyTyped/DefinitelyTyped/toastr/toastr.d.ts#62eedc3121a5e28c50473d2e4a9cefbcb9c3957f"
}
}
94 changes: 0 additions & 94 deletions src/typings/browser/ambient/whatwg-fetch/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/typings/main.d.ts
Expand Up @@ -19,4 +19,3 @@
/// <reference path="main/ambient/redux/redux.d.ts" />
/// <reference path="main/ambient/serve-static/serve-static.d.ts" />
/// <reference path="main/ambient/toastr/toastr.d.ts" />
/// <reference path="main/ambient/whatwg-fetch/index.d.ts" />
94 changes: 0 additions & 94 deletions src/typings/main/ambient/whatwg-fetch/index.d.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/typings/node-fetch.d.ts

This file was deleted.

0 comments on commit e058b91

Please sign in to comment.