Browse Source

Update to Typescript 2.0

Fix some errors in the code that the new typing caught.
Jason Grout 8 years ago
parent
commit
c823b10a71

+ 1 - 1
package.json

@@ -45,7 +45,7 @@
     "rimraf": "^2.5.0",
     "style-loader": "^0.13.0",
     "typedoc": "^0.4.2",
-    "typescript": "^1.8.0",
+    "typescript": "^2.0.2",
     "url-loader": "^0.5.7",
     "watch": "^0.17.1",
     "webpack": "^1.12.11"

+ 1 - 1
src/notebook/cells/widget.ts

@@ -440,7 +440,7 @@ class CodeCellWidget extends BaseCellWidget {
     let outputs = model.outputs;
     return outputs.execute(code, kernel).then(reply => {
       let status = reply.content.status;
-      if (status === 'aborted') {
+      if (status === 'abort') {
         model.executionCount = null;
         this.setPrompt(' ');
       } else {

+ 2 - 2
src/notebook/output-area/model.ts

@@ -167,14 +167,14 @@ class OutputAreaModel implements IDisposable {
       let future = kernel.execute(content);
       // Handle published messages.
       future.onIOPub = (msg: KernelMessage.IIOPubMessage) => {
-        let msgType = msg.header.msg_type as nbformat.OutputType;
+        let msgType = msg.header.msg_type;
         switch (msgType) {
         case 'execute_result':
         case 'display_data':
         case 'stream':
         case 'error':
           let model = msg.content as nbformat.IOutput;
-          model.output_type = msgType;
+          model.output_type = msgType as nbformat.OutputType;
           this.add(model);
           break;
         case 'clear_output':

+ 1 - 7
src/notebook/output-area/widget.ts

@@ -768,9 +768,6 @@ class OutputWidget extends Widget {
     case 'error':
       child.addClass(ERROR_CLASS);
       break;
-    default:
-      console.error(`Unrecognized output type: ${output.output_type}`);
-      data = {};
     }
   }
 
@@ -828,11 +825,8 @@ class OutputWidget extends Widget {
           `${out.ename}: ${out.evalue}`
       };
       break;
-    default:
-      console.error(`Unrecognized output type: ${output.output_type}`);
-      bundle = {};
     }
-    return bundle;
+    return bundle || {};
   }
 
   /**

+ 1 - 1
src/terminal/index.ts

@@ -69,7 +69,7 @@ class TerminalWidget extends Widget {
     this.color = options.color || 'white';
     this.id = `jp-TerminalWidget-${Private.id++}`;
     this.title.label = 'Terminal';
-    Xterm.brokenBold = true;
+    (Xterm as any).brokenBold = true;
   }
 
   /**