Просмотр исходного кода

Merge pull request #1761 from blink1073/typescript-2.1

Upgrade to TS2.1
Afshin Darian 8 лет назад
Родитель
Сommit
c9176b11a5

+ 2 - 3
package.json

@@ -24,10 +24,9 @@
     "xterm": "^2.3.0"
   },
   "devDependencies": {
-    "@jupyterlab/extension-builder": "^0.10.1",
+    "@jupyterlab/extension-builder": "^0.11.0",
     "@types/d3-dsv": "^1.0.29",
     "@types/expect.js": "^0.3.29",
-    "@types/lodash": "ts2.0",
     "@types/marked": "0.0.28",
     "@types/mathjax": "0.0.31",
     "@types/mocha": "^2.2.32",
@@ -57,7 +56,7 @@
     "rimraf": "^2.5.0",
     "style-loader": "^0.13.0",
     "typedoc": "^0.5.0",
-    "typescript": "~2.0.3",
+    "typescript": "~2.1.6",
     "url-loader": "^0.5.7",
     "watch": "^0.17.1",
     "webpack": "^1.12.11"

+ 3 - 3
src/application/index.ts

@@ -31,13 +31,13 @@ export { ApplicationShell } from './shell';
 export
 namespace CommandIDs {
   export
-  const closeAll = 'main-jupyterlab:close-all';
+  const closeAll: string = 'main-jupyterlab:close-all';
 
   export
-  const activateNextTab = 'main-jupyterlab:activate-next-tab';
+  const activateNextTab: string = 'main-jupyterlab:activate-next-tab';
 
   export
-  const activatePreviousTab = 'main-jupyterlab:activate-previous-tab';
+  const activatePreviousTab: string = 'main-jupyterlab:activate-previous-tab';
 };
 
 

+ 3 - 3
src/commandpalette/index.ts

@@ -22,13 +22,13 @@ import {
 export
 namespace CommandIDs {
   export
-  const activate = 'command-palette:activate';
+  const activate: string = 'command-palette:activate';
 
   export
-  const hide = 'command-palette:hide';
+  const hide: string = 'command-palette:hide';
 
   export
-  const toggle = 'command-palette:toggle';
+  const toggle: string = 'command-palette:toggle';
 };
 
 

+ 1 - 1
src/completer/handler.ts

@@ -26,7 +26,7 @@ import {
  * A class added to editors that can host a completer.
  */
 export
-const COMPLETABLE_CLASS = 'jp-mod-completable';
+const COMPLETABLE_CLASS: string = 'jp-mod-completable';
 
 
 /**

+ 3 - 3
src/completer/index.ts

@@ -29,13 +29,13 @@ export * from './widget';
 export
 namespace CommandIDs {
   export
-  const invoke = 'completer:invoke';
+  const invoke: string = 'completer:invoke';
 
   export
-  const invokeConsole = 'completer:invoke-console';
+  const invokeConsole: string = 'completer:invoke-console';
 
   export
-  const invokeNotebook = 'completer:invoke-notebook';
+  const invokeNotebook: string = 'completer:invoke-notebook';
 }
 
 

+ 11 - 11
src/console/index.ts

@@ -20,37 +20,37 @@ export * from './widget';
 export
 namespace CommandIDs {
   export
-  const create = 'console:create';
+  const create: string = 'console:create';
 
   export
-  const clear = 'console:clear';
+  const clear: string = 'console:clear';
 
   export
-  const run = 'console:run';
+  const run: string = 'console:run';
 
   export
-  const runForced = 'console:run-forced';
+  const runForced: string = 'console:run-forced';
 
   export
-  const linebreak = 'console:linebreak';
+  const linebreak: string = 'console:linebreak';
 
   export
-  const interrupt = 'console:interrupt-kernel';
+  const interrupt: string = 'console:interrupt-kernel';
 
   export
-  const restart = 'console:restart-kernel';
+  const restart: string = 'console:restart-kernel';
 
   export
-  const closeAndShutdown = 'console:close-and-shutdown';
+  const closeAndShutdown: string = 'console:close-and-shutdown';
 
   export
-  const open = 'console:open';
+  const open: string = 'console:open';
 
   export
-  const inject = 'console:inject';
+  const inject: string = 'console:inject';
 
   export
-  const switchKernel = 'console:switch-kernel';
+  const switchKernel: string = 'console:switch-kernel';
 };
 
 

+ 4 - 4
src/editorwidget/index.ts

@@ -10,14 +10,14 @@ export * from './widget';
 export
 namespace CommandIDs {
   export
-  const lineNumbers = 'editor:line-numbers';
+  const lineNumbers: string = 'editor:line-numbers';
 
   export
-  const lineWrap = 'editor:line-wrap';
+  const lineWrap: string = 'editor:line-wrap';
 
   export
-  const createConsole = 'editor:create-console';
+  const createConsole: string = 'editor:create-console';
 
   export
-  const runCode = 'editor:run-code';
+  const runCode: string = 'editor:run-code';
 };

+ 1 - 1
src/faq/index.ts

@@ -10,5 +10,5 @@ export * from './widget';
 export
 namespace CommandIDs {
   export
-  const open = 'faq-jupyterlab:open';
+  const open: string = 'faq-jupyterlab:open';
 };

+ 11 - 11
src/filebrowser/index.ts

@@ -15,35 +15,35 @@ export * from './tracker';
 export
 namespace CommandIDs {
   export
-  const save = 'file-operations:save';
+  const save: string = 'file-operations:save';
 
   export
-  const restoreCheckpoint = 'file-operations:restore-checkpoint';
+  const restoreCheckpoint: string = 'file-operations:restore-checkpoint';
 
   export
-  const saveAs = 'file-operations:save-as';
+  const saveAs: string = 'file-operations:save-as';
 
   export
-  const close = 'file-operations:close';
+  const close: string = 'file-operations:close';
 
   export
-  const closeAllFiles = 'file-operations:close-all-files';
+  const closeAllFiles: string = 'file-operations:close-all-files';
 
   export
-  const open = 'file-operations:open';
+  const open: string = 'file-operations:open';
 
   export
-  const newTextFile = 'file-operations:new-text-file';
+  const newTextFile: string = 'file-operations:new-text-file';
 
   export
-  const newNotebook = 'file-operations:new-notebook';
+  const newNotebook: string = 'file-operations:new-notebook';
 
   export
-  const showBrowser = 'file-browser:activate';
+  const showBrowser: string = 'file-browser:activate';
 
   export
-  const hideBrowser = 'file-browser:hide';
+  const hideBrowser: string = 'file-browser:hide';
 
   export
-  const toggleBrowser = 'file-browser:toggle';
+  const toggleBrowser: string = 'file-browser:toggle';
 };

+ 7 - 7
src/help/index.ts

@@ -8,23 +8,23 @@
 export
 namespace CommandIDs {
   export
-  const open = 'help-jupyterlab:open';
+  const open: string = 'help-jupyterlab:open';
 
   export
-  const activate = 'help-jupyterlab:activate';
+  const activate: string = 'help-jupyterlab:activate';
 
   export
-  const close = 'help-jupyterlab:close';
+  const close: string = 'help-jupyterlab:close';
 
   export
-  const show = 'help-jupyterlab:show';
+  const show: string = 'help-jupyterlab:show';
 
   export
-  const hide = 'help-jupyterlab:hide';
+  const hide: string = 'help-jupyterlab:hide';
 
   export
-  const toggle = 'help-jupyterlab:toggle';
+  const toggle: string = 'help-jupyterlab:toggle';
 
   export
-  const launchClassic = 'classic-notebook:launchClassic';
+  const launchClassic: string = 'classic-notebook:launchClassic';
 };

+ 3 - 3
src/imagewidget/index.ts

@@ -10,11 +10,11 @@ export * from './widget';
 export
 namespace CommandIDs {
   export
-  const zoomIn = 'imagewidget:zoom-in';
+  const zoomIn: string = 'imagewidget:zoom-in';
 
   export
-  const zoomOut = 'imagewidget:zoom-out';
+  const zoomOut: string = 'imagewidget:zoom-out';
 
   export
-  const resetZoom = 'imagewidget:reset-zoom';
+  const resetZoom: string = 'imagewidget:reset-zoom';
 };

+ 1 - 1
src/inspector/index.ts

@@ -11,5 +11,5 @@ export * from './inspector';
 export
 namespace CommandIDs {
   export
-  const open = 'inspector:open';
+  const open: string = 'inspector:open';
 };

+ 1 - 1
src/landing/index.ts

@@ -10,5 +10,5 @@ export * from './widget';
 export
 namespace CommandIDs {
   export
-  const open = 'landing-jupyterlab:open';
+  const open: string = 'landing-jupyterlab:open';
 };

+ 1 - 1
src/launcher/index.ts

@@ -41,7 +41,7 @@ import {
 export
 namespace CommandIDs {
   export
-  const show = 'launcher-jupyterlab:show';
+  const show: string = 'launcher-jupyterlab:show';
 };
 
 

+ 42 - 42
src/notebook/index.ts

@@ -19,128 +19,128 @@ export * from './widgetfactory';
 export
 namespace CommandIDs {
   export
-  const interrupt = 'notebook:interrupt-kernel';
+  const interrupt: string = 'notebook:interrupt-kernel';
 
   export
-  const restart = 'notebook:restart-kernel';
+  const restart: string = 'notebook:restart-kernel';
 
   export
-  const restartClear = 'notebook:restart-clear';
+  const restartClear: string = 'notebook:restart-clear';
 
   export
-  const restartRunAll = 'notebook:restart-runAll';
+  const restartRunAll: string = 'notebook:restart-runAll';
 
   export
-  const switchKernel = 'notebook:switch-kernel';
+  const switchKernel: string = 'notebook:switch-kernel';
 
   export
-  const clearAllOutputs = 'notebook:clear-outputs';
+  const clearAllOutputs: string = 'notebook:clear-outputs';
 
   export
-  const closeAndShutdown = 'notebook:close-and-shutdown';
+  const closeAndShutdown: string = 'notebook:close-and-shutdown';
 
   export
-  const trust = 'notebook:trust';
+  const trust: string = 'notebook:trust';
 
   export
-  const run = 'notebook-cells:run';
+  const run: string = 'notebook-cells:run';
 
   export
-  const runAndAdvance = 'notebook-cells:run-and-advance';
+  const runAndAdvance: string = 'notebook-cells:run-and-advance';
 
   export
-  const runAndInsert = 'notebook-cells:run-and-insert';
+  const runAndInsert: string = 'notebook-cells:run-and-insert';
 
   export
-  const runAll = 'notebook:run-all';
+  const runAll: string = 'notebook:run-all';
 
   export
-  const toCode = 'notebook-cells:to-code';
+  const toCode: string = 'notebook-cells:to-code';
 
   export
-  const toMarkdown = 'notebook-cells:to-markdown';
+  const toMarkdown: string = 'notebook-cells:to-markdown';
 
   export
-  const toRaw = 'notebook-cells:to-raw';
+  const toRaw: string = 'notebook-cells:to-raw';
 
   export
-  const cut = 'notebook-cells:cut';
+  const cut: string = 'notebook-cells:cut';
 
   export
-  const copy = 'notebook-cells:copy';
+  const copy: string = 'notebook-cells:copy';
 
   export
-  const paste = 'notebook-cells:paste';
+  const paste: string = 'notebook-cells:paste';
 
   export
-  const moveUp = 'notebook-cells:move-up';
+  const moveUp: string = 'notebook-cells:move-up';
 
   export
-  const moveDown = 'notebook-cells:move-down';
+  const moveDown: string = 'notebook-cells:move-down';
 
   export
-  const clearOutputs = 'notebook-cells:clear-output';
+  const clearOutputs: string = 'notebook-cells:clear-output';
 
   export
-  const deleteCell = 'notebook-cells:delete';
+  const deleteCell: string = 'notebook-cells:delete';
 
   export
-  const insertAbove = 'notebook-cells:insert-above';
+  const insertAbove: string = 'notebook-cells:insert-above';
 
   export
-  const insertBelow = 'notebook-cells:insert-below';
+  const insertBelow: string = 'notebook-cells:insert-below';
 
   export
-  const selectAbove = 'notebook-cells:select-above';
+  const selectAbove: string = 'notebook-cells:select-above';
 
   export
-  const selectBelow = 'notebook-cells:select-below';
+  const selectBelow: string = 'notebook-cells:select-below';
 
   export
-  const extendAbove = 'notebook-cells:extend-above';
+  const extendAbove: string = 'notebook-cells:extend-above';
 
   export
-  const extendBelow = 'notebook-cells:extend-below';
+  const extendBelow: string = 'notebook-cells:extend-below';
 
   export
-  const editMode = 'notebook:edit-mode';
+  const editMode: string = 'notebook:edit-mode';
 
   export
-  const merge = 'notebook-cells:merge';
+  const merge: string = 'notebook-cells:merge';
 
   export
-  const split = 'notebook-cells:split';
+  const split: string = 'notebook-cells:split';
 
   export
-  const commandMode = 'notebook:command-mode';
+  const commandMode: string = 'notebook:command-mode';
 
   export
-  const toggleLines = 'notebook-cells:toggle-line-numbers';
+  const toggleLines: string = 'notebook-cells:toggle-line-numbers';
 
   export
-  const toggleAllLines = 'notebook-cells:toggle-all-line-numbers';
+  const toggleAllLines: string = 'notebook-cells:toggle-all-line-numbers';
 
   export
-  const undo = 'notebook-cells:undo';
+  const undo: string = 'notebook-cells:undo';
 
   export
-  const redo = 'notebook-cells:redo';
+  const redo: string = 'notebook-cells:redo';
 
   export
-  const markdown1 = 'notebook-cells:markdown-header1';
+  const markdown1: string = 'notebook-cells:markdown-header1';
 
   export
-  const markdown2 = 'notebook-cells:markdown-header2';
+  const markdown2: string = 'notebook-cells:markdown-header2';
 
   export
-  const markdown3 = 'notebook-cells:markdown-header3';
+  const markdown3: string = 'notebook-cells:markdown-header3';
 
   export
-  const markdown4 = 'notebook-cells:markdown-header4';
+  const markdown4: string = 'notebook-cells:markdown-header4';
 
   export
-  const markdown5 = 'notebook-cells:markdown-header5';
+  const markdown5: string = 'notebook-cells:markdown-header5';
 
   export
-  const markdown6 = 'notebook-cells:markdown-header6';
+  const markdown6: string = 'notebook-cells:markdown-header6';
 };

+ 1 - 1
src/statedb/index.ts

@@ -18,7 +18,7 @@ export * from './statedb';
 export
 namespace CommandIDs {
   export
-  const clear = 'statedb:clear';
+  const clear: string = 'statedb:clear';
 };
 
 

+ 6 - 6
src/terminal/index.ts

@@ -10,20 +10,20 @@ export * from './widget';
 export
 namespace CommandIDs {
   export
-  const createNew = 'terminal:create-new';
+  const createNew: string = 'terminal:create-new';
 
   export
-  const open = 'terminal:open';
+  const open: string = 'terminal:open';
 
   export
-  const refresh = 'terminal:refresh';
+  const refresh: string = 'terminal:refresh';
 
   export
-  const increaseFont = 'terminal:increase-font';
+  const increaseFont: string = 'terminal:increase-font';
 
   export
-  const decreaseFont = 'terminal:decrease-font';
+  const decreaseFont: string = 'terminal:decrease-font';
 
   export
-  const toggleTheme = 'terminal:toggle-theme';
+  const toggleTheme: string = 'terminal:toggle-theme';
 };

+ 2 - 2
src/tooltip/plugin.ts

@@ -196,12 +196,12 @@ namespace Private {
 
       // If a newer request is pending, bail.
       if (current !== pending) {
-        return Promise.reject(void 0);
+        return Promise.reject(void 0) as Promise<JSONObject>;
       }
 
       // If request fails or returns negative results, bail.
       if (value.status !== 'ok' || !value.found) {
-        return Promise.reject(void 0);
+        return Promise.reject(void 0) as Promise<JSONObject>;
       }
 
       return Promise.resolve(value.data);