Tencent / tdesign-vue-next

A Vue3.x UI components lib for TDesign.
https://tdesign.tencent.com/vue-next
MIT License
1.39k stars 454 forks source link

[t-config-provider] global-config 配置项类型报错 #3778

Open ThereWeGo opened 7 months ago

ThereWeGo commented 7 months ago

tdesign-vue-next 版本

1.7.2

重现链接

No response

重现步骤

APP.vue

<template>
  <t-config-provider :global-config="zhConfig">
    <router-view key="zh_CN" :class="[mode]" />
  </t-config-provider>
</template>
<script setup lang="ts">
import zhConfig from 'tdesign-vue-next/es/locale/zh_CN'
import { computed } from 'vue'
import { useSettingStore } from '@/store'

const store = useSettingStore()
const mode = computed(() => {
  return store.mode
})
</script>

<style lang="less" scoped>
#nprogress .bar {
  background: var(--td-brand-color) !important;
}
</style>

image

期望结果

类型报错

实际结果

类型报错

框架版本

^3.3.13

浏览器版本

No response

系统版本

win10

Node版本

20

补充说明

No response

github-actions[bot] commented 7 months ago

👋 @ThereWeGo,感谢给 TDesign 提出了 issue。 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

ThereWeGo commented 7 months ago

尝试使用 as 强制转换, 先不转为unknown 让他报出错误: 如截图 image

<template>
  <t-config-provider :global-config="zhConfig">
    <router-view key="zh_CN" :class="[mode]" />
  </t-config-provider>
</template>

中 global-config 类型提示确实为:

(property) globalConfig?: GlobalConfigProvider | undefined

这说明

import zhConfig from 'tdesign-vue-next/es/locale/zh_CN'

zhConfig 不能完全兼容 GlobalConfigProvider类型