Giter Site home page Giter Site logo

uni-types's Introduction

@uni-helper/uni-typed

👇 请查看文档了解具体用法和示例。

Netlify | Cloudflare Pages

介绍

@uni-helper/uni-typed 是一个为 uni-app 打造的 TypeScript 支持项目,包含几个子包:

名称 描述
@uni-helper/uni-app-types 为 Vue v3 uni-app 组件提供 TypeScript 类型。
@uni-helper/uni-cloud-types 为 Vue v3 uni-cloud 组件提供 TypeScript 类型。
@uni-helper/uni-ui-types 为 Vue v3 uni-ui 组件提供 TypeScript 类型。
@uni-helper/uni-types 为 Vue v3 uni-app、uni-cloud 和 uni-ui 组件提供 TypeScript 类型支持,即以上三者的集合。
@uni-helper/uni-app-components 基于 @uni-helper/uni-app-types 封装 Vue v3 uni-app 组件。
@uni-helper/uni-cloud-components 基于 @uni-helper/uni-cloud-types 封装 Vue v3 uni-cloud 组件。
@uni-helper/uni-ui-components 基于 @uni-helper/uni-cloud-types 封装 Vue v3 uni-ui 组件。
@uni-helper/uni-components 基于 @uni-helper/uni-app-types 封装 Vue v3 uni-app 组件、基于 @uni-helper/uni-cloud-types 封装 Vue v3 uni-cloud 组件、基于 @uni-helper/uni-cloud-types 封装 Vue v3 uni-ui 组件,即以上三者的集合。

致谢

最初在 uni-base-components-types 得到了灵感。

基于 这个 PR 完成。

贡献者们

该项目由 ModyQyW 创建。

感谢 所有贡献者 的付出!

赞助

如果这个包对你有所帮助,请考虑 赞助 支持,这将有利于项目持续开发和维护。

uni-types's People

Contributors

modyqyw avatar paperstrike avatar

Stargazers

 avatar Eric Moore avatar  avatar 不如摸鱼去 avatar 企鹅2035 avatar qzs avatar xuelei avatar  avatar  avatar Vanisper avatar Tianxiang Ying avatar 苏杰豪 avatar samnyan avatar  avatar  avatar  avatar Mang avatar Yuchen avatar Hello avatar lzy1960 avatar 黄智勇 avatar

Watchers

KeJun avatar Tianxiang Ying avatar  avatar

uni-types's Issues

Vue: Argument of type { class: string; } is not assignable to parameter of type

描述问题

view tag and text tag type mismatch occurred
Snipaste_2024-08-14_10-08-52

复现

