Browse Source

refactor: 完善下jsx的类型

es6
Kira 3 years ago
parent
commit
cbfc58ee3f
  1. 1
      typescript/index.ts
  2. 7
      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 {

7
typescript/shims-tsx.ts

@ -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>;
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