Browse Source

Pull request #2410: refactor: 完善下jsx的类型

Merge in VISUAL/fineui from ~KIRA/fineui:master to master

* commit '5b649661e34f7015787cb6bc0460f031d1d36230':
  refactor: 完善下jsx的类型
  refactor: 完善下jsx的类型
es6
Kira 3 years ago
parent
commit
29607a6ed5
  1. 1
      typescript/index.ts
  2. 11
      typescript/shims-tsx.ts

1
typescript/index.ts

@ -180,6 +180,7 @@ import { TdLayout } from './core/wrapper/layout/layout.td';
import { MultiLayerSelectLevelTree } from './widget/multilayerselecttree/multilayerselecttree.leveltree'; import { MultiLayerSelectLevelTree } from './widget/multilayerselecttree/multilayerselecttree.leveltree';
import { SelectTreeExpander } from './widget/selecttree/selecttree.expander'; import { SelectTreeExpander } from './widget/selecttree/selecttree.expander';
import { DownListGroupItem } from "./widget/downlist/item.downlistgroup"; import { DownListGroupItem } from "./widget/downlist/item.downlistgroup";
import './shims-tsx';
export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils { export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils {

11
typescript/shims-tsx.ts

@ -4,9 +4,9 @@ interface UIProps {
width: number | string; width: number | string;
height: number | string; height: number | string;
top: number; top: number;
left: number; left: number | JSX.Element;
bottom: number; bottom: number;
right: number; right: number | JSX.Element;
rgap: number; rgap: number;
lgap: number; lgap: number;
tgap: number; tgap: number;
@ -63,7 +63,14 @@ interface ElementClassProps<T> extends UIProps {
destroyed(): void; destroyed(): void;
} }
type Widget = import('./index').Widget;
type Props<T extends Widget = any> = Partial<ElementClassProps<T> & AdditionalProps & Record<string, any>>;
declare namespace JSX { declare namespace JSX {
interface Element extends Props {
type: string;
}
interface ElementClass extends Widget {}
// for undefined // for undefined
interface IntrinsicElements { interface IntrinsicElements {
[elemName: string]: Partial<UIProps & AdditionalProps>; [elemName: string]: Partial<UIProps & AdditionalProps>;

Loading…
Cancel
Save