Skip to content

Commit

Permalink
docs: add function type
Browse files Browse the repository at this point in the history
  • Loading branch information
mistlog committed Feb 16, 2021
1 parent bbc41ed commit 809dcfe
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions README.md
Expand Up @@ -95,29 +95,42 @@ type c = string
```ts
type value = 1
type str = "abc"
type bool = true
type tuple = [1, 2, 3]
type obj = { a: 1; b: "abc"; c: [1, 2] }
type array = string[][]

type str = "abc"
type template = `value is: ${value}`
type keys = keyof { a: 1; b: 2 }

type obj = { a: 1; b: "abc"; c: [1, 2] }
type valueDeep = obj["c"][1]
type array = string[][]

type keys = keyof { a: 1; b: 2 }
```
### Complex type
### Function type
```ts
type f1 = type () => void
type f2 = type (a:number, b:string) => number
type f3 = type () => type (a:number, b:string) => void
```
### Conditional type
```ts
// conditional type
type conditional = ^{
if(1 extends string) {
return "string"
} else {
return "number"
}
}
```
// nested conditional type
nested:
```ts
type conditional2 = ^{
if(1 extends string) {
return "string"
Expand Down

0 comments on commit 809dcfe

Please sign in to comment.