iview [Bug Report] Calls the static method of Message, TS reports an error

cld4siwp  于 2022-11-19  发布在  其他
关注(0)|答案(3)|浏览(167)

Environment

vue

https://run.iviewui.com/abNQ16wG

Steps to reproduce

Message.info('title')

What is expected?

直接调用 Message 上的方法时 ts 不会产生错误
static error(config?: MessageConfig | string): void;

What is actually happening?

直接使用 message 时, ts 会提示 -> 类型“typeof Message”上不存在属性“error”。

92dk7w1h

92dk7w1h1#

Translation of this issue:

Environment

Vue

https://run.iviewui.com/abNQ16wG

Steps to reproduce

Message. info ('title')

What is expected?

TS does not produce errors when calling methods directly on Message
Static error (config?: MessageConfig | string): void;

What is actually happening?

When using message directly, TS will prompt - > that there is no attribute "error" on the type "typeof Message".

m528fe3b

m528fe3b3#

同样问题,兼容的办法,Message 做类型断言

相关问题