[英]declaring a variable with colon in JavaScript
嗨,我现在正在学习JavaScript。 我刚刚发现的一些JavaScript令人困惑。 这是源代码
import type { OptionsType } from 'Types'
const theme: OptionsType = {
title: 'Lawton',
baseFontSize: '16px',
baseLineHeight: 1.5
}
在代码中,const变量用“:”声明。
表达式中的“:”是什么意思?
它等同于
const theme = OptionsType = { title: 'Lawton' }
表达式中的“:”是什么意思?
这是FlowType。 在注释上签出文档: https : //flow.org/en/docs/getting-started/
这不是TypeScript,因为import type
是很简单的事情: https : //flow.org/en/docs/types/modules/#importing-and-exporting-types-a-classtoc-idtoc-importing-and-exporting-types -hreftoc进口和出口,typesa
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.