package.json:
{
"name": "uni-preset-vue",
"version": "0.0.0",
"scripts": {
"dev:app": "uni -p app",
"dev:app-android": "uni -p app-android",
"dev:app-ios": "uni -p app-ios",
"dev:app-harmony": "uni -p app-harmony",
"dev:custom": "uni -p",
"dev:h5": "uni",
"dev:h5:ssr": "uni --ssr",
"dev:mp-alipay": "uni -p mp-alipay",
"dev:mp-baidu": "uni -p mp-baidu",
"dev:mp-jd": "uni -p mp-jd",
"dev:mp-kuaishou": "uni -p mp-kuaishou",
"dev:mp-lark": "uni -p mp-lark",
"dev:mp-qq": "uni -p mp-qq",
"dev:mp-toutiao": "uni -p mp-toutiao",
"dev:mp-weixin": "uni -p mp-weixin",
"dev:mp-xhs": "uni -p mp-xhs",
"dev:quickapp-webview": "uni -p quickapp-webview",
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
"build:app": "uni build -p app",
"build:app-android": "uni build -p app-android",
"build:app-ios": "uni build -p app-ios",
"build:app-harmony": "uni build -p app-harmony",
"build:custom": "uni build -p",
"build:h5": "uni build",
"build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay",
"build:mp-baidu": "uni build -p mp-baidu",
"build:mp-jd": "uni build -p mp-jd",
"build:mp-kuaishou": "uni build -p mp-kuaishou",
"build:mp-lark": "uni build -p mp-lark",
"build:mp-qq": "uni build -p mp-qq",
"build:mp-toutiao": "uni build -p mp-toutiao",
"build:mp-weixin": "uni build -p mp-weixin",
"build:mp-xhs": "uni build -p mp-xhs",
"build:quickapp-webview": "uni build -p quickapp-webview",
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-4020420240722002",
"@dcloudio/uni-app-harmony": "3.0.0-4020420240722002",
"@dcloudio/uni-app-plus": "3.0.0-4020420240722002",
"@dcloudio/uni-components": "3.0.0-4020420240722002",
"@dcloudio/uni-h5": "3.0.0-4020420240722002",
"@dcloudio/uni-mp-alipay": "3.0.0-4020420240722002",
"@dcloudio/uni-mp-baidu": "3.0.0-4020420240722002",
"@dcloudio/uni-mp-jd": "3.0.0-4020420240722002",
"@dcloudio/uni-mp-kuaishou": "3.0.0-4020420240722002",
"@dcloudio/uni-mp-lark": "3.0.0-4020420240722002",
"@dcloudio/uni-mp-qq": "3.0.0-4020420240722002",
"@dcloudio/uni-mp-toutiao": "3.0.0-4020420240722002",
"@dcloudio/uni-mp-weixin": "3.0.0-4020420240722002",
"@dcloudio/uni-mp-xhs": "3.0.0-4020420240722002",
"@dcloudio/uni-quickapp-webview": "3.0.0-4020420240722002",
"bwip-js": "^4.5.0",
"default-passive-events": "^2.0.0",
"vue": "^3.4.21",
"vue-i18n": "^9.1.9"
},
"devDependencies": {
"@dcloudio/types": "^3.3.2",
"@dcloudio/uni-automator": "3.0.0-4020420240722002",
"@dcloudio/uni-cli-shared": "3.0.0-4020420240722002",
"@dcloudio/uni-stacktracey": "3.0.0-4020420240722002",
"@dcloudio/vite-plugin-uni": "3.0.0-4020420240722002",
"@uni-helper/uni-app-types": "^1.0.0-alpha.3",
"@uni-helper/uni-ui-types": "^1.0.0-alpha.3",
"@vue/runtime-core": "^3.4.21",
"@vue/tsconfig": "^0.1.3",
"sass": "^1.77.8",
"typescript": "^5.5.2",
"vite": "5.2.8",
"vue-tsc": "^2.0.22"
}
}
tsconfig.json:
{
"extends": "@vue/tsconfig/tsconfig.json",
"compilerOptions": {
"verbatimModuleSyntax": true,
"ignoreDeprecations": "5.0",
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@/": ["./src/"]
},
"lib": ["esnext", "dom"],
"types": ["@dcloudio/types", "@uni-helper/uni-app-types", "@uni-helper/uni-ui-types"]
},
"vueCompilerOptions": {
"plugins": ["@uni-helper/uni-app-types/volar-plugin"]
},
"include": ["src//*.ts", "src//.d.ts", "src/**/.tsx", "src/**/*.vue"]
}

The project use Vue3 Typescript Vite template
https://gitee.com/dcloud/uni-preset-vue/repository/archive/vite-ts.zip

系统信息

windows11

使用的包管理器

npm

核对

  • 遵循我们的 行为准则
  • 检查是否已经有一个报告相同错误的问题,以避免重复创建。
  • 这是一个具体的错误。请开启 GitHub 讨论你的疑问。
  • 所提供的复现是这个问题的 最小复现

给元素添加定义以外的属性会报错

描述问题

由于定义的type类型过于严格,导致定义以外的类型属性会报错。
这些未定义属性可能是第三方框架所需的,也可能是未来某一天会添加的,但现有定义尚未收录的。
建议拓宽类型描述,允许未出现在文档中的属性出现。

复现

image
如图所示,利用unocss给view标签添加一个 px-24rpx的样式(padding-left: 0.75rem; /* 12px / padding-right: 0.75rem; / 12px */),会报类型不匹配的错误,但实际开发中是合法可用的。

系统信息

