From 2c404faeb25210b8f0a10502b852075936bbbd3c Mon Sep 17 00:00:00 2001 From: fairskyDev0201 Date: Mon, 25 Nov 2019 04:24:37 +0000 Subject: [PATCH] Prettify README.md --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5f7a327..145a865 100644 --- a/README.md +++ b/README.md @@ -1411,30 +1411,32 @@ function foo() { return { a: 1, b: 2, - subInstArr: [{ + subInstArr: [ + { c: 3, d: 4 - }] - } + } + ] + }; } -type InstType = ReturnType -type SubInstArr = InstType['subInstArr']; +type InstType = ReturnType; +type SubInstArr = InstType["subInstArr"]; type SubIsntType = SubInstArr[0]; let baz: SubIsntType = { c: 5, d: 6 // type checks ok! -} +}; //You could just write a one-liner, //But please make sure it is forward-readable //(you can understand it from reading once left-to-right with no jumps) -type SubIsntType2 = ReturnType['subInstArr'][0]; +type SubIsntType2 = ReturnType["subInstArr"][0]; let baz2: SubIsntType2 = { c: 5, d: 6 // type checks ok! -} +}; ``` # Troubleshooting Handbook: Images and other non-TS/TSX files