Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 生成 react jsx 类型定义 #288

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

BaffinLee
Copy link
Contributor

Close #287

@zdhxiong
Copy link
Owner

我不是很熟悉 react,不知道是否可以像这样直接导入组件类型,而不是列出组件的所有属性:

import React from 'react';
import { Avatar } from './components/avatar.js';

type HTMLElementProps = React.DetailedHTMLProps<
  React.HTMLAttributes<HTMLElement>,
  HTMLElement
>;

declare global {
  namespace JSX {
    interface IntrinsicElements {
      'mdui-avatar': Partial<Avatar> & HTMLElementProps;
    }
  }
}

@BaffinLee
Copy link
Contributor Author

要区分 attribute 还是 property,jsx 只需要 attribute

@zdhxiong zdhxiong merged commit cfffbaf into zdhxiong:v2 Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

建议输出一个扩展 JSX 类型的 d.ts 文件
2 participants