基础环境信息:

  • os: Windows 10 10.0.19045
  • node: 20.12.1
  • packageManager: yarn
  • vscode: 1.92.2
  • volar: 2.0.21

基础依赖信息:

  • vue: 3.4.34
  • vite: 5.2.8
  • @dcloudio/uni-app: 3.0.0-4020420240722002
  • @uni-helper/uni-app-types: 1.0.0-alpha.3
  • @uni-helper/uni-ui-types: 1.0.0-alpha.3

使用的包管理器

yarn

核对

  • 遵循我们的 行为准则
  • 检查是否已经有一个报告相同错误的问题,以避免重复创建。
  • 这是一个具体的错误。请开启 GitHub 讨论你的疑问。
  • 所提供的复现是这个问题的 最小复现

[Vue] Plugin "@uni-helper/uni-app-types/volar-plugin (2)" API version incompatible, expected "2" but got "1".

描述问题

Error when running npm run type-check:
$ npm run type-check

[email protected] type-check
vue-tsc --noEmit

[Vue] Plugin "@uni-helper/uni-app-types/volar-plugin (2)" API version incompatible, expected "2" but got "1".
But it does not seem to affect the normal trial of the function

复现

package.json:
{
"name": "hi_bao",
"version": "0.1.0",
"scripts": {
"dev:app": "uni -p app",
"dev:app-android": "uni -p app-android",
"dev:app-ios": "uni -p app-ios",
"dev:custom": "uni -p",
"dev:h5": "uni",
"dev:h5:ssr": "uni --ssr",
"dev:mp-alipay": "uni -p mp-alipay",
"dev:mp-baidu": "uni -p mp-baidu",
"dev:mp-jd": "uni -p mp-jd",
"dev:mp-kuaishou": "uni -p mp-kuaishou",
"dev:mp-lark": "uni -p mp-lark",
"dev:mp-qq": "uni -p mp-qq",
"dev:mp-toutiao": "uni -p mp-toutiao",
"dev:mp-weixin": "uni -p mp-weixin",
"dev:mp-xhs": "uni -p mp-xhs",
"dev:quickapp-webview": "uni -p quickapp-webview",
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
"build:app": "uni build -p app",
"build:app-android": "uni build -p app-android",
"build:app-ios": "uni build -p app-ios",
"build:custom": "uni build -p",
"build:h5": "uni build",
"build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay",
"build:mp-baidu": "uni build -p mp-baidu",
"build:mp-jd": "uni build -p mp-jd",
"build:mp-kuaishou": "uni build -p mp-kuaishou",
"build:mp-lark": "uni build -p mp-lark",
"build:mp-qq": "uni build -p mp-qq",
"build:mp-toutiao": "uni build -p mp-toutiao",
"build:mp-weixin": "uni build -p mp-weixin",
"build:mp-xhs": "uni build -p mp-xhs",
"build:quickapp-webview": "uni build -p quickapp-webview",
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
"type-check": "vue-tsc --noEmit",
"mock": "node mock/server.mjs"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-4000820240401001",
"@dcloudio/uni-app-plus": "3.0.0-4000820240401001",
"@dcloudio/uni-components": "3.0.0-4000820240401001",
"@dcloudio/uni-h5": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-alipay": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-baidu": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-jd": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-lark": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-qq": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-toutiao": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-weixin": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-xhs": "3.0.0-4000820240401001",
"@dcloudio/uni-quickapp-webview": "3.0.0-4000820240401001",
"@types/numeral": "^2.0.5",
"@types/qs": "^6.9.15",
"@uni-helper/uni-app-types": "^0.5.13",
"axios": "^1.7.2",
"cors": "^2.8.5",
"dayjs": "^1.11.11",
"express": "^4.19.2",
"mockjs": "^1.1.0",
"numeral": "^2.0.6",
"qs": "^6.12.1",
"vue": "^3.3.11",
"vue-i18n": "^9.1.9"
},
"devDependencies": {
"@dcloudio/types": "^3.3.2",
"@dcloudio/uni-automator": "3.0.0-4000820240401001",
"@dcloudio/uni-cli-shared": "3.0.0-4000820240401001",
"@dcloudio/uni-stacktracey": "3.0.0-4000820240401001",
"@dcloudio/vite-plugin-uni": "3.0.0-4000820240401001",
"@vue/runtime-core": "^3.3.11",
"@vue/tsconfig": "^0.5.1",
"typescript": "^5.5.2",
"vite": "^4.5.3",
"vue-tsc": "^2.0.22"
}
}
tsconfig.json:
{
"extends": "@vue/tsconfig/tsconfig.json",
"compilerOptions": {
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@/": [
"./src/
"
]
},
"lib": [
"esnext",
"dom"
],
"types": ["@dcloudio/types", "@uni-helper/uni-app-types"]
},
"vueCompilerOptions": {
"plugins": ["@uni-helper/uni-app-types/volar-plugin"]
},
"include": [
"src//*.ts",
"src/
/.d.ts",
"src/**/
.tsx",
"src/**/*.vue"
]
}

