-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat(h5): 增加vue3/tsx组件类型定义 #11653
feat(h5): 增加vue3/tsx组件类型定义 #11653
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接这样定义开发者应该不好使用吧,是不是应该考虑定义一个 module 让开发者自己引入会更好一些
ts重写类型只能是在全局类型定义里面去重写一个库的类型, 比如 declare module '@tarojs/components' {
export * from '@tarojs/components/types/index.vue3'
} 另外一种设计就是直接提供类型重写文件,比如提供一个 "compilerOptions": {
"types": ["@tarojs/taro", "webpack-env", "vite/client", "@tarojs/components/types/vue3"],
} 你是想要第二种? |
@ZakaryCode 修改了增加了用户直接在 {
"compilerOptions": {
"types": ["@tarojs/component/vue3"]
}
} |
我有这个定义,编写tsx 就会报错 import { defineComponent } from 'vue';
import { View, Text } from '@tarojs/components';
import styles from './style.module.less';
export default defineComponent({
setup(props) {
return () => (
<View className={styles.container}>
<Text>123</Text>
</View>
);
}
}); error:
我吧 global.d.ts |
@ZakaryCode 类型是不是搞错了, 他那个 Component 没有正确推断出来 { new (): { $props }} 这样的结构 |
这个 PR 做了什么? (简要描述所做更改)
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台: