add tsx support

This commit is contained in:
pengfei.zhou
2021-09-01 10:47:40 +08:00
committed by osborn
parent cde8d1726f
commit 52b2b87e1c
20 changed files with 6856 additions and 6762 deletions

23
doric-js/index.d.ts vendored
View File

@@ -120,6 +120,7 @@ declare module 'doric/lib/src/util/index.util' {
export * from 'doric/lib/src/util/types';
export * from 'doric/lib/src/util/uniqueId';
export * from 'doric/lib/src/util/flexbox';
export * from 'doric/lib/src/util/jsx';
}
declare module 'doric/lib/src/pattern/index.pattern' {
@@ -1390,6 +1391,28 @@ declare module 'doric/lib/src/util/flexbox' {
export {};
}
declare module 'doric/lib/src/util/jsx' {
import { View } from "doric/lib/src/ui/view";
import { ClassType } from "doric/lib/src/util/types";
export const jsx: {
createElement: <T extends View>(constructor: ClassType<T>, config: Partial<T> | null, ...children: View[]) => T;
};
global {
namespace JSX {
interface IntrinsicElements {
}
interface ElementClass extends View {
}
interface ElementAttributesProperty {
props: {};
}
interface ElementChildrenAttribute {
children: View[];
}
}
}
}
declare module 'doric/lib/src/pattern/candies' {
export function take<T>(target: T): (block: (p: T) => void) => void;
export function takeNonNull<T, R>(target?: T): (block: (p: T) => R) => R | undefined;