系统信息

windows11

使用的包管理器

npm

核对

  • 遵循我们的 行为准则
  • 检查是否已经有一个报告相同错误的问题,以避免重复创建。
  • 这是一个具体的错误。请开启 GitHub 讨论你的疑问。
  • 所提供的复现是这个问题的 最小复现

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/autofix.yml
  • actions/checkout v4
  • pnpm/action-setup v4
  • actions/setup-node v4
  • autofix-ci/action v1
.github/workflows/ci.yml
  • actions/checkout v4
  • pnpm/action-setup v4
  • actions/setup-node v4
.github/workflows/pkg.pr.new.yml
  • actions/checkout v4
  • pnpm/action-setup v4
  • actions/setup-node v4
.github/workflows/release.yml
  • actions/checkout v4
  • pnpm/action-setup v4
  • actions/setup-node v4
npm
docs/package.json
  • vitepress ^1.3.4
  • vue 3.4.38
package.json
  • @biomejs/biome ^1.8.3
  • @dcloudio/types ^3.4.12
  • @lerna-lite/cli ^3.9.1
  • @lerna-lite/version ^3.9.1
  • @types/node ^20.16.5
  • conventional-changelog-conventionalcommits ^7.0.2
  • rimraf ^6.0.1
  • typescript ^5.6.2
  • unbuild ^3.0.0-rc.7
  • vitest ^2.0.5
  • node >=14.18
  • pnpm 9.10.0
packages/uni-app-components/package.json
  • vue 3.4.38
  • typescript ^5.0.0
  • vue ^3.4.21
  • node >=14.18
  • pnpm 9.10.0
packages/uni-app-types/package.json
  • vue 3.4.38
  • typescript ^5.0.0
  • vue ^3.0.0
  • node >=14.18
  • pnpm 9.10.0
packages/uni-cloud-types/package.json
  • vue 3.4.38
  • typescript ^5.0.0
  • vue ^3.0.0
  • node >=14.18
  • pnpm 9.10.0
packages/uni-types/package.json
  • vue 3.4.38
  • typescript ^5.0.0
  • vue ^3.0.0
  • node >=14.18
  • pnpm 9.10.0
packages/uni-ui-types/package.json
  • vue 3.4.38
  • typescript ^5.0.0
  • vue ^3.0.0
  • node >=14.18
  • pnpm 9.10.0
