Hi right now i'm learning JavaScript. There is a confusion with some JavaScript I just found. This is the source code
import type { OptionsType } from 'Types'
const theme: OptionsType = {
title: 'Lawton',
baseFontSize: '16px',
baseLineHeight: 1.5
}
In the code, the const variable is declared with ":"
What does ":" mean in the expression ?
Is it equivalent with
const theme = OptionsType = { title: 'Lawton' }
What does ":" mean in the expression ?
This is FlowType. Checkout the docs on the annotation: https://flow.org/en/docs/getting-started/
This is not TypeScript as import type is a flow thing: https://flow.org/en/docs/types/modules/#importing-and-exporting-types-a-classtoc-idtoc-importing-and-exporting-types-hreftoc-importing-and-exporting-typesa
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With