jd-opensource / jd-opensource/taro-ui
在 VSCode、IntelliJ IDEA 等开发环境下,AtCurtain、AtNoticebar、AtList 等组件报类型错误,但可以正常预览、编译
- Dominant language
- TypeScript
- Stars
- 4.7k
- Forks
- 740
- PR merge metrics
- No merged PRs in 30d
Description
### Taro UI 版本信息
v3.1.0-beta.3
### 问题描述
如题所诉,在 VSCode、IntelliJ IDEA 等开发环境下,AtCurtain、AtNoticebar、AtList 等组件报类型错误,但可以正常预览、编译。
部分组件,如 SwiperItem、AtGrid 可正常使用不报错
### 复现步骤
1、taro init 一路默认选项创建项目;
2、将 app.tsx 替换为以下 FC 入口;
3、用 VSCode 打开即可见上述 错误提示;
### 复现代码
```ts
// app.tsx
import 'default-passive-events'
import {useEffect, useState} from 'react'
import {useDidHide, useDidShow} from '@tarojs/taro'
import {AtCurtain} from "taro-ui";
import {View} from "@tarojs/components";
import './app.scss'
const App = (props) => {
const [curtainShown, setCurtainShown] = useState(false);
useEffect(() => {
setCurtainShown(true)
}, [])
useDidShow(() => {
})
useDidHide(() => {
})
return (
<>
setCurtainShown(false)}
>
{props.children}
)
}
export default App
```
### 报错信息
各错误提示如下:
```bash
TS2322: Type '{ children: Element; current: number; index: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes> & Readonly<...>'. Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Readonly<...>'.
Type '{ children: string; marquee: true; speed: number; icon: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes> & Readonly<...>'.
Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Readonly<...>'.ts(2322)
Type '{ children: Element; isOpened: boolean; closeBtnPosition: "bottom"; onClose: () => void; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes> & Readonly'.
Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Readonly'.ts(2322)
```
### 系统信息
```bash
👽 Taro v3.5.2
Taro CLI 3.5.2 environment info:
System:
OS: macOS 13.0
Shell: 3.5.1 - /usr/local/bin/fish
Binaries:
Node: 18.7.0 - /usr/local/bin/node
npm: 8.15.0 - /usr/local/bin/npm
npmPackages:
@tarojs/cli: 3.5.2 => 3.5.2
@tarojs/components: 3.5.2 => 3.5.2
@tarojs/helper: 3.5.2 => 3.5.2
@tarojs/plugin-framework-react: 3.5.2 => 3.5.2
@tarojs/plugin-platform-alipay: 3.5.2 => 3.5.2
@tarojs/plugin-platform-jd: 3.5.2 => 3.5.2
@tarojs/plugin-platform-qq: 3.5.2 => 3.5.2
@tarojs/plugin-platform-swan: 3.5.2 => 3.5.2
@tarojs/plugin-platform-tt: 3.5.2 => 3.5.2
@tarojs/plugin-platform-weapp: 3.5.2 => 3.5.2
@tarojs/react: 3.5.2 => 3.5.2
@tarojs/router: 3.5.2 => 3.5.2
@tarojs/runtime: 3.5.2 => 3.5.2
@tarojs/shared: 3.5.2 => 3.5.2
@tarojs/taro: 3.5.2 => 3.5.2
@tarojs/taro-h5: 3.5.2 => 3.5.2
babel-preset-taro: 3.5.2 => 3.5.2
eslint-config-taro: 3.5.2 => 3.5.2
react: ^18.0.0 => 18.2.0
taro-ui: 3.1.0-beta.3 => 3.1.0-beta.3
npmGlobalPackages:
typescript: 3.7.5
```
### 补充信息
这里有个相似的问题 https://github.com/NervJS/taro-ui/issues/1497
Contributor guide
Assessment
This issue has not been assessed yet.