playground/package.json
  • @dcloudio/uni-app 3.0.0-4020420240722002
  • @dcloudio/uni-app-harmony 3.0.0-4020420240722002
  • @dcloudio/uni-app-plus 3.0.0-4020420240722002
  • @dcloudio/uni-components 3.0.0-4020420240722002
  • @dcloudio/uni-h5 3.0.0-4020420240722002
  • @dcloudio/uni-mp-alipay 3.0.0-4020420240722002
  • @dcloudio/uni-mp-baidu 3.0.0-4020420240722002
  • @dcloudio/uni-mp-jd 3.0.0-4020420240722002
  • @dcloudio/uni-mp-kuaishou 3.0.0-4020420240722002
  • @dcloudio/uni-mp-lark 3.0.0-4020420240722002
  • @dcloudio/uni-mp-qq 3.0.0-4020420240722002
  • @dcloudio/uni-mp-toutiao 3.0.0-4020420240722002
  • @dcloudio/uni-mp-weixin 3.0.0-4020420240722002
  • @dcloudio/uni-mp-xhs 3.0.0-4020420240722002
  • @dcloudio/uni-quickapp-webview 3.0.0-4020420240722002
  • vue 3.4.38
  • vue-i18n ^9.14.0
  • @dcloudio/types ^3.4.12
  • @dcloudio/uni-automator 3.0.0-4020420240722002
  • @dcloudio/uni-cli-shared 3.0.0-4020420240722002
  • @dcloudio/uni-stacktracey 3.0.0-4020420240722002
  • @dcloudio/vite-plugin-uni 3.0.0-4020420240722002
  • typescript 5.5.4
  • vite ^5.4.3
  • vue-tsc 2.1.6
nvm
.nvmrc
  • node 20

  • Check this box to trigger a request for Renovate to run again on this repository

Fix types

Run typecheck or test will generate errors not shown before. Better take some surveys before releasing v1.

安装超时

描述问题

运行 npm i -D @uni-helper/uni-types 安装超时

复现

系统信息

使用的包管理器

npm

核对

  • 遵循我们的 行为准则
  • 检查是否已经有一个报告相同错误的问题,以避免重复创建。
  • 这是一个具体的错误。请开启 GitHub 讨论你的疑问。
  • 所提供的复现是这个问题的 最小复现

Visual Studio Code 中uni-app内置组件报错。

描述问题

项目使用Vues + ts 构建, 能正常开发和编译。但在Visual Studio Code中显示错误:

image

uni-ui组件无报错信息,uni-app内置组件view, text, button. 有错误提示:

Argument of type '{ class: string; }' is not assignable to parameter of type 'ComponentPublicInstanceConstructor<CreateComponentPublicInstance<Readonly<ExtractPropTypes<Partial<{ selectable: boolean; userSelect: boolean; space: _TextSpace; decode: boolean; }>>>, {}, ... 17 more ..., {}>, ... 4 more ..., MethodOptions> & ... 4 more ... & Record<...>'.
  Type '{ class: string; }' is not assignable to type 'ComponentPublicInstanceConstructor<CreateComponentPublicInstance<Readonly<ExtractPropTypes<Partial<{ selectable: boolean; userSelect: boolean; space: _TextSpace; decode: boolean; }>>>, {}, ... 17 more ..., {}>, ... 4 more ..., MethodOptions>'.
    Type '{ class: string; }' provides no match for the signature 'new (...args: any[]): CreateComponentPublicInstance<Readonly<ExtractPropTypes<Partial<{ selectable: boolean; userSelect: boolean; space: _TextSpace; decode: boolean; }>>>, ... 18 more ..., {}>'.ts-plugin(2345)

package.json

