Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

● ● ●

Slide 3

Slide 3 text

● ●

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

const user1 = { age: 26, driverLicense: { expirationDate: '2023/01/22' }, } const user2 = { age: 12, driverLicense: null, } user1.driverLicense.expirationDate // '2023/01/22' user2.driverLicense.expirationDate // TypeError: Cannot read property 'expirationDate' of null

Slide 6

Slide 6 text

Slide 7

Slide 7 text

https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Optional_chaining

Slide 8

Slide 8 text

const user1 = { age: 26, driverLicense: { expirationDate: '2023/01/22' }, } const user2 = { age: 12, driverLicense: null, } user1.driverLicense?.expirationDate // '2023/01/22' user2.driverLicense?.expirationDate // undefined

Slide 9

Slide 9 text

● let expirationDate if (user.driverLicense) { expirationDate = user.driverLicense.expirationDate }

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

● ○ https://devblogs.microsoft.com/typescript/announcing-typescript-3-7-rc/

Slide 13

Slide 13 text

https://devblogs.microsoft.com/typescript/ announcing-typescript-3-7-rc/ http://www.typescriptlang.org/play/

Slide 14

Slide 14 text

● "use strict"; var _a, _b; const foo = { bar: null }; // foo?.bar?.baz (_b = (_a = foo) === null || _a === void 0 ? void 0 : _a.bar) === null || _b === void 0 ? void 0 : _b.baz;

Slide 15

Slide 15 text

● ● const foo = { items: ['Pen', 'Pineapple', 'Apple'], get bar() { console.count('bar!'); return { baz: this.items.join() }; } } foo?.bar?.baz // bar!: 1 // 'Pen,Pineapple,Apple' foo && foo.bar && foo.bar.baz // bar!: 2 // bar!: 3 // 'Pen,Pineapple,Apple'

Slide 16

Slide 16 text

● ● $ npm i typescript@rc ts-node $ npx ts-node

Slide 17

Slide 17 text

No content