浏览代码

Work on pure functional components.

Brian E. Granger 7 年之前
父节点
当前提交
7378a4b2bf

+ 1 - 0
packages/launcher-extension/package.json

@@ -18,6 +18,7 @@
     "@jupyterlab/filebrowser": "^0.7.0",
     "@jupyterlab/launcher": "^0.7.0",
     "@jupyterlab/services": "^0.46.0",
+    "@phosphor/coreutils": "^1.1.1",
     "@phosphor/widgets": "^1.3.0"
   },
   "devDependencies": {

+ 1 - 1
packages/launcher-extension/src/index.ts

@@ -69,7 +69,7 @@ function activate(app: JupyterLab, services: IServiceManager, palette: ICommandP
 
   commands.addCommand(CommandIDs.create, {
     label: 'New Launcher',
-    execute: (args) => {
+    execute: (args: JSONObject) => {
       let cwd = args['cwd'] ? String(args['cwd']) : '';
       let id = `launcher-${Private.id++}`;
       let callback = (item: Widget) => {

+ 3 - 4
packages/launcher/src/index.tsx

@@ -55,10 +55,9 @@ type PropsType = JSONObject | null;
 export
 type FunctionalComponent = (props: PropsType, ...children: vdom.h.Child[]) => vdom.VirtualElement;
 
-export function h(tag: FunctionalComponent, props: PropsType, ...children: vdom.h.Child[]): vdom.VirtualElement {
-export function h(tag: string, ...children: vdom.h.Child[]): vdom.VirtualElement;
-export function h(tag: string, attrs: vdom.ElementAttrs, ...children: vdom.h.Child[]): vdom.VirtualElement;
-export function h(tag: string): vdom.VirtualElement {
+export function h(tag: string | FunctionalComponent, ...children: vdom.h.Child[]): vdom.VirtualElement;
+export function h(tag: string | FunctionalComponent, attrs: vdom.ElementAttrs | PropsType, ...children: vdom.h.Child[]): vdom.VirtualElement;
+export function h(tag: string | FunctionalComponent): vdom.VirtualElement {
   let attrs: vdom.ElementAttrs = {};
   let children: vdom.VirtualNode[] = [];
   for (let i = 1, n = arguments.length; i < n; ++i) {