Forráskód Böngészése

Cleaning up options arguments.

* If only some of the IOptions are optional, pass options as requred.
* If all are optional, pass as required with a default of {}
Brian E. Granger 8 éve
szülő
commit
27f89ec959

+ 2 - 2
packages/cells/src/inputarea.ts

@@ -217,7 +217,7 @@ namespace InputArea {
     /**
      * Construct a `ContentFactory`.
      */
-    constructor(options?: IContentFactoryOptions) {
+    constructor(options: IContentFactoryOptions = {}) {
       this._editor = (options.editorFactory || defaultEditorFactory);
     }
 
@@ -256,7 +256,7 @@ namespace InputArea {
    * The default `ContentFactory` instance.
    */
   export
-  const defaultContentFactory = new ContentFactory();
+  const defaultContentFactory = new ContentFactory({});
 
   /**
    * A function to create the default CodeMirror editor factory.

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

@@ -370,7 +370,7 @@ namespace Cell {
     /**
      * Create a content factory for a cell.
      */
-    constructor(options?: IContentFactoryOptions) {
+    constructor(options: IContentFactoryOptions = {}) {
       this._editorFactory = (options.editorFactory || InputArea.defaultEditorFactory);
     }
 

+ 1 - 1
packages/console/src/widget.ts

@@ -740,7 +740,7 @@ namespace CodeConsole {
     /**
      * Create a new cell model factory.
      */
-    constructor(options: IModelFactoryOptions) {
+    constructor(options: IModelFactoryOptions = {}) {
       this.codeCellContentFactory = (options.codeCellContentFactory ||
         CodeCellModel.defaultContentFactory
       );

+ 1 - 1
packages/notebook/src/panel.ts

@@ -351,7 +351,7 @@ export namespace NotebookPanel {
     /**
      * The content factory for the panel.
      */
-    contentFactory: IContentFactory;
+    contentFactory?: IContentFactory;
 
     /**
      * The mimeType service.

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

@@ -485,7 +485,7 @@ namespace StaticNotebook {
     /**
      * A factory for creating content.
      */
-    contentFactory: IContentFactory;
+    contentFactory?: IContentFactory;
 
     /**
      * The service used to look up mime types.