---
title: "Discussion on \"TypeScript\" | Hashnode"
description: "Discussion on \"TypeScript\". Type声明基本类型\n声明字符串类型\ntype Name = string\nconst str:Name= 'bot\n\n声明 字符串或数字类型\ntype Id = string|number\nconst id1:Id = '123'\nconst id2:Id = 123\n\n同时满足两种类型类型为never（写错了可能）\ntype wrongType = string & number\n\n\n可选类型\ntype User = {\n    name:string\n    age?:number\n}\nc..."
url: "https://hashnode.com/posts/typescript/625cff9f740c26066de656e6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [TypeScript](https://lihua.hashnode.dev/typescript?utm_source=hashnode&utm_medium=feed)

Type声明基本类型 声明字符串类型 type Name = string const str:Name= 'bot 声明 字符串或数字类型 type Id = string|number const id1:Id = '123' const id2:Id = 123 同时满足两种类型类型为never（写错了可能） type wrongType = string & number 可选类型 type User = { name:string age?:number } c...

Apr 18, 2022 · 1 min read · lihua.hashnode.dev  
Updated Apr 19, 2022  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)

## Written by

[Xin shen](https://hashnode.com/@lihua)

@lihua · China Beijing

  
[View profile](https://hashnode.com/@lihua)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
