-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## react history | ||
|
||
### html.js.css | ||
### jq | ||
### backbone.js | ||
### the birth of SPA | ||
### angular | ||
### mvc mvvm | ||
### react | ||
|
||
## declarative_vs_imperative | ||
|
||
### 声明式与命令式 | ||
## component architecture | ||
|
||
关于组件 | ||
|
3 changes: 3 additions & 0 deletions
3
.../typescript/Systematization/books/learningTypescript/5_functions/explicit_return_types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function singSongsRecursive(song: string[], count: number = 0): number { | ||
return song.length ? singSongsRecursive(song.slice(1), count + 1) : count; | ||
} |
16 changes: 16 additions & 0 deletions
16
...ference/typescript/Systematization/books/learningTypescript/5_functions/function_types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//#region function types parentheses | ||
|
||
let returnStringOrUndefined: () => string | undefined; | ||
let mayReturnsStrings: (() => string) | undefined; | ||
//#end region | ||
|
||
const neverReturn = () => { | ||
throw new Error("never never"); | ||
}; | ||
|
||
const voidReturn = () => { | ||
// while (false) { | ||
// return "hiihii"; | ||
// } | ||
return; | ||
}; |
16 changes: 16 additions & 0 deletions
16
...ference/typescript/Systematization/books/learningTypescript/5_functions/note.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
### 函数的类型定义需要注意的问题 | ||
|
||
- optional parameters中 | ||
required parameters必须在optional parameters前面 | ||
- Rest Parameters | ||
@[code](./rest_parameters.ts) | ||
- never vs void | ||
|
||
:::tip tip | ||
void:function return nothing | ||
never: function never return | ||
::: | ||
|
||
|
||
### unknown words | ||
- cumbersome 笨重的 |
14 changes: 14 additions & 0 deletions
14
...escript/Systematization/books/learningTypescript/5_functions/parameter_type_interfaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//#region part1 | ||
let singer: (song: string) => string; | ||
singer = function (song) { | ||
return `Singing ${song.toUpperCase()}`; | ||
}; | ||
//#endregion | ||
|
||
{ | ||
// Functions passed as arguments to parameters with function parameter types will have their parameter types inferred as well. | ||
let songs = ["1", "2", "3"]; | ||
songs.forEach((song, index) => { | ||
console.log(`${song} at index:${index}`); | ||
}); | ||
} |
8 changes: 8 additions & 0 deletions
8
...erence/typescript/Systematization/books/learningTypescript/5_functions/rest_parameters.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function singAllTheSongs(singer: string, ...songs: string[]) { | ||
for (const song of songs) { | ||
console.log(`《${song}》 by ${singer}`); | ||
} | ||
} | ||
|
||
singAllTheSongs("ajn404"); | ||
singAllTheSongs("ajn403", "我", "我记得"); |
31 changes: 31 additions & 0 deletions
31
...Systematization/books/learningTypescript/intersectionTypes/1_danger_of_insertion_tyoes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//Intersection types are a useful concept, but it’s easy to use them in ways that confuse either yourself or the TypeScript compiler. | ||
|
||
//#region long assignability errors | ||
type ShortPoemMBase = { | ||
author: string; | ||
}; | ||
|
||
type Haiku = ShortPoemMBase & { | ||
kigo: string; | ||
type: "haiku"; | ||
}; | ||
|
||
type Villanelle = ShortPoemMBase & { | ||
type: "villanelle"; | ||
meter: string; | ||
}; | ||
|
||
type ShortPoemM = Haiku | Villanelle; | ||
|
||
const oneArt: ShortPoemM = { | ||
author: "ajn404", | ||
type: "villanelle", | ||
// meter:'hihi' | ||
}; | ||
|
||
//#endregion | ||
|
||
//#region never | ||
type NotPossible = number & string; | ||
//type NotPossible = never | ||
//#endregion |