{
  "name": "ui",
  "version": "0.1.0",
  "scripts": {
    "dev:app": "uni -p app",
    "dev:app-android": "uni -p app-android",
    "dev:app-ios": "uni -p app-ios",
    "dev:custom": "uni -p",
    "dev:h5": "uni",
    "dev:h5:ssr": "uni --ssr",
    "dev:mp-alipay": "uni -p mp-alipay",
    "dev:mp-baidu": "uni -p mp-baidu",
    "dev:mp-jd": "uni -p mp-jd",
    "dev:mp-kuaishou": "uni -p mp-kuaishou",
    "dev:mp-lark": "uni -p mp-lark",
    "dev:mp-qq": "uni -p mp-qq",
    "dev:mp-toutiao": "uni -p mp-toutiao",
    "dev:mp-weixin": "uni -p mp-weixin",
    "dev:mp-xhs": "uni -p mp-xhs",
    "dev:quickapp-webview": "uni -p quickapp-webview",
    "dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
    "dev:quickapp-webview-union": "uni -p quickapp-webview-union",
    "build:app": "uni build -p app",
    "build:app-android": "uni build -p app-android",
    "build:app-ios": "uni build -p app-ios",
    "build:custom": "uni build -p",
    "build:h5": "uni build",
    "build:h5:ssr": "uni build --ssr",
    "build:mp-alipay": "uni build -p mp-alipay",
    "build:mp-baidu": "uni build -p mp-baidu",
    "build:mp-jd": "uni build -p mp-jd",
    "build:mp-kuaishou": "uni build -p mp-kuaishou",
    "build:mp-lark": "uni build -p mp-lark",
    "build:mp-qq": "uni build -p mp-qq",
    "build:mp-toutiao": "uni build -p mp-toutiao",
    "build:mp-weixin": "uni build -p mp-weixin",
    "build:mp-xhs": "uni build -p mp-xhs",
    "build:quickapp-webview": "uni build -p quickapp-webview",
    "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
    "build:quickapp-webview-union": "uni build -p quickapp-webview-union",
    "type-check": "vue-tsc --noEmit"
  },
  "dependencies": {
    "@dcloudio/uni-app": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-app-plus": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-components": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-h5": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-mp-alipay": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-mp-baidu": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-mp-jd": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-mp-lark": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-mp-qq": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-mp-toutiao": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-mp-weixin": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-mp-xhs": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-ui": "^1.5.6",
    "vue": "^3.4.35"
  },
  "devDependencies": {
    "@dcloudio/types": "^3.4.12",
    "@dcloudio/uni-automator": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-cli-shared": "3.0.0-alpha-4020520240731001",
    "@dcloudio/uni-stacktracey": "3.0.0-alpha-4020520240731001",
    "@dcloudio/vite-plugin-uni": "3.0.0-alpha-4020520240731001",
    "@types/wechat-miniprogram": "^3.4.7",
    "@uni-helper/uni-types": "1.0.0-alpha.1",
    "@vue/runtime-core": "^3.4.35",
    "@vue/tsconfig": "^0.5.1",
    "sass": "^1.77.8",
    "typescript": "^5.5.4",
    "vite": "^5.3.5",
    "vue-tsc": "^2.0.29"
  },
  "packageManager": "[email protected]+sha256.dae0f7e822c56b20979bb5965e3b73b8bdabb6b8b8ef121da6d857508599ca35"
}

tsconfig.json

