简体   繁体   中英

Can not use "default" as parameter in typescript

I want to render the "default" property received from the api request. But I don't know why can use "default" as parameter and it returns me an error. 在此处输入图像描述

Data from api response: 在此处输入图像描述

default is a keyword in TypeScript so that might be the culprit. (eg used in export default MyComponent )

Could you try passing the argument directly (let's call it props for example) instead of destructuring, and try to access the property like props['default'] ?

使用不同的关键字,如defaultProp ,我认为 default 是预定义的关键字,它可能是编译器没有经过训练来处理它

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM