File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 1- # 1.0.0 (2020-12-02 )
1+ # 1.0.0 (2020-12-10 )
22
33
44### Bug Fixes
4343* plop auto create docs model ([ 1f5a2f9] ( https://github.com/Rain120/typescript-guide/commit/1f5a2f94bbd7a430bbfbb48a09718b8ec9d14190 ) )
4444* plop new docs & update alias; update plop template; add docs catalog & folders ([ dd5326a] ( https://github.com/Rain120/typescript-guide/commit/dd5326ac2934069c2cb10238c674e4dc86844274 ) )
4545* refactor types(intersection, union, guard) to advanced types ([ bde41ab] ( https://github.com/Rain120/typescript-guide/commit/bde41ab8e61ae59f21c907c7a1a86e932ee71f31 ) )
46- * ** heading:** 加入特殊 heading 的处理; ignore IDE 相关的文件 ([ 5e9070b] ( https://github.com/Rain120/typescript-guide/commit/5e9070baf3b36cc0e753b9bde3a8aaec58590314 ) )
4746* ts basic type; update logo; guide; add editorconfig ([ c0b6eb2] ( https://github.com/Rain120/typescript-guide/commit/c0b6eb272ab4d87706902cdda365230e507b860b ) )
4847* ts operator; compile config; fix: playground frame width bug ([ f2bcaa0] ( https://github.com/Rain120/typescript-guide/commit/f2bcaa05bfdf574037ec54ed3e651ce1d1353b5c ) )
48+ * ts operators ([ 4e009df] ( https://github.com/Rain120/typescript-guide/commit/4e009dfa98c42be63705d71130af1bfc46861d19 ) )
49+ * ** heading:** 加入特殊 heading 的处理; ignore IDE 相关的文件 ([ 5e9070b] ( https://github.com/Rain120/typescript-guide/commit/5e9070baf3b36cc0e753b9bde3a8aaec58590314 ) )
4950* type assertion ([ f77f51c] ( https://github.com/Rain120/typescript-guide/commit/f77f51c574f036d6079742eca8f8affa7b06f617 ) )
5051* update the okrs about guide ([ a762e9c] ( https://github.com/Rain120/typescript-guide/commit/a762e9cb156ac0bcdbdc64f0b477e41c49fb9e8d ) )
5152* utility types; alias set bottom title; update generics params; ([ a306a25] ( https://github.com/Rain120/typescript-guide/commit/a306a25c512246ef230a445ccb4e292eef8b8a7d ) )
Original file line number Diff line number Diff line change @@ -102,14 +102,15 @@ type Readonly<T> = {
102102#### 使用
103103
104104` ` ` ts
105+ // Record
105106interface Page {
106- title: string ;
107- content: string ;
107+ title? : string | undefined ;
108+ content? : string | undefined ;
108109}
109110
110111type PageType = ' home' | ' about' | ' contact' ;
111112
112- const site: Record <Page , PageType > = {
113+ const site: Record <PageType , Page > = {
113114 home: {
114115 content: ' home'
115116 },
@@ -118,7 +119,11 @@ const site: Record<Page, PageType> = {
118119 content: ' about'
119120 },
120121 contact: {
121- content: ' contact'
122+ title: ' contact' ,
123+ // Error: Type '{ title: string; name: string; }' is not assignable to type 'Page'.
124+ // Object literal may only specify known properties,
125+ // and 'name' does not exist in type 'Page'.
126+ name: ' Rain120'
122127 },
123128}
124129
@@ -132,7 +137,7 @@ type Record<K extends keyof any, T> = {
132137}
133138` ` `
134139
135- [直接体验](https://www.typescriptlang.org/play/ #code/PTAECUFMGMHsCcAmAoZBLAdgF0vAZgIbSSgAKBA5iQN7Kj2hZpYA2kAXKAM5byYUBuOgzjZI2Tjz4ZByAL6osATwAOJclQAqqkgF5QAcgAWsALaQDoAD6GCAI1gBXLJZsHRWIi6HJRPbswcEDAIiAA8GpAANGSUkNpqAHyg+rQMoCbmnGnpIrBiEoaZFsL0clGloPZOWNmV6UysQQbVzgYVuXkFtbYObZXllR5edZ30HuI97vme0C4DFQpAA )
140+ [直接体验](https://www.typescriptlang.org/play? #code/PTAECUFMGMHsCcAmAoAlgOwC6XgMwIbSSgAK+A5sQN7ICQmqmANpAPwBcoAzpvBuaAA+oAK7pEkXBkiIA3HThZIWDt178ho8ZOlzkAX2TJMATwAOxMpQAq54gF5QAcgAWsALaQnmp-gBGsCKY3sJOipiEwfLIijzcjJCcUHBIADxWkLYWADSkFJAAfKCONLRunpyltOHKmJyuHl50+tl0-oF1oFUMzInO7UFOrbTVsEpY9QPBzcPhkZV09Iws9XPQwa2gW9tbIKBZxE5UoD0ranzo5LKg6PgV5-zX+t6oXDewmKD4XFyo5Ld+FgnWAnOzODJOAB0yB2Oz2AHk-AArGCfJgJeD4Jigdz4EygMZMfFcCzQVC4fEAa3QsAA7uhQGZ4LALPAGJAuJtYbswPhxM5bp5vIhYBz3p9IAAPV6fDCgizg-JQxaCvpOcD4DAARgATAAGJwzAxAA )
136141
137142### ` Pick <T , K >`
138143
You can’t perform that action at this time.
0 commit comments