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

✨ [Feature]: Hope to add the TypeScript type declaration of components #370

Open
kagol opened this issue Aug 9, 2023 · 2 comments
Open
Labels
refactoring Refactoring

Comments

@kagol
Copy link
Member

kagol commented Aug 9, 2023

What problem does this feature solve

Adding type declaration to components can improve the developer experience(DX).

建议优先完善高频组件的 TypeScript 类型声明。

TinyVue 高频组件

What does the proposed API look like

Take the alert component as an example.

packages/renderless/src/alert/vue.ts

  // Add type declaration to state
  const state: IAlertState = reactive({
    show: true,
    getIcon: computed(() => api.computedGetIcon()),
    getTitle: computed(() => api.computedGetTitle()),
    contentVisible: false,
    contentDescribeHeight: 0,
    contentDefaultHeight: 0,
    contentMaxHeight: constants.CONTENT_MAXHEUGHT,
    scrollStatus: false
  })
export interface IAlertState {
  show: boolean
  getIcon: ComputedRef<string>
  getTitle: ComputedRef<string>
  contentVisible: boolean
  contentDescribeHeight: number
  contentDefaultHeight: number
  contentMaxHeight: number
  scrollStatus: boolean
}
image
@kagol kagol added the refactoring Refactoring label Aug 9, 2023
@kagol kagol pinned this issue Aug 9, 2023
@kagol
Copy link
Member Author

kagol commented Aug 9, 2023

For more information on how to supplement the type declaration of a component, please refer to discussion #252

@zzcr zzcr closed this as completed Nov 23, 2023
@kagol kagol changed the title ✨ [Feature]: Please add type declaration to components ✨ [Feature]: 补充组件的 TypeScript 类型声明 Nov 23, 2023
@kagol kagol changed the title ✨ [Feature]: 补充组件的 TypeScript 类型声明 ✨ [Feature]: Hope to add the TypeScript type declaration of components Dec 9, 2023
@kagol
Copy link
Member Author

kagol commented Dec 9, 2023

The TypeScript type declaration of the component needs to be continuously improved.

@kagol kagol reopened this Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Refactoring
Projects
None yet
Development

No branches or pull requests

2 participants