wiki/content/20200929161544-primitive_types.md

36 lines
381 B
Markdown
Raw Permalink Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-09-29
2024-05-06 20:40:05 +00:00
id: 8809980a-615d-453f-bc63-2f890fca03b8
title: TypeScript primitive types
---
# Syntax
## Number
``` typescript
var num: number
num = 123
num = 123.24
num = '123' / Error
```
## String
``` typescript
var str: string
str = '123'
str = 123 // Error
```
## Boolean
``` typescript
var bool: boolean
bool = true
bool = false
bool = 'tralala' // Error
```