Skip to content

Commit

Permalink
Merge pull request #46 from duenyang/fix/type
Browse files Browse the repository at this point in the history
fix(type): fix TNode type
  • Loading branch information
dntzhang authored Jun 19, 2024
2 parents c46c790 + 94c23f1 commit abf2f3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/button/button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, tag, VNode } from 'omi';
import { Component, tag } from 'omi';

import { TNode } from '../common';
import { classname, getClassPrefix } from '../utils';

type Theme = 'default' | 'primary' | 'danger' | 'warning' | 'success';
Expand All @@ -11,7 +12,7 @@ export interface ButtonProps {
block?: boolean;
disabled?: boolean;
ghost?: boolean;
icon?: VNode;
icon?: TNode;
loading?: boolean;
shape?: 'rectangle' | 'square' | 'round' | 'circle';
size?: 'small' | 'medium' | 'large';
Expand Down
2 changes: 1 addition & 1 deletion src/common.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { VNode, WeElement } from 'omi';

export type TElement<T = undefined> = T extends undefined ? WeElement : (props: T) => WeElement;
export type TNode<T = undefined> = T extends undefined ? VNode : VNode | ((props: T) => VNode);
export type TNode<T = any> = VNode<T> | ((props: T) => VNode) | object | string | number | boolean | null;

export type AttachNodeReturnValue = HTMLElement | Element | Document;
export type AttachNode = CSSSelector | ((triggerNode?: HTMLElement) => AttachNodeReturnValue);
Expand Down

0 comments on commit abf2f3f

Please sign in to comment.