瀏覽代碼

Restrict cell types in the model interfaces

Jason Grout 9 年之前
父節點
當前提交
aa502ea2c2
共有 1 個文件被更改,包括 26 次插入2 次删除
  1. 26 2
      src/notebook/cells/model.ts

+ 26 - 2
src/notebook/cells/model.ts

@@ -96,6 +96,14 @@ interface ICellModel extends IDisposable {
  */
 export
 interface ICodeCellModel extends ICellModel {
+  /**
+   * The type of the cell.
+   *
+   * #### Notes
+   * This is a read-only property.
+   */
+  type: 'code';
+
   /**
    * The code cell's prompt number. Will be null if the cell has not been run.
    */
@@ -112,14 +120,30 @@ interface ICodeCellModel extends ICellModel {
  * The definition of a markdown cell.
  */
 export
-interface IMarkdownCellModel extends ICellModel { }
+interface IMarkdownCellModel extends ICellModel {
+  /**
+   * The type of the cell.
+   *
+   * #### Notes
+   * This is a read-only property.
+   */
+  type: 'markdown';
+ }
 
 
 /**
  * The definition of a raw cell.
  */
 export
-interface IRawCellModel extends ICellModel { }
+interface IRawCellModel extends ICellModel {
+  /**
+   * The type of the cell.
+   *
+   * #### Notes
+   * This is a read-only property.
+   */
+  type: 'raw';
+}
 
 
 /**