{
  "compilerOptions": {
    "lib": [
      "DOM",
      "DOM.Iterable",
      "ESNext"
    ],
    "module": "ESNext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "jsx": "preserve",
    "jsxImportSource": "vue",
    "noImplicitThis": true,
    "strict": true,
    "verbatimModuleSyntax": true,
    "target": "ESNext",
    "useDefineForClassFields": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true,
    "sourceMap": true,
    "baseUrl": ".",
    "paths": {
      "@/*": [
        "./src/*"
      ]
    },
    "types": [
      "vite/client",
      "@dcloudio/types",
      "@types/wechat-miniprogram",
      "@uni-helper/uni-types"
    ]
  },
  "vueCompilerOptions": {
    "plugins": [
      "@uni-helper/uni-types/volar-plugin"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.d.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "*.d.ts"
  ]
}

复现

visual studio code 的插件

  • uni-helper: v0.5.9
  • Vue - Official: v2.0.28
  • Vue 3 Snippets: v1.0.4
  1. pnpm i 安装依赖
  2. 用 visual studio code 打开项目

uni-app内置组件在visual studio code 中显示错误。

系统信息


基础环境信息:

  • os: macOS 13.0
  • node: 20.10.0
  • packageManager: pnpm
  • vscode: 1.91.1
  • volar: 2.0.28

基础依赖信息:

  • vue: 3.4.35
  • vite: 5.3.5
  • @dcloudio/uni-app: 3.0.0-alpha-4020520240731001

uni-helper依赖信息:

  • @uni-helper/uni-types: 1.0.0-alpha.1

uni-helper插件信息:

  • create-uniapp-view: 2.1.0
  • uni-app-schemas-vscode: 0.9.3
  • uni-app-snippets-vscode: 0.10.4
  • uni-cloud-snippets-vscode: 0.3.0
  • uni-helper-vscode: 0.5.9
  • uni-highlight-vscode: 0.3.10
  • uni-ui-snippets-vscode: 0.6.6

使用的包管理器

pnpm

核对

  • 遵循我们的 行为准则
  • 检查是否已经有一个报告相同错误的问题,以避免重复创建。
  • 这是一个具体的错误。请开启 GitHub 讨论你的疑问。
  • 所提供的复现是这个问题的 最小复现

在模板中使用时提示错误,不能将类型“Ref<string, string>”分配给类型“string”

描述问题

在模板中使用时提示错误,不能将类型“Ref<string, string>”分配给类型“string”。

不能将类型“Ref<string, string>”分配给类型“string”。ts-plugin(2322)
index.d.ts(5050, 5): 所需类型来自属性 "src",在此处的 "Partial<{}> & Omit<{ readonly src?: string | undefined; readonly mode?: _ImageMode | undefined; readonly lazyLoad?: boolean | undefined; readonly fadeShow?: boolean | undefined; ... 4 more ...; readonly onLoad?: _ImageOnLoad | undefined; } & VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly<...>, ..." 类型上声明该属性
(property) src?: string | undefined
图片资源地址

复现

先定义

gvar.baseIcon = ref('')

模板中使用:

<image :src="gvar.baseIcon">

系统信息

础环境信息:

  • os: Windows 11 10.0.22631
  • node: 18.14.2
  • packageManager: npm
  • vscode: 1.93.0
  • volar: 2.1.6

使用的包管理器

npm

核对

贡献

  • 我愿意提交一个 PR 修复这个问题
  • 我愿意提交一个 PR 带有失败的测试(实际上只要去做就好,谢谢!)

类型定义需要增加 Ref<string, string>

image

vscode中内嵌的template报错

描述问题

vscode编辑器中,如果是内嵌的template会显示报错,不过不影响最终编译。
image

复现

a.vue

<template>
  <view>
    <template>
        
    </template>
  </view>
</template>

package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },

  "devDependencies": {
    "@uni-helper/uni-app-types": "1.0.0-alpha.3"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es2016",
    "jsx": "preserve",
    "lib": ["DOM", "ESNext", "DOM.Iterable"],
    "baseUrl": ".",
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "paths": {
      "~/*": ["src/*"],
      "@/*": ["src/*"]
    },
    "resolveJsonModule": true,
    "types": [
      "@uni-helper/uni-app-types",
    ],
    "allowJs": true,
    "strict": true,
    "strictNullChecks": true,
    "noUnusedLocals": true,
    "outDir": "dist",
    "sourceMap": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true
  },
  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
  "exclude": ["dist", "node_modules"],

  // uni-app Component type prompt
  "vueCompilerOptions": {
    "target": 3, // or 2.7 for Vue 2
    "plugins": [
      "@uni-helper/uni-app-types/volar-plugin"
    ]
  }
}

image

系统信息

✔ 请选择需要反馈的依赖 › @uni-helper/uni-app-types
✔ 请选择需要反馈的vscode插件 › uni-app-snippets-vscode


基础环境信息:

  • os: macOS 14.5
  • node: 18.17.1
  • packageManager: pnpm
  • vscode: 1.92.2
  • volar: 2.0.28

基础依赖信息:

  • @dcloudio/uni-app: 3.0.0-4020420240722002

uni-helper依赖信息:

  • @uni-helper/uni-app-types: 1.0.0-alpha.3

uni-helper插件信息:

  • uni-app-snippets-vscode: 0.10.5

使用的包管理器

pnpm

核对

贡献

  • 我愿意提交一个 PR 修复这个问题
  • 我愿意提交一个 PR 带有失败的测试(实际上只要去做就好,谢谢!)

uni-search-bar的onInput事件参数类型应该是string | number

type _UniSearchBarValue = string | number;

type _UniSearchBarOnInputEvent = _UniSearchBarBaseEvent;

37行,uni-search-bar的onInput事件参数类型应该是string | number

// type _UniSearchBarOnInputEvent = _UniSearchBarBaseEvent; 
   type _UniSearchBarOnInputEvent = _UniSearchBarValue; 

https://uniapp.dcloud.net.cn/component/uniui/uni-search-bar.html#searchbar-events
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.