流类型,`+`符号在属性前面是什么意思? [英] Flow type, What does the `+` symbol mean in front a property?

查看:106
本文介绍了流类型,`+`符号在属性前面是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了以下用js FlowType编写的代码(我有兴趣知道在FlowType的上下文中+的值不是普通的JS)。

I came across the following code written in js FlowType (I am interested to know the value of + in the context of FlowType not in general JS).

可能您可以解释一下 + 符号在下面的代码中在该属性前面的含义:

Could you please explain me what does the + symbol mean in front of the property in the code below:

  export type User = {
      +name: string,
      +surname: string,
      +personId: PourceId,
    }

我在文档中找不到任何参考,也欢迎任何链接。

I could not find any reference in the documentation, any link is also welcome.

推荐答案

物业前面的 + 符号表示该物业是只读

The + symbol in front of the property means the property is read-only

参考: https://flow.org/en/docs/types/interfaces/#toc-interface-property-variance-read-仅限只写

这篇关于流类型,`+`符号在属性前面是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